[mutter/gbsneto/cleanup-x11-from-meta-window: 163/164] window: Trap X11 warp pointer errors on MetaBackendX11
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gbsneto/cleanup-x11-from-meta-window: 163/164] window: Trap X11 warp pointer errors on MetaBackendX11
- Date: Wed, 13 Feb 2019 08:06:25 +0000 (UTC)
commit 4504a313f79beca8034c71076b2c76e15c3c63c0
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Sat Dec 22 19:19:16 2018 -0200
window: Trap X11 warp pointer errors on MetaBackendX11
Only the X11 backend cares about trapping X11 errors when
warping pointers, and there is no reason for it to be done
by MetaWindow.
Move the push()/pop() calls to MetaBackendX11, and simplify
warp_grab_pointer() by removing the boolean return value
that is not being used anywhere.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/372
src/backends/x11/meta-backend-x11.c | 9 +++++++++
src/core/window.c | 18 ++----------------
2 files changed, 11 insertions(+), 16 deletions(-)
---
diff --git a/src/backends/x11/meta-backend-x11.c b/src/backends/x11/meta-backend-x11.c
index c10365f9d..9e2403dbe 100644
--- a/src/backends/x11/meta-backend-x11.c
+++ b/src/backends/x11/meta-backend-x11.c
@@ -52,6 +52,7 @@
#include "compositor/compositor-private.h"
#include "core/display-private.h"
#include "meta/meta-cursor-tracker.h"
+#include "meta/meta-x11-errors.h"
#include "meta/util.h"
struct _MetaBackendX11Private
@@ -598,6 +599,10 @@ meta_backend_x11_warp_pointer (MetaBackend *backend,
{
MetaBackendX11 *x11 = META_BACKEND_X11 (backend);
MetaBackendX11Private *priv = meta_backend_x11_get_instance_private (x11);
+ MetaDisplay *display = meta_get_display ();
+
+ if (display)
+ meta_x11_error_trap_push (display->x11_display);
XIWarpPointer (priv->xdisplay,
META_VIRTUAL_CORE_POINTER_ID,
@@ -605,6 +610,10 @@ meta_backend_x11_warp_pointer (MetaBackend *backend,
meta_backend_x11_get_xwindow (x11),
0, 0, 0, 0,
x, y);
+
+ if (display &&
+ meta_x11_error_trap_pop_with_return (display->x11_display) != Success)
+ meta_verbose ("Failed to warp pointer\n");
}
static MetaLogicalMonitor *
diff --git a/src/core/window.c b/src/core/window.c
index 15f8aab60..a5c0b882f 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -82,7 +82,6 @@
#include "meta/group.h"
#include "meta/meta-cursor-tracker.h"
#include "meta/meta-enum-types.h"
-#include "meta/meta-x11-errors.h"
#include "meta/prefs.h"
#include "ui/ui.h"
#include "x11/meta-x11-display-private.h"
@@ -6811,7 +6810,7 @@ meta_window_is_ancestor_of_transient (MetaWindow *window,
/* Warp pointer to location appropriate for grab,
* return root coordinates where pointer ended up.
*/
-static gboolean
+static void
warp_grab_pointer (MetaWindow *window,
MetaGrabOp grab_op,
int *x,
@@ -6852,8 +6851,6 @@ warp_grab_pointer (MetaWindow *window,
*x = CLAMP (*x, 0, display_rect.width - 1);
*y = CLAMP (*y, 0, display_rect.height - 1);
- meta_x11_error_trap_push (display->x11_display);
-
meta_topic (META_DEBUG_WINDOW_OPS,
"Warping pointer to %d,%d with window at %d,%d\n",
*x, *y, rect.x, rect.y);
@@ -6869,19 +6866,8 @@ warp_grab_pointer (MetaWindow *window,
meta_window_get_frame_rect (window,
&display->grab_anchor_window_pos);
- {
- MetaBackend *backend = meta_get_backend ();
- meta_backend_warp_pointer (backend, *x, *y);
- }
-
- if (meta_x11_error_trap_pop_with_return (display->x11_display) != Success)
- {
- meta_verbose ("Failed to warp pointer for window %s\n",
- window->desc);
- return FALSE;
- }
- return TRUE;
+ meta_backend_warp_pointer (meta_get_backend (), *x, *y);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]