summaryrefslogtreecommitdiff
path: root/beryl-plugins/src/resize.c
diff options
context:
space:
mode:
authoronestone <onestone@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2006-11-20 13:29:41 +0000
committeronestone <onestone@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2006-11-20 13:29:41 +0000
commit1938d27eda0b7c0677b41857d13f70a7dfbdc1cc (patch)
treeb943c3951fc7b6bab862d0b975e1ee2928c9ef0a /beryl-plugins/src/resize.c
parentb98019ca056690d53b8c25e155ec10ab0fd62bf9 (diff)
downloadmarex-dev-1938d27eda0b7c0677b41857d13f70a7dfbdc1cc.tar.gz
marex-dev-1938d27eda0b7c0677b41857d13f70a7dfbdc1cc.tar.bz2
beryl-plugins: resize: fixed outline/filled outline in combination with inputzoom
git-svn-id: file:///beryl/trunk@1309 d7aaf104-2d23-0410-ae22-9d23157bf5a3
Diffstat (limited to 'beryl-plugins/src/resize.c')
-rw-r--r--beryl-plugins/src/resize.c70
1 files changed, 65 insertions, 5 deletions
diff --git a/beryl-plugins/src/resize.c b/beryl-plugins/src/resize.c
index 6893e20..8b95d01 100644
--- a/beryl-plugins/src/resize.c
+++ b/beryl-plugins/src/resize.c
@@ -149,10 +149,12 @@ typedef struct _ResizeDisplay {
typedef struct _ResizeScreen {
int grabIndex;
+ Bool wasTransformed;
PaintWindowProc paintWindow;
PreparePaintScreenProc preparePaintScreen;
PaintScreenProc paintScreen;
+ PaintTransformedScreenProc paintTransformedScreen;
DonePaintScreenProc donePaintScreen;
Cursor leftCursor;
@@ -190,8 +192,8 @@ static void resizeUpdateWindowRealSize (CompDisplay *d, int move_only)
return;
if (move_only) {
- moveWindow(rd->w, rd->currentX-rd->w->attrib.x, rd->currentY-rd->w->attrib.y, TRUE, FALSE);
- syncWindowPosition(rd->w);
+ moveWindow(rd->w, rd->currentX-rd->w->attrib.x, rd->currentY-rd->w->attrib.y, TRUE, FALSE);
+ syncWindowPosition(rd->w);
} else {
if (rd->currentX != rd->w->serverX) xwcm |= CWX;
if (rd->currentY != rd->w->serverY) xwcm |= CWY;
@@ -897,19 +899,22 @@ static Bool resizePaintScreen (CompScreen * s,
if (rd->resizeMode != ResizeModeNormal && rd->w)
mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK;
+ rs->wasTransformed = FALSE;
+
UNWRAP (rs, s, paintScreen);
status = (*s->paintScreen) (s, sAttrib, region, output, mask);
WRAP (rs, s, paintScreen, resizePaintScreen);
if (rd->resizeMode > ResizeModeStretch && rd->w &&
+ !rs->wasTransformed &&
!(rd->w->state & (CompWindowStateMaximizedVertMask |
CompWindowStateMaximizedHorzMask))) {
-
+
x1 = rd->currentX - rd->w->input.left;
x2 = rd->currentX + rd->currentWidth + rd->w->input.right;
y1 = rd->currentY - rd->w->input.top;
y2 = rd->currentY + rd->currentHeight + rd->w->input.bottom;
-
+
glPushMatrix ();
prepareXCoords(s, output, -DEFAULT_Z_CAMERA);
glDisableClientState (GL_TEXTURE_COORD_ARRAY);
@@ -940,6 +945,59 @@ static Bool resizePaintScreen (CompScreen * s,
return status;
}
+static void
+resizePaintTransformedScreen (CompScreen * s, const ScreenPaintAttrib * sa,
+ Region region, int output, unsigned int mask)
+{
+ RESIZE_SCREEN (s);
+ RESIZE_DISPLAY (s->display);
+ int x1 = 0, x2 = 0, y1 = 0, y2 = 0;
+
+ UNWRAP (rs, s, paintTransformedScreen);
+ (*s->paintTransformedScreen) (s, sa, region, output, mask);
+ WRAP (rs, s, paintTransformedScreen, resizePaintTransformedScreen);
+
+ if (rd->resizeMode > ResizeModeStretch && rd->w &&
+ !(rd->w->state & (CompWindowStateMaximizedVertMask |
+ CompWindowStateMaximizedHorzMask))) {
+
+ rs->wasTransformed = TRUE;
+
+ x1 = rd->currentX - rd->w->input.left;
+ x2 = rd->currentX + rd->currentWidth + rd->w->input.right;
+ y1 = rd->currentY - rd->w->input.top;
+ y2 = rd->currentY + rd->currentHeight + rd->w->input.bottom;
+
+ glPushMatrix ();
+ glLoadIdentity();
+ (s->applyScreenTransform) (s, sa, output);
+ prepareXCoords(s, output, -sa->zTranslate);
+ glDisableClientState (GL_TEXTURE_COORD_ARRAY);
+ glEnable (GL_BLEND);
+
+ if (rd->resizeMode == ResizeModeFilled) {
+ glColor4usv (rd->opt[RESIZE_DISPLAY_OPTION_FILL_COLOR].value.c);
+ glRecti (x1, y2, x2, y1);
+ }
+
+ /* This section draws the outline */
+ glColor4usv (rd->opt[RESIZE_DISPLAY_OPTION_BORDER_COLOR].value.c);
+ glLineWidth (2.0);
+ glBegin (GL_LINE_LOOP);
+ glVertex2i (x1, y1);
+ glVertex2i (x2, y1);
+ glVertex2i (x2, y2);
+ glVertex2i (x1, y2);
+ glEnd ();
+
+ /* Clean up */
+ glColor4usv (defaultColor);
+ glDisable (GL_BLEND);
+ glEnableClientState (GL_TEXTURE_COORD_ARRAY);
+ glPopMatrix ();
+ }
+}
+
static void resizeDonePaintScreen (CompScreen * s)
{
RESIZE_SCREEN (s);
@@ -1115,7 +1173,7 @@ static CompOption *resizeGetDisplayOptions (CompDisplay * display, int *count)
{
if (display) {
RESIZE_DISPLAY (display);
-
+
*count = NUM_OPTIONS (rd);
return rd->opt;
} else {
@@ -1216,6 +1274,7 @@ resizeInitScreen (CompPlugin *p,
WRAP (rs, s, paintWindow, resizePaintWindow);
WRAP (rs, s, preparePaintScreen, resizePreparePaintScreen);
WRAP (rs, s, paintScreen, resizePaintScreen);
+ WRAP (rs, s, paintTransformedScreen, resizePaintTransformedScreen);
WRAP (rs, s, donePaintScreen, resizeDonePaintScreen);
s->privates[rd->screenPrivateIndex].ptr = rs;
@@ -1233,6 +1292,7 @@ resizeFiniScreen (CompPlugin *p,
UNWRAP (rs, s, paintWindow);
UNWRAP (rs, s, preparePaintScreen);
UNWRAP (rs, s, paintScreen);
+ UNWRAP (rs, s, paintTransformedScreen);
UNWRAP (rs, s, donePaintScreen);
removeScreenAction (s, &rd->opt[RESIZE_DISPLAY_OPTION_INITIATE].value.action);