[mutter/wip/carlosg/xwayland-on-demand: 22/32] x11: Split X11 focus change requests to a separate function
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/xwayland-on-demand: 22/32] x11: Split X11 focus change requests to a separate function
- Date: Mon, 7 Jan 2019 12:50:16 +0000 (UTC)
commit 9ec54eb5cbd9fb30399b48abd7a8d8dfa3a01222
Author: Carlos Garnacho <carlosg gnome org>
Date: Sun Dec 30 21:23:07 2018 +0100
x11: Split X11 focus change requests to a separate function
Just a minor refactor.
src/x11/events.c | 2 +-
src/x11/meta-x11-display-private.h | 3 +++
src/x11/meta-x11-display.c | 35 +++++++++++++++++++++++------------
3 files changed, 27 insertions(+), 13 deletions(-)
---
diff --git a/src/x11/events.c b/src/x11/events.c
index a842be75a..02c8509dc 100644
--- a/src/x11/events.c
+++ b/src/x11/events.c
@@ -807,7 +807,7 @@ handle_window_focus_event (MetaX11Display *x11_display,
x11_display->server_focus_serial == x11_display->focus_serial))
{
meta_display_update_focus_window (display, focus_window);
- meta_x11_display_update_focus_window (display,
+ meta_x11_display_update_focus_window (x11_display,
focus_window ?
focus_window->xwindow : None,
x11_display->server_focus_serial,
diff --git a/src/x11/meta-x11-display-private.h b/src/x11/meta-x11-display-private.h
index 8f10d8f86..d4bbf53a7 100644
--- a/src/x11/meta-x11-display-private.h
+++ b/src/x11/meta-x11-display-private.h
@@ -239,5 +239,8 @@ void meta_x11_display_update_focus_window (MetaX11Display *x11_display,
Window xwindow,
gulong serial,
gboolean focused_by_us);
+void meta_x11_display_set_input_focus (MetaX11Display *x11_display,
+ Window xwindow,
+ guint32 timestamp);
#endif /* META_X11_DISPLAY_PRIVATE_H */
diff --git a/src/x11/meta-x11-display.c b/src/x11/meta-x11-display.c
index 1afcb331f..875dbae0d 100644
--- a/src/x11/meta-x11-display.c
+++ b/src/x11/meta-x11-display.c
@@ -1826,17 +1826,11 @@ meta_x11_display_update_focus_window (MetaX11Display *x11_display,
meta_x11_display_update_active_window_hint (x11_display);
}
-static void
-request_xserver_input_focus_change (MetaX11Display *x11_display,
- MetaWindow *meta_window,
- Window xwindow,
- guint32 timestamp)
+void
+meta_x11_display_set_input_focus (MetaX11Display *x11_display,
+ Window xwindow,
+ guint32 timestamp)
{
- gulong serial;
-
- if (meta_display_timestamp_too_old (x11_display->display, ×tamp))
- return;
-
meta_x11_error_trap_push (x11_display);
/* In order for mutter to know that the focus request succeeded, we track
@@ -1849,8 +1843,6 @@ request_xserver_input_focus_change (MetaX11Display *x11_display,
*/
XGrabServer (x11_display->xdisplay);
- serial = XNextRequest (x11_display->xdisplay);
-
XSetInputFocus (x11_display->xdisplay,
xwindow,
RevertToPointerRoot,
@@ -1864,6 +1856,25 @@ request_xserver_input_focus_change (MetaX11Display *x11_display,
XUngrabServer (x11_display->xdisplay);
XFlush (x11_display->xdisplay);
+ meta_x11_error_trap_pop (x11_display);
+}
+
+static void
+request_xserver_input_focus_change (MetaX11Display *x11_display,
+ MetaWindow *meta_window,
+ Window xwindow,
+ guint32 timestamp)
+{
+ gulong serial;
+
+ if (meta_display_timestamp_too_old (x11_display->display, ×tamp))
+ return;
+
+ meta_x11_error_trap_push (x11_display);
+
+ serial = XNextRequest (x11_display->xdisplay);
+
+ meta_x11_display_set_input_focus (x11_display, xwindow, timestamp);
meta_display_update_focus_window (x11_display->display, meta_window);
meta_x11_display_update_focus_window (x11_display, xwindow, serial, TRUE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]