mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-05-01 06:46:34 -04:00
fix: optimize interactivity on_demand layer focus
This commit is contained in:
parent
eda0b018d5
commit
f92951b161
1 changed files with 18 additions and 4 deletions
22
src/maomao.c
22
src/maomao.c
|
|
@ -2917,7 +2917,10 @@ buttonpress(struct wl_listener *listener, void *data) {
|
||||||
motionnotify(0, NULL, 0, 0, 0, 0);
|
motionnotify(0, NULL, 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (l && l->layer_surface->current.keyboard_interactive) {
|
// 聚焦按需要交互焦点的layer,但注意不能抢占独占焦点的layer
|
||||||
|
if (l && !exclusive_focus &&
|
||||||
|
l->layer_surface->current.keyboard_interactive ==
|
||||||
|
ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND) {
|
||||||
focusclient(NULL, 0);
|
focusclient(NULL, 0);
|
||||||
client_notify_enter(l->layer_surface->surface,
|
client_notify_enter(l->layer_surface->surface,
|
||||||
wlr_seat_get_keyboard(seat));
|
wlr_seat_get_keyboard(seat));
|
||||||
|
|
@ -3258,6 +3261,7 @@ void get_layer_target_geometry(LayerSurface *l, struct wlr_box *target_box) {
|
||||||
|
|
||||||
void maplayersurfacenotify(struct wl_listener *listener, void *data) {
|
void maplayersurfacenotify(struct wl_listener *listener, void *data) {
|
||||||
int ji;
|
int ji;
|
||||||
|
|
||||||
LayerSurface *l = wl_container_of(listener, l, map);
|
LayerSurface *l = wl_container_of(listener, l, map);
|
||||||
l->mapped = 1;
|
l->mapped = 1;
|
||||||
|
|
||||||
|
|
@ -3300,6 +3304,15 @@ void maplayersurfacenotify(struct wl_listener *listener, void *data) {
|
||||||
}
|
}
|
||||||
// 刷新布局,让窗口能感应到exclude_zone变化以及设置独占表面
|
// 刷新布局,让窗口能感应到exclude_zone变化以及设置独占表面
|
||||||
arrangelayers(l->mon);
|
arrangelayers(l->mon);
|
||||||
|
|
||||||
|
// 按需交互layer需要像正常窗口一样抢占非独占layer的焦点
|
||||||
|
if (!exclusive_focus &&
|
||||||
|
l->layer_surface->current.keyboard_interactive ==
|
||||||
|
ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND) {
|
||||||
|
focusclient(NULL, 0);
|
||||||
|
client_notify_enter(l->layer_surface->surface,
|
||||||
|
wlr_seat_get_keyboard(seat));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void commitlayersurfacenotify(struct wl_listener *listener, void *data) {
|
void commitlayersurfacenotify(struct wl_listener *listener, void *data) {
|
||||||
|
|
@ -4198,9 +4211,10 @@ void focusclient(Client *c, int lift) {
|
||||||
/* Deactivate old client if focus is changing */
|
/* Deactivate old client if focus is changing */
|
||||||
if (old_keyboard_focus_surface &&
|
if (old_keyboard_focus_surface &&
|
||||||
(!c || client_surface(c) != old_keyboard_focus_surface)) {
|
(!c || client_surface(c) != old_keyboard_focus_surface)) {
|
||||||
/* If an overlay is focused, don't focus or activate the client,
|
/* If an exclusive_focus layer is focused, don't focus or activate the
|
||||||
* but only update its position in fstack to render its border with
|
* client, but only update its position in fstack to render its border
|
||||||
* focuscolor and focus it after the overlay is closed. */
|
* with focuscolor and focus it after the exclusive_focus layer is
|
||||||
|
* closed. */
|
||||||
Client *w = NULL;
|
Client *w = NULL;
|
||||||
LayerSurface *l = NULL;
|
LayerSurface *l = NULL;
|
||||||
int type =
|
int type =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue