metacity r4022 - in trunk: . src src/core src/include src/ui src/wm-tester



Author: tthurman
Date: Sat Nov 22 19:02:54 2008
New Revision: 4022
URL: http://svn.gnome.org/viewvc/metacity?rev=4022&view=rev

Log:
(Apologies for huge commit; these were done on a transatlantic flight.  This is why we need bzr.)

2008-11-22  Thomas Thurman  <tthurman gnome org>

        * src/core/all-keybindings.h: "backward", not "backwards" throughout.

2008-11-20  Thomas Thurman  <tthurman gnome org>

        * configure.in: turned on -Wall and -Werror in order to
          trap as many problems as possible.
        * src/ui/resizepopup.c: added correct #include.
        * src/ui/theme-viewer.c: initialised variable.
        * src/core/xprops.c: corrected cast.
        * src/core/main.c: added warning if chdir() fails.
        * src/core/schema-bindings.c: checking the return
          result of fgets().

2008-11-20  Thomas Thurman  <tthurman gnome org>

        Merged screen and window keybinding tables so that
        we can use just one file for the both.  Also incidentally
        closes #528337.  Further efficiencies of scale to come.

        * src/include/prefs.h: replace META_PREF_*_KEYBINDINGS
          with META_PREF_KEYBINDINGS
        * src/core/keybindings.c: replace *_bindings with key_bindings
          and similar throughout; all window-based functions are now
          guaranteed to receive a window so don't need to check for
          themselves
          (find_handler): moved so it can also be called from
                          rebuild_binding_table
        * src/core/display-private.h: replace *_bindings with key_bindings
        * src/core/prefs.c: update_*_binding becomes update_key_binding;
          (change_notify): tidy up references to "enormous if statement"
                           since it's almost entirely gone now
        * src/core/all-keybindings.h: new merged version of
                           screen-bindings.h and window-bindings.h.



Removed:
   trunk/src/include/screen-bindings.h
   trunk/src/include/window-bindings.h
Modified:
   trunk/ChangeLog
   trunk/configure.in
   trunk/src/Makefile.am
   trunk/src/core/display-private.h
   trunk/src/core/keybindings.c
   trunk/src/core/main.c
   trunk/src/core/prefs.c
   trunk/src/core/schema-bindings.c
   trunk/src/core/xprops.c
   trunk/src/include/prefs.h
   trunk/src/ui/resizepopup.c
   trunk/src/ui/theme-viewer.c
   trunk/src/wm-tester/test-resizing.c

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Sat Nov 22 19:02:54 2008
@@ -480,9 +480,12 @@
 	[  --enable-debug		enable debugging],,
 	enable_debug=no)
 if test "x$enable_debug" = "xyes"; then
-	CFLAGS="$CFLAGS -g -O -Wall"
+	CFLAGS="$CFLAGS -g -O"
 fi
 
+# Warnings are there for a reason
+CFLAGS="$CFLAGS -Wall -Werror"
+
 # Use gnome-doc-utils:
 GNOME_DOC_INIT([0.9.0])
 

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Sat Nov 22 19:02:54 2008
@@ -97,8 +97,7 @@
 	ui/themewidget.c			\
 	ui/themewidget.h			\
 	ui/ui.c					\
-	include/window-bindings.h		\
-	include/screen-bindings.h
+	include/all-keybindings.h
 
 # by setting libmetacity_private_la_CFLAGS, the files shared with
 # metacity proper will be compiled with different names.

Modified: trunk/src/core/display-private.h
==============================================================================
--- trunk/src/core/display-private.h	(original)
+++ trunk/src/core/display-private.h	Sat Nov 22 19:02:54 2008
@@ -201,10 +201,8 @@
   int	      grab_resize_timeout_id;
 
   /* Keybindings stuff */
-  MetaKeyBinding *screen_bindings;
-  int             n_screen_bindings;
-  MetaKeyBinding *window_bindings;
-  int             n_window_bindings;
+  MetaKeyBinding *key_bindings;
+  int             n_key_bindings;
   int             min_keycode;
   int             max_keycode;
   KeySym *keymap;

Modified: trunk/src/core/keybindings.c
==============================================================================
--- trunk/src/core/keybindings.c	(original)
+++ trunk/src/core/keybindings.c	Sat Nov 22 19:02:54 2008
@@ -63,8 +63,7 @@
          MetaWindow     *window,\
          XEvent         *event,\
          MetaKeyBinding *binding);
-#include "window-bindings.h"
-#include "screen-bindings.h"
+#include "all-keybindings.h"
 #undef keybind
 
 /* These can't be bound to anything, but they are used to handle
@@ -106,8 +105,7 @@
                                                XEvent      *event,
                                                KeySym       keysym);
 
-static void regrab_screen_bindings         (MetaDisplay *display);
-static void regrab_window_bindings         (MetaDisplay *display);
+static void regrab_key_bindings         (MetaDisplay *display);
 
 typedef struct
 {
@@ -128,16 +126,8 @@
 
 #define keybind(name, handler, param, flags, stroke, description) \
    { #name, handler, param, flags },
-static const MetaKeyHandler screen_handlers[] = {
-#include "screen-bindings.h"
-  { NULL, NULL, 0, 0 }
-};
-  
-static const MetaKeyHandler window_handlers[] = {
-/* TODO: Are window bindings only ever called on non-null windows?
- * If so, we can remove the check from all of them.
- */
-#include "window-bindings.h"
+static const MetaKeyHandler key_handlers[] = {
+#include "all-keybindings.h"
    { NULL, NULL, 0, 0 }
 };
 #undef keybind
