rnd-20060816-2-src
[rocksndiamonds.git] / src / libgame / system.c
index 4f8ef0fb89a4726d8b64215b98fbb362c0bc0353..264a3366832f24750ff3de0a2a9d3527ed2b9377 100644 (file)
@@ -69,22 +69,27 @@ int                 FrameCounter = 0;
 /* ========================================================================= */
 
 void InitProgramInfo(char *argv0,
-                    char *userdata_directory, char *program_title,
-                    char *window_title, char *icon_title,
+                    char *userdata_subdir, char *userdata_subdir_unix,
+                    char *program_title, char *window_title, char *icon_title,
                     char *x11_icon_filename, char *x11_iconmask_filename,
-                    char *msdos_cursor_filename,
+                    char *sdl_icon_filename, char *msdos_cursor_filename,
                     char *cookie_prefix, char *filename_prefix,
                     int program_version)
 {
   program.command_basepath = getBasePath(argv0);
   program.command_basename = getBaseName(argv0);
 
-  program.userdata_directory = userdata_directory;
+  program.userdata_subdir = userdata_subdir;
+  program.userdata_subdir_unix = userdata_subdir_unix;
+  program.userdata_path = getUserGameDataDir();
+
   program.program_title = program_title;
   program.window_title = window_title;
   program.icon_title = icon_title;
+
   program.x11_icon_filename = x11_icon_filename;
   program.x11_iconmask_filename = x11_iconmask_filename;
+  program.sdl_icon_filename = sdl_icon_filename;
   program.msdos_cursor_filename = msdos_cursor_filename;
 
   program.cookie_prefix = cookie_prefix;
@@ -118,7 +123,11 @@ void InitPlatformDependentStuff(void)
   _fmode = O_BINARY;
 #endif
 
-#if defined(PLATFORM_WIN32) || defined(PLATFORM_MSDOS)
+#if defined(PLATFORM_MACOSX)
+  updateUserGameDataDir();
+#endif
+
+#if !defined(PLATFORM_UNIX) || defined(PLATFORM_MACOSX)
   openErrorFile();
 #endif
 
@@ -318,8 +327,11 @@ void InitVideoBuffer(DrawBuffer **backbuffer, DrawWindow **window,
   video.width = width;
   video.height = height;
   video.depth = GetRealDepth(depth);
+
   video.fullscreen_available = FULLSCREEN_STATUS;
   video.fullscreen_enabled = FALSE;
+  video.fullscreen_modes = NULL;
+  video.fullscreen_mode_current = NULL;
 
 #if defined(TARGET_SDL)
   SDLInitVideoBuffer(backbuffer, window, fullscreen);
@@ -446,13 +458,15 @@ void BlitBitmap(Bitmap *src_bitmap, Bitmap *dst_bitmap,
              dst_x, dst_y, BLIT_OPAQUE);
 }
 
-void FadeScreen(Bitmap *bitmap_cross, int fade_mode, int fade_delay,
-               int post_delay)
+void FadeRectangle(Bitmap *bitmap_cross, int x, int y, int width, int height,
+                  int fade_mode, int fade_delay, int post_delay)
 {
 #if defined(TARGET_SDL)
-  SDLFadeScreen(bitmap_cross, fade_mode, fade_delay, post_delay);
+  SDLFadeRectangle(bitmap_cross, x, y, width, height,
+                  fade_mode, fade_delay, post_delay);
 #else
-  X11FadeScreen(bitmap_cross, fade_mode, fade_delay, post_delay);
+  X11FadeRectangle(bitmap_cross, x, y, width, height,
+                  fade_mode, fade_delay, post_delay);
 #endif
 }
 
@@ -1219,7 +1233,6 @@ KeyMod HandleKeyModState(Key key, int key_status)
 {
   static KeyMod current_modifiers = KMOD_None;
 
-#if !defined(TARGET_SDL)
   if (key != KSYM_UNDEFINED)   /* new key => check for modifier key change */
   {
     KeyMod new_modifier = KMOD_None;
@@ -1259,7 +1272,6 @@ KeyMod HandleKeyModState(Key key, int key_status)
     else
       current_modifiers &= ~new_modifier;
   }
-#endif
 
   return current_modifiers;
 }
@@ -1273,6 +1285,17 @@ KeyMod GetKeyModState()
 #endif
 }
 
+KeyMod GetKeyModStateFromEvents()
+{
+  /* always use key modifier state as tracked from key events (this is needed
+     if the modifier key event was injected into the event queue, but the key
+     was not really pressed on keyboard -- SDL_GetModState() seems to directly
+     query the keys as held pressed on the keyboard) -- this case is currently
+     only used to filter out clipboard insert events from "True X-Mouse" tool */
+
+  return HandleKeyModState(KSYM_UNDEFINED, 0);
+}
+
 boolean CheckCloseWindowEvent(ClientMessageEvent *event)
 {
   if (event->type != EVENT_CLIENTMESSAGE)