[PATCH 1/3] xwm: Define SEND_EVENT_MASK and EVENT_TYPE macros to clarify xcb event type checks

Kristian Høgsberg hoegsberg at gmail.com
Fri Jun 14 11:40:09 PDT 2013


On Tue, Jun 11, 2013 at 07:58:55PM -0500, MoD wrote:
> ---
>  src/xwayland/window-manager.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)

That does look a little nicer, thanks.

Kristian

> diff --git a/src/xwayland/window-manager.c b/src/xwayland/window-manager.c
> index 366f2e0..a021c76 100644
> --- a/src/xwayland/window-manager.c
> +++ b/src/xwayland/window-manager.c
> @@ -89,6 +89,9 @@ struct motif_wm_hints {
>  #define _NET_WM_MOVERESIZE_MOVE_KEYBOARD    10   /* move via keyboard */
>  #define _NET_WM_MOVERESIZE_CANCEL           11   /* cancel operation */
>  
> +#define SEND_EVENT_MASK (0x80)
> +#define EVENT_TYPE(event) ((event)->response_type & ~SEND_EVENT_MASK)
> +
>  struct weston_wm_window {
>  	struct weston_wm *wm;
>  	xcb_window_t id;
> @@ -748,7 +751,7 @@ weston_wm_handle_unmap_notify(struct weston_wm *wm, xcb_generic_event_t *event)
>  	if (our_resource(wm, unmap_notify->window))
>  		return;
>  
> -	if (unmap_notify->response_type & 0x80)
> +	if (unmap_notify->response_type & SEND_EVENT_MASK)
>  		/* We just ignore the ICCCM 4.1.4 synthetic unmap notify
>  		 * as it may come in after we've destroyed the window. */
>  		return;
> @@ -1333,7 +1336,7 @@ weston_wm_handle_event(int fd, uint32_t mask, void *data)
>  			continue;
>  		}
>  
> -		switch (event->response_type & ~0x80) {
> +		switch (EVENT_TYPE(event)) {
>  		case XCB_BUTTON_PRESS:
>  		case XCB_BUTTON_RELEASE:
>  			weston_wm_handle_button(wm, event);
> -- 
> 1.8.3
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list