diff options
author | Havoc Pennington <hp@pobox.com> | 2002-04-05 15:52:49 +0000 |
---|---|---|
committer | Havoc Pennington <hp@src.gnome.org> | 2002-04-05 15:52:49 +0000 |
commit | fa0592ebc7c99e5386da33501590e504458644e7 (patch) | |
tree | 43198ac8816df92b261db4c217bffdca7f0fd179 /src | |
parent | a500a7e668ea40896e22713e9b0af363f9c0c977 (diff) | |
download | metacity-fa0592ebc7c99e5386da33501590e504458644e7.tar.gz |
remove the unused tab stuff
2002-04-05 Havoc Pennington <hp@pobox.com>
* src/stack.c: remove the unused tab stuff
* src/display.c: implement tab list among panels
* src/keybindings.c: fill in move-between-panels keybindings
Diffstat (limited to 'src')
-rw-r--r-- | src/common.h | 3 | ||||
-rw-r--r-- | src/display.c | 56 | ||||
-rw-r--r-- | src/display.h | 10 | ||||
-rw-r--r-- | src/keybindings.c | 69 | ||||
-rw-r--r-- | src/screen.c | 4 | ||||
-rw-r--r-- | src/screen.h | 3 | ||||
-rw-r--r-- | src/stack.c | 176 | ||||
-rw-r--r-- | src/stack.h | 7 | ||||
-rw-r--r-- | src/window.h | 5 |
9 files changed, 110 insertions, 223 deletions
diff --git a/src/common.h b/src/common.h index d6615b21..238608f8 100644 --- a/src/common.h +++ b/src/common.h @@ -98,7 +98,8 @@ typedef enum META_GRAB_OP_KEYBOARD_RESIZING_SW, META_GRAB_OP_KEYBOARD_RESIZING_NW, - META_GRAB_OP_KEYBOARD_TABBING, + META_GRAB_OP_KEYBOARD_TABBING_NORMAL, + META_GRAB_OP_KEYBOARD_TABBING_DOCK, /* Frame button ops */ META_GRAB_OP_CLICKING_MINIMIZE, diff --git a/src/display.c b/src/display.c index 00fd886f..8f167c33 100644 --- a/src/display.c +++ b/src/display.c @@ -718,7 +718,8 @@ grab_op_is_keyboard (MetaGrabOp op) case META_GRAB_OP_KEYBOARD_RESIZING_NE: case META_GRAB_OP_KEYBOARD_RESIZING_SW: case META_GRAB_OP_KEYBOARD_RESIZING_NW: - case META_GRAB_OP_KEYBOARD_TABBING: + case META_GRAB_OP_KEYBOARD_TABBING_NORMAL: + case META_GRAB_OP_KEYBOARD_TABBING_DOCK: return TRUE; break; @@ -2043,8 +2044,14 @@ meta_display_begin_grab_op (MetaDisplay *display, /* Do this last, after everything is set up. */ switch (op) { - case META_GRAB_OP_KEYBOARD_TABBING: - meta_screen_ensure_tab_popup (window->screen); + case META_GRAB_OP_KEYBOARD_TABBING_NORMAL: + meta_screen_ensure_tab_popup (window->screen, + META_TAB_LIST_NORMAL); + break; + + case META_GRAB_OP_KEYBOARD_TABBING_DOCK: + meta_screen_ensure_tab_popup (window->screen, + META_TAB_LIST_DOCKS); break; default: @@ -2063,7 +2070,8 @@ meta_display_end_grab_op (MetaDisplay *display, if (display->grab_op == META_GRAB_OP_NONE) return; - if (display->grab_op == META_GRAB_OP_KEYBOARD_TABBING) + if (display->grab_op == META_GRAB_OP_KEYBOARD_TABBING_NORMAL || + display->grab_op == META_GRAB_OP_KEYBOARD_TABBING_DOCK) { meta_ui_tab_popup_free (display->grab_window->screen->tab_popup); display->grab_window->screen->tab_popup = NULL; @@ -2523,8 +2531,11 @@ meta_display_window_has_pending_pings (MetaDisplay *display, return FALSE; } +#define IN_TAB_CHAIN(w,t) (((t) == META_TAB_LIST_NORMAL && META_WINDOW_IN_NORMAL_TAB_CHAIN (w)) || ((t) == META_TAB_LIST_DOCKS && META_WINDOW_IN_DOCK_TAB_CHAIN (w))) + static MetaWindow* find_tab_forward (MetaDisplay *display, + MetaTabList type, MetaWorkspace *workspace, GList *start) { @@ -2537,7 +2548,7 @@ find_tab_forward (MetaDisplay *display, { MetaWindow *window = tmp->data; - if (META_WINDOW_IN_TAB_CHAIN (window) && + if (IN_TAB_CHAIN (window, type) && (workspace == NULL || meta_window_visible_on_workspace (window, workspace))) return window; @@ -2550,7 +2561,7 @@ find_tab_forward (MetaDisplay *display, { MetaWindow *window = tmp->data; - if (META_WINDOW_IN_TAB_CHAIN (window) && + if (IN_TAB_CHAIN (window, type) && (workspace == NULL || meta_window_visible_on_workspace (window, workspace))) return window; @@ -2563,6 +2574,7 @@ find_tab_forward (MetaDisplay *display, static MetaWindow* find_tab_backward (MetaDisplay *display, + MetaTabList type, MetaWorkspace *workspace, GList *start) { @@ -2575,7 +2587,7 @@ find_tab_backward (MetaDisplay *display, { MetaWindow *window = tmp->data; - if (META_WINDOW_IN_TAB_CHAIN (window) && + if (IN_TAB_CHAIN (window, type) && (workspace == NULL || meta_window_visible_on_workspace (window, workspace))) return window; @@ -2588,7 +2600,7 @@ find_tab_backward (MetaDisplay *display, { MetaWindow *window = tmp->data; - if (META_WINDOW_IN_TAB_CHAIN (window) && + if (IN_TAB_CHAIN (window, type) && (workspace == NULL || meta_window_visible_on_workspace (window, workspace))) return window; @@ -2601,17 +2613,14 @@ find_tab_backward (MetaDisplay *display, GSList* meta_display_get_tab_list (MetaDisplay *display, + MetaTabList type, MetaScreen *screen, MetaWorkspace *workspace) { GSList *tab_list; - /* workspace can be NULL for all workspaces */ - -#ifdef JOEL_RECOMMENDATION - /* mapping order */ - tab_list = meta_stack_get_tab_list (screen->stack, workspace); -#else + /* workspace can be NULL for all workspaces */ + /* Windows sellout mode - MRU order */ { GList *tmp; @@ -2623,7 +2632,7 @@ meta_display_get_tab_list (MetaDisplay *display, MetaWindow *window = tmp->data; if (window->screen == screen && - META_WINDOW_IN_TAB_CHAIN (window) && + IN_TAB_CHAIN (window, type) && (workspace == NULL || meta_window_visible_on_workspace (window, workspace))) tab_list = g_slist_prepend (tab_list, window); @@ -2632,23 +2641,17 @@ meta_display_get_tab_list (MetaDisplay *display, } tab_list = g_slist_reverse (tab_list); } -#endif return tab_list; } MetaWindow* meta_display_get_tab_next (MetaDisplay *display, + MetaTabList type, MetaWorkspace *workspace, MetaWindow *window, gboolean backward) { -#ifdef JOEL_RECOMMENDATION - return meta_stack_get_tab_next (window->screen->stack, - workspace, - window, - backward); -#else if (display->mru_list == NULL) return NULL; @@ -2657,22 +2660,21 @@ meta_display_get_tab_next (MetaDisplay *display, g_assert (window->display == display); if (backward) - return find_tab_backward (display, workspace, + return find_tab_backward (display, type, workspace, g_list_find (display->mru_list, window)); else - return find_tab_forward (display, workspace, + return find_tab_forward (display, type, workspace, g_list_find (display->mru_list, window)); } if (backward) - return find_tab_backward (display, workspace, + return find_tab_backward (display, type, workspace, g_list_last (display->mru_list)); else - return find_tab_forward (display, workspace, + return find_tab_forward (display, type, workspace, display->mru_list); -#endif } int diff --git a/src/display.h b/src/display.h index e12ded89..9de86b5d 100644 --- a/src/display.h +++ b/src/display.h @@ -274,11 +274,21 @@ void meta_display_ping_window (MetaDisplay *display, gboolean meta_display_window_has_pending_pings (MetaDisplay *display, MetaWindow *window); +typedef enum +{ + META_TAB_LIST_NORMAL, + META_TAB_LIST_DOCKS + + +} MetaTabList; + GSList* meta_display_get_tab_list (MetaDisplay *display, + MetaTabList type, MetaScreen *screen, MetaWorkspace *workspace); MetaWindow* meta_display_get_tab_next (MetaDisplay *display, + MetaTabList type, MetaWorkspace *workspace, MetaWindow *window, gboolean backward); diff --git a/src/keybindings.c b/src/keybindings.c index df9a2129..b259cf24 100644 --- a/src/keybindings.c +++ b/src/keybindings.c @@ -59,6 +59,10 @@ static void handle_focus_previous (MetaDisplay *display, MetaWindow *window, XEvent *event, gpointer data); +static void handle_toggle_fullscreen (MetaDisplay *display, + MetaWindow *window, + XEvent *event, + gpointer data); static void handle_workspace_left (MetaDisplay *display, MetaWindow *window, XEvent *event, @@ -117,9 +121,12 @@ static MetaKeyBinding screen_bindings[] = { { XK_4, Mod1Mask, KeyPress, handle_activate_workspace, GINT_TO_POINTER (3), 0 }, { XK_5, Mod1Mask, KeyPress, handle_activate_workspace, GINT_TO_POINTER (4), 0 }, { XK_6, Mod1Mask, KeyPress, handle_activate_workspace, GINT_TO_POINTER (5), 0 }, - { XK_Tab, Mod1Mask, KeyPress, handle_tab_forward, NULL, 0 }, - { XK_ISO_Left_Tab, ShiftMask | Mod1Mask, KeyPress, handle_tab_backward, NULL, 0 }, - { XK_Tab, ShiftMask | Mod1Mask, KeyPress, handle_tab_backward, NULL, 0 }, + { XK_Tab, Mod1Mask, KeyPress, handle_tab_forward, GINT_TO_POINTER (META_TAB_LIST_NORMAL), 0 }, + { XK_ISO_Left_Tab, ShiftMask | Mod1Mask, KeyPress, handle_tab_backward, GINT_TO_POINTER (META_TAB_LIST_NORMAL), 0 }, + { XK_Tab, ShiftMask | Mod1Mask, KeyPress, handle_tab_backward, GINT_TO_POINTER (META_TAB_LIST_NORMAL), 0 }, + { XK_Tab, Mod1Mask | ControlMask, KeyPress, handle_tab_forward, GINT_TO_POINTER (META_TAB_LIST_DOCKS), 0 }, + { XK_ISO_Left_Tab, ShiftMask | Mod1Mask | ControlMask, KeyPress, handle_tab_backward, GINT_TO_POINTER (META_TAB_LIST_DOCKS), 0 }, + { XK_Tab, ShiftMask | Mod1Mask | ControlMask, KeyPress, handle_tab_backward, GINT_TO_POINTER (META_TAB_LIST_DOCKS), 0 }, { XK_Escape, Mod1Mask, KeyPress, handle_focus_previous, NULL, 0 }, { XK_Left, Mod1Mask | ControlMask, KeyPress, handle_workspace_left, NULL, 0 }, { XK_Right, Mod1Mask | ControlMask, KeyPress, handle_workspace_right, NULL, 0 }, @@ -139,6 +146,8 @@ static MetaKeyBinding window_bindings[] = { { XK_ISO_Left_Tab, ShiftMask | Mod1Mask, KeyPress, handle_tab_backward, NULL, 0 }, { XK_Tab, ShiftMask | Mod1Mask, KeyPress, handle_tab_backward, NULL, 0 }, { XK_Escape, Mod1Mask, KeyPress, handle_focus_previous, NULL, 0 }, + /* Crack! */ + { XK_f, ControlMask | Mod1Mask, KeyPress, handle_toggle_fullscreen, NULL, 0 }, { None, 0, 0, NULL, NULL, 0 } }; @@ -592,7 +601,8 @@ meta_display_process_key_event (MetaDisplay *display, meta_verbose ("Processing event for keyboard move\n"); handled = process_keyboard_move_grab (display, window, event, keysym); break; - case META_GRAB_OP_KEYBOARD_TABBING: + case META_GRAB_OP_KEYBOARD_TABBING_NORMAL: + case META_GRAB_OP_KEYBOARD_TABBING_DOCK: meta_verbose ("Processing event for keyboard tabbing\n"); handled = process_tab_grab (display, window, event, keysym); break; @@ -947,6 +957,22 @@ handle_activate_menu (MetaDisplay *display, } } +static MetaGrabOp +op_from_tab_type (MetaTabList type) +{ + switch (type) + { + case META_TAB_LIST_NORMAL: + return META_GRAB_OP_KEYBOARD_TABBING_NORMAL; + case META_TAB_LIST_DOCKS: + return META_GRAB_OP_KEYBOARD_TABBING_DOCK; + } + + g_assert_not_reached (); + + return 0; +} + static void handle_tab_forward (MetaDisplay *display, MetaWindow *event_window, @@ -954,14 +980,18 @@ handle_tab_forward (MetaDisplay *display, gpointer data) { MetaWindow *window; + MetaTabList type; + + type = GPOINTER_TO_INT (data); - meta_verbose ("Tab forward\n"); + meta_verbose ("Tab forward type = %d\n", type); window = NULL; if (display->focus_window != NULL) { window = meta_display_get_tab_next (display, + type, display->focus_window->screen->active_workspace, display->focus_window, FALSE); @@ -980,6 +1010,7 @@ handle_tab_forward (MetaDisplay *display, if (screen) { window = meta_display_get_tab_next (screen->display, + type, screen->active_workspace, NULL, FALSE); @@ -989,11 +1020,11 @@ handle_tab_forward (MetaDisplay *display, if (window) { meta_verbose ("Starting tab forward, showing popup\n"); - + if (meta_display_begin_grab_op (window->display, display->focus_window ? display->focus_window : window, - META_GRAB_OP_KEYBOARD_TABBING, + op_from_tab_type (type), FALSE, 0, 0, event->xkey.time, @@ -1015,14 +1046,18 @@ handle_tab_backward (MetaDisplay *display, gpointer data) { MetaWindow *window; + MetaTabList type; + + type = GPOINTER_TO_INT (data); - meta_verbose ("Tab backward\n"); + meta_verbose ("Tab backward type = %d\n", type); window = NULL; if (display->focus_window != NULL) { window = meta_display_get_tab_next (display, + type, display->focus_window->screen->active_workspace, display->focus_window, TRUE); @@ -1041,6 +1076,7 @@ handle_tab_backward (MetaDisplay *display, if (screen) { window = meta_display_get_tab_next (screen->display, + type, screen->active_workspace, NULL, TRUE); @@ -1054,7 +1090,7 @@ handle_tab_backward (MetaDisplay *display, if (meta_display_begin_grab_op (window->display, display->focus_window ? display->focus_window : window, - META_GRAB_OP_KEYBOARD_TABBING, + op_from_tab_type (type), FALSE, 0, 0, event->xkey.time, @@ -1104,6 +1140,7 @@ handle_focus_previous (MetaDisplay *display, { /* Pick first window in tab order */ window = meta_display_get_tab_next (screen->display, + META_TAB_LIST_NORMAL, screen->active_workspace, NULL, TRUE); @@ -1124,6 +1161,20 @@ handle_focus_previous (MetaDisplay *display, } } +static void +handle_toggle_fullscreen (MetaDisplay *display, + MetaWindow *window, + XEvent *event, + gpointer data) +{ + if (window) + { + if (window->fullscreen) + meta_window_unmake_fullscreen (window); + else + meta_window_make_fullscreen (window); + } +} static void handle_spew_mark (MetaDisplay *display, diff --git a/src/screen.c b/src/screen.c index 764723e6..005014aa 100644 --- a/src/screen.c +++ b/src/screen.c @@ -591,7 +591,8 @@ meta_screen_set_cursor (MetaScreen *screen, } void -meta_screen_ensure_tab_popup (MetaScreen *screen) +meta_screen_ensure_tab_popup (MetaScreen *screen, + MetaTabList type) { MetaTabEntry *entries; GSList *tab_list; @@ -603,6 +604,7 @@ meta_screen_ensure_tab_popup (MetaScreen *screen) return; tab_list = meta_display_get_tab_list (screen->display, + type, screen, screen->active_workspace); diff --git a/src/screen.h b/src/screen.h index bd085d8b..5cda3c7c 100644 --- a/src/screen.h +++ b/src/screen.h @@ -66,7 +66,8 @@ int meta_screen_get_n_workspaces (MetaScreen *scree void meta_screen_set_cursor (MetaScreen *screen, MetaCursor cursor); -void meta_screen_ensure_tab_popup (MetaScreen *screen); +void meta_screen_ensure_tab_popup (MetaScreen *screen, + MetaTabList type); void meta_screen_focus_top_window (MetaScreen *screen, MetaWindow *not_this_one); diff --git a/src/stack.c b/src/stack.c index cebe648a..b31f89ef 100644 --- a/src/stack.c +++ b/src/stack.c @@ -929,182 +929,6 @@ meta_stack_get_default_focus_window (MetaStack *stack, return topmost_dock; } -#define GET_XWINDOW(stack, i) (g_array_index ((stack)->windows, \ - Window, (i))) - -static MetaWindow* -find_tab_forward (MetaStack *stack, - MetaWorkspace *workspace, - int start) -{ - int i; - - /* start may be -1 to find any tab window at all */ - - i = start + 1; - while (i < (int) stack->windows->len) - { - MetaWindow *window; - - window = meta_display_lookup_x_window (stack->screen->display, - GET_XWINDOW (stack, i)); - - if (window && META_WINDOW_IN_TAB_CHAIN (window) && - (workspace == NULL || - meta_window_visible_on_workspace (window, workspace))) - return window; - - ++i; - } - - i = 0; - while (i < start) - { - MetaWindow *window; - - window = meta_display_lookup_x_window (stack->screen->display, - GET_XWINDOW (stack, i)); - - if (window && META_WINDOW_IN_TAB_CHAIN (window) && - (workspace == NULL || - meta_window_visible_on_workspace (window, workspace))) - return window; - - ++i; - } - - /* no window other than the start window is in the tab chain */ - return NULL; -} - -static MetaWindow* -find_tab_backward (MetaStack *stack, - MetaWorkspace *workspace, - int start) -{ - int i; - - /* start may be stack->windows->len to find any tab window at all */ - - i = start - 1; - while (i >= 0) - { - MetaWindow *window; - - window = meta_display_lookup_x_window (stack->screen->display, - GET_XWINDOW (stack, i)); - - if (window && META_WINDOW_IN_TAB_CHAIN (window) && - (workspace == NULL || - meta_window_visible_on_workspace (window, workspace))) - return window; - - --i; - } - - i = stack->windows->len - 1; - while (i > start) - { - MetaWindow *window; - - window = meta_display_lookup_x_window (stack->screen->display, - GET_XWINDOW (stack, i)); - - if (window && META_WINDOW_IN_TAB_CHAIN (window) && - (workspace == NULL || - meta_window_visible_on_workspace (window, workspace))) - return window; - - --i; - } - - /* no window other than the start window is in the tab chain */ - return NULL; -} - -/* This ignores the dock/desktop layers */ -MetaWindow* -meta_stack_get_tab_next (MetaStack *stack, - MetaWorkspace *workspace, - MetaWindow *window, - gboolean backward) -{ - int i; - - if (workspace && window) - { - /* This is a paranoia check, because races can happen where - * you get a key shortcut or something on a window just as you - * are moving workspaces to one the window isn't on - */ - if (!meta_window_visible_on_workspace (window, workspace)) - return NULL; - } - - if (stack->windows->len == 0) - return NULL; - - if (window != NULL) - { - i = 0; - while (i < (int) stack->windows->len) - { - Window w; - - w = g_array_index (stack->windows, Window, i); - - if (w == window->xwindow) - { - if (backward) - return find_tab_backward (stack, workspace, i); - else - return find_tab_forward (stack, workspace, i); - } - - ++i; - } - } - - /* window may be NULL, or maybe the origin window was already the last/first - * window and we need to wrap around - */ - if (backward) - return find_tab_backward (stack, workspace, - stack->windows->len); - else - return find_tab_forward (stack, workspace, -1); -} - -GSList* -meta_stack_get_tab_list (MetaStack *stack, - MetaWorkspace *workspace) -{ - GSList *list; - int i; - - list = NULL; - - i = 0; - while (i < (int) stack->windows->len) - { - MetaWindow *window; - - window = meta_display_lookup_x_window (stack->screen->display, - GET_XWINDOW (stack, i)); - - if (window && META_WINDOW_IN_TAB_CHAIN (window) && - (workspace == NULL || - meta_window_visible_on_workspace (window, workspace))) - list = g_slist_prepend (list, window); - - ++i; - } - - list = g_slist_reverse (list); - - return list; -} - int meta_stack_windows_cmp (MetaStack *stack, MetaWindow *window_a, diff --git a/src/stack.h b/src/stack.h index 2e61fc0c..cc2c9d73 100644 --- a/src/stack.h +++ b/src/stack.h @@ -100,13 +100,6 @@ MetaWindow* meta_stack_get_default_focus_window (MetaStack *stack, MetaWorkspace *workspace, MetaWindow *not_this_one); -MetaWindow* meta_stack_get_tab_next (MetaStack *stack, - MetaWorkspace *workspace, - MetaWindow *window, - gboolean backward); -GSList* meta_stack_get_tab_list (MetaStack *stack, - MetaWorkspace *workspace); - /* -1 if a < b, etc. */ int meta_stack_windows_cmp (MetaStack *stack, MetaWindow *window_a, diff --git a/src/window.h b/src/window.h index 689f51ad..7a53f998 100644 --- a/src/window.h +++ b/src/window.h @@ -364,9 +364,12 @@ void meta_window_get_work_area (MetaWindow *window, gboolean meta_window_same_application (MetaWindow *window, MetaWindow *other_window); -#define META_WINDOW_IN_TAB_CHAIN(w) \ +#define META_WINDOW_IN_NORMAL_TAB_CHAIN(w) \ ((w)->type != META_WINDOW_DOCK && (w)->type != META_WINDOW_DESKTOP) +#define META_WINDOW_IN_DOCK_TAB_CHAIN(w) \ + (! META_WINDOW_IN_NORMAL_TAB_CHAIN (w)) + void meta_window_refresh_resize_popup (MetaWindow *window); #endif |