This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1cce61e
commit e3306e1
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |