diff --git a/ChangeLog b/ChangeLog index a37fb191f..dd0647e15 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2006-01-30 Elijah Newren + + * 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. + 2006-01-23 Elijah Newren * src/display.c (meta_display_check_threshold_reached): change the diff --git a/src/display.c b/src/display.c index e9282fd95..8289e1f98 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 ca74f19c7..639d7a645 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,