Make the workspace switcher work with dual-head (non-xinerama) setups.

2005-12-27  Elijah Newren  <newren@gmail.com>

	Make the workspace switcher work with dual-head (non-xinerama)
	setups.  Fixes #319423.

	* src/display.c (meta_display_open, event_callback,
	  meta_display_focus_the_no_focus_window):
	* src/display.h (struct MetaDisplay,
	  meta_display_focus_the_no_focus_window):
	* src/keybindings.c (primary_modifier_still_pressed):
	* src/screen.c (meta_screen_new):
	* src/screen.h (struct MetaScreen):
	* src/window.c (meta_window_new_with_attrs, meta_window_show):
	* src/workspace.c (meta_workspace_focus_default_window):
	Replace display->no_focus_window with a no_focus_window for each
	screen.

	* src/display.[ch] (meta_display_xwindow_is_a_no_focus_window,
	  event_callback):
	* src/window.c (meta_window_new_with_attrs):
	New utility function, meta_display_xwindow_is_a_no_focus_window(),
	for checking if the given xwindow is a no_focus_window for one of
	the screens.
This commit is contained in:
Elijah Newren 2005-12-28 06:24:30 +00:00 committed by Elijah Newren
parent 5e9f20e94c
commit 703f58cdf7
8 changed files with 80 additions and 22 deletions

View File

@ -1,3 +1,27 @@
2005-12-27 Elijah Newren <newren@gmail.com>
Make the workspace switcher work with dual-head (non-xinerama)
setups. Fixes #319423.
* src/display.c (meta_display_open, event_callback,
meta_display_focus_the_no_focus_window):
* src/display.h (struct MetaDisplay,
meta_display_focus_the_no_focus_window):
* src/keybindings.c (primary_modifier_still_pressed):
* src/screen.c (meta_screen_new):
* src/screen.h (struct MetaScreen):
* src/window.c (meta_window_new_with_attrs, meta_window_show):
* src/workspace.c (meta_workspace_focus_default_window):
Replace display->no_focus_window with a no_focus_window for each
screen.
* src/display.[ch] (meta_display_xwindow_is_a_no_focus_window,
event_callback):
* src/window.c (meta_window_new_with_attrs):
New utility function, meta_display_xwindow_is_a_no_focus_window(),
for checking if the given xwindow is a no_focus_window for one of
the screens.
2005-12-27 Elijah Newren <newren@gmail.com>
* src/tabpopup.c (meta_ui_tab_popup_new): since the title is going

View File

