From b78bbd15d892f70bb7e79bc82e55eb66b4e5d9ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sun, 26 May 2024 00:43:37 +0200 Subject: [PATCH 1/3] Revert "x11/window: Compare input shape to client rect when undecorating" This reverts commit d8af06fe4993227c5059971effbe28527cd75412. --- src/x11/window-x11.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c index 79090783f7..3116760e6e 100644 --- a/src/x11/window-x11.c +++ b/src/x11/window-x11.c @@ -2504,7 +2504,6 @@ meta_window_x11_update_input_region (MetaWindow *window) g_autoptr (MtkRegion) region = NULL; MetaWindowX11 *window_x11 = META_WINDOW_X11 (window); MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11); - MtkRectangle bounding_rect = { 0 }; Window xwindow; if (window->decorated) @@ -2516,14 +2515,10 @@ meta_window_x11_update_input_region (MetaWindow *window) return; } xwindow = priv->frame->xwindow; - bounding_rect.width = window->buffer_rect.width; - bounding_rect.height = window->buffer_rect.height; } else { xwindow = priv->xwindow; - bounding_rect.width = priv->client_rect.width; - bounding_rect.height = priv->client_rect.height; } if (META_X11_DISPLAY_HAS_SHAPE (x11_display)) @@ -2571,8 +2566,8 @@ meta_window_x11_update_input_region (MetaWindow *window) else if (n_rects == 1 && (rects[0].x == 0 && rects[0].y == 0 && - rects[0].width == bounding_rect.width && - rects[0].height == bounding_rect.height)) + rects[0].width == window->buffer_rect.width && + rects[0].height == window->buffer_rect.height)) { /* This is the bounding region case. Keep the * region as NULL. */ @@ -2589,6 +2584,13 @@ meta_window_x11_update_input_region (MetaWindow *window) if (region != NULL) { + MtkRectangle bounding_rect; + + bounding_rect.x = 0; + bounding_rect.y = 0; + bounding_rect.width = window->buffer_rect.width; + bounding_rect.height = window->buffer_rect.height; + /* The shape we get back from the client may have coordinates * outside of the frame. The X SHAPE Extension requires that * the overall shape the client provides never exceeds the -- 2.45.2 From 191c6777c9f1db240f1de4bb9de1e0d54856c12c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sun, 21 Apr 2024 16:54:52 +0200 Subject: [PATCH 2/3] Revert "x11/window: Update comment and variable name to reflect current behavior" This reverts commit e4763d00e8512aeb408ae118597d753f12217487. --- src/x11/window-x11.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c index 3116760e6e..618287a6d4 100644 --- a/src/x11/window-x11.c +++ b/src/x11/window-x11.c @@ -2584,20 +2584,21 @@ meta_window_x11_update_input_region (MetaWindow *window) if (region != NULL) { - MtkRectangle bounding_rect; + MtkRectangle client_area; - bounding_rect.x = 0; - bounding_rect.y = 0; - bounding_rect.width = window->buffer_rect.width; - bounding_rect.height = window->buffer_rect.height; + client_area.x = 0; + client_area.y = 0; + client_area.width = window->buffer_rect.width; + client_area.height = window->buffer_rect.height; /* The shape we get back from the client may have coordinates * outside of the frame. The X SHAPE Extension requires that * the overall shape the client provides never exceeds the * "bounding rectangle" of the window -- the shape that the - * window would have gotten if it was unshaped. + * window would have gotten if it was unshaped. In our case, + * this is simply the client area. */ - mtk_region_intersect_rectangle (region, &bounding_rect); + mtk_region_intersect_rectangle (region, &client_area); } meta_window_set_input_region (window, region); -- 2.45.2 From 779239a9ff63ba28c541c25eff0f5e7c1fcf3afc Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Thu, 5 Oct 2023 13:09:46 -0700 Subject: [PATCH 3/3] Revert "x11: Use input region from frame window for decorated windows" This reverts commit d991961ae2a5c8cf2e58ff1072239f4902b0f767. It seems to cause the broken mouse interaction bug reported in https://bugzilla.redhat.com/show_bug.cgi?id=2239128 . Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3068 --- src/x11/meta-x11-frame.c | 7 ------- src/x11/window-x11.c | 29 ++++++++++------------------- 2 files changed, 10 insertions(+), 26 deletions(-) diff --git a/src/x11/meta-x11-frame.c b/src/x11/meta-x11-frame.c index 9030a92569..d57e557c6b 100644 --- a/src/x11/meta-x11-frame.c +++ b/src/x11/meta-x11-frame.c @@ -35,7 +35,6 @@ #include #include -#include #define EVENT_MASK (SubstructureRedirectMask | \ StructureNotifyMask | SubstructureNotifyMask | \ @@ -120,9 +119,6 @@ meta_window_x11_set_frame_xwindow (MetaWindow *window, XChangeWindowAttributes (x11_display->xdisplay, frame->xwindow, CWEventMask, &attrs); - if (META_X11_DISPLAY_HAS_SHAPE (x11_display)) - XShapeSelectInput (x11_display->xdisplay, frame->xwindow, ShapeNotifyMask); - if (mtk_x11_error_trap_pop_with_return (x11_display->xdisplay)) { meta_topic (META_DEBUG_WINDOW_STATE, @@ -271,9 +267,6 @@ meta_window_destroy_frame (MetaWindow *window) window->reparents_pending += 1; } - if (META_X11_DISPLAY_HAS_SHAPE (x11_display)) - XShapeSelectInput (x11_display->xdisplay, frame->xwindow, NoEventMask); - XDeleteProperty (x11_display->xdisplay, meta_window_x11_get_xwindow (window), x11_display->atom__MUTTER_NEEDS_FRAME); diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c index 618287a6d4..45060c754d 100644 --- a/src/x11/window-x11.c +++ b/src/x11/window-x11.c @@ -2200,10 +2200,6 @@ meta_window_x11_constructed (GObject *object) &priv->border_width, NULL, MTK_ROUNDING_STRATEGY_GROW); - g_signal_connect (window, "notify::decorated", - G_CALLBACK (meta_window_x11_update_input_region), - NULL); - g_signal_connect (window, "notify::mapped", G_CALLBACK (on_mapped_changed), NULL); @@ -2504,21 +2500,16 @@ meta_window_x11_update_input_region (MetaWindow *window) g_autoptr (MtkRegion) region = NULL; MetaWindowX11 *window_x11 = META_WINDOW_X11 (window); MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11); - Window xwindow; + /* Decorated windows don't have an input region, because + we don't shape the frame to match the client windows + (so the events are blocked by the frame anyway) + */ if (window->decorated) { - if (!meta_window_x11_is_ssd (window)) - { - if (priv->input_region) - meta_window_set_input_region (window, NULL); - return; - } - xwindow = priv->frame->xwindow; - } - else - { - xwindow = priv->xwindow; + if (priv->input_region) + meta_window_set_input_region (window, NULL); + return; } if (META_X11_DISPLAY_HAS_SHAPE (x11_display)) @@ -2531,7 +2522,7 @@ meta_window_x11_update_input_region (MetaWindow *window) mtk_x11_error_trap_push (x11_display->xdisplay); protocol_rects = XShapeGetRectangles (x11_display->xdisplay, - xwindow, + priv->xwindow, ShapeInput, &n_rects, &ordering); @@ -2588,8 +2579,8 @@ meta_window_x11_update_input_region (MetaWindow *window) client_area.x = 0; client_area.y = 0; - client_area.width = window->buffer_rect.width; - client_area.height = window->buffer_rect.height; + client_area.width = priv->client_rect.width; + client_area.height = priv->client_rect.height; /* The shape we get back from the client may have coordinates * outside of the frame. The X SHAPE Extension requires that -- 2.45.2