[PATCH] xwm: Update input region on resize

Pekka Paalanen ppaalanen at gmail.com
Mon Mar 12 09:48:00 UTC 2018


On Tue, 6 Mar 2018 20:13:54 +0100
Emmanuel Gil Peyrot <linkmauve at linkmauve.fr> 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 <linkmauve at linkmauve.fr>
> Tested-by: Emmanuel Gil Peyrot <linkmauve at linkmauve.fr>
> 
> > ---
> >  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.
0x00007fffedcebc89 in frame_refresh_geometry (frame=0x0) at /home/pq/git/weston/shared/frame.c:535
535		struct theme *t = frame->theme;
(gdb) bt
#0  0x00007fffedcebc89 in frame_refresh_geometry (frame=0x0) at /home/pq/git/weston/shared/frame.c:535
#1  0x00007fffedcec01f in frame_input_rect (frame=0x0, x=0x7fffffffd548, y=0x7fffffffd54c, width=0x7fffffffd550, height=0x7fffffffd554)
    at /home/pq/git/weston/shared/frame.c:630
#2  0x00007fffedcdddb8 in weston_wm_window_get_input_rect (window=0x555555e2e280, x=0x7fffffffd548, y=0x7fffffffd54c, width=0x7fffffffd550, 
    height=0x7fffffffd554) at /home/pq/git/weston/xwayland/window-manager.c:657
#3  0x00007fffedcdde00 in weston_wm_window_shape (window=0x555555e2e280) at /home/pq/git/weston/xwayland/window-manager.c:668
#4  0x00007fffedcde403 in weston_wm_handle_configure_notify (wm=0x555555da3230, event=0x555555e2e420) at /home/pq/git/weston/xwayland/window-manager.c:817
#5  0x00007fffedce1441 in weston_wm_handle_event (fd=35, mask=1, data=0x555555da3230) at /home/pq/git/weston/xwayland/window-manager.c:2265
#6  0x00007ffff798fd42 in wl_event_loop_dispatch (loop=0x55555576a250, timeout=timeout at entry=-1) at src/event-loop.c:641
#7  0x00007ffff798e4fa in wl_display_run (display=0x55555576a170) at src/wayland-server.c:1260
#8  0x000055555555c3b7 in main (argc=1, argv=0x7fffffffdbb8) 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20180312/6fc284ce/attachment.sig>


More information about the wayland-devel mailing list