Make a structure to hold a keycode+modifers and mousebutton+modifiers, and use them...
authorDana Jansens <danakj@orodu.net>
Sat, 6 Aug 2011 01:36:20 +0000 (21:36 -0400)
committerDana Jansens <danakj@orodu.net>
Mon, 8 Aug 2011 19:13:04 +0000 (15:13 -0400)
Makes a complete value for these so it's one variable instead of two.

openbox/config.c
openbox/config.h
openbox/dock.c
openbox/keyboard.c
openbox/keyboard.h
openbox/mouse.h

index 9dd803beb6a4f7eaaf5fd017d19dfa30bcee6ecf..5b7caad178843d19c561d5b59cb5113dd06d2db2 100644 (file)
@@ -83,11 +83,9 @@ ObOrientation   config_dock_orient;
 gboolean        config_dock_hide;
 guint           config_dock_hide_delay;
 guint           config_dock_show_delay;
-guint           config_dock_app_move_button;
-guint           config_dock_app_move_modifiers;
+ObMouseButton   config_dock_app_move_button;
 
-guint config_keyboard_reset_keycode;
-guint config_keyboard_reset_state;
+ObKeyboardKey config_keyboard_reset_key;
 
 gint     config_mouse_threshold;
 gint     config_mouse_dclicktime;
@@ -430,8 +428,8 @@ static void parse_keyboard(xmlNodePtr node, gpointer d)
 
     if ((n = obt_xml_find_sibling(node->children, "chainQuitKey"))) {
         key = obt_xml_node_string(n);
-        translate_key(key, &config_keyboard_reset_state,
-                      &config_keyboard_reset_keycode);
+        translate_key(key, &config_keyboard_reset_key.modifiers,
+                      &config_keyboard_reset_key.keycode);
         g_free(key);
     }
 
@@ -857,8 +855,8 @@ static void parse_dock(xmlNodePtr node, gpointer d)
         gchar *str = obt_xml_node_string(n);
         guint b, s;
         if (translate_button(str, &s, &b)) {
-            config_dock_app_move_button = b;
-            config_dock_app_move_modifiers = s;
+            config_dock_app_move_button.button = b;
+            config_dock_app_move_button.modifiers = s;
         } else {
             g_message(_("Invalid button \"%s\" specified in config file"), str);
         }
@@ -1079,13 +1077,13 @@ void config_startup(ObtXmlInst *i)
     config_dock_hide = FALSE;
     config_dock_hide_delay = 300;
     config_dock_show_delay = 300;
-    config_dock_app_move_button = 2; /* middle */
-    config_dock_app_move_modifiers = 0;
+    config_dock_app_move_button.button = 2; /* middle */
+    config_dock_app_move_button.modifiers = 0;
 
     obt_xml_register(i, "dock", parse_dock, NULL);
 
-    translate_key("C-g", &config_keyboard_reset_state,
-                  &config_keyboard_reset_keycode);
+    translate_key("C-g", &config_keyboard_reset_key.modifiers,
+                  &config_keyboard_reset_key.keycode);
 
     bind_default_keyboard();
 
index 90b6581a0229de8550debf6582aa7254dc5c6f4e..834193de66c42a3b36f8c7cce39abde2c5a1e6f2 100644 (file)
@@ -25,6 +25,8 @@
 #include "place.h"
 #include "client.h"
 #include "geom.h"
+#include "keyboard.h"
+#include "mouse.h"
 #include "moveresize.h"
 #include "obrender/render.h"
 #include "obt/xml.h"
@@ -129,9 +131,7 @@ extern guint config_dock_hide_delay;
 /*! The number of milliseconds to wait before showing the dock */
 extern guint config_dock_show_delay;
 /*! The mouse button to be used to move dock apps */
-extern guint config_dock_app_move_button;
-/*! The modifiers to be used with the button to move dock apps */
-extern guint config_dock_app_move_modifiers;
+extern ObMouseButton config_dock_app_move_button;
 
 /*! The name of the theme */
 extern gchar *config_theme;
