summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCraig Black <blackc@speakeasy.net>2002-08-08 04:45:13 +0000
committerCraig Black <blackc@src.gnome.org>2002-08-08 04:45:13 +0000
commit7a598e55678de1dcfabfeb325abd1541bdc8c47a (patch)
tree853c87a61bbf70bd204233668f6f78b0b218623f /src
parentceb771aeb672f4bae5dfa98d44a388b27a373ded (diff)
downloadmetacity-7a598e55678de1dcfabfeb325abd1541bdc8c47a.tar.gz
metacity-7a598e55678de1dcfabfeb325abd1541bdc8c47a.tar.bz2
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.
Diffstat (limited to 'src')
-rw-r--r--src/display.c1
-rw-r--r--src/display.h5
-rw-r--r--src/window.c16
3 files changed, 20 insertions, 2 deletions
diff --git a/src/display.c b/src/display.c
index 78ade79..ec68bb5 100644
--- a/src/display.c
+++ b/src/display.c
@@ -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;
diff --git a/src/display.h b/src/display.h
index a16bc5b..c48292f 100644
--- a/src/display.h
+++ b/src/display.h
@@ -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.
*/
diff --git a/src/window.c b/src/window.c
index cc51234..f114517 100644
--- a/src/window.c
+++ b/src/window.c
@@ -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,