Compare commits

...

3 Commits

Author SHA1 Message Date
DreamMaoMao
16368a8781 opt: optimize code struct
Some checks failed
Close manually marked stale issues / close-issues (push) Has been cancelled
Lock Threads / lock (push) Has been cancelled
2025-11-28 12:49:06 +08:00
DreamMaoMao
b768f72eaa opt: allow ime in on-demand layer 2025-11-28 12:42:18 +08:00
DreamMaoMao
28ab0e6343 opt: re-judge the focus strategy of the layer when re-arrangelayer 2025-11-28 12:15:47 +08:00

View File

@@ -1557,12 +1557,19 @@ void apply_window_snap(Client *c) {
resize(c, c->geom, 0);
}
void focuslayer(LayerSurface *l) {
focusclient(NULL, 0);
dwl_im_relay_set_focus(dwl_input_method_relay, l->layer_surface->surface);
client_notify_enter(l->layer_surface->surface, wlr_seat_get_keyboard(seat));
}
void reset_exclusive_layer(Monitor *m) {
LayerSurface *l = NULL;
int i;
unsigned int layers_above_shell[] = {
ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY,
ZWLR_LAYER_SHELL_V1_LAYER_TOP,
ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM,
};
if (!m)
@@ -1570,18 +1577,24 @@ void reset_exclusive_layer(Monitor *m) {
for (i = 0; i < (int)LENGTH(layers_above_shell); i++) {
wl_list_for_each_reverse(l, &m->layers[layers_above_shell[i]], link) {
if (l == exclusive_focus &&
l->layer_surface->current.keyboard_interactive !=
ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE)
exclusive_focus = NULL;
if (l->layer_surface->current.keyboard_interactive ==
ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE &&
l->layer_surface->surface ==
seat->keyboard_state.focused_surface)
focusclient(focustop(selmon), 1);
if (locked ||
l->layer_surface->current.keyboard_interactive !=
ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE ||
!l->mapped || l == exclusive_focus)
continue;
/* Deactivate the focused client. */
focusclient(NULL, 0);
exclusive_focus = l;
dwl_im_relay_set_focus(dwl_input_method_relay,
l->layer_surface->surface);
client_notify_enter(l->layer_surface->surface,
wlr_seat_get_keyboard(seat));
focuslayer(l);
return;
}
}
@@ -1882,11 +1895,7 @@ buttonpress(struct wl_listener *listener, void *data) {
if (l && !exclusive_focus &&
l->layer_surface->current.keyboard_interactive ==
ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND) {
focusclient(NULL, 0);
dwl_im_relay_set_focus(dwl_input_method_relay,
l->layer_surface->surface);
client_notify_enter(l->layer_surface->surface,
wlr_seat_get_keyboard(seat));
focuslayer(l);
}
}
@@ -2215,9 +2224,7 @@ void maplayersurfacenotify(struct wl_listener *listener, void *data) {
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));
focuslayer(l);
}
}