X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Factions%2Fdesktop.c;h=8dadf550af3b2ea2787015be50528e48ce8c7a2d;hb=HEAD;hp=10b31acd535c9fc6b086e106a8a007a312333b71;hpb=d179d6428ae585a3b8a13479bfe4586e41de2ff9;p=chaz%2Fopenbox diff --git a/openbox/actions/desktop.c b/openbox/actions/desktop.c index 10b31acd..8dadf550 100644 --- a/openbox/actions/desktop.c +++ b/openbox/actions/desktop.c @@ -6,6 +6,7 @@ typedef enum { LAST, + CURRENT, RELATIVE, ABSOLUTE } SwitchType; @@ -53,7 +54,6 @@ static void i_post_func(gpointer options); static gpointer setup_go_last_func(xmlNodePtr node); static gpointer setup_send_last_func(xmlNodePtr node); static gpointer setup_go_abs_func(xmlNodePtr node); -static gpointer setup_send_abs_func(xmlNodePtr node); static gpointer setup_go_next_func(xmlNodePtr node, ObActionsIPreFunc *pre, ObActionsIInputFunc *input, @@ -124,8 +124,6 @@ void action_desktop_startup(void) actions_register("SendToDesktopLast", setup_send_last_func, free_func, run_func); actions_register("Desktop", setup_go_abs_func, free_func, run_func); - actions_register("SendToDesktop", setup_send_abs_func, - free_func, run_func); actions_register_i("DesktopNext", setup_go_next_func, free_func, run_func); actions_register_i("SendToDesktopNext", setup_send_next_func, free_func, run_func); @@ -168,6 +166,8 @@ static gpointer setup_func(xmlNodePtr node, gchar *s = obt_xml_node_string(n); if (!g_ascii_strcasecmp(s, "last")) o->type = LAST; + else if (!g_ascii_strcasecmp(s, "current")) + o->type = CURRENT; else if (!g_ascii_strcasecmp(s, "next")) { o->type = RELATIVE; o->u.rel.linear = TRUE; @@ -241,6 +241,11 @@ static gpointer setup_send_func(xmlNodePtr node, Options *o; o = setup_func(node, pre, input, cancel, post); + if ((n = obt_xml_find_node(node, "desktop"))) { + /* 3.4 compatibility */ + o->u.abs.desktop = obt_xml_node_int(n) - 1; + o->type = ABSOLUTE; + } o->send = TRUE; o->follow = TRUE; @@ -262,7 +267,6 @@ static void free_func(gpointer o) g_slice_free(Options, o); } -/* Always return FALSE because its not interactive */ static gboolean run_func(ObActionsData *data, gpointer options) { Options *o = options; @@ -272,6 +276,9 @@ static gboolean run_func(ObActionsData *data, gpointer options) case LAST: d = screen_last_desktop; break; + case CURRENT: + d = screen_desktop; + break; case ABSOLUTE: d = o->u.abs.desktop; break; @@ -283,7 +290,9 @@ static gboolean run_func(ObActionsData *data, gpointer options) g_assert_not_reached(); } - if (d < screen_num_desktops && d != screen_desktop) { + if (d < screen_num_desktops && + (d != screen_desktop || + (data->client && data->client->desktop != screen_desktop))) { gboolean go = TRUE; actions_client_move(data, TRUE); @@ -310,13 +319,14 @@ static gboolean i_input_func(guint initial_state, gpointer options, gboolean *used) { - guint mods; + guint mods, initial_mods; + initial_mods = obt_keyboard_only_modmasks(initial_state); mods = obt_keyboard_only_modmasks(e->xkey.state); if (e->type == KeyRelease) { /* remove from the state the mask of the modifier key being released, if it is a modifier key being released that is */ - mods &= ~obt_keyboard_keycode_to_modmask(e->xkey.keycode); + mods &= ~obt_keyboard_keyevent_to_modmask(e); } if (e->type == KeyPress) { @@ -327,11 +337,11 @@ static gboolean i_input_func(guint initial_state, return FALSE; /* There were no modifiers and they pressed enter */ - else if (sym == XK_Return && !initial_state) + else if ((sym == XK_Return || sym == XK_KP_Enter) && !initial_mods) return FALSE; } /* They released the modifiers */ - else if (e->type == KeyRelease && initial_state && !(mods & initial_state)) + else if (e->type == KeyRelease && initial_mods && !(mods & initial_mods)) { return FALSE; } @@ -341,7 +351,8 @@ static gboolean i_input_func(guint initial_state, static gboolean i_pre_func(guint initial_state, gpointer options) { - if (!initial_state) { + guint initial_mods = obt_keyboard_only_modmasks(initial_state); + if (!initial_mods) { Options *o = options; o->interactive = FALSE; return FALSE; @@ -395,18 +406,6 @@ static gpointer setup_go_abs_func(xmlNodePtr node) return o; } -static gpointer setup_send_abs_func(xmlNodePtr node) -{ - xmlNodePtr n; - Options *o = setup_follow(node); - o->type = ABSOLUTE; - if ((n = obt_xml_find_node(node, "desktop"))) - o->u.abs.desktop = obt_xml_node_int(n) - 1; - else - o->u.abs.desktop = screen_desktop; - return o; -} - static void setup_rel(Options *o, xmlNodePtr node, gboolean lin, ObDirection dir, ObActionsIPreFunc *pre,