mirror of
https://github.com/labwc/labwc.git
synced 2025-11-01 22:58:47 -04:00
desktop: don't use LAB_NODE_LAYER_SUBSURFACE node type
Instead, set ctx.type = LAB_NODE_LAYER_SURFACE for both layer-surfaces and layer-subsurfaces. This patch preserves the existing behaviors: - Pressing a subsurface of an on-demand layer-surface gives pointer focus to the subsurface, but gives keyboard focus to the parent layer-surface (related:a5fcbfaf). - Pressing a subsurface of a layer-surface doesn't close a popup (related:a89bcc3c).
This commit is contained in:
parent
574b20fbff
commit
3d670b772d
6 changed files with 23 additions and 83 deletions
|
|
@ -9,7 +9,6 @@
|
|||
#include <wlr/types/wlr_subcompositor.h>
|
||||
#include <wlr/types/wlr_xdg_shell.h>
|
||||
#include "common/scene-helpers.h"
|
||||
#include "common/surface-helpers.h"
|
||||
#include "dnd.h"
|
||||
#include "labwc.h"
|
||||
#include "layers.h"
|
||||
|
|
@ -312,9 +311,8 @@ get_cursor_context(struct server *server)
|
|||
}
|
||||
return ret;
|
||||
case LAB_NODE_LAYER_SURFACE:
|
||||
ret.node = node;
|
||||
ret.type = LAB_NODE_LAYER_SURFACE;
|
||||
ret.surface = get_surface_from_layer_node(node);
|
||||
ret.surface = lab_wlr_surface_from_node(ret.node);
|
||||
return ret;
|
||||
case LAB_NODE_LAYER_POPUP:
|
||||
ret.node = node;
|
||||
|
|
@ -374,29 +372,6 @@ get_cursor_context(struct server *server)
|
|||
}
|
||||
}
|
||||
|
||||
/* Edge-case nodes without node-descriptors */
|
||||
if (node->type == WLR_SCENE_NODE_BUFFER) {
|
||||
struct wlr_surface *surface = lab_wlr_surface_from_node(node);
|
||||
|
||||
/*
|
||||
* Handle layer-shell subsurfaces
|
||||
*
|
||||
* These don't have node-descriptors, but need to be
|
||||
* able to receive pointer actions so we have to process
|
||||
* them here.
|
||||
*
|
||||
* Test by running `gtk-layer-demo -k exclusive`, then
|
||||
* open the 'set margin' dialog and try setting the
|
||||
* margin with the pointer.
|
||||
*/
|
||||
if (surface && wlr_subsurface_try_from_wlr_surface(surface)
|
||||
&& subsurface_parent_layer(surface)) {
|
||||
ret.surface = surface;
|
||||
ret.type = LAB_NODE_LAYER_SUBSURFACE;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
/* node->parent is always a *wlr_scene_tree */
|
||||
node = node->parent ? &node->parent->node : NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue