mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
Chase wlroots: convert to try_from
Chases: 711a1a3ed42150fdbc716e80719d482006075f69 xdg-shell: convert to try_from Chases: f9bd416d4156942ce3951a6c5cf9f81a3cf4a3dd layer-shell-v1: convert to try_from Chases: fbf5982e3838ee28b5345e98832f6956c402b225 xwayland/xwm: introduce wlr_xwayland_surface_try_from_wlr_surface()
This commit is contained in:
parent
d0b24f73d7
commit
b5220a723e
9 changed files with 27 additions and 33 deletions
|
|
@ -63,7 +63,7 @@ handle_new_server_decoration(struct wl_listener *listener, void *data)
|
|||
struct kde_deco *kde_deco = znew(*kde_deco);
|
||||
kde_deco->wlr_kde_decoration = wlr_deco;
|
||||
|
||||
if (wlr_surface_is_xdg_surface(wlr_deco->surface)) {
|
||||
if (wlr_deco->surface) {
|
||||
/*
|
||||
* Depending on the application event flow, the supplied
|
||||
* wlr_surface may already have been set up as a xdg_surface
|
||||
|
|
@ -72,7 +72,7 @@ handle_new_server_decoration(struct wl_listener *listener, void *data)
|
|||
* kde_server_decoration_set_view().
|
||||
*/
|
||||
struct wlr_xdg_surface *xdg_surface =
|
||||
wlr_xdg_surface_from_wlr_surface(wlr_deco->surface);
|
||||
wlr_xdg_surface_try_from_wlr_surface(wlr_deco->surface);
|
||||
if (xdg_surface && xdg_surface->data) {
|
||||
kde_deco->view = (struct view *)xdg_surface->data;
|
||||
handle_mode(&kde_deco->mode, wlr_deco);
|
||||
|
|
|
|||
|
|
@ -97,9 +97,9 @@ desktop_focus_view_or_surface(struct seat *seat, struct view *view,
|
|||
if (view) {
|
||||
desktop_focus_view(view, raise);
|
||||
#if HAVE_XWAYLAND
|
||||
} else if (wlr_surface_is_xwayland_surface(surface)) {
|
||||
} else {
|
||||
struct wlr_xwayland_surface *xsurface =
|
||||
wlr_xwayland_surface_from_wlr_surface(surface);
|
||||
wlr_xwayland_surface_try_from_wlr_surface(surface);
|
||||
if (xsurface && wlr_xwayland_or_surface_wants_focus(xsurface)) {
|
||||
seat_focus_surface(seat, surface);
|
||||
}
|
||||
|
|
@ -432,7 +432,7 @@ get_cursor_context(struct server *server)
|
|||
if (node->type == WLR_SCENE_NODE_BUFFER) {
|
||||
struct wlr_surface *surface = lab_wlr_surface_from_node(node);
|
||||
if (surface) {
|
||||
if (wlr_surface_is_layer_surface(surface)) {
|
||||
if (wlr_layer_surface_v1_try_from_wlr_surface(surface)) {
|
||||
ret.type = LAB_SSD_LAYER_SURFACE;
|
||||
}
|
||||
if (is_layer_descendant(node)) {
|
||||
|
|
|
|||
|
|
@ -100,11 +100,11 @@ cursor_get_from_ssd(enum ssd_part_type view_area)
|
|||
static struct wlr_surface *
|
||||
get_toplevel(struct wlr_surface *surface)
|
||||
{
|
||||
while (surface && wlr_surface_is_xdg_surface(surface)) {
|
||||
while (surface) {
|
||||
struct wlr_xdg_surface *xdg_surface =
|
||||
wlr_xdg_surface_from_wlr_surface(surface);
|
||||
wlr_xdg_surface_try_from_wlr_surface(surface);
|
||||
if (!xdg_surface) {
|
||||
return NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (xdg_surface->role) {
|
||||
|
|
@ -117,7 +117,7 @@ get_toplevel(struct wlr_surface *surface)
|
|||
continue;
|
||||
}
|
||||
}
|
||||
if (surface && wlr_surface_is_layer_surface(surface)) {
|
||||
if (surface && wlr_layer_surface_v1_try_from_wlr_surface(surface)) {
|
||||
return surface;
|
||||
}
|
||||
return NULL;
|
||||
|
|
@ -329,7 +329,7 @@ process_cursor_motion_out_of_surface(struct server *server, uint32_t time)
|
|||
if (view) {
|
||||
lx = view->current.x;
|
||||
ly = view->current.y;
|
||||
} else if (node && wlr_surface_is_layer_surface(surface)) {
|
||||
} else if (node && wlr_layer_surface_v1_try_from_wlr_surface(surface)) {
|
||||
wlr_scene_node_coords(node, &lx, &ly);
|
||||
#if HAVE_XWAYLAND
|
||||
} else if (node && node->parent == server->unmanaged_tree) {
|
||||
|
|
@ -917,7 +917,7 @@ cursor_button_press(struct seat *seat, struct wlr_pointer_button_event *event)
|
|||
*/
|
||||
if (ctx.type == LAB_SSD_LAYER_SURFACE) {
|
||||
struct wlr_layer_surface_v1 *layer =
|
||||
wlr_layer_surface_v1_from_wlr_surface(ctx.surface);
|
||||
wlr_layer_surface_v1_try_from_wlr_surface(ctx.surface);
|
||||
if (layer && layer->current.keyboard_interactive) {
|
||||
seat_set_focus_layer(seat, layer);
|
||||
}
|
||||
|
|
|
|||
20
src/view.c
20
src/view.c
|
|
@ -34,20 +34,16 @@ view_from_wlr_surface(struct wlr_surface *surface)
|
|||
* - find a way to get rid of xdg/xwayland-specific stuff
|
||||
* - look up root/toplevel surface if passed a subsurface?
|
||||
*/
|
||||
if (wlr_surface_is_xdg_surface(surface)) {
|
||||
struct wlr_xdg_surface *xdg_surface =
|
||||
wlr_xdg_surface_from_wlr_surface(surface);
|
||||
if (xdg_surface) {
|
||||
return xdg_surface->data;
|
||||
}
|
||||
struct wlr_xdg_surface *xdg_surface =
|
||||
wlr_xdg_surface_try_from_wlr_surface(surface);
|
||||
if (xdg_surface) {
|
||||
return xdg_surface->data;
|
||||
}
|
||||
#if HAVE_XWAYLAND
|
||||
if (wlr_surface_is_xwayland_surface(surface)) {
|
||||
struct wlr_xwayland_surface *xsurface =
|
||||
wlr_xwayland_surface_from_wlr_surface(surface);
|
||||
if (xsurface) {
|
||||
return xsurface->data;
|
||||
}
|
||||
struct wlr_xwayland_surface *xsurface =
|
||||
wlr_xwayland_surface_try_from_wlr_surface(surface);
|
||||
if (xsurface) {
|
||||
return xsurface->data;
|
||||
}
|
||||
#endif
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -63,8 +63,7 @@ void
|
|||
xdg_popup_create(struct view *view, struct wlr_xdg_popup *wlr_popup)
|
||||
{
|
||||
struct wlr_xdg_surface *parent =
|
||||
wlr_surface_is_xdg_surface(wlr_popup->parent) ?
|
||||
wlr_xdg_surface_from_wlr_surface(wlr_popup->parent) : NULL;
|
||||
wlr_xdg_surface_try_from_wlr_surface(wlr_popup->parent);
|
||||
if (!parent) {
|
||||
wlr_log(WLR_ERROR, "parent is not a valid XDG surface");
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -579,12 +579,12 @@ xdg_activation_handle_request(struct wl_listener *listener, void *data)
|
|||
{
|
||||
const struct wlr_xdg_activation_v1_request_activate_event *event = data;
|
||||
|
||||
if (!wlr_surface_is_xdg_surface(event->surface)) {
|
||||
struct wlr_xdg_surface *xdg_surface =
|
||||
wlr_xdg_surface_try_from_wlr_surface(event->surface);
|
||||
if (!xdg_surface) {
|
||||
return;
|
||||
}
|
||||
struct wlr_xdg_surface *xdg_surface =
|
||||
wlr_xdg_surface_from_wlr_surface(event->surface);
|
||||
struct view *view = xdg_surface ? xdg_surface->data : NULL;
|
||||
struct view *view = xdg_surface->data;
|
||||
|
||||
if (!view) {
|
||||
wlr_log(WLR_INFO, "Not activating surface - no view attached to surface");
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ handle_request_activate(struct wl_listener *listener, void *data)
|
|||
struct view *view = desktop_topmost_focusable_view(server);
|
||||
if (view && view->type == LAB_XWAYLAND_VIEW) {
|
||||
struct wlr_xwayland_surface *surf =
|
||||
wlr_xwayland_surface_from_wlr_surface(view->surface);
|
||||
wlr_xwayland_surface_try_from_wlr_surface(view->surface);
|
||||
if (surf && surf->pid != xsurface->pid) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -701,8 +701,7 @@ xwayland_view_is_related(struct view *view, struct wlr_surface *surface)
|
|||
struct wlr_xwayland_surface *xsurface =
|
||||
xwayland_surface_from_view(view);
|
||||
struct wlr_xwayland_surface *xsurface2 =
|
||||
wlr_surface_is_xwayland_surface(surface) ?
|
||||
wlr_xwayland_surface_from_wlr_surface(surface) : NULL;
|
||||
wlr_xwayland_surface_try_from_wlr_surface(surface);
|
||||
|
||||
return (xsurface2 && xsurface2->pid == xsurface->pid);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[wrap-git]
|
||||
url = https://gitlab.freedesktop.org/wlroots/wlroots.git
|
||||
revision = 097ea84cda70a71ad8ea5940b3b3d277167424e5
|
||||
revision = f9bd416d4156942ce3951a6c5cf9f81a3cf4a3dd
|
||||
|
||||
[provide]
|
||||
dependency_names = wlroots
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue