From e44ab5d5840557491a170af64cf851a9c0f201f2 Mon Sep 17 00:00:00 2001 From: random human Date: Sat, 1 Sep 2018 15:12:53 +0530 Subject: Add function wlr_log_get_verbosity() Returns the verbosity passed to wlr_log_init(). --- include/wlr/util/log.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/wlr') diff --git a/include/wlr/util/log.h b/include/wlr/util/log.h index 7b0070bb..0d659780 100644 --- a/include/wlr/util/log.h +++ b/include/wlr/util/log.h @@ -37,6 +37,9 @@ typedef void (*wlr_log_func_t)(enum wlr_log_importance importance, // If `callback` is NULL, wlr will use its default logger. void wlr_log_init(enum wlr_log_importance verbosity, wlr_log_func_t callback); +// Returns the log verbosity provided to wlr_log_init +enum wlr_log_importance wlr_log_get_verbosity(void); + #ifdef __GNUC__ #define _WLR_ATTRIB_PRINTF(start, end) __attribute__((format(printf, start, end))) #else -- cgit v1.2.3 From b8cc4a4152e5bf7bbe9644c63bcf0e874bb28322 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Mon, 3 Sep 2018 17:07:07 +1000 Subject: xwayland: Introduce set_role event --- include/wlr/xwayland.h | 2 ++ include/xwayland/xwm.h | 1 + xwayland/xwm.c | 27 +++++++++++++++++++++++++++ 3 files changed, 30 insertions(+) (limited to 'include/wlr') diff --git a/include/wlr/xwayland.h b/include/wlr/xwayland.h index cf1c2cd1..eb5d6985 100644 --- a/include/wlr/xwayland.h +++ b/include/wlr/xwayland.h @@ -116,6 +116,7 @@ struct wlr_xwayland_surface { char *title; char *class; char *instance; + char *role; pid_t pid; bool has_utf8_title; @@ -157,6 +158,7 @@ struct wlr_xwayland_surface { struct wl_signal unmap; struct wl_signal set_title; struct wl_signal set_class; + struct wl_signal set_role; struct wl_signal set_parent; struct wl_signal set_pid; struct wl_signal set_window_type; diff --git a/include/xwayland/xwm.h b/include/xwayland/xwm.h index 607cc797..3536bbc8 100644 --- a/include/xwayland/xwm.h +++ b/include/xwayland/xwm.h @@ -25,6 +25,7 @@ enum atom_name { WM_HINTS, WM_NORMAL_HINTS, WM_SIZE_HINTS, + WM_WINDOW_ROLE, MOTIF_WM_HINTS, UTF8_STRING, WM_S0, diff --git a/xwayland/xwm.c b/xwayland/xwm.c index cebd9bbc..9c803543 100644 --- a/xwayland/xwm.c +++ b/xwayland/xwm.c @@ -24,6 +24,7 @@ const char *atom_map[ATOM_LAST] = { "WM_HINTS", "WM_NORMAL_HINTS", "WM_SIZE_HINTS", + "WM_WINDOW_ROLE", "_MOTIF_WM_HINTS", "UTF8_STRING", "WM_S0", @@ -152,6 +153,7 @@ static struct wlr_xwayland_surface *xwayland_surface_create( wl_signal_init(&surface->events.map); wl_signal_init(&surface->events.unmap); wl_signal_init(&surface->events.set_class); + wl_signal_init(&surface->events.set_role); wl_signal_init(&surface->events.set_title); wl_signal_init(&surface->events.set_parent); wl_signal_init(&surface->events.set_pid); @@ -327,6 +329,7 @@ static void xwayland_surface_destroy( free(xsurface->title); free(xsurface->class); free(xsurface->instance); + free(xsurface->role); free(xsurface->window_type); free(xsurface->protocols); free(xsurface->hints); @@ -365,6 +368,28 @@ static void read_surface_class(struct wlr_xwm *xwm, wlr_signal_emit_safe(&surface->events.set_class, surface); } +static void read_surface_role(struct wlr_xwm *xwm, + struct wlr_xwayland_surface *xsurface, + xcb_get_property_reply_t *reply) { + if (reply->type != XCB_ATOM_STRING && + reply->type != xwm->atoms[UTF8_STRING]) { + return; + } + + size_t len = xcb_get_property_value_length(reply); + char *role = xcb_get_property_value(reply); + + free(xsurface->role); + if (len > 0) { + xsurface->role = strndup(role, len); + } else { + xsurface->role = NULL; + } + + wlr_log(WLR_DEBUG, "XCB_ATOM_WM_WINDOW_ROLE: %s", xsurface->role); + wlr_signal_emit_safe(&xsurface->events.set_role, xsurface); +} + static void read_surface_title(struct wlr_xwm *xwm, struct wlr_xwayland_surface *xsurface, xcb_get_property_reply_t *reply) { @@ -638,6 +663,8 @@ static void read_surface_property(struct wlr_xwm *xwm, read_surface_normal_hints(xwm, xsurface, reply); } else if (property == xwm->atoms[MOTIF_WM_HINTS]) { read_surface_motif_hints(xwm, xsurface, reply); + } else if (property == xwm->atoms[WM_WINDOW_ROLE]) { + read_surface_role(xwm, xsurface, reply); } else { char *prop_name = xwm_get_atom_name(xwm, property); wlr_log(WLR_DEBUG, "unhandled X11 property %u (%s) for window %u", -- cgit v1.2.3 From 6daa69fbf567f8036031867d6767158a0a6e5fe4 Mon Sep 17 00:00:00 2001 From: random human Date: Mon, 3 Sep 2018 16:21:49 +0530 Subject: Update wlr_log_init docs --- include/wlr/util/log.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/wlr') diff --git a/include/wlr/util/log.h b/include/wlr/util/log.h index 0d659780..2c441180 100644 --- a/include/wlr/util/log.h +++ b/include/wlr/util/log.h @@ -35,6 +35,8 @@ typedef void (*wlr_log_func_t)(enum wlr_log_importance importance, // Will log all messages less than or equal to `verbosity` // If `callback` is NULL, wlr will use its default logger. +// The function can be called multiple times to update the verbosity or +// callback function. void wlr_log_init(enum wlr_log_importance verbosity, wlr_log_func_t callback); // Returns the log verbosity provided to wlr_log_init -- cgit v1.2.3 From f6168c2afeece02b118b2bc43412fc3344e59028 Mon Sep 17 00:00:00 2001 From: nyorain Date: Fri, 7 Sep 2018 14:48:28 +0200 Subject: Fix #1129 and remove sx, sy from wlr_drag_icon sx, sy used to store the buffer offset of the drag surface which was then be added (by rootston) to the drag icon position. Buffer offsets are handled already in surface_intersect_output (output.c) so they were added twice for dnd surfaces. --- include/wlr/types/wlr_data_device.h | 2 -- rootston/seat.c | 8 ++++---- types/data_device/wlr_drag.c | 3 --- 3 files changed, 4 insertions(+), 9 deletions(-) (limited to 'include/wlr') diff --git a/include/wlr/types/wlr_data_device.h b/include/wlr/types/wlr_data_device.h index cc04c9e9..c45e8d1c 100644 --- a/include/wlr/types/wlr_data_device.h +++ b/include/wlr/types/wlr_data_device.h @@ -93,8 +93,6 @@ struct wlr_drag_icon { bool is_pointer; int32_t touch_id; - int32_t sx, sy; - struct { struct wl_signal map; struct wl_signal unmap; diff --git a/rootston/seat.c b/rootston/seat.c index 9010d6e3..c11ff017 100644 --- a/rootston/seat.c +++ b/rootston/seat.c @@ -502,16 +502,16 @@ void roots_drag_icon_update_position(struct roots_drag_icon *icon) { struct roots_seat *seat = icon->seat; struct wlr_cursor *cursor = seat->cursor->cursor; if (wlr_icon->is_pointer) { - icon->x = cursor->x + wlr_icon->sx; - icon->y = cursor->y + wlr_icon->sy; + icon->x = cursor->x; + icon->y = cursor->y; } else { struct wlr_touch_point *point = wlr_seat_touch_get_point(seat->seat, wlr_icon->touch_id); if (point == NULL) { return; } - icon->x = seat->touch_x + wlr_icon->sx; - icon->y = seat->touch_y + wlr_icon->sy; + icon->x = seat->touch_x; + icon->y = seat->touch_y; } roots_drag_icon_damage_whole(icon); diff --git a/types/data_device/wlr_drag.c b/types/data_device/wlr_drag.c index 7f3b346d..fcde7b3e 100644 --- a/types/data_device/wlr_drag.c +++ b/types/data_device/wlr_drag.c @@ -345,9 +345,6 @@ static void drag_icon_surface_role_commit(struct wlr_surface *surface) { return; } - icon->sx += icon->surface->current.dx; - icon->sy += icon->surface->current.dy; - drag_icon_set_mapped(icon, wlr_surface_has_buffer(surface)); } -- cgit v1.2.3