summaryrefslogtreecommitdiffstats
path: root/event.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--event.c39
1 files changed, 27 insertions, 12 deletions
diff --git a/event.c b/event.c
index db95dfd..9d69373 100644
--- a/event.c
+++ b/event.c
@@ -79,7 +79,7 @@ movemouse(Client *c)
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);
@@ -93,6 +93,7 @@ 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;
@@ -113,7 +114,18 @@ resizemouse(Client *c)
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);
@@ -153,24 +165,27 @@ buttonpress(XEvent *e)
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 }
@@ -197,7 +212,7 @@ configurerequest(XEvent *e)
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;