Mercurial > dwm-meillo
comparison event.c @ 99:a19556fe83b5
applied Sanders resize patch, fixed lower bug
author | arg@10ksloc.org |
---|---|
date | Wed, 19 Jul 2006 11:31:04 +0200 |
parents | 5d88952cbf96 |
children | 3e74cc981e9b |
comparison
equal
deleted
inserted
replaced
98:f08394353588 | 99:a19556fe83b5 |
---|---|
77 break; | 77 break; |
78 case MotionNotify: | 78 case MotionNotify: |
79 XSync(dpy, False); | 79 XSync(dpy, False); |
80 *c->x = ocx + (ev.xmotion.x - x1); | 80 *c->x = ocx + (ev.xmotion.x - x1); |
81 *c->y = ocy + (ev.xmotion.y - y1); | 81 *c->y = ocy + (ev.xmotion.y - y1); |
82 resize(c, False); | 82 resize(c, False, TopLeft); |
83 break; | 83 break; |
84 case ButtonRelease: | 84 case ButtonRelease: |
85 XUngrabPointer(dpy, CurrentTime); | 85 XUngrabPointer(dpy, CurrentTime); |
86 return; | 86 return; |
87 } | 87 } |
91 static void | 91 static void |
92 resizemouse(Client *c) | 92 resizemouse(Client *c) |
93 { | 93 { |
94 XEvent ev; | 94 XEvent ev; |
95 int ocx, ocy; | 95 int ocx, ocy; |
96 Corner sticky; | |
96 | 97 |
97 ocx = *c->x; | 98 ocx = *c->x; |
98 ocy = *c->y; | 99 ocy = *c->y; |
99 if(XGrabPointer(dpy, root, False, MouseMask, GrabModeAsync, GrabModeAsync, | 100 if(XGrabPointer(dpy, root, False, MouseMask, GrabModeAsync, GrabModeAsync, |
100 None, cursor[CurResize], CurrentTime) != GrabSuccess) | 101 None, cursor[CurResize], CurrentTime) != GrabSuccess) |
111 XSync(dpy, False); | 112 XSync(dpy, False); |
112 *c->w = abs(ocx - ev.xmotion.x); | 113 *c->w = abs(ocx - ev.xmotion.x); |
113 *c->h = abs(ocy - ev.xmotion.y); | 114 *c->h = abs(ocy - ev.xmotion.y); |
114 *c->x = (ocx <= ev.xmotion.x) ? ocx : ocx - *c->w; | 115 *c->x = (ocx <= ev.xmotion.x) ? ocx : ocx - *c->w; |
115 *c->y = (ocy <= ev.xmotion.y) ? ocy : ocy - *c->h; | 116 *c->y = (ocy <= ev.xmotion.y) ? ocy : ocy - *c->h; |
116 resize(c, True); | 117 if(ocx <= ev.xmotion.x) { |
118 if(ocy <= ev.xmotion.y) | |
119 sticky = TopLeft; | |
120 else | |
121 sticky = BottomLeft; | |
122 } else { | |
123 if(ocy <= ev.xmotion.y) | |
124 sticky = TopRight; | |
125 else | |
126 sticky = BottomRight; | |
127 } | |
128 resize(c, True, sticky); | |
117 break; | 129 break; |
118 case ButtonRelease: | 130 case ButtonRelease: |
119 XUngrabPointer(dpy, CurrentTime); | 131 XUngrabPointer(dpy, CurrentTime); |
120 return; | 132 return; |
121 } | 133 } |
151 view(&a); | 163 view(&a); |
152 break; | 164 break; |
153 } | 165 } |
154 } | 166 } |
155 else if((c = getclient(ev->window))) { | 167 else if((c = getclient(ev->window))) { |
156 if(arrange == dotile && !c->isfloat) { | |
157 if((ev->state & ControlMask) && (ev->button == Button1)) | |
158 zoom(NULL); | |
159 return; | |
160 } | |
161 /* floating windows */ | |
162 higher(c); | |
163 switch(ev->button) { | 168 switch(ev->button) { |
164 default: | 169 default: |
165 break; | 170 break; |
166 case Button1: | 171 case Button1: |
167 movemouse(c); | 172 if(arrange == dotile && !c->isfloat) { |
173 if((ev->state & ControlMask) && (ev->button == Button1)) | |
174 zoom(NULL); | |
175 } | |
176 else { | |
177 higher(c); | |
178 movemouse(c); | |
179 } | |
168 break; | 180 break; |
169 case Button2: | 181 case Button2: |
170 lower(c); | 182 lower(c); |
171 break; | 183 break; |
172 case Button3: | 184 case Button3: |
173 resizemouse(c); | 185 if(arrange == dofloat || c->isfloat) { |
186 higher(c); | |
187 resizemouse(c); | |
188 } | |
174 break; | 189 break; |
175 } | 190 } |
176 } | 191 } |
177 } | 192 } |
178 | 193 |
195 if(ev->value_mask & CWHeight) | 210 if(ev->value_mask & CWHeight) |
196 *c->h = ev->height; | 211 *c->h = ev->height; |
197 if(ev->value_mask & CWBorderWidth) | 212 if(ev->value_mask & CWBorderWidth) |
198 c->border = 1; | 213 c->border = 1; |
199 gravitate(c, False); | 214 gravitate(c, False); |
200 resize(c, True); | 215 resize(c, True, TopLeft); |
201 } | 216 } |
202 | 217 |
203 wc.x = ev->x; | 218 wc.x = ev->x; |
204 wc.y = ev->y; | 219 wc.y = ev->y; |
205 wc.width = ev->width; | 220 wc.width = ev->width; |