@@ -264,32 +254,17 @@
 {
   meta_topic (META_DEBUG_KEYBINDINGS,
               "Reloading keycodes for binding tables\n");
-  
-  if (display->screen_bindings)
-    {
-      int i;
-      
-      i = 0;
-      while (i < display->n_screen_bindings)
-        {
-          if (display->screen_bindings[i].keycode == 0)
-              display->screen_bindings[i].keycode = XKeysymToKeycode (
-                      display->xdisplay, display->screen_bindings[i].keysym);
-          
-          ++i;
-        }
-    }
 
-  if (display->window_bindings)
+  if (display->key_bindings)
     {
       int i;
       
       i = 0;
-      while (i < display->n_window_bindings)
+      while (i < display->n_key_bindings)
         {
-          if (display->window_bindings[i].keycode == 0)
-              display->window_bindings[i].keycode = XKeysymToKeycode (
-                      display->xdisplay, display->window_bindings[i].keysym);
+          if (display->key_bindings[i].keycode == 0)
+              display->key_bindings[i].keycode = XKeysymToKeycode (
+                      display->xdisplay, display->key_bindings[i].keysym);
           
           ++i;
         }
@@ -302,49 +277,29 @@
   meta_topic (META_DEBUG_KEYBINDINGS,
               "Reloading keycodes for binding tables\n");
   
-  if (display->screen_bindings)
-    {
-      int i;
-      
-      i = 0;
-      while (i < display->n_screen_bindings)
-        {
-          meta_display_devirtualize_modifiers (display,
-                                               display->screen_bindings[i].modifiers,
-                                               &display->screen_bindings[i].mask);
-
-          meta_topic (META_DEBUG_KEYBINDINGS,
-                      " Devirtualized mods 0x%x -> 0x%x (%s)\n",
-                      display->screen_bindings[i].modifiers,
-                      display->screen_bindings[i].mask,
-                      display->screen_bindings[i].name);          
-          
-          ++i;
-        }
-    }
-
-  if (display->window_bindings)
+  if (display->key_bindings)
     {
       int i;
       
       i = 0;
-      while (i < display->n_window_bindings)
+      while (i < display->n_key_bindings)
         {
           meta_display_devirtualize_modifiers (display,
-                                               display->window_bindings[i].modifiers,
-                                               &display->window_bindings[i].mask);
+                                               display->key_bindings[i].modifiers,
+                                               &display->key_bindings[i].mask);
 
           meta_topic (META_DEBUG_KEYBINDINGS,
                       " Devirtualized mods 0x%x -> 0x%x (%s)\n",
-                      display->window_bindings[i].modifiers,
-                      display->window_bindings[i].mask,
-                      display->window_bindings[i].name);
+                      display->key_bindings[i].modifiers,
+                      display->key_bindings[i].mask,
+                      display->key_bindings[i].name);          
           
           ++i;
         }
     }
 }
 
+
 static int
 count_bindings (const MetaKeyPref *prefs,
                 int                n_prefs)
@@ -380,6 +335,25 @@
   return count;
 }
 
+/* FIXME: replace this with a temporary hash */
+static const MetaKeyHandler*
+find_handler (const MetaKeyHandler *handlers,
+              const char           *name)
+{
+  const MetaKeyHandler *iter;
+
+  iter = handlers;
+  while (iter->name)
+    {
+      if (strcmp (iter->name, name) == 0)
+        return iter;
+
+      ++iter;
+    }
+
+  return NULL;
+}
+
 static void
 rebuild_binding_table (MetaDisplay        *display,
                        MetaKeyBinding    **bindings_p,
@@ -406,7 +380,10 @@
 
           if (combo && (combo->keysym != None || combo->keycode != 0))
             {
+              const MetaKeyHandler *handler = find_handler (key_handlers, prefs[src].name);
+
               (*bindings_p)[dest].name = prefs[src].name;
+              (*bindings_p)[dest].handler = handler;
               (*bindings_p)[dest].keysym = combo->keysym;
               (*bindings_p)[dest].keycode = combo->keycode;
               (*bindings_p)[dest].modifiers = combo->modifiers;
@@ -422,6 +399,7 @@
                                prefs[src].name);
               
                   (*bindings_p)[dest].name = prefs[src].name;
+                  (*bindings_p)[dest].handler = handler;
                   (*bindings_p)[dest].keysym = combo->keysym;
                   (*bindings_p)[dest].keycode = combo->keycode;
                   (*bindings_p)[dest].modifiers = combo->modifiers |
@@ -448,41 +426,26 @@
 }
 
 static void
-rebuild_screen_binding_table (MetaDisplay *display)
+rebuild_key_binding_table (MetaDisplay *display)
 {
   const MetaKeyPref *prefs;
   int n_prefs;
   
   meta_topic (META_DEBUG_KEYBINDINGS,
-              "Rebuilding screen binding table from preferences\n");
+              "Rebuilding key binding table from preferences\n");
   
-  meta_prefs_get_screen_bindings (&prefs, &n_prefs);
+  meta_prefs_get_key_bindings (&prefs, &n_prefs);
   rebuild_binding_table (display,
-                         &display->screen_bindings,
-                         &display->n_screen_bindings,
+                         &display->key_bindings,
+                         &display->n_key_bindings,
                          prefs, n_prefs);
 }
 
 static void
-rebuild_window_binding_table (MetaDisplay *display)
-{
-  const MetaKeyPref *prefs;
-  int n_prefs;
-  
-  meta_topic (META_DEBUG_KEYBINDINGS,
-              "Rebuilding window binding table from preferences\n");
-  
-  meta_prefs_get_window_bindings (&prefs, &n_prefs);
-  rebuild_binding_table (display,
-                         &display->window_bindings,
-                         &display->n_window_bindings,
-                         prefs, n_prefs);
-}
-
-static void
-regrab_screen_bindings (MetaDisplay *display)
+regrab_key_bindings (MetaDisplay *display)
 {
   GSList *tmp;
+  GSList *windows;
 
   meta_error_trap_push (display); /* for efficiency push outer trap */
   
@@ -497,18 +460,7 @@
       tmp = tmp->next;
     }
 
