[PATCH weston 1/1] xwayland - input size calculation correction

Ray, Ian (GE Healthcare) ian.ray at ge.com
Thu Dec 21 11:03:34 UTC 2017


On 20/12/2017, 13.19, "Daniel Stone" <daniel at fooishbar.org> wrote:
> 
> Hi Ian and Nandor,
> 
> On 20 December 2017 at 10:09, Ian Ray <ian.ray at ge.com> wrote:
> > The input area for an undecorated non-fullscreen window is based on the
> > window size itself.
> >
> > Fixes a case where mouse events in the `invisible' window margin failed
> > to reach the window behind.
> 
> Scott sent some patches to fix similar issues a while ago:
> https://lists.freedesktop.org/archives/wayland-devel/2017-June/thread.html#34332
> 
> I had some questions here:
> https://lists.freedesktop.org/archives/wayland-devel/2017-December/036116.html
> https://lists.freedesktop.org/archives/wayland-devel/2017-December/036117.html
> 
> Would you have any input on these?

Hi Daniel,

After checking Scott's earlier work, and review comments, together with
testing decorated and undecorated windows, it *seems* like the input
region change is the thing that is needed.

RFC pasted below.

Tested that X cursor changes shape at expected boundaries for both
decorated and undecorated windows.

Tested that mouse clicks in the shadow are received by the window
underneath.

However, clicks in the shadow region do not cause focus to change.
This suggests that there is some other transformation that I have
not found...

The other reason for the RFC is that it is clear that shared/frame.c
does not consider the case where there are no decorations.  I'm not
sure if it should.


> Cheers,
> Daniel

Thanks,
Ian

----8<----

Subject: [RFC PATCH weston 1/1] xwm: do not include shadow in input region

The window frame was created with position and size which include
an offset for margins and shadow.  Set the input region to ignore
shadow.

Signed-off-by: Ian Ray <ian.ray at ge.com>
---
 xwayland/window-manager.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c
index d529d41..884f0f4 100644
--- a/xwayland/window-manager.c
+++ b/xwayland/window-manager.c
@@ -707,6 +707,22 @@ weston_wm_window_get_child_position(struct weston_wm_window *window,
 }

 static void
+weston_wm_window_get_input_rect(struct weston_wm_window *window,
+                               int32_t *x, int32_t *y,
+                               int32_t *width, int32_t *height)
+{
+       struct theme *t = window->wm->theme;
+
+       if (!window->decorate) {
+               weston_wm_window_get_child_position(window, x, y);
+               *width = window->width;
+               *height = window->height;
+       } else {
+               frame_input_rect(window->frame, x, y, width, height);
+       }
+}
+
+static void
 weston_wm_window_send_configure_notify(struct weston_wm_window *window)
 {
        xcb_configure_notify_event_t configure_notify;
@@ -1031,6 +1047,7 @@ static void
 weston_wm_window_create_frame(struct weston_wm_window *window)
 {
        struct weston_wm *wm = window->wm;
+       xcb_rectangle_t rect;
        uint32_t values[3];
        int x, y, width, height;
        int buttons = FRAME_BUTTON_CLOSE;
@@ -1086,6 +1103,21 @@ weston_wm_window_create_frame(struct weston_wm_window *window)
                                                             &wm->format_rgba,
                                                             width, height);

+       weston_wm_window_get_input_rect(window, &rect.x, &rect.y, &rect.width, &rect.height);
+
+       /* The window frame was created with position and size which include
+        * an offset for margins and shadow.  Set the input region to ignore
+        * shadow. */
+       xcb_shape_rectangles(wm->conn,
+                            XCB_SHAPE_SO_SET,
+                            XCB_SHAPE_SK_INPUT,
+                            0,
+                            window->frame_id,
+                            0,
+                            0,
+                            1,
+                            &rect);
+
        hash_table_insert(wm->window_hash, window->frame_id, window);
 }

-- 
2.10.1






More information about the wayland-devel mailing list