commit 4ef0fde5bcae5ec088f04b0c90e67533e3789a94
parent aefe37bd3296210b82ed62bfd06f36a35e4b6214
Author: Kebigon <git@kebigon.xyz>
Date: Sun, 15 Aug 2021 15:13:05 +0900
Removed root variable, use screen->root instead
Diffstat:
5 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/client.c b/client.c
@@ -319,7 +319,7 @@ void client_grab_buttons(struct client *client, bool focused)
if (!focused)
{
xcb_grab_button(c, 1, client->id, BUTTON_EVENT_MASK, XCB_GRAB_MODE_ASYNC,
- XCB_GRAB_MODE_ASYNC, root, XCB_NONE, XCB_BUTTON_INDEX_ANY,
+ XCB_GRAB_MODE_ASYNC, screen->root, XCB_NONE, XCB_BUTTON_INDEX_ANY,
XCB_MOD_MASK_ANY);
}
@@ -335,7 +335,7 @@ void client_grab_buttons(struct client *client, bool focused)
for (uint_fast8_t j = 0; j != LENGTH(modifiers); j++)
{
xcb_grab_button(c, 0, client->id, BUTTON_EVENT_MASK, XCB_GRAB_MODE_ASYNC,
- XCB_GRAB_MODE_ASYNC, root, XCB_NONE, button.keysym,
+ XCB_GRAB_MODE_ASYNC, screen->root, XCB_NONE, button.keysym,
button.modifiers | modifiers[j]);
}
}
diff --git a/events.c b/events.c
@@ -112,7 +112,7 @@ static void handle_motion_notify(xcb_generic_event_t *e)
assert(focused != NULL);
struct client *client = focused->data;
- assert(client->id != root);
+ assert(client->id != screen->root);
if (client->maximized)
client_unmaximize(client);
@@ -299,7 +299,7 @@ void setup_events()
uint32_t values[] = {XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | XCB_EVENT_MASK_STRUCTURE_NOTIFY |
XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY};
- xcb_change_window_attributes_checked(c, root, XCB_CW_EVENT_MASK, values);
+ xcb_change_window_attributes_checked(c, screen->root, XCB_CW_EVENT_MASK, values);
for (uint_fast8_t i = 0; i != keys_length; i++)
xcb_register_key_events(keys[i]);
diff --git a/kbgwm.c b/kbgwm.c
@@ -38,7 +38,6 @@ bool running = true;
bool moving = false;
bool resizing = false;
xcb_connection_t *c;
-xcb_window_t root;
xcb_screen_t *screen;
uint_least16_t previous_x;
uint_least16_t previous_y;
@@ -343,8 +342,6 @@ int main(void)
exit(1);
}
- root = screen->root;
-
xcb_flush(c);
/*
diff --git a/kbgwm.h b/kbgwm.h
@@ -41,7 +41,6 @@ extern bool running;
extern bool moving;
extern bool resizing;
extern xcb_connection_t *c;
-extern xcb_window_t root;
extern xcb_screen_t *screen;
extern uint_least16_t previous_x;
extern uint_least16_t previous_y;
diff --git a/xcbutils.c b/xcbutils.c
@@ -27,7 +27,7 @@
#include "log.h"
extern xcb_connection_t *c;
-extern xcb_window_t root;
+extern xcb_screen_t *screen;
extern uint16_t numlockmask;
extern xcb_atom_t wm_protocols;
@@ -63,8 +63,8 @@ void xcb_register_key_events(struct Key key)
for (int i = 0; (keycode = keycodes[i]) != XCB_NO_SYMBOL; i++)
{
for (int j = 0; j != LENGTH(modifiers); j++)
- xcb_grab_key(c, 1, root, key.modifiers | modifiers[j], keycode, XCB_GRAB_MODE_ASYNC,
- XCB_GRAB_MODE_ASYNC);
+ xcb_grab_key(c, 1, screen->root, key.modifiers | modifiers[j], keycode,
+ XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC);
}
free(keycodes);