-  meta_error_trap_pop (display, FALSE);
-}
-
-static void
-regrab_window_bindings (MetaDisplay *display)
-{
-  GSList *windows;
-  GSList *tmp;
-
   windows = meta_display_list_windows (display);
-
-  meta_error_trap_push (display); /* for efficiency push outer trap */
   tmp = windows;
   while (tmp != NULL)
     {
@@ -532,14 +484,14 @@
 {
   int i;
 
-  i = display->n_screen_bindings - 1;
+  i = display->n_key_bindings - 1;
   while (i >= 0)
     {
-      if (display->screen_bindings[i].keysym == keysym &&
-          display->screen_bindings[i].keycode == keycode &&
-          display->screen_bindings[i].mask == mask)
+      if (display->key_bindings[i].keysym == keysym &&
+          display->key_bindings[i].keycode == keycode &&
+          display->key_bindings[i].mask == mask)
         {
-          return meta_prefs_get_keybinding_action (display->screen_bindings[i].name);
+          return meta_prefs_get_keybinding_action (display->key_bindings[i].name);
         }
       
       --i;
@@ -561,8 +513,7 @@
 
       reload_modifiers (display);
       
-      regrab_screen_bindings (display);
-      regrab_window_bindings (display);
+      regrab_key_bindings (display);
     }
   else if (event->xmapping.request == MappingKeyboard)
     {
@@ -574,8 +525,7 @@
       
       reload_keycodes (display);
 
-      regrab_screen_bindings (display);
-      regrab_window_bindings (display);
+      regrab_key_bindings (display);
     }
 }
 
@@ -589,17 +539,11 @@
   
   switch (pref)
     {
-    case META_PREF_SCREEN_KEYBINDINGS:
-      rebuild_screen_binding_table (display);
+    case META_PREF_KEYBINDINGS:
+      rebuild_key_binding_table (display);
       reload_keycodes (display);
       reload_modifiers (display);
-      regrab_screen_bindings (display);
-      break;
-    case META_PREF_WINDOW_KEYBINDINGS:
-      rebuild_window_binding_table (display);
-      reload_keycodes (display);
-      reload_modifiers (display);
-      regrab_window_bindings (display);
+      regrab_key_bindings (display);
       break;
     default:
       break;
@@ -622,10 +566,8 @@
   display->hyper_mask = 0;
   display->super_mask = 0;
   display->meta_mask = 0;
-  display->screen_bindings = NULL;
-  display->n_screen_bindings = 0;
-  display->window_bindings = NULL;
-  display->n_window_bindings = 0;
+  display->key_bindings = NULL;
+  display->n_key_bindings = 0;
 
   XDisplayKeycodes (display->xdisplay,
                     &display->min_keycode,
@@ -639,8 +581,7 @@
   reload_keymap (display);
   reload_modmap (display);
 
-  rebuild_window_binding_table (display);
-  rebuild_screen_binding_table (display);
+  rebuild_key_binding_table (display);
 
   reload_keycodes (display);
   reload_modifiers (display);
@@ -662,8 +603,7 @@
   
   if (display->modmap)
     XFreeModifiermap (display->modmap);
-  g_free (display->screen_bindings);
-  g_free (display->window_bindings);
+  g_free (display->key_bindings);
 }
 
 static const char*
@@ -765,7 +705,8 @@
 grab_keys (MetaKeyBinding *bindings,
            int             n_bindings,
            MetaDisplay    *display,
-           Window          xwindow)
+           Window          xwindow,
+           gboolean        binding_per_window)
 {
   int i;
 
@@ -776,7 +717,9 @@
   i = 0;
   while (i < n_bindings)
     {
-      if (bindings[i].keycode != 0)
+      if (!!binding_per_window ==
+          !!(bindings[i].handler->flags & BINDING_PER_WINDOW) &&
+          bindings[i].keycode != 0)
         {
           meta_grab_key (display, xwindow,
                          bindings[i].keysym,
@@ -825,9 +768,10 @@
   if (screen->keys_grabbed)
     return;
 
-  grab_keys (screen->display->screen_bindings,
-             screen->display->n_screen_bindings,
-             screen->display, screen->xroot);
+  grab_keys (screen->display->key_bindings,
+             screen->display->n_key_bindings,
+             screen->display, screen->xroot,
+             FALSE);
 
   screen->keys_grabbed = TRUE;
 }
@@ -867,10 +811,11 @@
         return; /* already all good */
     }
   
-  grab_keys (window->display->window_bindings,
-             window->display->n_window_bindings,
+  grab_keys (window->display->key_bindings,
+             window->display->n_key_bindings,
              window->display,
-             window->frame ? window->frame->xwindow : window->xwindow);
+             window->frame ? window->frame->xwindow : window->xwindow,
+             TRUE);
 
   window->keys_grabbed = TRUE;
   window->grab_on_frame = window->frame != NULL;
@@ -1214,83 +1159,67 @@
     return TRUE;
 }
 
-static const MetaKeyHandler*
-find_handler (const MetaKeyHandler *handlers,
-              const char           *name)
-{
-  const MetaKeyHandler *iter;
-
-  iter = handlers;
-  while (iter->name)
-    {
-      if (strcmp (iter->name,
-                  name) == 0)
-        return iter;
-
-      ++iter;
-    }
-
-  return NULL;
-}               
-
+/* now called from only one place, may be worth merging */
 static gboolean
 process_event (MetaKeyBinding       *bindings,
                int                   n_bindings,
-               const MetaKeyHandler *handlers,
                MetaDisplay          *display,
                MetaScreen           *screen,
                MetaWindow           *window,
                XEvent               *event,
-               KeySym                keysym)
+               KeySym                keysym,
+               gboolean              on_window)
 {
   int i;
 
   /* we used to have release-based bindings but no longer. */
   if (event->type == KeyRelease)
     return FALSE;
-  
-  i = 0;
-  while (i < n_bindings)
+
+  /*
+   * TODO: This would be better done with a hash table;
+   * it doesn't suit to use O(n) for such a common operation.
+   */
+  for (i=0; i<n_bindings; i++)
     {
-      if (bindings[i].keycode == event->xkey.keycode && 
-          ((event->xkey.state & 0xff & ~(display->ignored_modifier_mask)) ==
-           bindings[i].mask) &&
-          event->type == KeyPress)
-        {
-          const MetaKeyHandler *handler;
+      const MetaKeyHandler *handler = bindings[i].handler;
 
-          meta_topic (META_DEBUG_KEYBINDINGS,
-                      "Binding keycode 0x%x mask 0x%x matches event 0x%x state 0x%x\n",
-                      bindings[i].keycode, bindings[i].mask,
-                      event->xkey.keycode, event->xkey.state);
-          
-          if (bindings[i].handler)
-            handler = bindings[i].handler;
-          else
-            {
-              handler = find_handler (handlers, bindings[i].name);
-              bindings[i].handler = handler; /* cache */
-            }
+      if ((!on_window && handler->flags & BINDING_PER_WINDOW) ||
+          event->type != KeyPress ||
+          bindings[i].keycode != event->xkey.keycode ||
+          ((event->xkey.state & 0xff & ~(display->ignored_modifier_mask)) !=
+           bindings[i].mask))
+        continue;
+        
+      /*
+       * window must be non-NULL for on_window to be true,
+       * and so also window must be non-NULL if we get here and
+       * this is a BINDING_PER_WINDOW binding.
+       */
 
-          if (handler == NULL)
-            meta_bug ("Binding %s has no handler\n", bindings[i].name);
-          else
-            meta_topic (META_DEBUG_KEYBINDINGS,
-                        "Running handler for %s\n",
-                        bindings[i].name);
+      meta_topic (META_DEBUG_KEYBINDINGS,
+                  "Binding keycode 0x%x mask 0x%x matches event 0x%x state 0x%x\n",
+                  bindings[i].keycode, bindings[i].mask,
+                  event->xkey.keycode, event->xkey.state);
+
+      if (handler == NULL)
+        meta_bug ("Binding %s has no handler\n", bindings[i].name);
+      else
+        meta_topic (META_DEBUG_KEYBINDINGS,
+                    "Running handler for %s\n",
+                    bindings[i].name);
           
-          /* Global keybindings count as a let-the-terminal-lose-focus
-           * due to new window mapping until the user starts
-           * interacting with the terminal again.
-           */
-          display->allow_terminal_deactivation = TRUE;
+      /* Global keybindings count as a let-the-terminal-lose-focus
+       * due to new window mapping until the user starts
+       * interacting with the terminal again.
+       */
+      display->allow_terminal_deactivation = TRUE;
 
-          (* handler->func) (display, screen, window, event,
-                             &bindings[i]);
-          return TRUE;
-        }
-      
-      ++i;
+      (* handler->func) (display, screen,
+                         bindings[i].handler->flags & BINDING_PER_WINDOW? window: NULL,
+                         event,
+                         &bindings[i]);
+      return TRUE;
     }
 
   meta_topic (META_DEBUG_KEYBINDINGS,
@@ -1315,12 +1244,11 @@
                                 XEvent      *event)
 {
   KeySym keysym;
-  gboolean handled;
   gboolean keep_grab;
   gboolean all_keys_grabbed;
   const char *str;
   MetaScreen *screen;
-  
+
   XAllowEvents (display->xdisplay,
                 all_bindings_disabled ? ReplayKeyboard : AsyncKeyboard,
                 event->xkey.time);
@@ -1349,6 +1277,7 @@
 
   str = XKeysymToString (keysym);
   
+  /* was topic */
   meta_topic (META_DEBUG_KEYBINDINGS,
               "Processing key %s event, keysym: %s state: 0x%x window: %s\n",
               event->type == KeyPress ? "press" : "release",
@@ -1441,16 +1370,10 @@
         }
       }
   /* Do the normal keybindings */
-  handled = process_event (display->screen_bindings,
-                           display->n_screen_bindings,
-                           screen_handlers,
-                           display, screen, NULL, event, keysym);
- 
-  if (!all_keys_grabbed && !handled && window)
-    handled = process_event (display->window_bindings,
-                             display->n_window_bindings,
-                             window_handlers,
-                             display, screen, window, event, keysym);
+  process_event (display->key_bindings,
+                 display->n_key_bindings,
+                 display, screen, window, event, keysym,
+                 !all_keys_grabbed && window);
 }
 
 static gboolean
@@ -2480,7 +2403,7 @@
                       XEvent         *event,
                       MetaKeyBinding *binding)
 {
-  if (window && window->has_resize_func)
+  if (window->has_resize_func)
     {
       if (window->maximized_vertically)
         meta_window_unmaximize (window, META_MAXIMIZE_VERTICAL);
@@ -2496,7 +2419,7 @@
                        XEvent         *event,
                        MetaKeyBinding *binding)
 {
-  if (window && window->has_resize_func)
+  if (window->has_resize_func)
     {
       if (window->maximized_horizontally)
         meta_window_unmaximize (window, META_MAXIMIZE_HORIZONTAL);
@@ -2564,10 +2487,7 @@
                            XEvent         *event,
                            MetaKeyBinding *binding)
 {
-  if (window)
-    {
-      handle_move_to_corner_backend (display, screen, window, TRUE, TRUE, FALSE, FALSE);
-    }
+  handle_move_to_corner_backend (display, screen, window, TRUE, TRUE, FALSE, FALSE);
 }
 
 static void
@@ -2577,10 +2497,7 @@
                            XEvent         *event,
                            MetaKeyBinding *binding)
 {
-  if (window)
-    {
-      handle_move_to_corner_backend (display, screen, window, TRUE, TRUE, TRUE, FALSE);
-    }
+  handle_move_to_corner_backend (display, screen, window, TRUE, TRUE, TRUE, FALSE);
 }
 
 static void
@@ -2590,10 +2507,7 @@
                            XEvent         *event,
                            MetaKeyBinding *binding)
 {
-  if (window)
-    {
-      handle_move_to_corner_backend (display, screen, window, TRUE, TRUE, FALSE, TRUE);
-    }
+  handle_move_to_corner_backend (display, screen, window, TRUE, TRUE, FALSE, TRUE);
 }
 
 static void
@@ -2603,10 +2517,7 @@
                            XEvent         *event,
                            MetaKeyBinding *binding)
 {
-  if (window)
-    {
-      handle_move_to_corner_backend (display, screen, window, TRUE, TRUE, TRUE, TRUE);
-    }
+  handle_move_to_corner_backend (display, screen, window, TRUE, TRUE, TRUE, TRUE);
 }
 
 static void
