summaryrefslogtreecommitdiff
path: root/beryl-plugins/src/resize.c
diff options
context:
space:
mode:
authormaniac <maniac@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-01-26 09:02:11 +0000
committermaniac <maniac@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-01-26 09:02:11 +0000
commit1a2f3fb89b00484a263a7b1eb7fbf437a373faa1 (patch)
tree2f7fe31b3fc450a51dac8047e21c2b85928d5ede /beryl-plugins/src/resize.c
parentd34a9861e77727d7062ac4495a274312ec4fa6b2 (diff)
downloadmarex-dev-1a2f3fb89b00484a263a7b1eb7fbf437a373faa1.tar.gz
marex-dev-1a2f3fb89b00484a263a7b1eb7fbf437a373faa1.tar.bz2
resize plugin:
- don't ungrab before resize finished - fixes strange looking water waves when using (filled) outline/stretch modes group plugin: - removed kludgy workaround for the old (broken) resize behaviour git-svn-id: file:///beryl/trunk@3157 d7aaf104-2d23-0410-ae22-9d23157bf5a3
Diffstat (limited to 'beryl-plugins/src/resize.c')
-rw-r--r--beryl-plugins/src/resize.c80
1 files changed, 49 insertions, 31 deletions
diff --git a/beryl-plugins/src/resize.c b/beryl-plugins/src/resize.c
index af58142..c467927 100644
--- a/beryl-plugins/src/resize.c
+++ b/beryl-plugins/src/resize.c
@@ -149,6 +149,7 @@ typedef struct _ResizeDisplay
GLushort opacifyMinOpacity;
int resizeMode;
+ Bool ungrabPending;
GLushort border[4];
GLushort fill[4];
@@ -616,13 +617,15 @@ resizeTerminate(CompDisplay * d,
xwc.height = rd->savedAttrib.height;
configureXWindow(rd->w, CWX | CWY | CWWidth | CWHeight, &xwc);
- }
- else if (rd->resizeMode != ResizeModeNormal)
+
+ rd->ungrabPending = TRUE;
+ } else if (rd->resizeMode != ResizeModeNormal) {
+ rd->ungrabPending = TRUE;
resizeUpdateWindowRealSize(d, 0);
- else
+ } else {
syncWindowPosition(rd->w);
-
- (rd->w->screen->windowUngrabNotify) (rd->w);
+ (rd->w->screen->windowUngrabNotify) (rd->w);
+ }
if (rs->grabIndex)
{
@@ -635,7 +638,9 @@ resizeTerminate(CompDisplay * d,
if (rd->resizeMode != ResizeModeNormal)
damageScreen(rd->w->screen);
- rd->w = 0;
+ if (!rd->ungrabPending)
+ rd->w = NULL;
+
rd->releaseButton = 0;
return FALSE;
@@ -921,6 +926,21 @@ static void resizeHandleEvent(CompDisplay * d, XEvent * event)
UNWRAP(rd, d, handleEvent);
(*d->handleEvent) (d, event);
WRAP(rd, d, handleEvent, resizeHandleEvent);
+
+ switch (event->type) {
+ case ConfigureNotify:
+ if (rd->ungrabPending) {
+ if (rd->w && (rd->w->id == event->xconfigure.window)) {
+ (rd->w->screen->windowUngrabNotify) (rd->w);
+ rd->w = 0;
+ }
+ rd->ungrabPending = FALSE;
+ }
+ break;
+
+ default:
+ break;
+ }
}
static void resizePreparePaintScreen(CompScreen * s, int msSinceLastPaint)
@@ -930,6 +950,7 @@ static void resizePreparePaintScreen(CompScreen * s, int msSinceLastPaint)
RESIZE_DISPLAY(s->display);
if (rd->w && rd->resizeMode > ResizeModeNormal &&
+ rs->grabIndex &&
(rd->lastWidth != rd->currentWidth ||
rd->lastHeight != rd->currentHeight))
{
@@ -951,35 +972,31 @@ resizePaintWindow(CompWindow * w,
Bool status;
RESIZE_SCREEN(s);
+ RESIZE_DISPLAY(s->display);
- if (rs->grabIndex)
+ if ((rs->grabIndex || rd->ungrabPending) && (rd->w == w))
{
- RESIZE_DISPLAY(s->display);
+ sAttrib = *attrib;
- if (rd->w == w)
- {
- sAttrib = *attrib;
-
- if (rd->resizeMode != ResizeModeNormal)
- mask |= PAINT_WINDOW_TRANSFORMED_MASK;
+ if (rd->resizeMode != ResizeModeNormal)
+ mask |= PAINT_WINDOW_TRANSFORMED_MASK;
- if (rd->resizeMode == ResizeModeStretch)
- {
- sAttrib.xScale =
- (float)(rd->currentWidth) /
- (float)(rd->w->serverWidth);
- sAttrib.yScale =
- (float)(rd->currentHeight) /
- (float)(rd->w->serverHeight);
- }
+ if (rd->resizeMode == ResizeModeStretch)
+ {
+ sAttrib.xScale =
+ (float)(rd->currentWidth) /
+ (float)(rd->w->attrib.width);
+ sAttrib.yScale =
+ (float)(rd->currentHeight) /
+ (float)(rd->w->attrib.height);
+ }
- if (rd->resizeOpacity != OPAQUE
- && sAttrib.opacity >= rd->opacifyMinOpacity)
- {
- sAttrib.opacity = (sAttrib.opacity * rd->resizeOpacity) >> 16;
- }
- attrib = &sAttrib;
+ if (rd->resizeOpacity != OPAQUE
+ && sAttrib.opacity >= rd->opacifyMinOpacity)
+ {
+ sAttrib.opacity = (sAttrib.opacity * rd->resizeOpacity) >> 16;
}
+ attrib = &sAttrib;
}
UNWRAP(rs, s, paintWindow);
@@ -1059,7 +1076,7 @@ resizePaintScreen(CompScreen * s,
RESIZE_SCREEN(s);
RESIZE_DISPLAY(s->display);
- if (rd->w && rd->resizeMode == ResizeModeStretch)
+ if (rd->w && rs->grabIndex && rd->resizeMode == ResizeModeStretch)
mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK;
rs->wasTransformed = FALSE;
@@ -1092,7 +1109,7 @@ static void resizeDonePaintScreen(CompScreen * s)
RESIZE_SCREEN(s);
RESIZE_DISPLAY(s->display);
- if (rd->resizeMode != ResizeModeNormal && rd->w)
+ if (rd->resizeMode != ResizeModeNormal && rd->w && rs->grabIndex)
{
rd->lastWidth = rd->currentWidth;
rd->lastHeight = rd->currentHeight;
@@ -1341,6 +1358,7 @@ static Bool resizeInitDisplay(CompPlugin * p, CompDisplay * d)
resizeDisplayInitOptions(rd);
rd->w = 0;
+ rd->ungrabPending = FALSE;
rd->releaseButton = 0;