diff options
| author | Anselm R. Garbe <garbeam@wmii.de> | 2006-07-11 21:24:10 +0200 |
|---|---|---|
| committer | Anselm R. Garbe <garbeam@wmii.de> | 2006-07-11 21:24:10 +0200 |
| commit | b9da4b082eb658b4142b61c149212f414f7653b6 (patch) | |
| tree | 146a4e480866d1497c3ec3ccf2b71305b07a5f03 /event.c | |
| parent | updated README (diff) | |
| download | dwm-b9da4b082eb658b4142b61c149212f414f7653b6.tar.gz dwm-b9da4b082eb658b4142b61c149212f414f7653b6.zip | |
added mouse-based resizals
Diffstat (limited to 'event.c')
| -rw-r--r-- | event.c | 30 |
1 files changed, 27 insertions, 3 deletions
| @@ -12,6 +12,7 @@ | |||
| 12 | #include "wm.h" | 12 | #include "wm.h" |
| 13 | 13 | ||
| 14 | /* local functions */ | 14 | /* local functions */ |
| 15 | static void buttonpress(XEvent *e); | ||
| 15 | static void configurerequest(XEvent *e); | 16 | static void configurerequest(XEvent *e); |
| 16 | static void destroynotify(XEvent *e); | 17 | static void destroynotify(XEvent *e); |
| 17 | static void enternotify(XEvent *e); | 18 | static void enternotify(XEvent *e); |
| @@ -23,6 +24,7 @@ static void propertynotify(XEvent *e); | |||
| 23 | static void unmapnotify(XEvent *e); | 24 | static void unmapnotify(XEvent *e); |
| 24 | 25 | ||
| 25 | void (*handler[LASTEvent]) (XEvent *) = { | 26 | void (*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 | ||
| 38 | unsigned int | 40 | unsigned int |
| 39 | flush_events(long even_mask) | 41 | discard_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 | ||
| 47 | static void | 49 | static void |
| 50 | buttonpress(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 | |||
| 72 | static void | ||
| 48 | configurerequest(XEvent *e) | 73 | configurerequest(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) |
