gnome-games r8573 - in trunk: aisleriot libgames-support



Author: chpe
Date: Thu Jan 15 19:49:51 2009
New Revision: 8573
URL: http://svn.gnome.org/viewvc/gnome-games?rev=8573&view=rev

Log:
Add window state debugging output, in trying to track down bug #560142.

Modified:
   trunk/aisleriot/window.c
   trunk/libgames-support/games-conf.c
   trunk/libgames-support/games-debug.c
   trunk/libgames-support/games-debug.h

Modified: trunk/aisleriot/window.c
==============================================================================
--- trunk/aisleriot/window.c	(original)
+++ trunk/aisleriot/window.c	Thu Jan 15 19:49:51 2009
@@ -41,6 +41,7 @@
 #include <libgames-support/games-card-theme.h>
 #include <libgames-support/games-card-themes.h>
 #include <libgames-support/games-clock.h>
+#include <libgames-support/games-debug.h>
 #include <libgames-support/games-files.h>
 #include <libgames-support/games-stock.h>
 #include <libgames-support/games-runtime.h>
@@ -1039,6 +1040,11 @@
 fullscreen_toggled_cb (GtkToggleAction *action,
                        GtkWindow *window)
 {
+  _games_debug_print (GAMES_DEBUG_WINDOW_STATE,
+                      "[window %p] fullscreen_toggled_cb, %s fullscreen\n",
+                      window,
+                      gtk_toggle_action_get_active (action) ? "going" : "leaving");
+
   if (gtk_toggle_action_get_active (action)) {
     gtk_window_fullscreen (window);
   } else {

Modified: trunk/libgames-support/games-conf.c
==============================================================================
--- trunk/libgames-support/games-conf.c	(original)
+++ trunk/libgames-support/games-conf.c	Thu Jan 15 19:49:51 2009
@@ -30,6 +30,7 @@
 #define ACCELMAP_EXT "accels"
 #endif
 
+#include "games-debug.h"
 #include "games-marshal.h"
 
 #include "games-conf.h"
@@ -95,6 +96,7 @@
 };
 
 typedef struct {
+  GtkWindow *window;
   char *group;
   guint timeout_id;
   int width;
@@ -109,6 +111,11 @@
   games_conf_set_integer (state->group, window_state_key_name[STATE_KEY_WIDTH], state->width);
   games_conf_set_integer (state->group, window_state_key_name[STATE_KEY_HEIGHT], state->height);
 
+  _games_debug_print (GAMES_DEBUG_WINDOW_STATE,
+                      "[window %p] timeout: persisting width:%d height:%d\n",
+                      state->window,
+                      state->width, state->height);
+
   state->timeout_id = 0;
   return FALSE;
 }
@@ -133,11 +140,23 @@
                            GdkEventConfigure *event,
                            WindowState *state)
 {
+  _games_debug_print (GAMES_DEBUG_WINDOW_STATE,
+                      "[window %p] configure event current %dx%d new %dx%d [state: is-maximised:%s is-fullscreen:%s]\n",
+                      state->window,
+                      state->width, state->height,
+                      event->width, event->height,
+                      state->is_maximised ? "t" : "f",
+                      state->is_fullscreen ? "t" : "f");
+
   if (!state->is_maximised && !state->is_fullscreen &&
       (state->width != event->width || state->height != event->height)) {
     state->width = event->width;
     state->height = event->height;
 
+  _games_debug_print (GAMES_DEBUG_WINDOW_STATE,
+                      "[window %p] scheduling save of new window size\n",
+                      state->window);
+
     if (state->timeout_id == 0) {
       state->timeout_id = g_timeout_add (WINDOW_STATE_TIMEOUT,
                                          (GSourceFunc) window_state_timeout_cb,
@@ -153,6 +172,13 @@
                        GdkEventWindowState *event,
                        WindowState *state)
 {
+  _games_debug_print (GAMES_DEBUG_WINDOW_STATE,
+                      "[window %p] state event, mask:%x new-state:%x current state: is-maximised:%s is-fullscreen:%s\n",
+                      state->window,
+                      event->changed_mask, event->new_window_state,
+                      state->is_maximised ? "t" : "f",
+                      state->is_fullscreen ? "t" : "f");
+
   if (event->changed_mask & GDK_WINDOW_STATE_MAXIMIZED) {
     state->is_maximised = (event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED) != 0;
     games_conf_set_boolean (state->group, window_state_key_name[STATE_KEY_MAXIMISED], state->is_maximised);
@@ -162,6 +188,12 @@
     games_conf_set_boolean (state->group, window_state_key_name[STATE_KEY_FULLSCREEN], state->is_fullscreen);
   }
 
+  _games_debug_print (GAMES_DEBUG_WINDOW_STATE,
+                      "  > new state: is-maximised:%s is-fullscreen:%s\n",
+                      state->is_maximised ? "t" : "f",
+                      state->is_fullscreen ? "t" : "f");
+
+
   return FALSE;
 }
 
@@ -1213,6 +1245,7 @@
   g_return_if_fail (!GTK_WIDGET_REALIZED (window));
 
   state = g_slice_new0 (WindowState);
+  state->window = window;
   state->group = g_strdup (group);
   g_object_set_data_full (G_OBJECT (window), "GamesConf::WindowState",
                           state, (GDestroyNotify) free_window_state);
@@ -1228,12 +1261,22 @@
   height = games_conf_get_integer (group, window_state_key_name[STATE_KEY_HEIGHT], NULL);
 
   if (width > 0 && height > 0) {
+    _games_debug_print (GAMES_DEBUG_WINDOW_STATE,
+                        "[window %p] restoring size %dx%d\n",
+                        state->window,
+                        width, height);
     gtk_window_set_default_size (GTK_WINDOW (window), width, height);
   }
   if (maximised) {
+    _games_debug_print (GAMES_DEBUG_WINDOW_STATE,
+                        "[window %p] restoring maximised state\n",
+                        state->window);
     gtk_window_maximize (GTK_WINDOW (window));
   }
   if (fullscreen) {
+    _games_debug_print (GAMES_DEBUG_WINDOW_STATE,
+                        "[window %p] restoring fullscreen state\n",
+                        state->window);
     gtk_window_fullscreen (GTK_WINDOW (window));
   }
 }

Modified: trunk/libgames-support/games-debug.c
==============================================================================
--- trunk/libgames-support/games-debug.c	(original)
+++ trunk/libgames-support/games-debug.c	Thu Jan 15 19:49:51 2009
@@ -31,10 +31,11 @@
 {
 #ifdef GNOME_ENABLE_DEBUG
   const GDebugKey keys[] = {
-    { "card-theme", GAMES_DEBUG_CARD_THEME },
-    { "card-cache", GAMES_DEBUG_CARD_CACHE },
-    { "runtime",    GAMES_DEBUG_RUNTIME    },
-    { "sound ",     GAMES_DEBUG_SOUND      }
+    { "card-theme",   GAMES_DEBUG_CARD_THEME   },
+    { "card-cache",   GAMES_DEBUG_CARD_CACHE   },
+    { "runtime",      GAMES_DEBUG_RUNTIME      },
+    { "sound ",       GAMES_DEBUG_SOUND        },
+    { "window-state", GAMES_DEBUG_WINDOW_STATE }
   };
 
   _games_debug_flags = g_parse_debug_string (g_getenv ("GAMES_DEBUG"),

Modified: trunk/libgames-support/games-debug.h
==============================================================================
--- trunk/libgames-support/games-debug.h	(original)
+++ trunk/libgames-support/games-debug.h	Thu Jan 15 19:49:51 2009
@@ -28,10 +28,11 @@
 #define GAMES_DEBUG_LAST_RESERVED_BIT (8)
 
 typedef enum {
-  GAMES_DEBUG_CARD_THEME = 1 << 0,
-  GAMES_DEBUG_CARD_CACHE = 1 << 1,
-  GAMES_DEBUG_RUNTIME    = 1 << 2,
-  GAMES_DEBUG_SOUND      = 1 << 3,
+  GAMES_DEBUG_CARD_THEME    = 1 << 0,
+  GAMES_DEBUG_CARD_CACHE    = 1 << 1,
+  GAMES_DEBUG_RUNTIME       = 1 << 2,
+  GAMES_DEBUG_SOUND         = 1 << 3,
+  GAMES_DEBUG_WINDOW_STATE  = 1 << 4
 } GamesDebugFlags;
 
 #ifdef GNOME_ENABLE_DEBUG



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]