aboutsummaryrefslogtreecommitdiff
path: root/dminiwm.c
diff options
context:
space:
mode:
Diffstat (limited to 'dminiwm.c')
-rw-r--r--dminiwm.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/dminiwm.c b/dminiwm.c
index 1c1b0ff..22cbd9d 100644
--- a/dminiwm.c
+++ b/dminiwm.c
@@ -1,4 +1,8 @@
+<<<<<<< HEAD
/* dminiwm.c [ 0.1.7 ]
+=======
+/* dminiwm.c [ 0.1.8 ]
+>>>>>>> mirror
*
* I started this from catwm 31/12/10
* Bad window error checking and numlock checking used from
@@ -97,6 +101,7 @@ static const AtomNode atomList[] = {
// Functions
static void add_window(Window w);
+static void buttonpressed(XEvent *e);
static void change_desktop(const Arg arg);
static void client_to_desktop(const Arg arg);
static void configurenotify(XEvent *e);
@@ -161,6 +166,7 @@ static void (*events[LASTEvent])(XEvent *e) = {
[KeyPress] = keypress,
[MapRequest] = maprequest,
[EnterNotify] = enternotify,
+ [ButtonPress] = buttonpressed,
[DestroyNotify] = destroynotify,
[ConfigureNotify] = configurenotify,
[ConfigureRequest] = configurerequest
@@ -571,9 +577,14 @@ void update_current() {
XSetWindowBorder(dis,c->win,win_focus);
XSetInputFocus(dis,c->win,RevertToParent,CurrentTime);
XRaiseWindow(dis,c->win);
+ if(CLICK_TO_FOCUS == 0)
+ XUngrabButton(dis, AnyButton, AnyModifier, c->win);
}
- else
+ else {
XSetWindowBorder(dis,c->win,win_unfocus);
+ if(CLICK_TO_FOCUS == 0)
+ XGrabButton(dis, AnyButton, AnyModifier, c->win, True, ButtonPressMask|ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, None);
+ }
}
XSync(dis, False);
}
@@ -805,6 +816,20 @@ void enternotify(XEvent *e) {
}
}
+void buttonpressed(XEvent *e) {
+ client *c;
+ XButtonPressedEvent *ev = &e->xbutton;
+
+ // change focus with LMB
+ if(CLICK_TO_FOCUS == 0 && ev->window != current->win && ev->button == Button1)
+ for(c=head;c;c=c->next)
+ if(ev->window == c->win) {
+ current = c;
+ update_current();
+ return;
+ }
+}
+
void send_kill_signal(Window w) {
XEvent ke;
ke.type = ClientMessage;