mirror of
https://github.com/labwc/labwc.git
synced 2026-03-27 07:58:31 -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);
|
struct kde_deco *kde_deco = znew(*kde_deco);
|
||||||
kde_deco->wlr_kde_decoration = wlr_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
|
* Depending on the application event flow, the supplied
|
||||||
* wlr_surface may already have been set up as a xdg_surface
|
* 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().
|
* kde_server_decoration_set_view().
|
||||||
*/
|
*/
|
||||||
struct wlr_xdg_surface *xdg_surface =
|
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) {
|
if (xdg_surface && xdg_surface->data) {
|
||||||
kde_deco->view = (struct view *)xdg_surface->data;
|
kde_deco->view = (struct view *)xdg_surface->data;
|
||||||
handle_mode(&kde_deco->mode, wlr_deco);
|
handle_mode(&kde_deco->mode, wlr_deco);
|
||||||
|
|
|
||||||
|
|
@ -97,9 +97,9 @@ desktop_focus_view_or_surface(struct seat *seat, struct view *view,
|
||||||
if (view) {
|
if (view) {
|
||||||
desktop_focus_view(view, raise);
|
desktop_focus_view(view, raise);
|
||||||
#if HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
} else if (wlr_surface_is_xwayland_surface(surface)) {
|
} else {
|
||||||
struct wlr_xwayland_surface *xsurface =
|
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)) {
|
if (xsurface && wlr_xwayland_or_surface_wants_focus(xsurface)) {
|
||||||
seat_focus_surface(seat, surface);
|
seat_focus_surface(seat, surface);
|
||||||
}
|
}
|
||||||
|
|
@ -432,7 +432,7 @@ get_cursor_context(struct server *server)
|
||||||
if (node->type == WLR_SCENE_NODE_BUFFER) {
|
if (node->type == WLR_SCENE_NODE_BUFFER) {
|
||||||
struct wlr_surface *surface = lab_wlr_surface_from_node(node);
|
struct wlr_surface *surface = lab_wlr_surface_from_node(node);
|
||||||
if (surface) {
|
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;
|
ret.type = LAB_SSD_LAYER_SURFACE;
|
||||||
}
|
}
|
||||||
if (is_layer_descendant(node)) {
|
if (is_layer_descendant(node)) {
|
||||||
|
|
|
||||||
|
|
@ -100,11 +100,11 @@ cursor_get_from_ssd(enum ssd_part_type view_area)
|
||||||
static struct wlr_surface *
|
static struct wlr_surface *
|
||||||
get_toplevel(struct wlr_surface *surface)
|
get_toplevel(struct wlr_surface *surface)
|
||||||
{
|
{
|
||||||
while (surface && wlr_surface_is_xdg_surface(surface)) {
|
while (surface) {
|
||||||
struct wlr_xdg_surface *xdg_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) {
|
if (!xdg_surface) {
|
||||||
return NULL;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (xdg_surface->role) {
|
switch (xdg_surface->role) {
|
||||||
|
|
@ -117,7 +117,7 @@ get_toplevel(struct wlr_surface *surface)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (surface && wlr_surface_is_layer_surface(surface)) {
|
if (surface && wlr_layer_surface_v1_try_from_wlr_surface(surface)) {
|
||||||
return surface;
|
return surface;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -329,7 +329,7 @@ process_cursor_motion_out_of_surface(struct server *server, uint32_t time)
|
||||||
if (view) {
|
if (view) {
|
||||||
lx = view->current.x;
|
lx = view->current.x;
|
||||||
ly = view->current.y;
|
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);
|
wlr_scene_node_coords(node, &lx, &ly);
|
||||||
#if HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
} else if (node && node->parent == server->unmanaged_tree) {
|
} 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) {
|
if (ctx.type == LAB_SSD_LAYER_SURFACE) {
|
||||||
struct wlr_layer_surface_v1 *layer =
|
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) {
|
if (layer && layer->current.keyboard_interactive) {
|
||||||
seat_set_focus_layer(seat, layer);
|
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
|
* - find a way to get rid of xdg/xwayland-specific stuff
|
||||||
* - look up root/toplevel surface if passed a subsurface?
|
* - look up root/toplevel surface if passed a subsurface?
|
||||||
*/
|
*/
|
||||||
if (wlr_surface_is_xdg_surface(surface)) {
|
struct wlr_xdg_surface *xdg_surface =
|
||||||
struct wlr_xdg_surface *xdg_surface =
|
wlr_xdg_surface_try_from_wlr_surface(surface);
|
||||||
wlr_xdg_surface_from_wlr_surface(surface);
|
if (xdg_surface) {
|
||||||
if (xdg_surface) {
|
return xdg_surface->data;
|
||||||
return xdg_surface->data;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#if HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
if (wlr_surface_is_xwayland_surface(surface)) {
|
struct wlr_xwayland_surface *xsurface =
|
||||||
struct wlr_xwayland_surface *xsurface =
|
wlr_xwayland_surface_try_from_wlr_surface(surface);
|
||||||
wlr_xwayland_surface_from_wlr_surface(surface);
|
if (xsurface) {
|
||||||
if (xsurface) {
|
return xsurface->data;
|
||||||
return xsurface->data;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
||||||
|
|
@ -63,8 +63,7 @@ void
|
||||||
xdg_popup_create(struct view *view, struct wlr_xdg_popup *wlr_popup)
|
xdg_popup_create(struct view *view, struct wlr_xdg_popup *wlr_popup)
|
||||||
{
|
{
|
||||||
struct wlr_xdg_surface *parent =
|
struct wlr_xdg_surface *parent =
|
||||||
wlr_surface_is_xdg_surface(wlr_popup->parent) ?
|
wlr_xdg_surface_try_from_wlr_surface(wlr_popup->parent);
|
||||||
wlr_xdg_surface_from_wlr_surface(wlr_popup->parent) : NULL;
|
|
||||||
if (!parent) {
|
if (!parent) {
|
||||||
wlr_log(WLR_ERROR, "parent is not a valid XDG surface");
|
wlr_log(WLR_ERROR, "parent is not a valid XDG surface");
|
||||||
return;
|
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;
|
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;
|
return;
|
||||||
}
|
}
|
||||||
struct wlr_xdg_surface *xdg_surface =
|
struct view *view = xdg_surface->data;
|
||||||
wlr_xdg_surface_from_wlr_surface(event->surface);
|
|
||||||
struct view *view = xdg_surface ? xdg_surface->data : NULL;
|
|
||||||
|
|
||||||
if (!view) {
|
if (!view) {
|
||||||
wlr_log(WLR_INFO, "Not activating surface - no view attached to surface");
|
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);
|
struct view *view = desktop_topmost_focusable_view(server);
|
||||||
if (view && view->type == LAB_XWAYLAND_VIEW) {
|
if (view && view->type == LAB_XWAYLAND_VIEW) {
|
||||||
struct wlr_xwayland_surface *surf =
|
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) {
|
if (surf && surf->pid != xsurface->pid) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -701,8 +701,7 @@ xwayland_view_is_related(struct view *view, struct wlr_surface *surface)
|
||||||
struct wlr_xwayland_surface *xsurface =
|
struct wlr_xwayland_surface *xsurface =
|
||||||
xwayland_surface_from_view(view);
|
xwayland_surface_from_view(view);
|
||||||
struct wlr_xwayland_surface *xsurface2 =
|
struct wlr_xwayland_surface *xsurface2 =
|
||||||
wlr_surface_is_xwayland_surface(surface) ?
|
wlr_xwayland_surface_try_from_wlr_surface(surface);
|
||||||
wlr_xwayland_surface_from_wlr_surface(surface) : NULL;
|
|
||||||
|
|
||||||
return (xsurface2 && xsurface2->pid == xsurface->pid);
|
return (xsurface2 && xsurface2->pid == xsurface->pid);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[wrap-git]
|
[wrap-git]
|
||||||
url = https://gitlab.freedesktop.org/wlroots/wlroots.git
|
url = https://gitlab.freedesktop.org/wlroots/wlroots.git
|
||||||
revision = 097ea84cda70a71ad8ea5940b3b3d277167424e5
|
revision = f9bd416d4156942ce3951a6c5cf9f81a3cf4a3dd
|
||||||
|
|
||||||
[provide]
|
[provide]
|
||||||
dependency_names = wlroots
|
dependency_names = wlroots
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue