mirror of
https://github.com/labwc/labwc.git
synced 2025-11-05 13:29:58 -05:00
desktop.c: handle layer-subsurfaces in get_cursor_context()
...to allow these surfaces to receive pointer button events Test by running `gtk-layer-demo --keyboard exclusive`, then open the 'set margin' dialog and try setting the margin with the pointer.
This commit is contained in:
parent
15781a394c
commit
86fa0c0a65
1 changed files with 36 additions and 0 deletions
|
|
@ -310,6 +310,21 @@ get_surface_from_layer_node(struct wlr_scene_node *node)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
is_layer_descendant(struct wlr_scene_node *node)
|
||||||
|
{
|
||||||
|
goto start;
|
||||||
|
while (node) {
|
||||||
|
struct node_descriptor *desc = node->data;
|
||||||
|
if (desc && desc->type == LAB_NODE_DESC_LAYER_SURFACE) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
start:
|
||||||
|
node = node->parent ? &node->parent->node : NULL;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/* TODO: make this less big and scary */
|
/* TODO: make this less big and scary */
|
||||||
struct cursor_context
|
struct cursor_context
|
||||||
get_cursor_context(struct server *server)
|
get_cursor_context(struct server *server)
|
||||||
|
|
@ -389,6 +404,27 @@ get_cursor_context(struct server *server)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Edge-case nodes without node-descriptors */
|
||||||
|
if (node->type == WLR_SCENE_NODE_BUFFER) {
|
||||||
|
struct wlr_surface *surface = lab_wlr_surface_from_node(node);
|
||||||
|
if (surface) {
|
||||||
|
if (is_layer_descendant(node)) {
|
||||||
|
/*
|
||||||
|
* layer-shell subsurfaces need to be
|
||||||
|
* able to receive pointer actions.
|
||||||
|
*
|
||||||
|
* Test by running
|
||||||
|
* `gtk-layer-demo -k exclusive`, then
|
||||||
|
* open the 'set margin' dialog and try
|
||||||
|
* setting the margin with the pointer.
|
||||||
|
*/
|
||||||
|
ret.surface = surface;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* node->parent is always a *wlr_scene_tree */
|
/* node->parent is always a *wlr_scene_tree */
|
||||||
node = node->parent ? &node->parent->node : NULL;
|
node = node->parent ? &node->parent->node : NULL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue