Got questions, comments, patches, etc.?
Contact Jason Woofenden
gitweb
/
spectrwm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1b78470
)
Don't allow move and resize out of region.
author
Marco Peereboom
<marco@conformal.com>
Tue, 13 Oct 2009 17:22:42 +0000
(17:22 +0000)
committer
Marco Peereboom
<marco@conformal.com>
Tue, 13 Oct 2009 17:22:42 +0000
(17:22 +0000)
scrotwm.c
patch
|
blob
|
history
diff --git
a/scrotwm.c
b/scrotwm.c
index
2dd1d00
..
be7b57f
100644
(file)
--- a/
scrotwm.c
+++ b/
scrotwm.c
@@
-2198,6
+2198,7
@@
resize(struct ws_win *win, union arg *args)
{
XEvent ev;
Time time = 0;
{
XEvent ev;
Time time = 0;
+ struct swm_region *r = win->ws->r;
DNPRINTF(SWM_D_MOUSE, "resize: win %lu floating %d trans %d\n",
win->id, win->floating, win->transient);
DNPRINTF(SWM_D_MOUSE, "resize: win %lu floating %d trans %d\n",
win->id, win->floating, win->transient);
@@
-2219,6
+2220,14
@@
resize(struct ws_win *win, union arg *args)
handler[ev.type](&ev);
break;
case MotionNotify:
handler[ev.type](&ev);
break;
case MotionNotify:
+ /* do not allow resize outside of region */
+ if (ev.xmotion.y_root < r->g.y ||
+ ev.xmotion.y_root >= r->g.y + r->g.h - 1)
+ continue;
+ if (ev.xmotion.x_root < r->g.x ||
+ ev.xmotion.x_root >= r->g.x + r->g.w - 1)
+ continue;
+
if (ev.xmotion.x <= 1)
ev.xmotion.x = 1;
if (ev.xmotion.y <= 1)
if (ev.xmotion.x <= 1)
ev.xmotion.x = 1;
if (ev.xmotion.y <= 1)
@@
-2273,6
+2282,7
@@
move(struct ws_win *win, union arg *args)
XEvent ev;
Time time = 0;
int restack = 0;
XEvent ev;
Time time = 0;
int restack = 0;
+ struct swm_region *r = win->ws->r;
DNPRINTF(SWM_D_MOUSE, "move: win %lu floating %d trans %d\n",
win->id, win->floating, win->transient);
DNPRINTF(SWM_D_MOUSE, "move: win %lu floating %d trans %d\n",
win->id, win->floating, win->transient);
@@
-2297,6
+2307,14
@@
move(struct ws_win *win, union arg *args)
handler[ev.type](&ev);
break;
case MotionNotify:
handler[ev.type](&ev);
break;
case MotionNotify:
+ /* don't allow to move window out of region */
+ if (ev.xmotion.y_root < r->g.y ||
+ ev.xmotion.y_root + win->g.h >= r->g.y + r->g.h - 1)
+ continue;
+ if (ev.xmotion.x_root < r->g.x ||
+ ev.xmotion.x_root + win->g.w >= r->g.x + r->g.w - 1)
+ continue;
+
win->g.x = ev.xmotion.x_root;
win->g.y = ev.xmotion.y_root;
win->g.x = ev.xmotion.x_root;
win->g.y = ev.xmotion.y_root;