mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
Cleanups to workspace popup patch. Space before all parens in a couple
2002-06-08 Havoc Pennington <hp@pobox.com> Cleanups to workspace popup patch. Space before all parens in a couple places. * src/prefs.c (meta_prefs_get_keybinding_action): fix brace indentation, and use while instead of for loop. Take a "mask" argument to avoid ambiguity issues. * src/keybindings.c (handle_workspace_switch): rename from handle_workspace_forward since there's no directionality here (handle_workspace_switch): add a FIXME about how screwed it is that we need a window in order to do our grab. Should be able to grab on a dummy window like no_focus_window or the root window. (process_workspace_switch_grab): rename from tab_grab for clarity, no tab involved here. * src/common.h (enum): have only one grab op for all workspace switching directions, instead of one for each.
This commit is contained in:
parent
fb5a3a8998
commit
b168954ed3
20
ChangeLog
20
ChangeLog
@ -1,3 +1,23 @@
|
|||||||
|
2002-06-08 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
|
Cleanups to workspace popup patch. Space before all parens
|
||||||
|
in a couple places.
|
||||||
|
|
||||||
|
* src/prefs.c (meta_prefs_get_keybinding_action): fix brace
|
||||||
|
indentation, and use while instead of for loop. Take a "mask"
|
||||||
|
argument to avoid ambiguity issues.
|
||||||
|
|
||||||
|
* src/keybindings.c (handle_workspace_switch): rename from
|
||||||
|
handle_workspace_forward since there's no directionality here
|
||||||
|
(handle_workspace_switch): add a FIXME about how screwed it is
|
||||||
|
that we need a window in order to do our grab. Should be able to
|
||||||
|
grab on a dummy window like no_focus_window or the root window.
|
||||||
|
(process_workspace_switch_grab): rename from tab_grab for clarity,
|
||||||
|
no tab involved here.
|
||||||
|
|
||||||
|
* src/common.h (enum): have only one grab op for all workspace
|
||||||
|
switching directions, instead of one for each.
|
||||||
|
|
||||||
2002-06-08 Havoc Pennington <hp@pobox.com>
|
2002-06-08 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
Apply big patch from blackc@speakeasy.net adding a popup window
|
Apply big patch from blackc@speakeasy.net adding a popup window
|
||||||
|
@ -102,10 +102,7 @@ typedef enum
|
|||||||
META_GRAB_OP_KEYBOARD_TABBING_NORMAL,
|
META_GRAB_OP_KEYBOARD_TABBING_NORMAL,
|
||||||
META_GRAB_OP_KEYBOARD_TABBING_DOCK,
|
META_GRAB_OP_KEYBOARD_TABBING_DOCK,
|
||||||
|
|
||||||
META_GRAB_OP_KEYBOARD_WORKSPACE_UP,
|
META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING,
|
||||||
META_GRAB_OP_KEYBOARD_WORKSPACE_DOWN,
|
|
||||||
META_GRAB_OP_KEYBOARD_WORKSPACE_LEFT,
|
|
||||||
META_GRAB_OP_KEYBOARD_WORKSPACE_RIGHT,
|
|
||||||
|
|
||||||
/* Frame button ops */
|
/* Frame button ops */
|
||||||
META_GRAB_OP_CLICKING_MINIMIZE,
|
META_GRAB_OP_CLICKING_MINIMIZE,
|
||||||
|
@ -766,10 +766,7 @@ grab_op_is_keyboard (MetaGrabOp op)
|
|||||||
case META_GRAB_OP_KEYBOARD_RESIZING_NW:
|
case META_GRAB_OP_KEYBOARD_RESIZING_NW:
|
||||||
case META_GRAB_OP_KEYBOARD_TABBING_NORMAL:
|
case META_GRAB_OP_KEYBOARD_TABBING_NORMAL:
|
||||||
case META_GRAB_OP_KEYBOARD_TABBING_DOCK:
|
case META_GRAB_OP_KEYBOARD_TABBING_DOCK:
|
||||||
case META_GRAB_OP_KEYBOARD_WORKSPACE_UP:
|
case META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING:
|
||||||
case META_GRAB_OP_KEYBOARD_WORKSPACE_DOWN:
|
|
||||||
case META_GRAB_OP_KEYBOARD_WORKSPACE_LEFT:
|
|
||||||
case META_GRAB_OP_KEYBOARD_WORKSPACE_RIGHT:
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -2255,10 +2252,7 @@ meta_display_begin_grab_op (MetaDisplay *display,
|
|||||||
META_TAB_LIST_DOCKS);
|
META_TAB_LIST_DOCKS);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case META_GRAB_OP_KEYBOARD_WORKSPACE_UP:
|
case META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING:
|
||||||
case META_GRAB_OP_KEYBOARD_WORKSPACE_DOWN:
|
|
||||||
case META_GRAB_OP_KEYBOARD_WORKSPACE_LEFT:
|
|
||||||
case META_GRAB_OP_KEYBOARD_WORKSPACE_RIGHT:
|
|
||||||
meta_workspace_ensure_tab_popup (display, window->screen);
|
meta_workspace_ensure_tab_popup (display, window->screen);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -2280,10 +2274,7 @@ meta_display_end_grab_op (MetaDisplay *display,
|
|||||||
|
|
||||||
if (display->grab_op == META_GRAB_OP_KEYBOARD_TABBING_NORMAL ||
|
if (display->grab_op == META_GRAB_OP_KEYBOARD_TABBING_NORMAL ||
|
||||||
display->grab_op == META_GRAB_OP_KEYBOARD_TABBING_DOCK ||
|
display->grab_op == META_GRAB_OP_KEYBOARD_TABBING_DOCK ||
|
||||||
display->grab_op == META_GRAB_OP_KEYBOARD_WORKSPACE_LEFT ||
|
display->grab_op == META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING)
|
||||||
display->grab_op == META_GRAB_OP_KEYBOARD_WORKSPACE_RIGHT ||
|
|
||||||
display->grab_op == META_GRAB_OP_KEYBOARD_WORKSPACE_UP ||
|
|
||||||
display->grab_op == META_GRAB_OP_KEYBOARD_WORKSPACE_DOWN)
|
|
||||||
{
|
{
|
||||||
meta_ui_tab_popup_free (display->grab_window->screen->tab_popup);
|
meta_ui_tab_popup_free (display->grab_window->screen->tab_popup);
|
||||||
display->grab_window->screen->tab_popup = NULL;
|
display->grab_window->screen->tab_popup = NULL;
|
||||||
|
@ -94,7 +94,7 @@ static void handle_move_to_workspace (MetaDisplay *display,
|
|||||||
MetaWindow *window,
|
MetaWindow *window,
|
||||||
XEvent *event,
|
XEvent *event,
|
||||||
MetaKeyBinding *binding);
|
MetaKeyBinding *binding);
|
||||||
static void handle_workspace_forward (MetaDisplay *display,
|
static void handle_workspace_switch (MetaDisplay *display,
|
||||||
MetaWindow *window,
|
MetaWindow *window,
|
||||||
XEvent *event,
|
XEvent *event,
|
||||||
MetaKeyBinding *binding);
|
MetaKeyBinding *binding);
|
||||||
@ -119,7 +119,7 @@ static gboolean process_tab_grab (MetaDisplay *display,
|
|||||||
XEvent *event,
|
XEvent *event,
|
||||||
KeySym keysym);
|
KeySym keysym);
|
||||||
|
|
||||||
static gboolean process_workspace_tab_grab (MetaDisplay *display,
|
static gboolean process_workspace_switch_grab (MetaDisplay *display,
|
||||||
MetaWindow *window,
|
MetaWindow *window,
|
||||||
XEvent *event,
|
XEvent *event,
|
||||||
KeySym keysym);
|
KeySym keysym);
|
||||||
@ -168,13 +168,13 @@ static const MetaKeyHandler screen_handlers[] = {
|
|||||||
GINT_TO_POINTER (10) },
|
GINT_TO_POINTER (10) },
|
||||||
{ META_KEYBINDING_WORKSPACE_12, handle_activate_workspace,
|
{ META_KEYBINDING_WORKSPACE_12, handle_activate_workspace,
|
||||||
GINT_TO_POINTER (11) },
|
GINT_TO_POINTER (11) },
|
||||||
{ META_KEYBINDING_WORKSPACE_LEFT, handle_workspace_forward,
|
{ META_KEYBINDING_WORKSPACE_LEFT, handle_workspace_switch,
|
||||||
GINT_TO_POINTER (META_MOTION_LEFT) },
|
GINT_TO_POINTER (META_MOTION_LEFT) },
|
||||||
{ META_KEYBINDING_WORKSPACE_RIGHT, handle_workspace_forward,
|
{ META_KEYBINDING_WORKSPACE_RIGHT, handle_workspace_switch,
|
||||||
GINT_TO_POINTER (META_MOTION_RIGHT) },
|
GINT_TO_POINTER (META_MOTION_RIGHT) },
|
||||||
{ META_KEYBINDING_WORKSPACE_UP, handle_workspace_forward,
|
{ META_KEYBINDING_WORKSPACE_UP, handle_workspace_switch,
|
||||||
GINT_TO_POINTER (META_MOTION_UP) },
|
GINT_TO_POINTER (META_MOTION_UP) },
|
||||||
{ META_KEYBINDING_WORKSPACE_DOWN, handle_workspace_forward,
|
{ META_KEYBINDING_WORKSPACE_DOWN, handle_workspace_switch,
|
||||||
GINT_TO_POINTER (META_MOTION_DOWN) },
|
GINT_TO_POINTER (META_MOTION_DOWN) },
|
||||||
{ META_KEYBINDING_SWITCH_WINDOWS, handle_tab_forward,
|
{ META_KEYBINDING_SWITCH_WINDOWS, handle_tab_forward,
|
||||||
GINT_TO_POINTER (META_TAB_LIST_NORMAL) },
|
GINT_TO_POINTER (META_TAB_LIST_NORMAL) },
|
||||||
@ -1097,13 +1097,10 @@ meta_display_process_key_event (MetaDisplay *display,
|
|||||||
"Processing event for keyboard tabbing\n");
|
"Processing event for keyboard tabbing\n");
|
||||||
handled = process_tab_grab (display, window, event, keysym);
|
handled = process_tab_grab (display, window, event, keysym);
|
||||||
break;
|
break;
|
||||||
case META_GRAB_OP_KEYBOARD_WORKSPACE_UP:
|
case META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING:
|
||||||
case META_GRAB_OP_KEYBOARD_WORKSPACE_DOWN:
|
|
||||||
case META_GRAB_OP_KEYBOARD_WORKSPACE_LEFT:
|
|
||||||
case META_GRAB_OP_KEYBOARD_WORKSPACE_RIGHT:
|
|
||||||
meta_topic (META_DEBUG_KEYBINDINGS,
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
||||||
"Processing event for keyboard tabbing workspace\n");
|
"Processing event for keyboard workspace switching\n");
|
||||||
handled = process_workspace_tab_grab (display, window, event, keysym);
|
handled = process_workspace_switch_grab (display, window, event, keysym);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -1282,7 +1279,8 @@ process_tab_grab (MetaDisplay *display,
|
|||||||
if (is_modifier (display, event->xkey.keycode))
|
if (is_modifier (display, event->xkey.keycode))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
action = meta_prefs_get_keybinding_action(keysym);
|
action = meta_prefs_get_keybinding_action (keysym,
|
||||||
|
display->grab_mask);
|
||||||
|
|
||||||
switch (action)
|
switch (action)
|
||||||
{
|
{
|
||||||
@ -1391,7 +1389,7 @@ handle_activate_workspace (MetaDisplay *display,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
process_workspace_tab_grab (MetaDisplay *display,
|
process_workspace_switch_grab (MetaDisplay *display,
|
||||||
MetaWindow *window,
|
MetaWindow *window,
|
||||||
XEvent *event,
|
XEvent *event,
|
||||||
KeySym keysym)
|
KeySym keysym)
|
||||||
@ -1451,7 +1449,8 @@ process_workspace_tab_grab (MetaDisplay *display,
|
|||||||
MetaWorkspace *target_workspace;
|
MetaWorkspace *target_workspace;
|
||||||
MetaKeyBindingAction action;
|
MetaKeyBindingAction action;
|
||||||
|
|
||||||
action = meta_prefs_get_keybinding_action(keysym);
|
action = meta_prefs_get_keybinding_action (keysym,
|
||||||
|
display->grab_mask);
|
||||||
|
|
||||||
switch (action)
|
switch (action)
|
||||||
{
|
{
|
||||||
@ -1895,28 +1894,8 @@ handle_raise_or_lower (MetaDisplay *display,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static MetaGrabOp
|
|
||||||
op_from_motion_direction (MetaMotionDirection motion)
|
|
||||||
{
|
|
||||||
switch (motion)
|
|
||||||
{
|
|
||||||
case META_MOTION_UP:
|
|
||||||
return META_GRAB_OP_KEYBOARD_WORKSPACE_UP;
|
|
||||||
case META_MOTION_DOWN:
|
|
||||||
return META_GRAB_OP_KEYBOARD_WORKSPACE_DOWN;
|
|
||||||
case META_MOTION_LEFT:
|
|
||||||
return META_GRAB_OP_KEYBOARD_WORKSPACE_LEFT;
|
|
||||||
case META_MOTION_RIGHT:
|
|
||||||
return META_GRAB_OP_KEYBOARD_WORKSPACE_RIGHT;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_assert_not_reached ();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handle_workspace_forward (MetaDisplay *display,
|
handle_workspace_switch (MetaDisplay *display,
|
||||||
MetaWindow *window,
|
MetaWindow *window,
|
||||||
XEvent *event,
|
XEvent *event,
|
||||||
MetaKeyBinding *binding)
|
MetaKeyBinding *binding)
|
||||||
@ -1933,6 +1912,11 @@ handle_workspace_forward (MetaDisplay *display,
|
|||||||
if (screen == NULL)
|
if (screen == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* FIXME this is all broken, that you need a window to grab on.
|
||||||
|
* There's no reason we need a window here, in fact it's broken
|
||||||
|
* that you have to have one.
|
||||||
|
*/
|
||||||
|
|
||||||
if (display->focus_window != NULL)
|
if (display->focus_window != NULL)
|
||||||
{
|
{
|
||||||
window = display->focus_window;
|
window = display->focus_window;
|
||||||
@ -1949,7 +1933,7 @@ handle_workspace_forward (MetaDisplay *display,
|
|||||||
|
|
||||||
if (meta_display_begin_grab_op (display,
|
if (meta_display_begin_grab_op (display,
|
||||||
window,
|
window,
|
||||||
op_from_motion_direction (motion),
|
META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING,
|
||||||
FALSE,
|
FALSE,
|
||||||
0,
|
0,
|
||||||
event->xkey.state & ~(display->ignored_modifier_mask),
|
event->xkey.state & ~(display->ignored_modifier_mask),
|
||||||
|
14
src/prefs.c
14
src/prefs.c
@ -1033,17 +1033,21 @@ meta_prefs_get_auto_raise_delay ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
MetaKeyBindingAction
|
MetaKeyBindingAction
|
||||||
meta_prefs_get_keybinding_action (unsigned int keysym)
|
meta_prefs_get_keybinding_action (unsigned int keysym,
|
||||||
|
unsigned long mask)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = (int) G_N_ELEMENTS (screen_bindings) - 1; i >= 0; --i)
|
i = G_N_ELEMENTS (screen_bindings) - 1;
|
||||||
{
|
while (i >= 0)
|
||||||
if (screen_bindings[i].keysym == keysym)
|
|
||||||
{
|
{
|
||||||
|
if (screen_bindings[i].keysym == keysym &&
|
||||||
|
screen_bindings[i].mask == mask)
|
||||||
return (MetaKeyBindingAction) i;
|
return (MetaKeyBindingAction) i;
|
||||||
|
|
||||||
|
--i;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return META_KEYBINDING_ACTION_NONE;
|
return META_KEYBINDING_ACTION_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +149,9 @@ void meta_prefs_get_screen_bindings (const MetaKeyPref **bindings,
|
|||||||
int *n_bindings);
|
int *n_bindings);
|
||||||
void meta_prefs_get_window_bindings (const MetaKeyPref **bindings,
|
void meta_prefs_get_window_bindings (const MetaKeyPref **bindings,
|
||||||
int *n_bindings);
|
int *n_bindings);
|
||||||
MetaKeyBindingAction meta_prefs_get_keybinding_action (unsigned int keysym);
|
|
||||||
|
MetaKeyBindingAction meta_prefs_get_keybinding_action (unsigned int keysym,
|
||||||
|
unsigned long mask);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user