Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Patch: init windows
Browse files Browse the repository at this point in the history
  • Loading branch information
SeungheonOh committed Jan 16, 2020
1 parent 1cce61e commit e3306e1
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions patches/sowm-init.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
diff --git a/sowm.c b/sowm.c
index 6b9f794..a5bad10 100644
--- a/sowm.c
+++ b/sowm.c
@@ -28,6 +28,7 @@ typedef struct client {
Window w;
} client;

+static void init();
static void button_press(XEvent *e);
static void button_release();
static void configure_request(XEvent *e);
@@ -76,6 +77,18 @@ static void (*events[LASTEvent])(XEvent *e) = {
XGetGeometry(d, W, &(Window){0}, gx, gy, gw, gh, \
&(unsigned int){0}, &(unsigned int){0})

+void init() {
+ Window *child;
+ unsigned int nchild;
+ XQueryTree(d, RootWindow(d, DefaultScreen(d)), &(Window){0},
+ &(Window){0}, &child, &nchild);
+ for(unsigned int i = 0; i < nchild; i++) {
+ XSelectInput(d, child[i], StructureNotifyMask|EnterWindowMask);
+ XMapWindow(d, child[i]);
+ win_add(child[i]);
+ }
+}
+
void win_focus(client *c) {
cur = c;
XSetInputFocus(d, cur->w, RevertToParent, CurrentTime);
@@ -290,6 +303,8 @@ int main(void) {
XSelectInput(d, root, SubstructureRedirectMask);
XDefineCursor(d, root, XCreateFontCursor(d, 68));

+ init();
+
for (unsigned int i=0; i < sizeof(keys)/sizeof(*keys); ++i)
XGrabKey(d, XKeysymToKeycode(d, keys[i].keysym), keys[i].mod,
root, True, GrabModeAsync, GrabModeAsync);

0 comments on commit e3306e1

Please sign in to comment.