fix: layer shell + view bugs
- fix bug that causes layer shell seat focus incorrect on layer windows - focus on a regular view now raises all views of the related applications on top of the output
This commit is contained in:
49
seat.c
49
seat.c
@ -6,6 +6,7 @@
|
||||
#include <assert.h>
|
||||
#include "seat.h"
|
||||
#include "view.h"
|
||||
#include "output.h"
|
||||
|
||||
static void configure_keyboard(struct diyac_seat* seat, struct diyac_input* input, bool force)
|
||||
{
|
||||
@ -406,14 +407,33 @@ void diyac_seat_focus_layer(struct diyac_seat *seat, struct wlr_layer_surface_v1
|
||||
if (!layer)
|
||||
{
|
||||
seat->focused_layer = NULL;
|
||||
diyac_seat_focus_topmost(seat, diyac_output_from_cursor(seat->server));
|
||||
return;
|
||||
/*
|
||||
diyac_focus_topmost_view(seat->server, false);
|
||||
return;
|
||||
*/
|
||||
}
|
||||
if(seat->focused_layer == layer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(seat->focused_layer)
|
||||
wlr_log(WLR_INFO,"Layer focus changed %s -> %s", seat->focused_layer->namespace, layer->namespace);
|
||||
|
||||
// unfocus currently focus view
|
||||
if (seat->server->active_view)
|
||||
{
|
||||
diya_view_unfocus(seat->server->active_view);
|
||||
}
|
||||
seat_focus(seat, layer->surface, /*is_lock_surface*/ false);
|
||||
seat->focused_layer = layer;
|
||||
/*
|
||||
if (layer->current.layer >= ZWLR_LAYER_SHELL_V1_LAYER_TOP)
|
||||
{
|
||||
seat->focused_layer = layer;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void diyac_seat_configure(struct diyac_server* server)
|
||||
@ -435,4 +455,33 @@ void diyac_seat_configure(struct diyac_server* server)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void diyac_seat_focus_topmost(struct diyac_seat* seat, struct diyac_output* output)
|
||||
{
|
||||
for(int i = ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY; i >= ZWLR_LAYER_SHELL_V1_LAYER_TOP; i--)
|
||||
{
|
||||
struct wlr_scene_tree *scene = output->layer_tree[i];
|
||||
struct wl_list *node_list = & scene->children;
|
||||
struct wlr_scene_node *node;
|
||||
wl_list_for_each_reverse(node,node_list, link)
|
||||
{
|
||||
struct diyac_node_descriptor *node_descriptor = node->data;
|
||||
if (!node->enabled || !node_descriptor || node_descriptor->type != DIYAC_NODE_LAYER_SURFACE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
struct diyac_layer_surface* surface = (struct diyac_layer_surface *)node_descriptor->data;
|
||||
struct wlr_layer_surface_v1* layer_surface = surface->scene_layer_surface->layer_surface;
|
||||
if(!surface->mapped || layer_surface->current.keyboard_interactive == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
wlr_log(WLR_INFO," Update focus on layer: %s", layer_surface->namespace);
|
||||
diyac_seat_focus_layer(seat, layer_surface);
|
||||
return;
|
||||
}
|
||||
}
|
||||
seat->focused_layer = NULL;
|
||||
diyac_focus_topmost_view(seat->server, true);
|
||||
}
|
Reference in New Issue
Block a user