summaryrefslogtreecommitdiff
path: root/beryl-plugins/src/resize.c
diff options
context:
space:
mode:
authormaniac <maniac@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2006-12-13 14:30:10 +0000
committermaniac <maniac@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2006-12-13 14:30:10 +0000
commit868ace49a7c29a5d6e6803ea5643153ce7a4cb36 (patch)
tree51845f9077eb176c5874b95f3cd17d78cfb6d2f8 /beryl-plugins/src/resize.c
parent6714db3b2ce0218b14bca22a40103985fcb9227a (diff)
downloadmarex-dev-868ace49a7c29a5d6e6803ea5643153ce7a4cb36.tar.gz
marex-dev-868ace49a7c29a5d6e6803ea5643153ce7a4cb36.tar.bz2
resize plugin:
- fix resize outline being drawn on all viewports - eliminate code duplication git-svn-id: file:///beryl/trunk@1719 d7aaf104-2d23-0410-ae22-9d23157bf5a3
Diffstat (limited to 'beryl-plugins/src/resize.c')
-rw-r--r--beryl-plugins/src/resize.c148
1 files changed, 57 insertions, 91 deletions
diff --git a/beryl-plugins/src/resize.c b/beryl-plugins/src/resize.c
index 0c80565..befc67a 100644
--- a/beryl-plugins/src/resize.c
+++ b/beryl-plugins/src/resize.c
@@ -963,17 +963,66 @@ static Bool resizePaintWindow(CompWindow * w,
return status;
}
+static void resizePaintOutline (CompScreen *s, const ScreenPaintAttrib *sa, int output, Bool transformed)
+{
+ int x1 = 0, x2 = 0, y1 = 0, y2 = 0;
+
+ RESIZE_SCREEN (s);
+ RESIZE_DISPLAY (s->display);
+
+ if (rd->resizeMode > ResizeModeStretch && rd->w &&
+ !(rd->w->state & MAXIMIZE_STATE) &&
+ (!rs->wasTransformed || transformed)) {
+
+ if (transformed)
+ 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();
+
+ if (transformed) {
+ 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 Bool resizePaintScreen(CompScreen * s,
const ScreenPaintAttrib * sAttrib,
Region region, int output, unsigned int mask)
{
Bool status = FALSE;
- RESIZE_SCREEN(s);
- RESIZE_DISPLAY(s->display);
- int x1 = 0, x2 = 0, y1 = 0, y2 = 0;
- if (rd->resizeMode != ResizeModeNormal && rd->w)
- mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK;
+ RESIZE_SCREEN (s);
rs->wasTransformed = FALSE;
@@ -981,46 +1030,7 @@ static Bool resizePaintScreen(CompScreen * s,
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);
- 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();
- }
+ resizePaintOutline (s, sAttrib, output, FALSE);
return status;
}
@@ -1029,57 +1039,13 @@ 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;
+ RESIZE_SCREEN (s);
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();
- }
+ resizePaintOutline (s, sa, output, TRUE);
}
static void resizeDonePaintScreen(CompScreen * s)