opt: optimize code struct
This commit is contained in:
24
src/mango.c
24
src/mango.c
@@ -1557,6 +1557,12 @@ 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;
|
||||
@@ -1587,12 +1593,8 @@ void reset_exclusive_layer(Monitor *m) {
|
||||
!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;
|
||||
}
|
||||
}
|
||||
@@ -1893,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2226,11 +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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user