mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-26 14:45:58 +01:00
Identify topmost interactive layer surface
This commit is contained in:
parent
d466cc117f
commit
883d8d306c
2 changed files with 31 additions and 3 deletions
|
@ -36,6 +36,7 @@ static int32_t margin_top = 0;
|
||||||
static double alpha = 1.0;
|
static double alpha = 1.0;
|
||||||
static bool run_display = true;
|
static bool run_display = true;
|
||||||
static bool animate = false;
|
static bool animate = false;
|
||||||
|
static bool keyboard_interactive = false;
|
||||||
static double frame = 0;
|
static double frame = 0;
|
||||||
static int cur_x = -1, cur_y = -1;
|
static int cur_x = -1, cur_y = -1;
|
||||||
static int buttons = 0;
|
static int buttons = 0;
|
||||||
|
@ -274,7 +275,7 @@ int main(int argc, char **argv) {
|
||||||
int32_t margin_right = 0, margin_bottom = 0, margin_left = 0;
|
int32_t margin_right = 0, margin_bottom = 0, margin_left = 0;
|
||||||
bool found;
|
bool found;
|
||||||
int c;
|
int c;
|
||||||
while ((c = getopt(argc, argv, "nw:h:o:l:a:x:m:t:")) != -1) {
|
while ((c = getopt(argc, argv, "knw:h:o:l:a:x:m:t:")) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'o':
|
case 'o':
|
||||||
output = atoi(optarg);
|
output = atoi(optarg);
|
||||||
|
@ -354,6 +355,9 @@ int main(int argc, char **argv) {
|
||||||
case 'n':
|
case 'n':
|
||||||
animate = true;
|
animate = true;
|
||||||
break;
|
break;
|
||||||
|
case 'k':
|
||||||
|
keyboard_interactive = true;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -407,9 +411,10 @@ int main(int argc, char **argv) {
|
||||||
zwlr_layer_surface_v1_set_exclusive_zone(layer_surface, exclusive_zone);
|
zwlr_layer_surface_v1_set_exclusive_zone(layer_surface, exclusive_zone);
|
||||||
zwlr_layer_surface_v1_set_margin(layer_surface,
|
zwlr_layer_surface_v1_set_margin(layer_surface,
|
||||||
margin_top, margin_right, margin_bottom, margin_left);
|
margin_top, margin_right, margin_bottom, margin_left);
|
||||||
|
zwlr_layer_surface_v1_set_keyboard_interactivity(
|
||||||
|
layer_surface, keyboard_interactive);
|
||||||
zwlr_layer_surface_v1_add_listener(layer_surface,
|
zwlr_layer_surface_v1_add_listener(layer_surface,
|
||||||
&layer_surface_listener, layer_surface);
|
&layer_surface_listener, layer_surface);
|
||||||
// TODO: interactivity
|
|
||||||
wl_surface_commit(wl_surface);
|
wl_surface_commit(wl_surface);
|
||||||
wl_display_roundtrip(display);
|
wl_display_roundtrip(display);
|
||||||
|
|
||||||
|
|
|
@ -192,6 +192,29 @@ void arrange_layers(struct roots_output *output) {
|
||||||
arrange_layer(output->wlr_output,
|
arrange_layer(output->wlr_output,
|
||||||
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND],
|
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND],
|
||||||
&usable_area, false);
|
&usable_area, false);
|
||||||
|
|
||||||
|
// Find topmost keyboard interactive layer, if such a layer exists
|
||||||
|
uint32_t layers_above_shell[] = {
|
||||||
|
ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY,
|
||||||
|
ZWLR_LAYER_SHELL_V1_LAYER_TOP,
|
||||||
|
};
|
||||||
|
struct roots_layer_surface *layer, *topmost = NULL;
|
||||||
|
for (size_t i = 0;
|
||||||
|
i < sizeof(layers_above_shell) / sizeof(layers_above_shell[0]);
|
||||||
|
++i) {
|
||||||
|
wl_list_for_each_reverse(layer,
|
||||||
|
&output->layers[layers_above_shell[i]],
|
||||||
|
link) {
|
||||||
|
if (layer->layer_surface->current.keyboard_interactive) {
|
||||||
|
topmost = layer;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (topmost != NULL) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
wlr_log(L_DEBUG, "topmost interactive layer: %p", topmost);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_output_destroy(struct wl_listener *listener, void *data) {
|
static void handle_output_destroy(struct wl_listener *listener, void *data) {
|
||||||
|
|
Loading…
Reference in a new issue