From: Dana Jansens Date: Fri, 26 Sep 2003 07:59:06 +0000 (+0000) Subject: add which can change which button combo is used to move dock apps... X-Git-Url: https://git.dogcows.com/gitweb?a=commitdiff_plain;h=b192784070b3ec03038e33f2080a39e497e5dd80;p=chaz%2Fopenbox add which can change which button combo is used to move dock apps around in the dock. The new default is A-Left instead of Middle, since soem dock apps use middle, assuming they can! --- diff --git a/data/rc.xml.in b/data/rc.xml.in index a5eaa34d..e107ac04 100644 --- a/data/rc.xml.in +++ b/data/rc.xml.in @@ -48,6 +48,7 @@ 0 no 300 + A-Left diff --git a/data/rc.xsd b/data/rc.xsd index 9ddc67b7..16704600 100644 --- a/data/rc.xsd +++ b/data/rc.xsd @@ -108,6 +108,7 @@ + diff --git a/openbox/config.c b/openbox/config.c index 72aa88a9..97accc01 100644 --- a/openbox/config.c +++ b/openbox/config.c @@ -47,6 +47,8 @@ gint config_dock_y; ObOrientation config_dock_orient; gboolean config_dock_hide; guint config_dock_hide_delay; +guint config_dock_app_move_button; +guint config_dock_app_move_modifiers; guint config_keyboard_reset_keycode; guint config_keyboard_reset_state; @@ -325,6 +327,17 @@ static void parse_dock(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, void *d) config_dock_hide = parse_bool(doc, n); if ((n = parse_find_node("hideDelay", node))) config_dock_hide_delay = parse_int(doc, n) * 1000; + if ((n = parse_find_node("moveButton", node))) { + gchar *str = parse_string(doc, n); + guint b, s; + if (translate_button(str, &s, &b)) { + config_dock_app_move_button = b; + config_dock_app_move_modifiers = s; + } else { + g_warning("invalid button '%s'", str); + } + g_free(str); + } } static void parse_menu(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, void *d) @@ -489,6 +502,8 @@ void config_startup(ObParseInst *i) config_dock_orient = OB_ORIENTATION_VERT; config_dock_hide = FALSE; config_dock_hide_delay = 300; + config_dock_app_move_button = 2; /* middle */ + config_dock_app_move_modifiers = 0; parse_register(i, "dock", parse_dock, NULL); diff --git a/openbox/config.h b/openbox/config.h index c228871e..0c14b376 100644 --- a/openbox/config.h +++ b/openbox/config.h @@ -61,6 +61,10 @@ extern ObOrientation config_dock_orient; extern gboolean config_dock_hide; /*! The number of microseconds to wait before hiding the dock */ extern guint config_dock_hide_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; /* The name of the theme */ extern char *config_theme; diff --git a/openbox/dock.c b/openbox/dock.c index 63a7f977..b7708900 100644 --- a/openbox/dock.c +++ b/openbox/dock.c @@ -34,11 +34,27 @@ static ObDock *dock; 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, + ButtonPressMask | ButtonReleaseMask | + ButtonMotionMask, + GrabModeAsync, OB_CURSOR_MOVE); + } else { + ungrab_button(config_dock_app_move_button, + config_dock_app_move_modifiers, app->icon_win); + } +} + void dock_startup(gboolean reconfig) { XSetWindowAttributes attrib; if (reconfig) { + GList *it; + XSetWindowBorder(ob_display, dock->frame, RrColorPixel(ob_rr_theme->b_color)); XSetWindowBorderWidth(ob_display, dock->frame, ob_rr_theme->bwidth); @@ -50,6 +66,9 @@ void dock_startup(gboolean reconfig) dock_configure(); dock_hide(TRUE); + + for (it = dock->dock_apps; it; it = g_list_next(it)) + dock_app_grab_button(it->data, TRUE); return; } @@ -81,7 +100,12 @@ void dock_startup(gboolean reconfig) void dock_shutdown(gboolean reconfig) { if (reconfig) { + GList *it; + stacking_remove(DOCK_AS_WINDOW(dock)); + + for (it = dock->dock_apps; it; it = g_list_next(it)) + dock_app_grab_button(it->data, FALSE); return; } @@ -149,9 +173,7 @@ void dock_add(Window win, XWMHints *wmhints) XChangeSaveSet(ob_display, app->icon_win, SetModeInsert); XSelectInput(ob_display, app->icon_win, DOCKAPP_EVENT_MASK); - grab_button_full(2, 0, app->icon_win, - ButtonPressMask | ButtonReleaseMask | ButtonMotionMask, - GrabModeAsync, OB_CURSOR_MOVE); + dock_app_grab_button(app, TRUE); g_hash_table_insert(window_map, &app->icon_win, app); @@ -166,7 +188,7 @@ void dock_remove_all() void dock_remove(ObDockApp *app, gboolean reparent) { - ungrab_button(2, 0, app->icon_win); + dock_app_grab_button(app, FALSE); XSelectInput(ob_display, app->icon_win, NoEventMask); /* remove the window from our save set */ XChangeSaveSet(ob_display, app->icon_win, SetModeDelete);