summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorElijah Newren <newren gmail com>2006-01-30 17:22:14 +0000
committerElijah Newren <newren@src.gnome.org>2006-01-30 17:22:14 +0000
commit297e0e466f1ba8b9bddfdc659abcf0c659f9a611 (patch)
tree393c95bf2c1f75e7c64117d872653be0ae3ab0c7 /src
parentbe036ca3002e7633e335f1429b58a80d768686aa (diff)
downloadmetacity-297e0e466f1ba8b9bddfdc659abcf0c659f9a611.tar.gz
Track the active_screen, (event_callback): If the mouse enters a window on
2006-01-30 Elijah Newren <newren gmail com> * src/display.[ch] (struct MetaDisplay), meta_display_open, meta_display_set_input_focus_window, meta_display_focus_the_no_focus_window): Track the active_screen, (event_callback): If the mouse enters a window on a different screen, activate the default window on the new screen. May need to be modified for click-to-focus; we'll wait for feedback. Fixes #319348.
Diffstat (limited to 'src')
-rw-r--r--src/display.c30
-rw-r--r--src/display.h1
2 files changed, 28 insertions, 3 deletions
diff --git a/src/display.c b/src/display.c
index e9282fd9..8289e1f9 100644
--- a/src/display.c
+++ b/src/display.c
@@ -472,6 +472,7 @@ meta_display_open (const char *name)
display->window_menu = NULL;
display->screens = NULL;
+ display->active_screen = NULL;
#ifdef HAVE_STARTUP_NOTIFICATION
display->sn_display = sn_display_new (display->xdisplay,
@@ -1822,9 +1823,30 @@ event_callback (XEvent *event,
if (display->grab_window == window &&
event->xany.serial >= display->grab_start_serial &&
grab_op_is_mouse (display->grab_op))
- meta_window_handle_mouse_grab_op_event (window, event);
- /* do this even if window->has_focus to avoid races */
- else if (window && !serial_is_ignored (display, event->xany.serial) &&
+ {
+ meta_window_handle_mouse_grab_op_event (window, event);
+ break;
+ }
+
+ /* If the mouse switches screens, active the default window on the new
+ * screen; this will make keybindings and workspace-launched items
+ * actually appear on the right screen.
+ */
+ if (display->active_screen !=
+ meta_display_screen_for_root (display, event->xcrossing.root))
+ {
+ MetaScreen *new_screen;
+ new_screen = meta_display_screen_for_root (display,
+ event->xcrossing.root);
+ meta_workspace_focus_default_window (new_screen->active_workspace,
+ NULL,
+ event->xcrossing.time);
+ }
+
+ /* Check if we've entered a window; do this even if window->has_focus to
+ * avoid races.
+ */
+ if (window && !serial_is_ignored (display, event->xany.serial) &&
event->xcrossing.mode != NotifyGrab &&
event->xcrossing.mode != NotifyUngrab &&
event->xcrossing.detail != NotifyInferior &&
@@ -4908,6 +4930,7 @@ meta_display_set_input_focus_window (MetaDisplay *display,
timestamp);
display->expected_focus_window = window;
display->last_focus_time = timestamp;
+ display->active_screen = window->screen;
if (window != display->autoraise_window)
meta_display_remove_autoraise_callback (window->display);
@@ -4927,6 +4950,7 @@ meta_display_focus_the_no_focus_window (MetaDisplay *display,
timestamp);
display->expected_focus_window = NULL;
display->last_focus_time = timestamp;
+ display->active_screen = screen;
meta_display_remove_autoraise_callback (display);
}
diff --git a/src/display.h b/src/display.h
index ca74f19c..639d7a64 100644
--- a/src/display.h
+++ b/src/display.h
@@ -218,6 +218,7 @@ struct _MetaDisplay
guint error_trap_synced_at_last_pop : 1;
MetaEventQueue *events;
GSList *screens;
+ MetaScreen *active_screen;
GHashTable *window_ids;
int error_traps;
int (* error_trap_handler) (Display *display,