mirror of
https://github.com/brl/mutter.git
synced 2024-11-24 17:10:40 -05:00
Push the tab/workspace popup abstraction completely into screen.c
Also, use MetaWindows as the tab_popup keys rather than using (X) Windows and then having to map back and forth everywhere, which is silly since we never actually want the X Window. http://bugzilla.gnome.org/show_bug.cgi?id=580917
This commit is contained in:
parent
7b522c0de8
commit
99d0f41d98
@ -3552,9 +3552,9 @@ meta_display_end_grab_op (MetaDisplay *display,
|
||||
display->grab_op == META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING)
|
||||
{
|
||||
if (GRAB_OP_IS_WINDOW_SWITCH (display->grab_op))
|
||||
meta_screen_destroy_tab_popup (display->grab_screen);
|
||||
meta_screen_tab_popup_destroy (display->grab_screen);
|
||||
else
|
||||
meta_screen_destroy_workspace_popup (display->grab_screen);
|
||||
meta_screen_workspace_popup_destroy (display->grab_screen);
|
||||
|
||||
/* If the ungrab here causes an EnterNotify, ignore it for
|
||||
* sloppy focus
|
||||
|
@ -2045,7 +2045,6 @@ process_tab_grab (MetaDisplay *display,
|
||||
gboolean popup_not_showing;
|
||||
gboolean backward;
|
||||
gboolean key_used;
|
||||
Window prev_xwindow;
|
||||
MetaWindow *prev_window;
|
||||
|
||||
if (screen != display->grab_screen)
|
||||
@ -2130,13 +2129,9 @@ process_tab_grab (MetaDisplay *display,
|
||||
end_keyboard_grab (display, event->xkey.keycode))
|
||||
{
|
||||
/* We're done, move to the new window. */
|
||||
Window target_xwindow;
|
||||
MetaWindow *target_window;
|
||||
|
||||
target_xwindow =
|
||||
(Window) meta_ui_tab_popup_get_selected (screen->tab_popup);
|
||||
target_window =
|
||||
meta_display_lookup_x_window (display, target_xwindow);
|
||||
target_window = meta_screen_tab_popup_get_selected (screen);
|
||||
|
||||
meta_topic (META_DEBUG_KEYBINDINGS,
|
||||
"Ending tab operation, primary modifier released\n");
|
||||
@ -2172,8 +2167,7 @@ process_tab_grab (MetaDisplay *display,
|
||||
if (is_modifier (display, event->xkey.keycode))
|
||||
return TRUE;
|
||||
|
||||
prev_xwindow = (Window) meta_ui_tab_popup_get_selected (screen->tab_popup);
|
||||
prev_window = meta_display_lookup_x_window (display, prev_xwindow);
|
||||
prev_window = meta_screen_tab_popup_get_selected (screen);
|
||||
|
||||
/* Cancel when alt-Escape is pressed during using alt-Tab, and vice
|
||||
* versa.
|
||||
@ -2293,25 +2287,21 @@ process_tab_grab (MetaDisplay *display,
|
||||
backward = !backward;
|
||||
|
||||
if (backward)
|
||||
meta_ui_tab_popup_backward (screen->tab_popup);
|
||||
meta_screen_tab_popup_backward (screen);
|
||||
else
|
||||
meta_ui_tab_popup_forward (screen->tab_popup);
|
||||
meta_screen_tab_popup_forward (screen);
|
||||
|
||||
if (popup_not_showing)
|
||||
{
|
||||
/* We can't actually change window focus, due to the grab.
|
||||
* but raise the window.
|
||||
*/
|
||||
Window target_xwindow;
|
||||
MetaWindow *target_window;
|
||||
|
||||
meta_stack_set_positions (screen->stack,
|
||||
display->grab_old_window_stacking);
|
||||
|
||||
target_xwindow =
|
||||
(Window) meta_ui_tab_popup_get_selected (screen->tab_popup);
|
||||
target_window =
|
||||
meta_display_lookup_x_window (display, target_xwindow);
|
||||
target_window = meta_screen_tab_popup_get_selected (screen);
|
||||
|
||||
if (prev_window && prev_window->tab_unminimized)
|
||||
{
|
||||
@ -2739,8 +2729,7 @@ process_workspace_switch_grab (MetaDisplay *display,
|
||||
/* We're done, move to the new workspace. */
|
||||
MetaWorkspace *target_workspace;
|
||||
|
||||
target_workspace =
|
||||
(MetaWorkspace *) meta_ui_tab_popup_get_selected (screen->ws_popup);
|
||||
target_workspace = meta_screen_workspace_popup_get_selected (screen);
|
||||
|
||||
meta_topic (META_DEBUG_KEYBINDINGS,
|
||||
"Ending workspace tab operation, primary modifier released\n");
|
||||
@ -2775,9 +2764,8 @@ process_workspace_switch_grab (MetaDisplay *display,
|
||||
if (is_modifier (display, event->xkey.keycode))
|
||||
return TRUE;
|
||||
|
||||
/* select the next workspace in the tabpopup */
|
||||
workspace =
|
||||
(MetaWorkspace *) meta_ui_tab_popup_get_selected (screen->ws_popup);
|
||||
/* select the next workspace in the popup */
|
||||
workspace = meta_screen_workspace_popup_get_selected (screen);
|
||||
|
||||
if (workspace)
|
||||
{
|
||||
@ -2818,8 +2806,7 @@ process_workspace_switch_grab (MetaDisplay *display,
|
||||
|
||||
if (target_workspace)
|
||||
{
|
||||
meta_ui_tab_popup_select (screen->ws_popup,
|
||||
(MetaTabEntryKey) target_workspace);
|
||||
meta_screen_workspace_popup_select (screen, target_workspace);
|
||||
meta_topic (META_DEBUG_KEYBINDINGS,
|
||||
"Tab key pressed, moving tab focus in popup\n");
|
||||
|
||||
@ -2835,8 +2822,7 @@ process_workspace_switch_grab (MetaDisplay *display,
|
||||
/* end grab */
|
||||
meta_topic (META_DEBUG_KEYBINDINGS,
|
||||
"Ending workspace tabbing & focusing default window; uninteresting key pressed\n");
|
||||
workspace =
|
||||
(MetaWorkspace *) meta_ui_tab_popup_get_selected (screen->ws_popup);
|
||||
workspace = meta_screen_workspace_popup_get_selected (screen);
|
||||
meta_workspace_focus_default_window (workspace, NULL, event->xkey.time);
|
||||
return FALSE;
|
||||
}
|
||||
@ -3076,14 +3062,10 @@ do_choose_window (MetaDisplay *display,
|
||||
|
||||
meta_screen_ensure_tab_popup (screen, type,
|
||||
show_popup ? META_TAB_SHOW_ICON :
|
||||
META_TAB_SHOW_INSTANTLY);
|
||||
META_TAB_SHOW_INSTANTLY,
|
||||
initial_selection);
|
||||
|
||||
meta_ui_tab_popup_select (screen->tab_popup,
|
||||
(MetaTabEntryKey) initial_selection->xwindow);
|
||||
|
||||
if (show_popup)
|
||||
meta_ui_tab_popup_set_showing (screen->tab_popup, TRUE);
|
||||
else
|
||||
if (!show_popup)
|
||||
{
|
||||
meta_window_raise (initial_selection);
|
||||
initial_selection->tab_unminimized =
|
||||
@ -3458,13 +3440,7 @@ handle_workspace_switch (MetaDisplay *display,
|
||||
meta_workspace_activate (next, event->xkey.time);
|
||||
|
||||
if (grabbed_before_release && !meta_prefs_get_no_tab_popup ())
|
||||
{
|
||||
meta_screen_ensure_workspace_popup (screen);
|
||||
meta_ui_tab_popup_select (screen->ws_popup, (MetaTabEntryKey) next);
|
||||
|
||||
/* only after selecting proper space */
|
||||
meta_ui_tab_popup_set_showing (screen->ws_popup, TRUE);
|
||||
}
|
||||
meta_screen_ensure_workspace_popup (screen, next);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -166,10 +166,19 @@ void meta_screen_update_cursor (MetaScreen *scree
|
||||
|
||||
void meta_screen_ensure_tab_popup (MetaScreen *screen,
|
||||
MetaTabList list_type,
|
||||
MetaTabShowType show_type);
|
||||
void meta_screen_destroy_tab_popup (MetaScreen *screen);
|
||||
void meta_screen_ensure_workspace_popup (MetaScreen *screen);
|
||||
void meta_screen_destroy_workspace_popup (MetaScreen *screen);
|
||||
MetaTabShowType show_type,
|
||||
MetaWindow *initial_window);
|
||||
void meta_screen_tab_popup_forward (MetaScreen *screen);
|
||||
void meta_screen_tab_popup_backward (MetaScreen *screen);
|
||||
MetaWindow* meta_screen_tab_popup_get_selected (MetaScreen *screen);
|
||||
void meta_screen_tab_popup_destroy (MetaScreen *screen);
|
||||
|
||||
void meta_screen_ensure_workspace_popup (MetaScreen *screen,
|
||||
MetaWorkspace *initial_selection);
|
||||
void meta_screen_workspace_popup_select (MetaScreen *screen,
|
||||
MetaWorkspace *workspace);
|
||||
MetaWorkspace*meta_screen_workspace_popup_get_selected (MetaScreen *screen);
|
||||
void meta_screen_workspace_popup_destroy (MetaScreen *screen);
|
||||
|
||||
MetaWindow* meta_screen_get_mouse_window (MetaScreen *screen,
|
||||
MetaWindow *not_this_one);
|
||||
|
@ -1426,7 +1426,8 @@ meta_screen_update_cursor (MetaScreen *screen)
|
||||
void
|
||||
meta_screen_ensure_tab_popup (MetaScreen *screen,
|
||||
MetaTabList list_type,
|
||||
MetaTabShowType show_type)
|
||||
MetaTabShowType show_type,
|
||||
MetaWindow *initial_selection)
|
||||
{
|
||||
MetaTabEntry *entries;
|
||||
GList *tab_list;
|
||||
@ -1460,7 +1461,7 @@ meta_screen_ensure_tab_popup (MetaScreen *screen,
|
||||
|
||||
window = tmp->data;
|
||||
|
||||
entries[i].key = (MetaTabEntryKey) window->xwindow;
|
||||
entries[i].key = (MetaTabEntryKey) window;
|
||||
entries[i].title = window->title;
|
||||
entries[i].icon = g_object_ref (window->icon);
|
||||
entries[i].blank = FALSE;
|
||||
@ -1531,11 +1532,39 @@ meta_screen_ensure_tab_popup (MetaScreen *screen,
|
||||
|
||||
g_list_free (tab_list);
|
||||
|
||||
/* don't show tab popup, since proper window isn't selected yet */
|
||||
meta_ui_tab_popup_select (screen->tab_popup,
|
||||
(MetaTabEntryKey) initial_selection);
|
||||
|
||||
if (show_type != META_TAB_SHOW_INSTANTLY)
|
||||
meta_ui_tab_popup_set_showing (screen->tab_popup, TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
meta_screen_destroy_tab_popup (MetaScreen *screen)
|
||||
meta_screen_tab_popup_forward (MetaScreen *screen)
|
||||
{
|
||||
g_return_if_fail (screen->tab_popup != NULL);
|
||||
|
||||
meta_ui_tab_popup_forward (screen->tab_popup);
|
||||
}
|
||||
|
||||
void
|
||||
meta_screen_tab_popup_backward (MetaScreen *screen)
|
||||
{
|
||||
g_return_if_fail (screen->tab_popup != NULL);
|
||||
|
||||
meta_ui_tab_popup_backward (screen->tab_popup);
|
||||
}
|
||||
|
||||
MetaWindow *
|
||||
meta_screen_tab_popup_get_selected (MetaScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (screen->tab_popup != NULL, NULL);
|
||||
|
||||
return (MetaWindow *) meta_ui_tab_popup_get_selected (screen->tab_popup);
|
||||
}
|
||||
|
||||
void
|
||||
meta_screen_tab_popup_destroy (MetaScreen *screen)
|
||||
{
|
||||
if (screen->tab_popup)
|
||||
{
|
||||
@ -1545,7 +1574,8 @@ meta_screen_destroy_tab_popup (MetaScreen *screen)
|
||||
}
|
||||
|
||||
void
|
||||
meta_screen_ensure_workspace_popup (MetaScreen *screen)
|
||||
meta_screen_ensure_workspace_popup (MetaScreen *screen,
|
||||
MetaWorkspace *initial_selection)
|
||||
{
|
||||
MetaTabEntry *entries;
|
||||
int len;
|
||||
@ -1609,11 +1639,31 @@ meta_screen_ensure_workspace_popup (MetaScreen *screen)
|
||||
g_free (entries);
|
||||
meta_screen_free_workspace_layout (&layout);
|
||||
|
||||
/* don't show tab popup, since proper space isn't selected yet */
|
||||
meta_ui_tab_popup_select (screen->ws_popup,
|
||||
(MetaTabEntryKey) initial_selection);
|
||||
meta_ui_tab_popup_set_showing (screen->ws_popup, TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
meta_screen_destroy_workspace_popup (MetaScreen *screen)
|
||||
meta_screen_workspace_popup_select (MetaScreen *screen,
|
||||
MetaWorkspace *workspace)
|
||||
{
|
||||
g_return_if_fail (screen->ws_popup != NULL);
|
||||
|
||||
meta_ui_tab_popup_select (screen->ws_popup,
|
||||
(MetaTabEntryKey) workspace);
|
||||
}
|
||||
|
||||
MetaWorkspace *
|
||||
meta_screen_workspace_popup_get_selected (MetaScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (screen->ws_popup != NULL, NULL);
|
||||
|
||||
return (MetaWorkspace *) meta_ui_tab_popup_get_selected (screen->ws_popup);
|
||||
}
|
||||
|
||||
void
|
||||
meta_screen_workspace_popup_destroy (MetaScreen *screen)
|
||||
{
|
||||
if (screen->ws_popup)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user