@@ -2616,10 +2527,7 @@
                            XEvent         *event,
                            MetaKeyBinding *binding)
 {
-  if (window)
-    {
-      handle_move_to_corner_backend (display, screen, window, FALSE, TRUE, FALSE, FALSE);
-    }
+  handle_move_to_corner_backend (display, screen, window, FALSE, TRUE, FALSE, FALSE);
 }
 
 static void
@@ -2629,10 +2537,7 @@
                            XEvent         *event,
                            MetaKeyBinding *binding)
 {
-  if (window)
-    {
-      handle_move_to_corner_backend (display, screen, window, FALSE, TRUE, FALSE, TRUE);
-    }
+  handle_move_to_corner_backend (display, screen, window, FALSE, TRUE, FALSE, TRUE);
 }
 
 static void
@@ -2642,10 +2547,7 @@
                            XEvent         *event,
                            MetaKeyBinding *binding)
 {
-  if (window)
-    {
-      handle_move_to_corner_backend (display, screen, window, TRUE, FALSE, TRUE, FALSE);
-    }
+  handle_move_to_corner_backend (display, screen, window, TRUE, FALSE, TRUE, FALSE);
 }
 
 static void
@@ -2655,10 +2557,7 @@
                            XEvent         *event,
                            MetaKeyBinding *binding)
 {
-  if (window)
-    {
-      handle_move_to_corner_backend (display, screen, window, TRUE, FALSE, FALSE, FALSE);
-    }
+  handle_move_to_corner_backend (display, screen, window, TRUE, FALSE, FALSE, FALSE);
 }
 
 static void
@@ -2673,9 +2572,6 @@
   int orig_x, orig_y;
   int frame_width, frame_height;
 
-  if (!window)
-    return;
-
   meta_window_get_work_area_all_xineramas (window, &work_area);
   meta_window_get_outer_rect (window, &outer);
   meta_window_get_position (window, &orig_x, &orig_y);
@@ -3074,13 +2970,10 @@
                            XEvent         *event,
                            MetaKeyBinding *binding)
 {
-  if (window)
-    {
-      if (window->fullscreen)
-        meta_window_unmake_fullscreen (window);
-      else if (window->has_fullscreen_func)
-        meta_window_make_fullscreen (window);
-    }
+  if (window->fullscreen)
+    meta_window_unmake_fullscreen (window);
+  else if (window->has_fullscreen_func)
+    meta_window_make_fullscreen (window);
 }
 
 static void
@@ -3090,13 +2983,10 @@
                            XEvent         *event,
                            MetaKeyBinding *binding)
 {
-  if (window)
-    {
-      if (window->wm_state_above)
-        meta_window_unmake_above (window);
-      else
-        meta_window_make_above (window);
-    }
+  if (window->wm_state_above)
+    meta_window_unmake_above (window);
+  else
+    meta_window_make_above (window);
 }
 
 static void
@@ -3106,17 +2996,14 @@
                            XEvent         *event,
                            MetaKeyBinding *binding)
 {
-  if (window)
-    {
-      if (META_WINDOW_MAXIMIZED (window))
-        meta_window_unmaximize (window,
-                                META_MAXIMIZE_HORIZONTAL |
-                                META_MAXIMIZE_VERTICAL);
-      else if (window->has_maximize_func)
-        meta_window_maximize (window,
-                              META_MAXIMIZE_HORIZONTAL |
-                              META_MAXIMIZE_VERTICAL);
-    }
+  if (META_WINDOW_MAXIMIZED (window))
+    meta_window_unmaximize (window,
+                            META_MAXIMIZE_HORIZONTAL |
+                            META_MAXIMIZE_VERTICAL);
+  else if (window->has_maximize_func)
+    meta_window_maximize (window,
+                          META_MAXIMIZE_HORIZONTAL |
+                          META_MAXIMIZE_VERTICAL);
 }
 
 static void
