commit 5675787b0394de26b1d871ea7f4570165a3bb13a
parent 893b45b2ded9481d2df8be40fd88ea31721369f0
Author: dylan <dylan.araps@gmail.com>
Date: Fri, 17 Jan 2020 11:23:59 +0200
Merge pull request #46 from SeungheonOh/master
Patch: init windows
Diffstat:
1 file changed, 40 insertions(+), 0 deletions(-)
diff --git a/patches/sowm-init.patch b/patches/sowm-init.patch
@@ -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);