summaryrefslogtreecommitdiffstats
path: root/event.c
diff options
context:
space:
mode:
authorAnselm R. Garbe <garbeam@wmii.de>2006-07-11 21:24:10 +0200
committerAnselm R. Garbe <garbeam@wmii.de>2006-07-11 21:24:10 +0200
commitb9da4b082eb658b4142b61c149212f414f7653b6 (patch)
tree146a4e480866d1497c3ec3ccf2b71305b07a5f03 /event.c
parentupdated README (diff)
downloaddwm-b9da4b082eb658b4142b61c149212f414f7653b6.tar.gz
dwm-b9da4b082eb658b4142b61c149212f414f7653b6.zip
added mouse-based resizals
Diffstat (limited to 'event.c')
-rw-r--r--event.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/event.c b/event.c
index 344a0cc..ad4a16b 100644
--- a/event.c
+++ b/event.c
@@ -12,6 +12,7 @@
12#include "wm.h" 12#include "wm.h"
13 13
14/* local functions */ 14/* local functions */
15static void buttonpress(XEvent *e);
15static void configurerequest(XEvent *e); 16static void configurerequest(XEvent *e);
16static void destroynotify(XEvent *e); 17static void destroynotify(XEvent *e);
17static void enternotify(XEvent *e); 18static void enternotify(XEvent *e);
@@ -23,6 +24,7 @@ static void propertynotify(XEvent *e);
23static void unmapnotify(XEvent *e); 24static void unmapnotify(XEvent *e);
24 25
25void (*handler[LASTEvent]) (XEvent *) = { 26void (*handler[LASTEvent]) (XEvent *) = {
27 [ButtonPress] = buttonpress,
26 [ConfigureRequest] = configurerequest, 28 [ConfigureRequest] = configurerequest,
27 [DestroyNotify] = destroynotify, 29 [DestroyNotify] = destroynotify,
28 [EnterNotify] = enternotify, 30 [EnterNotify] = enternotify,
@@ -36,7 +38,7 @@ void (*handler[LASTEvent]) (XEvent *) = {
36}; 38};
37 39
38unsigned int 40unsigned int
39flush_events(long even_mask) 41discard_events(long even_mask)
40{ 42{
41 XEvent ev; 43 XEvent ev;
42 unsigned int n = 0; 44 unsigned int n = 0;
@@ -45,15 +47,37 @@ flush_events(long even_mask)
45} 47}
46 48
47static void 49static void
50buttonpress(XEvent *e)
51{
52 XButtonPressedEvent *ev = &e->xbutton;
53 Client *c;
54
55 if((c = getclient(ev->window))) {
56 switch(ev->button) {
57 default:
58 break;
59 case Button1:
60 mmove(c);
61 break;
62 case Button2:
63 XLowerWindow(dpy, c->win);
64 break;
65 case Button3:
66 mresize(c);
67 break;
68 }
69 }
70}
71
72static void
48configurerequest(XEvent *e) 73configurerequest(XEvent *e)
49{ 74{
50 XConfigureRequestEvent *ev = &e->xconfigurerequest; 75 XConfigureRequestEvent *ev = &e->xconfigurerequest;
51 XWindowChanges wc; 76 XWindowChanges wc;
52 Client *c; 77 Client *c;
53 78
54 c = getclient(ev->window);
55 ev->value_mask &= ~CWSibling; 79 ev->value_mask &= ~CWSibling;
56 if(c) { 80 if((c = getclient(ev->window))) {
57 if(ev->value_mask & CWX) 81 if(ev->value_mask & CWX)
58 c->r[RFloat].x = ev->x; 82 c->r[RFloat].x = ev->x;
59 if(ev->value_mask & CWY) 83 if(ev->value_mask & CWY)