@@ -167,10 +167,8 @@ extern GSList *config_desktops_names;
 /*! Amount of time to show the desktop switch dialog */
 extern guint config_desktop_popup_time;
 
-/*! The keycode of the key combo which resets the keybaord chains */
-extern guint config_keyboard_reset_keycode;
-/*! The modifiers of the key combo which resets the keybaord chains */
-extern guint config_keyboard_reset_state;
+/*! The key combo which resets the keybaord chains */
+extern ObKeyboardKey config_keyboard_reset_key;
 
 /*! Number of pixels a drag must go before being considered a drag */
 extern gint config_mouse_threshold;
index c26eee6291457adefc0394c930213ca96ab7ae52..b8092a18a47f536857a7f3577d4ca39dfc15ee4b 100644 (file)
@@ -41,14 +41,14 @@ StrutPartial dock_strut;
 static void dock_app_grab_button(ObDockApp *app, gboolean grab)
 {
     if (grab) {
-        grab_button_full(config_dock_app_move_button,
-                         config_dock_app_move_modifiers, app->icon_win,
+        grab_button_full(config_dock_app_move_button.button,
+                         config_dock_app_move_button.modifiers, app->icon_win,
                          ButtonPressMask | ButtonReleaseMask |
                          ButtonMotionMask,
                          GrabModeAsync, OB_CURSOR_MOVE);
     } else {
-        ungrab_button(config_dock_app_move_button,
-                      config_dock_app_move_modifiers, app->icon_win);
+        ungrab_button(config_dock_app_move_button.button,
+                      config_dock_app_move_button.modifiers, app->icon_win);
     }
 }
 
index a3cd9d0e8b1844c5151b8d2419ffd36999d31eda..8d6096773fcef671fa7327e7047891f965b7019f 100644 (file)
@@ -59,8 +59,8 @@ static void grab_keys(gboolean grab)
             p = p->next_sibling;
         }
         if (curpos)
-            grab_key(config_keyboard_reset_keycode,
-                     config_keyboard_reset_state,
+            grab_key(config_keyboard_reset_key.keycode,
+                     config_keyboard_reset_key.modifiers,
                      obt_root(ob_screen), GrabModeAsync);
     }
 }
@@ -235,8 +235,8 @@ gboolean keyboard_event(ObClient *client, const XEvent *e)
 
     mods = obt_keyboard_only_modmasks(e->xkey.state);
 
-    if (e->xkey.keycode == config_keyboard_reset_keycode &&
-        mods == config_keyboard_reset_state)
+    if (e->xkey.keycode == config_keyboard_reset_key.keycode &&
+        mods == config_keyboard_reset_key.modifiers)
     {
         if (chain_timer) g_source_remove(chain_timer);
         keyboard_reset_chains(-1);
index 300a9106a35be6475de4344d503253897cfb7fa4..b6bcab30c9d180ad32aef4c2969db109fea946f8 100644 (file)
 #include <glib.h>
 #include <X11/Xlib.h>
 
+typedef struct _ObKeyboardKey ObKeyboardKey;
+
 struct _ObClient;
 struct _ObActionList;
 
 extern KeyBindingTree *keyboard_firstnode;
 
+struct _ObKeyboardKey {
+    guint keycode;
+    guint modifiers;
+};
+
 void keyboard_startup(gboolean reconfig);
 void keyboard_shutdown(gboolean reconfig);
 
index 5f38c9f48823cfd2bba506a0a9c3151c6818a62c..ad519e2f74a2eced24a8e5682102c68254ed83a0 100644 (file)
 
 #include <X11/Xlib.h>
 
+typedef struct _ObMouseButton ObMouseButton;
+
 struct _ObActionList;
 
+struct _ObMouseButton {
+    guint button;
+    guint modifiers;
+};
+
 void mouse_startup(gboolean reconfig);
 void mouse_shutdown(gboolean reconfig);