@@ -3126,13 +3013,10 @@
                            XEvent         *event,
                            MetaKeyBinding *binding)
 {
-  if (window)
-    {
-      if (window->has_maximize_func)
-        meta_window_maximize (window,
-                              META_MAXIMIZE_HORIZONTAL |
-                              META_MAXIMIZE_VERTICAL);
-    }
+  if (window->has_maximize_func)
+    meta_window_maximize (window,
+                          META_MAXIMIZE_HORIZONTAL |
+                          META_MAXIMIZE_VERTICAL);
 }
 
 static void
@@ -3142,13 +3026,10 @@
                            XEvent         *event,
                            MetaKeyBinding *binding)
 {
-  if (window)
-    {
-      if (window->maximized_vertically || window->maximized_horizontally)
-        meta_window_unmaximize (window,
-                                META_MAXIMIZE_HORIZONTAL |
-                                META_MAXIMIZE_VERTICAL);
-    }
+  if (window->maximized_vertically || window->maximized_horizontally)
+    meta_window_unmaximize (window,
+                            META_MAXIMIZE_HORIZONTAL |
+                            META_MAXIMIZE_VERTICAL);
 }
 
 static void
@@ -3158,13 +3039,10 @@
                            XEvent         *event,
                            MetaKeyBinding *binding)
 {
-  if (window)
-    {
-      if (window->shaded)
-        meta_window_unshade (window, event->xkey.time);
-      else if (window->has_shade_func)
-        meta_window_shade (window, event->xkey.time);
-    }
+  if (window->shaded)
+    meta_window_unshade (window, event->xkey.time);
+  else if (window->has_shade_func)
+    meta_window_shade (window, event->xkey.time);
 }
 
 static void
@@ -3174,9 +3052,8 @@
                            XEvent         *event,
                            MetaKeyBinding *binding)
 {
-  if (window)
-     if (window->has_close_func)
-       meta_window_delete (window, event->xkey.time);
+  if (window->has_close_func)
+    meta_window_delete (window, event->xkey.time);
 }
 
 static void
@@ -3186,9 +3063,8 @@
                         XEvent         *event,
                         MetaKeyBinding *binding)
 {
-  if (window)
-     if (window->has_minimize_func)
-       meta_window_minimize (window);
+  if (window->has_minimize_func)
+    meta_window_minimize (window);
 }
 
 static void
