add <dock><moveButton> 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!

This commit is contained in:
Dana Jansens 2003-09-26 07:59:06 +00:00
parent 11615ac2c4
commit b192784070
5 changed files with 47 additions and 4 deletions

View file

@ -48,6 +48,7 @@
<floatingY>0</floatingY>
<autoHide>no</autoHide>
<hideDelay>300</hideDelay>
<moveButton>A-Left</moveButton>
</dock>
<keyboard>

View file

@ -108,6 +108,7 @@
<xs:element name="floatingY" type="xs:integer"/>
<xs:element name="autoHide" type="ob:yesorno"/>
<xs:element name="hideDelay" type="xs:integer"/>
<xs:element name="moveButton" type="ob:button"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="action">

View file

@ -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);

View file

@ -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;

View file

@ -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);