summaryrefslogtreecommitdiff
path: root/beryl-plugins/src/resize.c
diff options
context:
space:
mode:
authoronestone <onestone@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2006-11-30 19:39:50 +0000
committeronestone <onestone@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2006-11-30 19:39:50 +0000
commiteced035342499f251b7cc60d055b1f30f91c52aa (patch)
tree3badbf0a99ecbc86d51ec5700fc9af10d8a6c881 /beryl-plugins/src/resize.c
parent721fe0d0e0296877b23f3ad9dfd58165a487adf3 (diff)
downloadmarex-dev-eced035342499f251b7cc60d055b1f30f91c52aa.tar.gz
marex-dev-eced035342499f251b7cc60d055b1f30f91c52aa.tar.bz2
beryl-plugins: resize: fixed keyboard and window menu initiated resize. closes #69
git-svn-id: file:///beryl/trunk@1470 d7aaf104-2d23-0410-ae22-9d23157bf5a3
Diffstat (limited to 'beryl-plugins/src/resize.c')
-rw-r--r--beryl-plugins/src/resize.c32
1 files changed, 29 insertions, 3 deletions
diff --git a/beryl-plugins/src/resize.c b/beryl-plugins/src/resize.c
index a8a7669..432b003 100644
--- a/beryl-plugins/src/resize.c
+++ b/beryl-plugins/src/resize.c
@@ -133,6 +133,7 @@ typedef struct _ResizeDisplay {
int currentX;
int currentY;
int xdelta, ydelta; /* Offset when resize started */
+ Bool keyResize;
int dx_to_apply, dy_to_apply, width_to_apply, height_to_apply;
@@ -431,9 +432,11 @@ static Bool resizeInitiate (CompDisplay *d,
* will resize up and to the left. Keyboard resize starts out
* with the cursor in the middle of the window and then starts
* resizing the edge corresponding to the next key press. */
+ rd->keyResize = FALSE;
if (state & CompActionStateInitKey)
- mask = 0;
- else if (!mask) {
+ rd->keyResize = TRUE;
+
+ if (!mask) {
mask |= ((x - w->attrib.x) < (w->width / 2)) ?
ResizeLeftMask : ResizeRightMask;
@@ -574,7 +577,7 @@ static Bool resizeTerminate (CompDisplay *d,
configureXWindow (rd->w, CWX | CWY | CWWidth | CWHeight, &xwc);
resizeWindow (rd->w, rd->savedAttrib.x, rd->savedAttrib.y, rd->savedAttrib.width, rd->savedAttrib.height, rd->w->attrib.border_width);
- } else if (rd->resizeMode != ResizeModeNormal)
+ } else if (rd->resizeMode != ResizeModeNormal)
resizeUpdateWindowRealSize (d, 0);
else
syncWindowPosition (rd->w);
@@ -667,6 +670,14 @@ static void resizeHandleMotionEvent (CompScreen *s, int xRoot, int yRoot)
if (!rs->grabIndex)
return;
+ if (rd->keyResize && rd->w)
+ {
+ rd->mask = ((xRoot - rd->w->attrib.x) < (rd->w->width / 2)) ?
+ ResizeLeftMask : ResizeRightMask;
+ rd->mask |= ((yRoot - rd->w->attrib.y) < (rd->w->height / 2)) ?
+ ResizeUpMask : ResizeDownMask;
+ }
+
pointerDx = xRoot - rd->currentX;
pointerDy = yRoot - rd->currentY;
@@ -788,6 +799,21 @@ static void resizeHandleEvent (CompDisplay *d, XEvent *event)
case KeyRelease:
break;
+ case ButtonPress:
+ s = findScreenAtDisplay (d, event->xbutton.root);
+ if (s)
+ {
+ RESIZE_SCREEN (s);
+
+ if (rs->grabIndex)
+ {
+ resizeTerminate (d,
+ &rd->opt[RESIZE_DISPLAY_OPTION_INITIATE].value.action,
+ 0, NULL, 0);
+ }
+ }
+ break;
+
case ButtonRelease: {
CompAction *action =
&rd->opt[RESIZE_DISPLAY_OPTION_INITIATE].value.action;