Avoid using CurrentTime when focusing, handle it better in case we miss

2005-02-08  Elijah Newren  <newren@gmail.com>

	Avoid using CurrentTime when focusing, handle it better in case we
	miss any cases.  Fixes #166732.

	* src/window.c: (meta_window_shade): use
	meta_display_get_current_time_roundtrip() to ensure we have a
	valid timestamp, (meta_window_unshade): same

	* src/display.c: (meta_display_set_input_focus_window): If
	CurrentTime was passed, get one from the XServer in addition to
	throwing a warning, (meta_display_focus_the_no_focus_window): same
This commit is contained in:
Elijah Newren 2005-02-09 03:18:46 +00:00 committed by Elijah Newren
parent 454e595ef8
commit fe1416c65f
3 changed files with 18 additions and 2 deletions

View File

@ -1,3 +1,16 @@
2005-02-08 Elijah Newren <newren@gmail.com>
Avoid using CurrentTime when focusing, handle it better in case we
miss any cases. Fixes #166732.
* src/window.c: (meta_window_shade): use
meta_display_get_current_time_roundtrip() to ensure we have a
valid timestamp, (meta_window_unshade): same
* src/display.c: (meta_display_set_input_focus_window): If
CurrentTime was passed, get one from the XServer in addition to
throwing a warning, (meta_display_focus_the_no_focus_window): same
2005-02-08 Elijah Newren <newren@gmail.com> 2005-02-08 Elijah Newren <newren@gmail.com>
* src/window.c: (meta_window_activate): If we're not passed a * src/window.c: (meta_window_activate): If we're not passed a

View File

@ -4660,6 +4660,7 @@ meta_display_set_input_focus_window (MetaDisplay *display,
"timestamp of 0 for window %s. This shouldn't happen!\n", "timestamp of 0 for window %s. This shouldn't happen!\n",
window->desc); window->desc);
meta_print_backtrace (); meta_print_backtrace ();
timestamp = meta_display_get_current_time_roundtrip (display);
} }
else if (XSERVER_TIME_IS_BEFORE (timestamp, display->last_focus_time)) else if (XSERVER_TIME_IS_BEFORE (timestamp, display->last_focus_time))
return; return;
@ -4684,6 +4685,7 @@ meta_display_focus_the_no_focus_window (MetaDisplay *display,
meta_warning ("meta_display_focus_the_no_focus_window called with a " meta_warning ("meta_display_focus_the_no_focus_window called with a "
"timestamp of 0. This shouldn't happen!\n"); "timestamp of 0. This shouldn't happen!\n");
meta_print_backtrace (); meta_print_backtrace ();
timestamp = meta_display_get_current_time_roundtrip (display);
} }
else if (XSERVER_TIME_IS_BEFORE (timestamp, display->last_focus_time)) else if (XSERVER_TIME_IS_BEFORE (timestamp, display->last_focus_time))
{ {

View File

@ -2109,7 +2109,7 @@ meta_window_shade (MetaWindow *window)
"Re-focusing window %s after shading it\n", "Re-focusing window %s after shading it\n",
window->desc); window->desc);
meta_window_focus (window, meta_window_focus (window,
meta_display_get_current_time (window->display)); meta_display_get_current_time_roundtrip (window->display));
set_net_wm_state (window); set_net_wm_state (window);
} }
@ -2130,7 +2130,8 @@ meta_window_unshade (MetaWindow *window)
meta_topic (META_DEBUG_FOCUS, meta_topic (META_DEBUG_FOCUS,
"Focusing window %s after unshading it\n", "Focusing window %s after unshading it\n",
window->desc); window->desc);
meta_window_focus (window, meta_display_get_current_time (window->display)); meta_window_focus (window,
meta_display_get_current_time_roundtrip (window->display));
set_net_wm_state (window); set_net_wm_state (window);
} }