Commit fa0592eb authored by Havoc Pennington's avatar Havoc Pennington Committed by Havoc Pennington
Browse files

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
parent a500a7e6
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
2002-03-31 Johan Dahlin <jdahlin@telia.com>
* src/menu.c (meta_window_menu_new): Make sure all menu items are
......
......@@ -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,
......
......@@ -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
......
......@@ -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);
......
......@@ -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,
......
......@@ -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);
......
......@@ -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);
......
......@@ -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,
......
......@@ -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,
......
......@@ -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))