@ -461,7 +461,6 @@ meta_display_open (const char *name)
* created in screen_new
*/
display->leader_window = None;
display->no_focus_window = None;
display->xinerama_cache_invalidated = TRUE;
@ -712,7 +711,10 @@ meta_display_open (const char *name)
* as it is the most recent timestamp.
*/
if (focus == None || focus == PointerRoot)
meta_display_focus_the_no_focus_window (display, timestamp);
/* Just focus the no_focus_window on the first screen */
meta_display_focus_the_no_focus_window (display,
display->screens->data,
timestamp);
else
{
MetaWindow * window;
@ -720,7 +722,10 @@ meta_display_open (const char *name)
if (window)
meta_display_set_input_focus_window (display, window, FALSE, timestamp);
else
meta_display_focus_the_no_focus_window (display, timestamp);
/* Just focus the no_focus_window on the first screen */
meta_display_focus_the_no_focus_window (display,
display->screens->data,
timestamp);
}
meta_error_trap_pop (display, FALSE);
@ -1870,6 +1875,7 @@ event_callback (XEvent *event,
"Unsetting focus from %s due to LeaveNotify\n",
window->desc);
meta_display_focus_the_no_focus_window (display,
window->screen,
event->xcrossing.time);
}
if (window->type != META_WINDOW_DOCK &&
@ -1901,7 +1907,8 @@ event_callback (XEvent *event,
{
meta_window_notify_focus (window, event);
}
else if (event->xany.window == display->no_focus_window)
else if (meta_display_xwindow_is_a_no_focus_window (display,
event->xany.window))
{
meta_topic (META_DEBUG_FOCUS,
"Focus %s event received on no_focus_window 0x%lx "
@ -2991,6 +2998,24 @@ meta_display_unregister_x_window (MetaDisplay *display,
remove_pending_pings_for_window (display, xwindow);
}
gboolean
meta_display_xwindow_is_a_no_focus_window (MetaDisplay *display,
Window xwindow)
{
gboolean is_a_no_focus_window = FALSE;
GSList *temp = display->screens;
while (temp != NULL) {
MetaScreen *screen = temp->data;
if (screen->no_focus_window == xwindow) {
is_a_no_focus_window = TRUE;
break;
}
temp = temp->next;
}
return is_a_no_focus_window;
}
Cursor
meta_display_create_x_cursor (MetaDisplay *display,
MetaCursor cursor)
@ -4821,13 +4846,14 @@ meta_display_set_input_focus_window (MetaDisplay *display,
void
meta_display_focus_the_no_focus_window (MetaDisplay *display,
MetaScreen *screen,
Time timestamp)
{
if (timestamp_too_old (display, NULL, &timestamp))
return;
XSetInputFocus (display->xdisplay,
display->no_focus_window,
screen->no_focus_window,
RevertToPointerRoot,
timestamp);
display->expected_focus_window = NULL;

View File

@ -216,11 +216,6 @@ struct _MetaDisplay
XErrorEvent *error);
int server_grab_count;
/* This window holds the focus when we don't want to focus
* any actual clients
*/
Window no_focus_window;
/* for double click */
Time last_button_time;
Window last_button_xwindow;
@ -413,6 +408,9 @@ void meta_display_register_x_window (MetaDisplay *display,
MetaWindow *window);
void meta_display_unregister_x_window (MetaDisplay *display,
Window xwindow);
/* Return whether the xwindow is a no focus window for any of the screens */
gboolean meta_display_xwindow_is_a_no_focus_window (MetaDisplay *display,
Window xwindow);
GSList* meta_display_list_windows (MetaDisplay *display);
@ -539,6 +537,7 @@ void meta_display_set_input_focus_window (MetaDisplay *display,
* same as meta_display_set_input_focus_window
*/
void meta_display_focus_the_no_focus_window (MetaDisplay *display,
MetaScreen *screen,
Time timestamp);
void meta_display_queue_autoraise_callback (MetaDisplay *display,

View File

@ -1451,11 +1451,15 @@ primary_modifier_still_pressed (MetaDisplay *display,
int x, y, root_x, root_y;
Window root, child;
guint mask;
MetaScreen *random_screen;
Window random_xwindow;
primary_modifier = get_primary_modifier (display, entire_binding_mask);
random_screen = display->screens->data;
random_xwindow = random_screen->no_focus_window;
XQueryPointer (display->xdisplay,
display->no_focus_window, /* some random window */
random_xwindow, /* some random window */
&root, &child,
&root_x, &root_y,
&x, &y,

View File

@ -577,16 +577,14 @@ meta_screen_new (MetaDisplay *display,
reload_xinerama_infos (screen);
meta_screen_set_cursor (screen, META_CURSOR_DEFAULT);
if (display->no_focus_window == None)
{
display->no_focus_window = meta_create_offscreen_window (display->xdisplay,
screen->xroot);
XSelectInput (display->xdisplay, display->no_focus_window,
FocusChangeMask | KeyPressMask | KeyReleaseMask);
XMapWindow (display->xdisplay, display->no_focus_window);
}
/* Handle creating a no_focus_window for this screen */
screen->no_focus_window = meta_create_offscreen_window (display->xdisplay,
screen->xroot);
XSelectInput (display->xdisplay, screen->no_focus_window,
FocusChangeMask | KeyPressMask | KeyReleaseMask);
XMapWindow (display->xdisplay, screen->no_focus_window);
/* Done with no_focus_window stuff */
set_wm_icon_size_hint (screen);

View File

@ -72,6 +72,11 @@ struct _MetaScreen
MetaWorkspace *active_workspace;
/* This window holds the focus when we don't want to focus
* any actual clients
*/
Window no_focus_window;
GList *workspaces;
MetaStack *stack;

View File

@ -241,7 +241,7 @@ meta_window_new_with_attrs (MetaDisplay *display,
meta_verbose ("Attempting to manage 0x%lx\n", xwindow);
if (xwindow == display->no_focus_window)
if (meta_display_xwindow_is_a_no_focus_window (display, xwindow))
{
meta_verbose ("Not managing no_focus_window 0x%lx\n",
xwindow);
@ -1763,7 +1763,7 @@ meta_window_show (MetaWindow *window)
"ancestor.\n",
window->display->focus_window->desc, window->desc);
meta_display_focus_the_no_focus_window (window->display, meta_display_get_current_time_roundtrip (window->display));
meta_display_focus_the_no_focus_window (window->display, window->screen, meta_display_get_current_time_roundtrip (window->display));
}
else
{

View File

@ -925,6 +925,7 @@ meta_workspace_focus_default_window (MetaWorkspace *workspace,
"Setting focus to no_focus_window, since no valid "
"window to focus found.\n");
meta_display_focus_the_no_focus_window (workspace->screen->display,
workspace->screen,
timestamp);
}
}
@ -1014,6 +1015,7 @@ focus_ancestor_or_mru_window (MetaWorkspace *workspace,
{
meta_topic (META_DEBUG_FOCUS, "No MRU window to focus found; focusing no_focus_window.\n");
meta_display_focus_the_no_focus_window (workspace->screen->display,
workspace->screen,
timestamp);
}
}