clear expected focus window on open

2002-08-07  Craig Black  <blackc@speakeasy.net>

  * src/display.c: (meta_display_open): clear expected focus window
  on open

  * src/display.h: add expected_focus_window field

  * src/window.c: (meta_window_make_fullscreen),
  (meta_window_unmake_fullscreen): change meta_window_update_layer()
  to meta_stack_update_layer() so build works again.
  (meta_window_free), (meta_window_make_fullscreen),
  (meta_window_focus), (meta_window_notify_focus): keep track of
  expected focus window after sending WM_TAKE_FOCUS event,
  previously if a UnmapNotify event arrived before the FocusIn event
  we would lose focus, fixes #84564.
This commit is contained in:
Craig Black 2002-08-08 04:45:13 +00:00 committed by Craig Black
parent ceb771aeb6
commit 7a598e5567
4 changed files with 36 additions and 2 deletions

View File

@ -1,3 +1,19 @@
2002-08-07 Craig Black <blackc@speakeasy.net>
* src/display.c: (meta_display_open): clear expected focus window
on open
* src/display.h: add expected_focus_window field
* src/window.c: (meta_window_make_fullscreen),
(meta_window_unmake_fullscreen): change meta_window_update_layer()
to meta_stack_update_layer() so build works again.
(meta_window_free), (meta_window_make_fullscreen),
(meta_window_focus), (meta_window_notify_focus): keep track of
expected focus window after sending WM_TAKE_FOCUS event,
previously if a UnmapNotify event arrived before the FocusIn event
we would lose focus, fixes #84564.
2002-08-07 Havoc Pennington <hp@redhat.com>
* src/window.c (meta_window_unmake_fullscreen): update layer

View File

@ -288,6 +288,7 @@ meta_display_open (const char *name)
display->pending_pings = NULL;
display->autoraise_timeout_id = 0;
display->focus_window = NULL;
display->expected_focus_window = NULL;
display->mru_list = NULL;
display->showing_desktop = FALSE;

View File

@ -153,6 +153,11 @@ struct _MetaDisplay
*/
MetaWindow *focus_window;
/* WM_TAKE_FOCUS has been sent but we have not yet
* received the resulting FocusIn event for this window
*/
MetaWindow *expected_focus_window;
/* Most recently focused list. Always contains all
* live windows.
*/

View File

@ -812,6 +812,14 @@ meta_window_free (MetaWindow *window)
window->desc);
meta_screen_focus_top_window (window->screen, window);
}
else if (window->display->expected_focus_window == window)
{
meta_topic (META_DEBUG_FOCUS,
"Focusing top window since expected focus window freed %s\n",
window->desc);
window->display->expected_focus_window = NULL;
meta_screen_focus_top_window (window->screen, window);
}
else
{
meta_topic (META_DEBUG_FOCUS,
@ -1632,7 +1640,7 @@ meta_window_make_fullscreen (MetaWindow *window)
window->fullscreen = TRUE;
meta_window_update_layer (window);
meta_stack_update_layer (window->screen->stack, window);
meta_window_raise (window);
/* save size/pos as appropriate args for move_resize */
@ -1661,7 +1669,7 @@ meta_window_unmake_fullscreen (MetaWindow *window)
window->fullscreen = FALSE;
meta_window_update_layer (window);
meta_stack_update_layer (window->screen->stack, window);
meta_window_move_resize (window,
TRUE,
@ -2798,6 +2806,7 @@ meta_window_focus (MetaWindow *window,
meta_window_send_icccm_message (window,
window->display->atom_wm_take_focus,
timestamp);
window->display->expected_focus_window = window;
}
meta_error_trap_pop (window->display);
@ -3580,6 +3589,9 @@ meta_window_notify_focus (MetaWindow *window,
if (event->type == FocusIn)
{
if (window->display->expected_focus_window == window)
window->display->expected_focus_window = NULL;
if (window != window->display->focus_window)
{
meta_topic (META_DEBUG_FOCUS,