summaryrefslogtreecommitdiff
path: root/schewm.c
diff options
context:
space:
mode:
Diffstat (limited to 'schewm.c')
-rw-r--r--schewm.c42
1 files changed, 25 insertions, 17 deletions
diff --git a/schewm.c b/schewm.c
index 126ab2f..4a3811a 100644
--- a/schewm.c
+++ b/schewm.c
@@ -465,6 +465,7 @@ typedef void (*generic_event_handler_t)(xcb_generic_event_t *);
static struct {
uint32_t cur_workspace, num_workspaces;
bool is_running;
+ uint16_t mod_key;
struct Client *focus;
struct ClientsMap *clients;
struct Workspace *workspaces;
@@ -1778,6 +1779,29 @@ wm_fit_client(struct Client *client) {
return should_move || should_resize;
}
+void
+wm_set_mod_key(uint16_t mod) {
+ wm.mod_key = mod;
+}
+
+uint16_t
+wm_get_mod_key(bool with_shift) {
+ if (with_shift) {
+ return wm.mod_key | MOD_SHIFT;
+ }
+ return wm.mod_key;
+}
+
+void
+wm_grab_key_with_mod(xcb_keysym_t keysym) {
+ dpy_grab_key(wm_get_mod_key(false), keysym);
+}
+
+void
+wm_grab_key_with_mod_shift(xcb_keysym_t keysym) {
+ dpy_grab_key(wm_get_mod_key(true), keysym);
+}
+
/*
* event handlers which take a generic event and know what to cast it into.
*/
@@ -1879,8 +1903,7 @@ wm_init() {
dpy_update_window_list(wm.clients);
wm_set_workspace(wm.cur_workspace);
- // grab_keys();
- dpy_grab_key(XCB_MOD_MASK_ANY, XK_q);
+ wm.mod_key = MOD_META;
dpy_flush();
memset(wm.events, 0, sizeof(wm.events));
@@ -1930,21 +1953,6 @@ wm_run() {
wm_destroy();
}
-static uint16_t mod_key = MOD_META;
-
-void
-wm_set_mod_key(uint16_t mod) {
- mod_key = mod;
-}
-
-uint16_t
-wm_get_mod_key(bool with_shift) {
- if (with_shift) {
- return mod_key | MOD_SHIFT;
- }
- return mod_key;
-}
-
/*
* NOTE:
* Don't do the thing below. Create hooks for relevant stuff the user