This commit is contained in:
2025-09-29 16:06:42 +01:00
parent 908e1d39e2
commit 1c9e62f9a3
3 changed files with 26 additions and 25 deletions

View File

@@ -54,13 +54,15 @@ void cleanup(void) {
xcb_disconnect(conn);
}
// Keybind function to setup a key grab if the keycode is clicked along with the MOD key
// Keybind function to setup a key grab if the keycode is clicked along with the
// MOD key
void add_keybind(int key) {
xcb_grab_key(conn, 0, scr->root, MOD, key, XCB_GRAB_MODE_ASYNC,
XCB_GRAB_MODE_ASYNC);
}
// Mousebind function to setup a mouse button grab if the button is clicked along with the MOD key
// Mousebind function to setup a mouse button grab if the button is clicked
// along with the MOD key
void add_mousebind(int button) {
xcb_grab_button(conn, 0, scr->root,
XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE,
@@ -68,7 +70,8 @@ void add_mousebind(int button) {
button, MOD);
}
// Deploy function to initialize the X connection, set up event masks, and prepare the window manager
// Deploy function to initialize the X connection, set up event masks, and
// prepare the window manager
int deploy(void) {
uint32_t values[2];
int mask;
@@ -98,7 +101,7 @@ void free_geometry(Geometry *g) { free(g); }
// The caller is responsible for freeing the returned array
Geometry *xrandr_get_monitors(void) {
// TODO: Loop through monitors and return their geometries
return all;
// return all;
}
// Set input focus to a window
@@ -168,7 +171,8 @@ Geometry get_screen(void) {
}
// Warp the pointer to a specific position in a window
// Can be used with get_geometry to warp to a specific position in a window (eg. the center)
// Can be used with get_geometry to warp to a specific position in a window (eg.
// the center)
void warp_pointer(xcb_window_t win, int x, int y) {
xcb_warp_pointer(conn, XCB_NONE, win, 0, 0, 0, 0, x, y);
xcb_flush(conn);
@@ -304,4 +308,4 @@ Event wait_for_event(void) {
xcb_flush(conn);
free(ev);
return ret;
}
}