@@ -3198,7 +3074,7 @@
                            XEvent         *event,
                            MetaKeyBinding *binding)
 {
-  if (window && window->has_move_func)
+  if (window->has_move_func)
     {
       meta_window_begin_grab_op (window,
                                  META_GRAB_OP_KEYBOARD_MOVING,
@@ -3214,7 +3090,7 @@
                            XEvent         *event,
                            MetaKeyBinding *binding)
 {
-  if (window && window->has_resize_func)
+  if (window->has_resize_func)
     {
       meta_window_begin_grab_op (window,
                                  META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN,
@@ -3230,13 +3106,10 @@
                            XEvent         *event,
                            MetaKeyBinding *binding)
 {
-  if (window)
-    {
-      if (window->on_all_workspaces)
-        meta_window_unstick (window);
-      else
-        meta_window_stick (window);
-    }
+  if (window->on_all_workspaces)
+    meta_window_unstick (window);
+  else
+    meta_window_stick (window);
 }
 
 static void
@@ -3258,7 +3131,7 @@
    * all of whose members are negative.  Such a change is called a flip.
    */
 
-  if (window == NULL || window->always_sticky)
+  if (window->always_sticky)
     return;
   
   workspace = NULL;
@@ -3302,44 +3175,41 @@
 {
   /* Get window at pointer */
   
-  if (window)
-    {
-      MetaWindow *above = NULL;
-      
-      /* Check if top */
-      if (meta_stack_get_top (window->screen->stack) == window)
-	{
-	  meta_window_lower (window);
-	  return;
-	}
+  MetaWindow *above = NULL;
       
-      /* else check if windows in same layer are intersecting it */
+  /* Check if top */
+  if (meta_stack_get_top (window->screen->stack) == window)
+    {
+      meta_window_lower (window);
+      return;
+    }
       
-      above = meta_stack_get_above (window->screen->stack, window, TRUE); 
-
-      while (above)
-	{
-	  MetaRectangle tmp, win_rect, above_rect;
+  /* else check if windows in same layer are intersecting it */
+  
+  above = meta_stack_get_above (window->screen->stack, window, TRUE); 
 
-          if (above->mapped)
+  while (above)
+    {
+      MetaRectangle tmp, win_rect, above_rect;
+      
+      if (above->mapped)
+        {
+          meta_window_get_outer_rect (window, &win_rect);
+          meta_window_get_outer_rect (above, &above_rect);
+          
+          /* Check if obscured */
+          if (meta_rectangle_intersect (&win_rect, &above_rect, &tmp))
             {
-              meta_window_get_outer_rect (window, &win_rect);
-              meta_window_get_outer_rect (above, &above_rect);
-              
-              /* Check if obscured */
-              if (meta_rectangle_intersect (&win_rect, &above_rect, &tmp))
-                {
-                  meta_window_raise (window);
-                  return;
-                }
+              meta_window_raise (window);
+              return;
             }
+        }
 	  
-	  above = meta_stack_get_above (window->screen->stack, above, TRUE); 
-	}
-
-      /* window is not obscured */
-      meta_window_lower (window);
+      above = meta_stack_get_above (window->screen->stack, above, TRUE); 
     }
+
+  /* window is not obscured */
+  meta_window_lower (window);
 }
 
 static void
@@ -3349,10 +3219,7 @@
               XEvent         *event,
               MetaKeyBinding *binding)
 {
-  if (window)
-    {
-      meta_window_raise (window);
-    }
+  meta_window_raise (window);
 }
 
 static void
@@ -3362,10 +3229,7 @@
               XEvent         *event,
               MetaKeyBinding *binding)
 {
-  if (window)
-    {
-      meta_window_lower (window);
-    }
+  meta_window_lower (window);
 }
 
 static void

Modified: trunk/src/core/main.c
==============================================================================
--- trunk/src/core/main.c	(original)
+++ trunk/src/core/main.c	Sat Nov 22 19:02:54 2008
@@ -403,7 +403,9 @@
     meta_set_debugging (TRUE);
 
   if (g_get_home_dir ())
-    chdir (g_get_home_dir ());
+    if (chdir (g_get_home_dir ()) < 0)
+      meta_warning ("Could not change to home directory %s.\n",
+                    g_get_home_dir ());
 
   meta_print_self_identity ();
   

Modified: trunk/src/core/prefs.c
==============================================================================
--- trunk/src/core/prefs.c	(original)
+++ trunk/src/core/prefs.c	Sat Nov 22 19:02:54 2008
@@ -108,17 +108,13 @@
 #ifdef HAVE_GCONF
 static gboolean handle_preference_update_enum (const gchar *key, GConfValue *value);
 
-static gboolean update_window_binding     (const char *name,
-                                           const char *value);
-static gboolean update_screen_binding     (const char *name,
-                                           const char *value);
+static gboolean update_key_binding     (const char *name,
+                                        const char *value);
 static gboolean find_and_update_list_binding (MetaKeyPref *bindings,
                                               const char  *name,
                                               GSList      *value);
-static gboolean update_window_list_binding (const char *name,
-                                            GSList      *value);
-static gboolean update_screen_list_binding (const char *name,
-                                            GSList      *value);
+static gboolean update_key_list_binding (const char *name,
+                                         GSList      *value);
 static gboolean update_command            (const char  *name,
                                            const char  *value);
 static gboolean update_workspace_name     (const char  *name,
@@ -1091,17 +1087,13 @@
   while (preference_update_handler[i]!=NULL)
     {
       if (preference_update_handler[i] (key, value))
-        goto out; /* Get rid of this when we're done with the if */
+        goto out; /* Get rid of this eventually */
 
       i++;
     }
-
-  /* Otherwise, use the enormous if statement. We'll move entries
-   * out of here as it becomes possible to deal with them in a
-   * more general way.
-   */
-
-  if (g_str_has_prefix (key, KEY_WINDOW_BINDINGS_PREFIX))
+  
+  if (g_str_has_prefix (key, KEY_WINDOW_BINDINGS_PREFIX) ||
+      g_str_has_prefix (key, KEY_SCREEN_BINDINGS_PREFIX))
     {
       if (g_str_has_suffix (key, KEY_LIST_BINDINGS_SUFFIX))
         {
@@ -1116,8 +1108,8 @@
 
           list = value ? gconf_value_get_list (value) : NULL;
 
-          if (update_window_list_binding (key, list))
-             queue_changed (META_PREF_WINDOW_KEYBINDINGS);
+          if (update_key_list_binding (key, list))
+            queue_changed (META_PREF_KEYBINDINGS);
         }
       else
         {
@@ -1132,43 +1124,8 @@
 
           str = value ? gconf_value_get_string (value) : NULL;
 
-          if (update_window_binding (key, str))
-             queue_changed (META_PREF_WINDOW_KEYBINDINGS);
-        }
-    }
-  else if (g_str_has_prefix (key, KEY_SCREEN_BINDINGS_PREFIX))
-    {
-      if (g_str_has_suffix (key, KEY_LIST_BINDINGS_SUFFIX))
-        {
-          GSList *list;
-
-          if (value && value->type != GCONF_VALUE_LIST)
-            {
-              meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
-                            key);
-              goto out;
-            }
-
-          list = value ? gconf_value_get_list (value) : NULL;
-
-          if (update_screen_list_binding (key, list))
-             queue_changed (META_PREF_SCREEN_KEYBINDINGS);
-         }
-      else
-        {
-          const char *str;
-
-          if (value && value->type != GCONF_VALUE_STRING)
-            {
-               meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
-                            key);
-               goto out;
-            }
-
-          str = value ? gconf_value_get_string (value) : NULL;
-
-          if (update_screen_binding (key, str))
-             queue_changed (META_PREF_SCREEN_KEYBINDINGS);
+          if (update_key_binding (key, str))
+            queue_changed (META_PREF_KEYBINDINGS);
         }
     }
   else if (g_str_has_prefix (key, KEY_COMMAND_PREFIX))
@@ -1722,11 +1679,8 @@
     case META_PREF_APPLICATION_BASED:
       return "APPLICATION_BASED";
 
-    case META_PREF_SCREEN_KEYBINDINGS:
-      return "SCREEN_KEYBINDINGS";
-
-    case META_PREF_WINDOW_KEYBINDINGS:
-      return "WINDOW_KEYBINDINGS";
+    case META_PREF_KEYBINDINGS:
+      return "KEYBINDINGS";
 
     case META_PREF_DISABLE_WORKAROUNDS:
       return "DISABLE_WORKAROUNDS";
@@ -1821,19 +1775,21 @@
 }
 
 #define keybind(name, handler, param, flags, stroke, description) \
-  { #name, NULL, flags & BINDING_REVERSES },
-static MetaKeyPref screen_bindings[] = {
-#include "screen-bindings.h"
-  { NULL, NULL, FALSE}
-};
-
-static MetaKeyPref window_bindings[] = {
-#include "window-bindings.h"
+  { #name, NULL, !!(flags & BINDING_REVERSES), !!(flags & BINDING_PER_WINDOW) },
+static MetaKeyPref key_bindings[] = {
+#include "all-keybindings.h"
   { NULL, NULL, FALSE }
 };
 #undef keybind
 
 #ifndef HAVE_GCONF
+
+/**
+ * A type to map names of keybindings (such as "switch_windows")
+ * to the binding strings themselves (such as "<Alt>Tab").
+ * It exists only when GConf is turned off in ./configure and
+ * functions as a sort of ersatz GConf.
+ */
 typedef struct
 {
   const char *name;
@@ -1849,16 +1805,11 @@
  */
 
 #define keybind(name, handler, param, flags, stroke, description) \
-  { #name, keystroke },
+  { #name, stroke },
 
-static MetaSimpleKeyMapping screen_string_bindings[] = {
-#include "screen-bindings.h"
-  { NULL,                                   NULL                         }
-};
-
-static MetaSimpleKeyMapping window_string_bindings[] = {
-#include "window-bindings.h"
-  { NULL,                                   NULL                         }
+static MetaSimpleKeyMapping key_string_bindings[] = {
+#include "all-keybindings.h"
+  { NULL, NULL }
 };
 #undef keybind
 
@@ -1867,81 +1818,44 @@
 static void
 init_bindings (void)
 {
-#ifdef HAVE_GCONF
-  int i;
+#ifdef HAVE_GCONF  
+  int i = 0;
   GError *err;
-  
-  i = 0;
-  while (window_bindings[i].name)
-    {
-      GSList *list_val, *tmp;
-      char *str_val;
-      char *key;
-
-      key = g_strconcat (KEY_WINDOW_BINDINGS_PREFIX, "/",
-                         window_bindings[i].name, NULL);
-
-      err = NULL;
-      str_val = gconf_client_get_string (default_client, key, &err);
-      cleanup_error (&err);
 
-      update_binding (&window_bindings[i], str_val);
-
-      g_free (str_val);      
-      g_free (key);
-
-      key = g_strconcat (KEY_WINDOW_BINDINGS_PREFIX, "/",
-                         window_bindings[i].name,
-                         KEY_LIST_BINDINGS_SUFFIX, NULL);
-
-      err = NULL;
-
-      list_val = gconf_client_get_list (default_client, key, GCONF_VALUE_STRING, &err);
-      cleanup_error (&err);
-
-      update_list_binding (&window_bindings[i], list_val, META_LIST_OF_STRINGS);
-
-      tmp = list_val;
-      while (tmp)
-        {
-          g_free (tmp->data);
-          tmp = tmp->next;
-        }
-      g_slist_free (list_val);
-      g_free (key);
-
-      ++i;
-    }
-
-  i = 0;
-  while (screen_bindings[i].name)
+  while (key_bindings[i].name)
     {
       GSList *list_val, *tmp;
       char *str_val;
       char *key;
-
-      key = g_strconcat (KEY_SCREEN_BINDINGS_PREFIX, "/",
-                         screen_bindings[i].name, NULL);
-
+ 
+      key = g_strconcat (key_bindings[i].per_window?
+                         KEY_WINDOW_BINDINGS_PREFIX:
+                         KEY_SCREEN_BINDINGS_PREFIX,
+                         "/",
+                         key_bindings[i].name, NULL);
+ 
       err = NULL;
       str_val = gconf_client_get_string (default_client, key, &err);
       cleanup_error (&err);
 
-      update_binding (&screen_bindings[i], str_val);
+      update_binding (&key_bindings[i], str_val);
 
       g_free (str_val);      
       g_free (key);
 
-      key = g_strconcat (KEY_SCREEN_BINDINGS_PREFIX, "/",
-                         screen_bindings[i].name,
+      key = g_strconcat (key_bindings[i].per_window?
+                         KEY_WINDOW_BINDINGS_PREFIX:
+                         KEY_SCREEN_BINDINGS_PREFIX,
+                         "/",
+                         key_bindings[i].name,
                          KEY_LIST_BINDINGS_SUFFIX, NULL);
 
       err = NULL;
 
       list_val = gconf_client_get_list (default_client, key, GCONF_VALUE_STRING, &err);
       cleanup_error (&err);
-
-      update_list_binding (&screen_bindings[i], list_val, META_LIST_OF_STRINGS);
+ 
+      update_list_binding (&key_bindings[i], list_val, META_LIST_OF_STRINGS);
 
       tmp = list_val;
       while (tmp)
@@ -1957,42 +1871,18 @@
 #else /* HAVE_GCONF */
   int i = 0;
   int which = 0;
-  while (window_string_bindings[i].name)
+  while (key_string_bindings[i].name)
     {
-      if (window_string_bindings[i].keybinding == NULL)
-        continue;
-
-      /* Find which window_bindings entry this window_string_bindings entry
-       * corresponds to.
-       */
-      while (strcmp(window_bindings[which].name, 
-                    window_string_bindings[i].name) != 0)
-        which++;
-
-      /* Set the binding */
-      update_binding (&window_bindings[which],
-                      window_string_bindings[i].keybinding);
-
-      ++i;
-    }
-
-  i = 0;
-  which = 0;
-  while (screen_string_bindings[i].name)
-    {
-      if (screen_string_bindings[i].keybinding == NULL)
+      if (key_string_bindings[i].keybinding == NULL)
         continue;
     
-      /* Find which window_bindings entry this window_string_bindings entry
-       * corresponds to.
-       */
-      while (strcmp(screen_bindings[which].name, 
-                    screen_string_bindings[i].name) != 0)
+      while (strcmp(key_bindings[which].name, 
+                    key_string_bindings[i].name) != 0)
         which++;
 
       /* Set the binding */
-      update_binding (&screen_bindings[which], 
-                      screen_string_bindings[i].keybinding);
+      update_binding (&key_bindings[which], 
+                      key_string_bindings[i].keybinding);
 
       ++i;
     }
@@ -2079,7 +1969,7 @@
   MetaVirtualModifier mods;
   MetaKeyCombo *combo;
   gboolean changed;
-  
+
   meta_topic (META_DEBUG_KEYBINDINGS,
               "Binding \"%s\" has new gconf value \"%s\"\n",
               binding->name, value ? value : "none");
@@ -2112,8 +2002,8 @@
 
 #ifdef HAVE_GCONF
    /* Bug 329676: Bindings which can be shifted must not have no modifiers,
-   * nor only SHIFT as a modifier.
-   */
+    * nor only SHIFT as a modifier.
+    */
 
   if (binding->add_shift &&
       0 != keysym &&
@@ -2147,6 +2037,11 @@
                     binding->name,
                     old_setting);
 
+      /* FIXME: add_shift is currently screen_bindings only, but
+       * there's no really good reason it should always be.
+       * So we shouldn't blindly add KEY_SCREEN_BINDINGS_PREFIX
+       * onto here.
+       */
       key = g_strconcat (KEY_SCREEN_BINDINGS_PREFIX, "/",
                          binding->name, NULL);
       
@@ -2350,17 +2245,10 @@
 }
 
 static gboolean
-update_window_binding (const char *name,
-                       const char *value)
-{
-  return find_and_update_binding (window_bindings, name, value);
-}
-
-static gboolean
-update_screen_binding (const char *name,
+update_key_binding (const char *name,
                        const char *value)
 {
-  return find_and_update_binding (screen_bindings, name, value);
+  return find_and_update_binding (key_bindings, name, value);
 }
 
 static gboolean
@@ -2393,17 +2281,10 @@
 }
 
 static gboolean
-update_window_list_binding (const char *name,
-                            GSList *value)
-{
-  return find_and_update_list_binding (window_bindings, name, value);
-}
-
-static gboolean
-update_screen_list_binding (const char *name,
+update_key_list_binding (const char *name,
                             GSList *value)
 {
-  return find_and_update_list_binding (screen_bindings, name, value);
+  return find_and_update_list_binding (key_bindings, name, value);
 }
 
 static gboolean
@@ -2706,20 +2587,12 @@
 }
 
 void
-meta_prefs_get_screen_bindings (const MetaKeyPref **bindings,
+meta_prefs_get_key_bindings (const MetaKeyPref **bindings,
                                 int                *n_bindings)
 {
   
-  *bindings = screen_bindings;
-  *n_bindings = (int) G_N_ELEMENTS (screen_bindings) - 1;
-}
-
-void
-meta_prefs_get_window_bindings (const MetaKeyPref **bindings,
-                                int                *n_bindings)
-{
-  *bindings = window_bindings;
-  *n_bindings = (int) G_N_ELEMENTS (window_bindings) - 1;
+  *bindings = key_bindings;
+  *n_bindings = (int) G_N_ELEMENTS (key_bindings) - 1;
 }
 
 MetaActionTitlebar
@@ -2775,10 +2648,10 @@
 {
   int i;
 
-  i = G_N_ELEMENTS (screen_bindings) - 2; /* -2 for dummy entry at end */
+  i = G_N_ELEMENTS (key_bindings) - 2; /* -2 for dummy entry at end */
   while (i >= 0)
     {
-      if (strcmp (screen_bindings[i].name, name) == 0)
+      if (strcmp (key_bindings[i].name, name) == 0)
         return (MetaKeyBindingAction) i;
       
       --i;
@@ -2798,12 +2671,13 @@
 {
   int i;
 
-  i = G_N_ELEMENTS (window_bindings) - 2; /* -2 for dummy entry at end */
+  i = G_N_ELEMENTS (key_bindings) - 2; /* -2 for dummy entry at end */
   while (i >= 0)
     {
-      if (strcmp (window_bindings[i].name, name) == 0)
+      if (key_bindings[i].per_window &&
+          strcmp (key_bindings[i].name, name) == 0)
         {
-          GSList *s = window_bindings[i].bindings;
+          GSList *s = key_bindings[i].bindings;
 
           while (s)
             {

Modified: trunk/src/core/schema-bindings.c
==============================================================================
--- trunk/src/core/schema-bindings.c	(original)
+++ trunk/src/core/schema-bindings.c	Sat Nov 22 19:02:54 2008
@@ -21,8 +21,8 @@
 
 /** \file  Schema bindings generator.
  *
- * This program simply takes the items given in the binding lists in
- * window-bindings.h and scheme-bindings.h and turns them into a portion of
+ * This program simply takes the items given in the binding list in
+ * all-keybindings.h and turns them into a portion of
  * the GConf .schemas file.
  *
  * FIXME: also need to make 50-metacity-desktop-key.xml
@@ -92,6 +92,11 @@
 static void
 produce_bindings ()
 {
+  /* 10240 is ridiculous overkill; we're writing the input file and
+   * the lines are always 80 chars or less.
+   */
+  char buffer[10240];
+
   source_file = fopen(source_filename, "r");
 
   if (!source_file)
@@ -108,15 +113,8 @@
         target_filename, strerror (errno));
     }
 
-  while (!feof (source_file))
+  while (fgets (buffer, sizeof (buffer), source_file))
     {
-      /* 10240 is ridiculous overkill; we're writing the input file and
-       * the lines are always 80 chars or less.
-       */
-      char buffer[10240];
-      
-      fgets (buffer, sizeof (buffer), source_file);
-      
       if (strstr (buffer, "<!-- GENERATED -->"))
          break;
          
@@ -132,19 +130,12 @@
                stroke, \
                flags & BINDING_REVERSES, \
                description);
-#include "window-bindings.h"
-#include "screen-bindings.h"
+#include "all-keybindings.h"
 #undef keybind
     }
 
-  while (!feof (source_file))
-    {
-      char buffer[10240];
-      
-      fgets (buffer, sizeof (buffer), source_file);
-      
+  while (fgets (buffer, sizeof (buffer), source_file))
       fprintf (target_file, "%s", buffer);
-    }
 
   if (fclose (source_file)!=0)
       g_error ("Cannot close %s: %s\n",

Modified: trunk/src/core/xprops.c
==============================================================================
--- trunk/src/core/xprops.c	(original)
+++ trunk/src/core/xprops.c	Sat Nov 22 19:02:54 2008
@@ -1051,7 +1051,7 @@
                                       &results.type, &results.format,
                                       &results.n_items,
                                       &results.bytes_after,
-                                      (unsigned char **)(&results.prop)) != Success ||
+                                      (char **)(&results.prop)) != Success ||
           results.type == None)
         {
           values[i].type = META_PROP_VALUE_INVALID;

Modified: trunk/src/include/prefs.h
==============================================================================
--- trunk/src/include/prefs.h	(original)
+++ trunk/src/include/prefs.h	Sat Nov 22 19:02:54 2008
@@ -44,8 +44,7 @@
   META_PREF_TITLEBAR_FONT,
   META_PREF_NUM_WORKSPACES,
   META_PREF_APPLICATION_BASED,
-  META_PREF_WINDOW_KEYBINDINGS,
-  META_PREF_SCREEN_KEYBINDINGS,
+  META_PREF_KEYBINDINGS,
   META_PREF_DISABLE_WORKAROUNDS,
   META_PREF_COMMANDS,
   META_PREF_TERMINAL_COMMAND,
@@ -183,7 +182,8 @@
 typedef struct
 {
   const char   *name;
-  /* a list of MetaKeyCombos. Each of them is bound to
+  /**
+   * A list of MetaKeyCombos. Each of them is bound to
    * this keypref. If one has keysym==modifiers==0, it is
    * ignored. For historical reasons, the first entry is
    * governed by the pref FOO and the remainder are
@@ -191,14 +191,15 @@
    */
   GSList *bindings;
 
-  /* for keybindings that can have shift or not like Alt+Tab */
-  gboolean      add_shift;
+  /** for keybindings that can have shift or not like Alt+Tab */
+  gboolean      add_shift:1;
+
+  /** for keybindings that apply only to a window */
+  gboolean      per_window:1;
 } MetaKeyPref;
 
-void meta_prefs_get_screen_bindings (const MetaKeyPref **bindings,
-                                     int                *n_bindings);
-void meta_prefs_get_window_bindings (const MetaKeyPref **bindings,
-                                     int                *n_bindings);
+void meta_prefs_get_key_bindings (const MetaKeyPref **bindings,
+                                  int                *n_bindings);
 
 MetaKeyBindingAction meta_prefs_get_keybinding_action (const char *name);
 

Modified: trunk/src/ui/resizepopup.c
==============================================================================
--- trunk/src/ui/resizepopup.c	(original)
+++ trunk/src/ui/resizepopup.c	Sat Nov 22 19:02:54 2008
@@ -25,6 +25,7 @@
 #include "resizepopup.h"
 #include "util.h"
 #include <gtk/gtk.h>
+#include <gdk/gdkx.h>
 
 struct _MetaResizePopup
 {

Modified: trunk/src/ui/theme-viewer.c
==============================================================================
--- trunk/src/ui/theme-viewer.c	(original)
+++ trunk/src/ui/theme-viewer.c	Sat Nov 22 19:02:54 2008
@@ -486,7 +486,7 @@
   i = 0;
   while (i < META_FRAME_TYPE_LAST)
     {
-      const char *title;
+      const char *title = NULL;
       GtkWidget *contents;
       GtkWidget *align;
       double xalign, yalign;

Modified: trunk/src/wm-tester/test-resizing.c
==============================================================================
--- trunk/src/wm-tester/test-resizing.c	(original)
+++ trunk/src/wm-tester/test-resizing.c	Sat Nov 22 19:02:54 2008
@@ -68,7 +68,7 @@
           int *xp, int *yp, int *widthp, int *heightp)
 {
   int x, y;
-  unsigned int width, height, border, depth;
+  unsigned int width=0, height=0, border=0, depth=0;
   Window root;
   
   XGetGeometry (d, draw, &root, &x, &y, &width, &height, &border, &depth);



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