Mercurial > dwm-meillo
comparison event.c @ 26:e8f627998d6f
simplified several portions of code through replacing rect structs with x,y,h,w counterparts (much more readable)
author | Anselm R. Garbe <garbeam@wmii.de> |
---|---|
date | Wed, 12 Jul 2006 15:17:22 +0200 |
parents | e238dc4844d7 |
children | 8ad86d0a6a53 |
comparison
equal
deleted
inserted
replaced
25:e238dc4844d7 | 26:e8f627998d6f |
---|---|
35 [MapRequest] = maprequest, | 35 [MapRequest] = maprequest, |
36 [PropertyNotify] = propertynotify, | 36 [PropertyNotify] = propertynotify, |
37 [UnmapNotify] = unmapnotify | 37 [UnmapNotify] = unmapnotify |
38 }; | 38 }; |
39 | 39 |
40 unsigned int | 40 void |
41 discard_events(long even_mask) | 41 discard_events(long even_mask) |
42 { | 42 { |
43 XEvent ev; | 43 XEvent ev; |
44 unsigned int n = 0; | 44 while(XCheckMaskEvent(dpy, even_mask, &ev)); |
45 while(XCheckMaskEvent(dpy, even_mask, &ev)) n++; | |
46 return n; | |
47 } | 45 } |
48 | 46 |
49 static void | 47 static void |
50 buttonpress(XEvent *e) | 48 buttonpress(XEvent *e) |
51 { | 49 { |
52 XButtonPressedEvent *ev = &e->xbutton; | 50 XButtonPressedEvent *ev = &e->xbutton; |
53 Client *c; | 51 Client *c; |
54 | 52 |
55 if((c = getclient(ev->window))) { | 53 if((c = getclient(ev->window))) { |
54 raise(c); | |
56 switch(ev->button) { | 55 switch(ev->button) { |
57 default: | 56 default: |
58 break; | 57 break; |
59 case Button1: | 58 case Button1: |
60 mmove(c); | 59 mmove(c); |
61 break; | 60 break; |
62 case Button2: | 61 case Button2: |
63 XLowerWindow(dpy, c->win); | 62 lower(c); |
64 break; | 63 break; |
65 case Button3: | 64 case Button3: |
66 mresize(c); | 65 mresize(c); |
67 break; | 66 break; |
68 } | 67 } |
120 if(ev->mode != NotifyNormal || ev->detail == NotifyInferior) | 119 if(ev->mode != NotifyNormal || ev->detail == NotifyInferior) |
121 return; | 120 return; |
122 | 121 |
123 if((c = getclient(ev->window))) | 122 if((c = getclient(ev->window))) |
124 focus(c); | 123 focus(c); |
125 else if(ev->window == root) { | 124 else if(ev->window == root) |
126 sel_screen = True; | 125 sel_screen = True; |
127 /*draw_frames();*/ | |
128 } | |
129 } | 126 } |
130 | 127 |
131 static void | 128 static void |
132 leavenotify(XEvent *e) | 129 leavenotify(XEvent *e) |
133 { | 130 { |
134 XCrossingEvent *ev = &e->xcrossing; | 131 XCrossingEvent *ev = &e->xcrossing; |
135 | 132 |
136 if((ev->window == root) && !ev->same_screen) { | 133 if((ev->window == root) && !ev->same_screen) |
137 sel_screen = True; | 134 sel_screen = True; |
138 /*draw_frames();*/ | |
139 } | |
140 } | 135 } |
141 | 136 |
142 static void | 137 static void |
143 expose(XEvent *e) | 138 expose(XEvent *e) |
144 { | 139 { |