forked from RepoMirrors/dwl
feat: apply keyboard shortcuts inhibit patch
This commit is contained in:
parent
6003a32330
commit
e4a2a5250c
22
dwl.c
22
dwl.c
@ -32,6 +32,7 @@
|
||||
#include <wlr/types/wlr_input_device.h>
|
||||
#include <wlr/types/wlr_keyboard.h>
|
||||
#include <wlr/types/wlr_keyboard_group.h>
|
||||
#include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h>
|
||||
#include <wlr/types/wlr_layer_shell_v1.h>
|
||||
#include <wlr/types/wlr_linux_dmabuf_v1.h>
|
||||
#include <wlr/types/wlr_output.h>
|
||||
@ -286,6 +287,7 @@ static void createpointer(struct wlr_pointer *pointer);
|
||||
static void createpointerconstraint(struct wl_listener *listener, void *data);
|
||||
static void createpopup(struct wl_listener *listener, void *data);
|
||||
static void cursorconstrain(struct wlr_pointer_constraint_v1 *constraint);
|
||||
static void createshortcutsinhibitor(struct wl_listener *listener, void *data);
|
||||
static void cursorframe(struct wl_listener *listener, void *data);
|
||||
static void cursorwarptohint(void);
|
||||
static void destroydecoration(struct wl_listener *listener, void *data);
|
||||
@ -299,6 +301,7 @@ static void destroypointerconstraint(struct wl_listener *listener, void *data);
|
||||
static void destroysessionlock(struct wl_listener *listener, void *data);
|
||||
static void destroysessionmgr(struct wl_listener *listener, void *data);
|
||||
static void destroykeyboardgroup(struct wl_listener *listener, void *data);
|
||||
static void destroyshortcutsinhibitmgr(struct wl_listener *listener, void *data);
|
||||
static Monitor *dirtomon(enum wlr_direction dir);
|
||||
static void dwl_ipc_manager_bind(struct wl_client *client, void *data, uint32_t version, uint32_t id);
|
||||
static void dwl_ipc_manager_destroy(struct wl_resource *resource);
|
||||
@ -421,6 +424,7 @@ static struct wlr_idle_notifier_v1 *idle_notifier;
|
||||
static struct wlr_idle_inhibit_manager_v1 *idle_inhibit_mgr;
|
||||
static struct wlr_input_inhibit_manager *input_inhibit_mgr;
|
||||
static struct wlr_drm_lease_v1_manager *drm_lease_manager;
|
||||
static struct wlr_keyboard_shortcuts_inhibit_manager_v1 *shortcuts_inhibit_mgr;
|
||||
static struct wlr_layer_shell_v1 *layer_shell;
|
||||
static struct wlr_output_manager_v1 *output_mgr;
|
||||
static struct wlr_gamma_control_manager_v1 *gamma_control_mgr;
|
||||
@ -441,6 +445,7 @@ static struct wlr_session_lock_manager_v1 *session_lock_mgr;
|
||||
static struct wlr_scene_rect *locked_bg;
|
||||
static struct wlr_session_lock_v1 *cur_lock;
|
||||
static struct wl_listener lock_listener = {.notify = locksession};
|
||||
static struct wl_listener new_shortcuts_inhibitor = {.notify = createshortcutsinhibitor};
|
||||
|
||||
static struct wlr_seat *seat;
|
||||
static KeyboardGroup *kb_group;
|
||||
@ -1269,6 +1274,10 @@ createpointer(struct wlr_pointer *pointer)
|
||||
wlr_cursor_attach_input_device(cursor, &pointer->base);
|
||||
}
|
||||
|
||||
void createshortcutsinhibitor(struct wl_listener *listener, void *data) {
|
||||
wlr_keyboard_shortcuts_inhibitor_v1_activate(data);
|
||||
}
|
||||
|
||||
void
|
||||
createpointerconstraint(struct wl_listener *listener, void *data)
|
||||
{
|
||||
@ -1475,6 +1484,11 @@ destroykeyboardgroup(struct wl_listener *listener, void *data)
|
||||
free(group);
|
||||
}
|
||||
|
||||
void destroyshortcutsinhibitmgr(struct wl_listener *listener, void *data) {
|
||||
wl_list_remove(&new_shortcuts_inhibitor.link);
|
||||
wl_list_remove(&listener->link);
|
||||
}
|
||||
|
||||
Monitor *
|
||||
dirtomon(enum wlr_direction dir)
|
||||
{
|
||||
@ -1999,7 +2013,9 @@ keypress(struct wl_listener *listener, void *data)
|
||||
|
||||
/* On _press_ if there is no active screen locker,
|
||||
* attempt to process a compositor keybinding. */
|
||||
if (!locked && event->state == WL_KEYBOARD_KEY_STATE_PRESSED) {
|
||||
if (!locked
|
||||
&& event->state == WL_KEYBOARD_KEY_STATE_PRESSED
|
||||
&& wl_list_empty(&shortcuts_inhibit_mgr->inhibitors)) {
|
||||
for (i = 0; i < nsyms; i++)
|
||||
handled = keybinding(mods, syms[i]) || handled;
|
||||
}
|
||||
@ -2946,6 +2962,10 @@ setup(void)
|
||||
(float [4]){0.1f, 0.1f, 0.1f, 1.0f});
|
||||
wlr_scene_node_set_enabled(&locked_bg->node, 0);
|
||||
|
||||
shortcuts_inhibit_mgr = wlr_keyboard_shortcuts_inhibit_v1_create(dpy);
|
||||
wl_signal_add(&shortcuts_inhibit_mgr->events.new_inhibitor, &new_shortcuts_inhibitor);
|
||||
LISTEN_STATIC(&shortcuts_inhibit_mgr->events.destroy, destroyshortcutsinhibitmgr);
|
||||
|
||||
/* Use decoration protocols to negotiate server-side decorations */
|
||||
wlr_server_decoration_manager_set_default_mode(
|
||||
wlr_server_decoration_manager_create(dpy),
|
||||
|
Loading…
Reference in New Issue
Block a user