[mutter] compositor: Add an API to focus the stage X window
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] compositor: Add an API to focus the stage X window
- Date: Fri, 24 May 2013 21:44:02 +0000 (UTC)
commit bd19de94292b3db7902c09ba16f5ba35c92a09d5
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu May 23 16:21:24 2013 -0400
compositor: Add an API to focus the stage X window
gnome-shell has traditionally just called XSetInputFocus when wanting to
set the input focus to the stage window, but this might cause strange,
hard-to-reproduce bugs because of an interference with mutter's focus
prediction. Add API to allow gnome-shell to focus the stage window that
also updates mutter's internal focus prediction state.
https://bugzilla.gnome.org/show_bug.cgi?id=700735
src/compositor/compositor.c | 22 ++++++++++++++++++++++
src/core/display-private.h | 5 +++++
src/core/display.c | 12 ++++++++++++
src/meta/compositor-mutter.h | 2 ++
4 files changed, 41 insertions(+), 0 deletions(-)
---
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index 86abfaf..40b9854 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -369,6 +369,28 @@ meta_empty_stage_input_region (MetaScreen *screen)
meta_set_stage_input_region (screen, region);
}
+void
+meta_focus_stage_window (MetaScreen *screen,
+ guint32 timestamp)
+{
+ ClutterStage *stage;
+ Window window;
+
+ stage = CLUTTER_STAGE (meta_get_stage_for_screen (screen));
+ if (!stage)
+ return;
+
+ window = clutter_x11_get_stage_window (stage);
+
+ if (window == None)
+ return;
+
+ meta_display_set_input_focus_xwindow (screen->display,
+ screen,
+ window,
+ timestamp);
+}
+
gboolean
meta_begin_modal_for_plugin (MetaScreen *screen,
MetaPlugin *plugin,
diff --git a/src/core/display-private.h b/src/core/display-private.h
index 3415c84..c9a7d23 100644
--- a/src/core/display-private.h
+++ b/src/core/display-private.h
@@ -465,4 +465,9 @@ gboolean meta_display_process_barrier_event (MetaDisplay *display,
XIBarrierEvent *event);
#endif /* HAVE_XI23 */
+void meta_display_set_input_focus_xwindow (MetaDisplay *display,
+ MetaScreen *screen,
+ Window window,
+ guint32 timestamp);
+
#endif
diff --git a/src/core/display.c b/src/core/display.c
index 242d539..aa3338a 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -5807,6 +5807,18 @@ meta_display_request_take_focus (MetaDisplay *display,
}
void
+meta_display_set_input_focus_xwindow (MetaDisplay *display,
+ MetaScreen *screen,
+ Window window,
+ guint32 timestamp)
+{
+ request_xserver_input_focus_change (display,
+ screen,
+ window,
+ timestamp);
+}
+
+void
meta_display_focus_the_no_focus_window (MetaDisplay *display,
MetaScreen *screen,
guint32 timestamp)
diff --git a/src/meta/compositor-mutter.h b/src/meta/compositor-mutter.h
index 357b42e..698f8de 100644
--- a/src/meta/compositor-mutter.h
+++ b/src/meta/compositor-mutter.h
@@ -46,5 +46,7 @@ void meta_enable_unredirect_for_screen (MetaScreen *screen);
void meta_set_stage_input_region (MetaScreen *screen,
XserverRegion region);
void meta_empty_stage_input_region (MetaScreen *screen);
+void meta_focus_stage_window (MetaScreen *screen,
+ guint32 timestamp);
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]