Re: [PATCH] xwm: Update input region on resize
Hi Scott, On 19 February 2018 at 19:18, Scott Moreau wrote: > Commit 332d1892 introduced a bug because the window was > shaped only when the frame was created, leaving the input > region unchanged regardless if the window was resized. > This patch updates the input region shape on resize, > fixing the problem. Thanks for this! I've had a look - well, as much of a look into XWM as I can stomach on a Monday morning - and I think it's mostly right, but could be improved a little further. In the override-redirect case, we call frame_resize_inside in the branch closed just above where you added the weston_wm_window_shape() call. That is the first point where we know the window has a different size, so would be the right place to call it. On the other hand, for OR we probably just shouldn't be trying to manage the input mask at all ... ? For non-OR windows, send_configure() is where we send the server a ConfigureRequest (which it will process immediately as we hold the substructure redirect), so we should chase that immediately with the input-region update. That resolves a potential race where we have incoherent input/output size. As Pekka says, there's something fishy about decorate/frame confusion I think. Anyone who put clear and concise comments above decorate/frame explaining what they actually do and when they will actually be set would have my eternal gratitude, because I have to go re-learn what they are every time. :\ Cheers, Daniel ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH] xwm: Update input region on resize
On Tue, 6 Mar 2018 20:13:54 +0100 Emmanuel Gil Peyrot wrote: > On Mon, Feb 19, 2018 at 12:18:51PM -0700, Scott Moreau wrote: > > Commit 332d1892 introduced a bug because the window was > > shaped only when the frame was created, leaving the input > > region unchanged regardless if the window was resized. > > This patch updates the input region shape on resize, > > fixing the problem. > > This fixes the issue I had with Firefox, thanks! > > Reviewed-by: Emmanuel Gil Peyrot > Tested-by: Emmanuel Gil Peyrot > > > --- > > xwayland/window-manager.c | 46 > > +++--- > > 1 file changed, 27 insertions(+), 19 deletions(-) > > > > diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c > > index c307e19..5588166 100644 > > --- a/xwayland/window-manager.c > > +++ b/xwayland/window-manager.c > > @@ -659,6 +659,30 @@ weston_wm_window_get_input_rect(struct > > weston_wm_window *window, > > } > > > > static void > > +weston_wm_window_shape(struct weston_wm_window *window) > > +{ > > + struct weston_wm *wm = window->wm; > > + xcb_rectangle_t rect; > > + int x, y, width, height; > > + > > + weston_wm_window_get_input_rect(window, &x, &y, &width, &height); > > + > > + rect.x = x; > > + rect.y = y; > > + rect.width = width; > > + rect.height = 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); > > +} > > + > > +static void > > weston_wm_window_send_configure_notify(struct weston_wm_window *window) > > { > > xcb_configure_notify_event_t configure_notify; > > @@ -789,6 +813,8 @@ weston_wm_handle_configure_notify(struct weston_wm *wm, > > xcb_generic_event_t *eve > > xwayland_api->set_xwayland(window->shsurf, > >window->x, window->y); > > } > > + > > + weston_wm_window_shape(window); > > } Hi, something is wrong: Program received signal SIGSEGV, Segmentation fault. 0x7fffedcebc89 in frame_refresh_geometry (frame=0x0) at /home/pq/git/weston/shared/frame.c:535 535 struct theme *t = frame->theme; (gdb) bt #0 0x7fffedcebc89 in frame_refresh_geometry (frame=0x0) at /home/pq/git/weston/shared/frame.c:535 #1 0x7fffedcec01f in frame_input_rect (frame=0x0, x=0x7fffd548, y=0x7fffd54c, width=0x7fffd550, height=0x7fffd554) at /home/pq/git/weston/shared/frame.c:630 #2 0x7fffedcdddb8 in weston_wm_window_get_input_rect (window=0x55e2e280, x=0x7fffd548, y=0x7fffd54c, width=0x7fffd550, height=0x7fffd554) at /home/pq/git/weston/xwayland/window-manager.c:657 #3 0x7fffedcdde00 in weston_wm_window_shape (window=0x55e2e280) at /home/pq/git/weston/xwayland/window-manager.c:668 #4 0x7fffedcde403 in weston_wm_handle_configure_notify (wm=0x55da3230, event=0x55e2e420) at /home/pq/git/weston/xwayland/window-manager.c:817 #5 0x7fffedce1441 in weston_wm_handle_event (fd=35, mask=1, data=0x55da3230) at /home/pq/git/weston/xwayland/window-manager.c:2265 #6 0x7798fd42 in wl_event_loop_dispatch (loop=0x5576a250, timeout=timeout@entry=-1) at src/event-loop.c:641 #7 0x7798e4fa in wl_display_run (display=0x5576a170) at src/wayland-server.c:1260 #8 0xc3b7 in main (argc=1, argv=0x7fffdbb8) at /home/pq/git/weston/compositor/main.c:1867 I triggered this crash with kcachegrind, by opening a drop-down item on the UI a couple of times. This seems to be a regression caused by this patch. (Unrelatedly, the kcachegrind menus and drop-downs open at consistent but wrong positions, but that is not caused by this patch.) I would guess that something is breaking assumptions between window->decorate and window->frame, since it crashes on NULL frame. FWIW, this is my short XWM manual check list: - xterm, and menus - geany, and menus, tooltips - printf 'eka\ntoka\nkol\nnel\nvii\nkuusix\n' | dmenu -l 4 - gimp, and toolboxes, menus, tooltips - kcachegrind, and menus, tooltips Thanks, pq pgpetcfX1zTtx.pgp Description: OpenPGP digital signature ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH] xwm: Update input region on resize
On Mon, Feb 19, 2018 at 12:18:51PM -0700, Scott Moreau wrote: > Commit 332d1892 introduced a bug because the window was > shaped only when the frame was created, leaving the input > region unchanged regardless if the window was resized. > This patch updates the input region shape on resize, > fixing the problem. This fixes the issue I had with Firefox, thanks! Reviewed-by: Emmanuel Gil Peyrot Tested-by: Emmanuel Gil Peyrot > --- > xwayland/window-manager.c | 46 +++--- > 1 file changed, 27 insertions(+), 19 deletions(-) > > diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c > index c307e19..5588166 100644 > --- a/xwayland/window-manager.c > +++ b/xwayland/window-manager.c > @@ -659,6 +659,30 @@ weston_wm_window_get_input_rect(struct weston_wm_window > *window, > } > > static void > +weston_wm_window_shape(struct weston_wm_window *window) > +{ > + struct weston_wm *wm = window->wm; > + xcb_rectangle_t rect; > + int x, y, width, height; > + > + weston_wm_window_get_input_rect(window, &x, &y, &width, &height); > + > + rect.x = x; > + rect.y = y; > + rect.width = width; > + rect.height = 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); > +} > + > +static void > weston_wm_window_send_configure_notify(struct weston_wm_window *window) > { > xcb_configure_notify_event_t configure_notify; > @@ -789,6 +813,8 @@ weston_wm_handle_configure_notify(struct weston_wm *wm, > xcb_generic_event_t *eve > xwayland_api->set_xwayland(window->shsurf, > window->x, window->y); > } > + > + weston_wm_window_shape(window); > } > > static void > @@ -983,7 +1009,6 @@ weston_wm_window_create_frame(struct weston_wm_window > *window) > { > struct weston_wm *wm = window->wm; > uint32_t values[3]; > - xcb_rectangle_t rect; > int x, y, width, height; > int buttons = FRAME_BUTTON_CLOSE; > > @@ -1040,24 +1065,7 @@ weston_wm_window_create_frame(struct weston_wm_window > *window) >&wm->format_rgba, >width, height); > > - weston_wm_window_get_input_rect(window, &x, &y, &width, &height); > - rect.x = x; > - rect.y = y; > - rect.width = width; > - rect.height = 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); > + weston_wm_window_shape(window); > > hash_table_insert(wm->window_hash, window->frame_id, window); > } > -- > 2.7.4 > > ___ > wayland-devel mailing list > wayland-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/wayland-devel -- Emmanuel Gil Peyrot signature.asc Description: PGP signature ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH] xwm: Update input region on resize
Commit 332d1892 introduced a bug because the window was shaped only when the frame was created, leaving the input region unchanged regardless if the window was resized. This patch updates the input region shape on resize, fixing the problem. --- xwayland/window-manager.c | 46 +++--- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c index c307e19..5588166 100644 --- a/xwayland/window-manager.c +++ b/xwayland/window-manager.c @@ -659,6 +659,30 @@ weston_wm_window_get_input_rect(struct weston_wm_window *window, } static void +weston_wm_window_shape(struct weston_wm_window *window) +{ + struct weston_wm *wm = window->wm; + xcb_rectangle_t rect; + int x, y, width, height; + + weston_wm_window_get_input_rect(window, &x, &y, &width, &height); + + rect.x = x; + rect.y = y; + rect.width = width; + rect.height = 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); +} + +static void weston_wm_window_send_configure_notify(struct weston_wm_window *window) { xcb_configure_notify_event_t configure_notify; @@ -789,6 +813,8 @@ weston_wm_handle_configure_notify(struct weston_wm *wm, xcb_generic_event_t *eve xwayland_api->set_xwayland(window->shsurf, window->x, window->y); } + + weston_wm_window_shape(window); } static void @@ -983,7 +1009,6 @@ weston_wm_window_create_frame(struct weston_wm_window *window) { struct weston_wm *wm = window->wm; uint32_t values[3]; - xcb_rectangle_t rect; int x, y, width, height; int buttons = FRAME_BUTTON_CLOSE; @@ -1040,24 +1065,7 @@ weston_wm_window_create_frame(struct weston_wm_window *window) &wm->format_rgba, width, height); - weston_wm_window_get_input_rect(window, &x, &y, &width, &height); - rect.x = x; - rect.y = y; - rect.width = width; - rect.height = 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); + weston_wm_window_shape(window); hash_table_insert(wm->window_hash, window->frame_id, window); } -- 2.7.4 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel