[beryl-commits] compiz mirror: Changes to 'master' (a8cc416007443038c998f022aa07fcb11eef87be)
compiz at server.beryl-project.org
compiz at server.beryl-project.org
Wed Jun 6 00:36:21 CEST 2007
New commits:
commit a8cc416007443038c998f022aa07fcb11eef87be
Author: David Reveman <davidr at novell.com>
Date: Tue Jun 5 18:33:41 2007 -0400
Allow plugins to hook into scalePaintDecoration.
commit 82d388847151a7aa902a18bb66ba1aa3f537245f
Author: David Reveman <davidr at novell.com>
Date: Tue Jun 5 18:28:27 2007 -0400
Move scale icon rendering into function.
commit fd3216b808defb54f2b9ad95750fd641953d85b0
Author: David Reveman <davidr at novell.com>
Date: Tue Jun 5 18:15:30 2007 -0400
Clean up.
commit ac69a39da0a3ce259b1960caf9bc4694c5e811db
Author: David Reveman <davidr at novell.com>
Date: Tue Jun 5 18:12:53 2007 -0400
Clean up.
commit 6ea14ef6b2db795d91b341b026a06cb01e9da501
Author: David Reveman <davidr at novell.com>
Date: Tue Jun 5 18:07:52 2007 -0400
Allow plugins to hook into layoutSlotsAndAssignWindows.
commit 040017b703afd2cafae4df1036fed1195c31e5bc
Author: David Reveman <davidr at novell.com>
Date: Tue Jun 5 18:00:53 2007 -0400
Create layoutSlotsAndAssignWindows function.
commit 97bfcbd391ff93da78ca7fc9643a4efaad47259c
Author: David Reveman <davidr at novell.com>
Date: Tue Jun 5 17:51:01 2007 -0400
Add ABI and INDEX options to scale plugin.
commit 021a696d8f00e8f35066c7ca69e5ed34bf4642f7
Author: David Reveman <davidr at novell.com>
Date: Tue Jun 5 17:42:18 2007 -0400
Add pkg-config file for scale plugin.
commit 27a1b59b3aaf282c9da47c9cbdec691d5fe8dcfd
Author: David Reveman <davidr at novell.com>
Date: Tue Jun 5 17:39:17 2007 -0400
Add scale.h.
Makefile.am | 3 +-
compiz-scale.pc.in | 12 ++
configure.ac | 1 +
include/Makefile.am | 3 +-
include/scale.h | 171 ++++++++++++++++++
metadata/scale.xml.in | 2 +
plugins/scale.c | 469 ++++++++++++++++++++-----------------------------
7 files changed, 379 insertions(+), 282 deletions(-)
create mode 100644 compiz-scale.pc.in
create mode 100644 include/scale.h
Modified: compiz/Makefile.am
===================================================================
--- compiz/Makefile.am
+++ compiz/Makefile.am
@@ -7,6 +7,7 @@ EXTRA_DIST = \
COPYING.MIT \
compiz.pc.in \
compiz-cube.pc.in \
+ compiz-scale.pc.in \
compiz-gconf.pc.in \
intltool-extract.in \
intltool-merge.in \
@@ -22,4 +23,4 @@ gconfdata = compiz-gconf.pc
endif
pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = compiz.pc compiz-cube.pc $(gconfdata)
+pkgconfig_DATA = compiz.pc compiz-cube.pc compiz-scale.pc $(gconfdata)
Modified: compiz/compiz-scale.pc.in
new file mode 100644
===================================================================
--- /dev/null
+++ compiz/compiz-scale.pc.in
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: compiz-scale
+Description: Scale plugin for compiz
+Version: @VERSION@
+
+Requires: @COMPIZ_REQUIRES@
+Libs:
+Cflags: @COMPIZ_CFLAGS@ @GL_CFLAGS@ -I${includedir}/compiz
\ No newline at end of file
Modified: compiz/configure.ac
===================================================================
--- compiz/configure.ac
+++ compiz/configure.ac
@@ -449,6 +449,7 @@ fi
AC_OUTPUT([
compiz.pc
compiz-cube.pc
+compiz-scale.pc
compiz-gconf.pc
Makefile
src/Makefile
Modified: compiz/include/Makefile.am
===================================================================
--- compiz/include/Makefile.am
+++ compiz/include/Makefile.am
@@ -2,4 +2,5 @@ compizincludedir = $(includedir)/compiz
compizinclude_HEADERS = \
compiz.h \
decoration.h \
- cube.h
+ cube.h \
+ scale.h
Modified: compiz/include/scale.h
new file mode 100644
===================================================================
--- /dev/null
+++ compiz/include/scale.h
@@ -0,0 +1,171 @@
+/*
+ * Copyright © 2007 Novell, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Novell, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * Novell, Inc. makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr at novell.com>
+ */
+
+#include <compiz.h>
+
+#define SCALE_ABIVERSION 20070605
+
+#define SCALE_STATE_NONE 0
+#define SCALE_STATE_OUT 1
+#define SCALE_STATE_WAIT 2
+#define SCALE_STATE_IN 3
+
+#define SCALE_ICON_NONE 0
+#define SCALE_ICON_EMBLEM 1
+#define SCALE_ICON_BIG 2
+#define SCALE_ICON_LAST SCALE_ICON_BIG
+
+typedef struct _ScaleSlot {
+ int x1, y1, x2, y2;
+ int filled;
+ float scale;
+} ScaleSlot;
+
+#define SCALE_DISPLAY_OPTION_ABI 0
+#define SCALE_DISPLAY_OPTION_INDEX 1
+#define SCALE_DISPLAY_OPTION_INITIATE 2
+#define SCALE_DISPLAY_OPTION_INITIATE_ALL 3
+#define SCALE_DISPLAY_OPTION_INITIATE_GROUP 4
+#define SCALE_DISPLAY_OPTION_INITIATE_OUTPUT 5
+#define SCALE_DISPLAY_OPTION_SHOW_DESKTOP 6
+#define SCALE_DISPLAY_OPTION_NUM 7
+
+typedef struct _ScaleDisplay {
+ int screenPrivateIndex;
+ HandleEventProc handleEvent;
+
+ CompOption opt[SCALE_DISPLAY_OPTION_NUM];
+
+ unsigned int lastActiveNum;
+ Window lastActiveWindow;
+ Window selectedWindow;
+ KeyCode leftKeyCode, rightKeyCode, upKeyCode, downKeyCode;
+} ScaleDisplay;
+
+#define SCALE_SCREEN_OPTION_SPACING 0
+#define SCALE_SCREEN_OPTION_SPEED 1
+#define SCALE_SCREEN_OPTION_TIMESTEP 2
+#define SCALE_SCREEN_OPTION_WINDOW_MATCH 3
+#define SCALE_SCREEN_OPTION_DARKEN_BACK 4
+#define SCALE_SCREEN_OPTION_OPACITY 5
+#define SCALE_SCREEN_OPTION_ICON 6
+#define SCALE_SCREEN_OPTION_HOVER_TIME 7
+#define SCALE_SCREEN_OPTION_NUM 8
+
+typedef enum {
+ ScaleTypeNormal = 0,
+ ScaleTypeOutput,
+ ScaleTypeGroup,
+ ScaleTypeAll
+} ScaleType;
+
+typedef Bool (*ScaleLayoutSlotsAndAssignWindowsProc) (CompScreen *s);
+
+typedef void (*ScalePaintDecorationProc) (CompWindow *w,
+ const WindowPaintAttrib *attrib,
+ const CompTransform *transform,
+ Region region,
+ unsigned int mask);
+
+typedef struct _ScaleScreen {
+ int windowPrivateIndex;
+
+ PreparePaintScreenProc preparePaintScreen;
+ DonePaintScreenProc donePaintScreen;
+ PaintOutputProc paintOutput;
+ PaintWindowProc paintWindow;
+ DamageWindowRectProc damageWindowRect;
+
+ ScaleLayoutSlotsAndAssignWindowsProc layoutSlotsAndAssignWindows;
+ ScalePaintDecorationProc scalePaintDecoration;
+
+ CompOption opt[SCALE_SCREEN_OPTION_NUM];
+
+ Bool grab;
+ int grabIndex;
+
+ Window dndTarget;
+
+ CompTimeoutHandle hoverHandle;
+
+ int state;
+ int moreAdjust;
+
+ Cursor cursor;
+
+ ScaleSlot *slots;
+ int slotsSize;
+ int nSlots;
+
+ /* only used for sorting */
+ CompWindow **windows;
+ int windowsSize;
+ int nWindows;
+
+ GLushort opacity;
+
+ ScaleType type;
+
+ Window clientLeader;
+
+ CompMatch match;
+ CompMatch *currentMatch;
+} ScaleScreen;
+
+typedef struct _ScaleWindow {
+ ScaleSlot *slot;
+
+ int sid;
+ int distance;
+
+ GLfloat xVelocity, yVelocity, scaleVelocity;
+ GLfloat scale;
+ GLfloat tx, ty;
+ float delta;
+ Bool adjust;
+
+ float lastThumbOpacity;
+} ScaleWindow;
+
+#define GET_SCALE_DISPLAY(d) \
+ ((ScaleDisplay *) (d)->privates[displayPrivateIndex].ptr)
+
+#define SCALE_DISPLAY(d) \
+ ScaleDisplay *sd = GET_SCALE_DISPLAY (d)
+
+#define GET_SCALE_SCREEN(s, sd) \
+ ((ScaleScreen *) (s)->privates[(sd)->screenPrivateIndex].ptr)
+
+#define SCALE_SCREEN(s) \
+ ScaleScreen *ss = GET_SCALE_SCREEN (s, GET_SCALE_DISPLAY (s->display))
+
+#define GET_SCALE_WINDOW(w, ss) \
+ ((ScaleWindow *) (w)->privates[(ss)->windowPrivateIndex].ptr)
+
+#define SCALE_WINDOW(w) \
+ ScaleWindow *sw = GET_SCALE_WINDOW (w, \
+ GET_SCALE_SCREEN (w->screen, \
+ GET_SCALE_DISPLAY (w->screen->display)))
+
Modified: compiz/metadata/scale.xml.in
===================================================================
--- compiz/metadata/scale.xml.in
+++ compiz/metadata/scale.xml.in
@@ -3,6 +3,8 @@
<_short>Scale</_short>
<_long>Scale windows</_long>
<display>
+ <option name="abi" type="int" read_only="true"/>
+ <option name="index" type="int" read_only="true"/>
<option name="initiate" type="action">
<_short>Initiate Window Picker</_short>
<_long>Layout and start transforming windows</_long>
Modified: compiz/plugins/scale.c
===================================================================
--- compiz/plugins/scale.c
+++ compiz/plugins/scale.c
@@ -32,7 +32,7 @@
#include <X11/Xatom.h>
#include <X11/cursorfont.h>
-#include <compiz.h>
+#include <scale.h>
#define EDGE_STATE (CompActionStateInitEdge)
@@ -41,140 +41,10 @@
#define WIN_W(w) ((w)->width + (w)->input.left + (w)->input.right)
#define WIN_H(w) ((w)->height + (w)->input.top + (w)->input.bottom)
-#define SCALE_STATE_NONE 0
-#define SCALE_STATE_OUT 1
-#define SCALE_STATE_WAIT 2
-#define SCALE_STATE_IN 3
-
-#define SCALE_ICON_NONE 0
-#define SCALE_ICON_EMBLEM 1
-#define SCALE_ICON_BIG 2
-#define SCALE_ICON_LAST SCALE_ICON_BIG
-
static CompMetadata scaleMetadata;
static int displayPrivateIndex;
-typedef struct _ScaleSlot {
- int x1, y1, x2, y2;
- int filled;
- float scale;
-} ScaleSlot;
-
-#define SCALE_DISPLAY_OPTION_INITIATE 0
-#define SCALE_DISPLAY_OPTION_INITIATE_ALL 1
-#define SCALE_DISPLAY_OPTION_INITIATE_GROUP 2
-#define SCALE_DISPLAY_OPTION_INITIATE_OUTPUT 3
-#define SCALE_DISPLAY_OPTION_SHOW_DESKTOP 4
-#define SCALE_DISPLAY_OPTION_NUM 5
-
-typedef struct _ScaleDisplay {
- int screenPrivateIndex;
- HandleEventProc handleEvent;
-
- CompOption opt[SCALE_DISPLAY_OPTION_NUM];
-
- unsigned int lastActiveNum;
- Window lastActiveWindow;
- Window selectedWindow;
- KeyCode leftKeyCode, rightKeyCode, upKeyCode, downKeyCode;
-} ScaleDisplay;
-
-#define SCALE_SCREEN_OPTION_SPACING 0
-#define SCALE_SCREEN_OPTION_SPEED 1
-#define SCALE_SCREEN_OPTION_TIMESTEP 2
-#define SCALE_SCREEN_OPTION_WINDOW_MATCH 3
-#define SCALE_SCREEN_OPTION_DARKEN_BACK 4
-#define SCALE_SCREEN_OPTION_OPACITY 5
-#define SCALE_SCREEN_OPTION_ICON 6
-#define SCALE_SCREEN_OPTION_HOVER_TIME 7
-#define SCALE_SCREEN_OPTION_NUM 8
-
-typedef enum {
- ScaleTypeNormal = 0,
- ScaleTypeOutput,
- ScaleTypeGroup,
- ScaleTypeAll
-} ScaleType;
-
-typedef struct _ScaleScreen {
- int windowPrivateIndex;
-
- PreparePaintScreenProc preparePaintScreen;
- DonePaintScreenProc donePaintScreen;
- PaintOutputProc paintOutput;
- PaintWindowProc paintWindow;
- DamageWindowRectProc damageWindowRect;
-
- CompOption opt[SCALE_SCREEN_OPTION_NUM];
-
- Bool grab;
- int grabIndex;
-
- Window dndTarget;
-
- CompTimeoutHandle hoverHandle;
-
- int state;
- int moreAdjust;
-
- Cursor cursor;
-
- ScaleSlot *slots;
- int slotsSize;
- int nSlots;
-
- /* only used for sorting */
- CompWindow **windows;
- int windowsSize;
- int nWindows;
-
- GLushort opacity;
-
- ScaleType type;
-
- Window clientLeader;
-
- CompMatch match;
- CompMatch *currentMatch;
-} ScaleScreen;
-
-typedef struct _ScaleWindow {
- ScaleSlot *slot;
-
- int sid;
- int distance;
-
- GLfloat xVelocity, yVelocity, scaleVelocity;
- GLfloat scale;
- GLfloat tx, ty;
- float delta;
- Bool adjust;
-
- float lastThumbOpacity;
-} ScaleWindow;
-
-
-#define GET_SCALE_DISPLAY(d) \
- ((ScaleDisplay *) (d)->privates[displayPrivateIndex].ptr)
-
-#define SCALE_DISPLAY(d) \
- ScaleDisplay *sd = GET_SCALE_DISPLAY (d)
-
-#define GET_SCALE_SCREEN(s, sd) \
- ((ScaleScreen *) (s)->privates[(sd)->screenPrivateIndex].ptr)
-
-#define SCALE_SCREEN(s) \
- ScaleScreen *ss = GET_SCALE_SCREEN (s, GET_SCALE_DISPLAY (s->display))
-
-#define GET_SCALE_WINDOW(w, ss) \
- ((ScaleWindow *) (w)->privates[(ss)->windowPrivateIndex].ptr)
-
-#define SCALE_WINDOW(w) \
- ScaleWindow *sw = GET_SCALE_WINDOW (w, \
- GET_SCALE_SCREEN (w->screen, \
- GET_SCALE_DISPLAY (w->screen->display)))
-
#define NUM_OPTIONS(s) (sizeof ((s)->opt) / sizeof (CompOption))
static CompOption *
@@ -189,7 +59,7 @@ scaleGetScreenOptions (CompPlugin *plugin,
}
static Bool
-scaleSetScreenOption (CompPlugin *plugin,
+scaleSetScreenOption (CompPlugin *plugin,
CompScreen *screen,
char *name,
CompOptionValue *value)
@@ -273,6 +143,150 @@ isScaleWin (CompWindow *w)
return TRUE;
}
+static void
+scalePaintDecoration (CompWindow *w,
+ const WindowPaintAttrib *attrib,
+ const CompTransform *transform,
+ Region region,
+ unsigned int mask)
+{
+ CompScreen *s = w->screen;
+
+ SCALE_SCREEN (s);
+
+ if (ss->opt[SCALE_SCREEN_OPTION_ICON].value.i != SCALE_ICON_NONE)
+ {
+ WindowPaintAttrib sAttrib = *attrib;
+ CompIcon *icon;
+
+ SCALE_WINDOW (w);
+
+ icon = getWindowIcon (w, 96, 96);
+ if (!icon)
+ icon = w->screen->defaultIcon;
+
+ if (icon && (icon->texture.name || iconToTexture (w->screen, icon)))
+ {
+ REGION iconReg;
+ float scale;
+ float x, y;
+ int width, height;
+ int scaledWinWidth, scaledWinHeight;
+ float ds;
+
+ scaledWinWidth = w->width * sw->scale;
+ scaledWinHeight = w->height * sw->scale;
+
+ switch (ss->opt[SCALE_SCREEN_OPTION_ICON].value.i) {
+ case SCALE_ICON_NONE:
+ case SCALE_ICON_EMBLEM:
+ scale = 1.0f;
+ break;
+ case SCALE_ICON_BIG:
+ default:
+ sAttrib.opacity /= 3;
+ scale = MIN (((float) scaledWinWidth / icon->width),
+ ((float) scaledWinHeight / icon->height));
+ break;
+ }
+
+ width = icon->width * scale;
+ height = icon->height * scale;
+
+ switch (ss->opt[SCALE_SCREEN_OPTION_ICON].value.i) {
+ case SCALE_ICON_NONE:
+ case SCALE_ICON_EMBLEM:
+ x = w->attrib.x + scaledWinWidth - icon->width;
+ y = w->attrib.y + scaledWinHeight - icon->height;
+ break;
+ case SCALE_ICON_BIG:
+ default:
+ x = w->attrib.x + scaledWinWidth / 2 - width / 2;
+ y = w->attrib.y + scaledWinHeight / 2 - height / 2;
+ break;
+ }
+
+ x += sw->tx;
+ y += sw->ty;
+
+ if (sw->slot)
+ {
+ sw->delta =
+ fabs (sw->slot->x1 - w->attrib.x) +
+ fabs (sw->slot->y1 - w->attrib.y) +
+ fabs (1.0f - sw->slot->scale) * 500.0f;
+ }
+
+ if (sw->delta)
+ {
+ float o;
+
+ ds =
+ fabs (sw->tx) +
+ fabs (sw->ty) +
+ fabs (1.0f - sw->scale) * 500.0f;
+
+ if (ds > sw->delta)
+ ds = sw->delta;
+
+ o = ds / sw->delta;
+
+ if (sw->slot)
+ {
+ if (o < sw->lastThumbOpacity)
+ o = sw->lastThumbOpacity;
+ }
+ else
+ {
+ if (o > sw->lastThumbOpacity)
+ o = 0.0f;
+ }
+
+ sw->lastThumbOpacity = o;
+
+ sAttrib.opacity = sAttrib.opacity * o;
+ }
+
+ mask |= PAINT_WINDOW_BLEND_MASK;
+
+ iconReg.rects = &iconReg.extents;
+ iconReg.numRects = 1;
+
+ iconReg.extents.x1 = 0;
+ iconReg.extents.y1 = 0;
+ iconReg.extents.x2 = iconReg.extents.x1 + width;
+ iconReg.extents.y2 = iconReg.extents.y1 + height;
+
+ w->vCount = w->indexCount = 0;
+ if (iconReg.extents.x1 < iconReg.extents.x2 &&
+ iconReg.extents.y1 < iconReg.extents.y2)
+ (*w->screen->addWindowGeometry) (w,
+ &icon->texture.matrix, 1,
+ &iconReg, &iconReg);
+
+ if (w->vCount)
+ {
+ FragmentAttrib fragment;
+ CompTransform wTransform = *transform;
+
+ initFragmentAttrib (&fragment, &sAttrib);
+
+ matrixScale (&wTransform, scale, scale, 1.0f);
+ matrixTranslate (&wTransform, x / scale, y / scale, 0.0f);
+
+ glPushMatrix ();
+ glLoadMatrixf (wTransform.m);
+
+ (*w->screen->drawWindowTexture) (w,
+ &icon->texture, &fragment,
+ mask);
+
+ glPopMatrix ();
+ }
+ }
+ }
+}
+
static Bool
scalePaintWindow (CompWindow *w,
const WindowPaintAttrib *attrib,
@@ -355,138 +369,8 @@ scalePaintWindow (CompWindow *w,
mask | PAINT_WINDOW_TRANSFORMED_MASK);
glPopMatrix ();
- }
- if (scaled &&
- (ss->opt[SCALE_SCREEN_OPTION_ICON].value.i != SCALE_ICON_NONE))
- {
- CompIcon *icon;
-
- icon = getWindowIcon (w, 96, 96);
- if (!icon)
- icon = w->screen->defaultIcon;
-
- if (icon && (icon->texture.name || iconToTexture (w->screen, icon)))
- {
- REGION iconReg;
- float scale;
- float x, y;
- int width, height;
- int scaledWinWidth, scaledWinHeight;
- float ds;
-
- scaledWinWidth = w->width * sw->scale;
- scaledWinHeight = w->height * sw->scale;
-
- switch (ss->opt[SCALE_SCREEN_OPTION_ICON].value.i)
- {
- case SCALE_ICON_NONE:
- case SCALE_ICON_EMBLEM:
- scale = 1.0f;
- break;
- case SCALE_ICON_BIG:
- default:
- sAttrib.opacity /= 3;
- scale = MIN (((float) scaledWinWidth / icon->width),
- ((float) scaledWinHeight / icon->height));
- break;
- }
-
- width = icon->width * scale;
- height = icon->height * scale;
-
- switch (ss->opt[SCALE_SCREEN_OPTION_ICON].value.i)
- {
- case SCALE_ICON_NONE:
- case SCALE_ICON_EMBLEM:
- x = w->attrib.x + scaledWinWidth - icon->width;
- y = w->attrib.y + scaledWinHeight - icon->height;
- break;
- case SCALE_ICON_BIG:
- default:
- x = w->attrib.x + scaledWinWidth / 2 - width / 2;
- y = w->attrib.y + scaledWinHeight / 2 - height / 2;
- break;
- }
-
- x += sw->tx;
- y += sw->ty;
-
- if (sw->slot)
- {
- sw->delta =
- fabs (sw->slot->x1 - w->attrib.x) +
- fabs (sw->slot->y1 - w->attrib.y) +
- fabs (1.0f - sw->slot->scale) * 500.0f;
- }
-
- if (sw->delta)
- {
- float o;
-
- ds =
- fabs (sw->tx) +
- fabs (sw->ty) +
- fabs (1.0f - sw->scale) * 500.0f;
-
- if (ds > sw->delta)
- ds = sw->delta;
-
- o = ds / sw->delta;
-
- if (sw->slot)
- {
- if (o < sw->lastThumbOpacity)
- o = sw->lastThumbOpacity;
- }
- else
- {
- if (o > sw->lastThumbOpacity)
- o = 0.0f;
- }
-
- sw->lastThumbOpacity = o;
-
- sAttrib.opacity = sAttrib.opacity * o;
- }
-
- mask |= PAINT_WINDOW_BLEND_MASK;
-
- iconReg.rects = &iconReg.extents;
- iconReg.numRects = 1;
-
- iconReg.extents.x1 = 0;
- iconReg.extents.y1 = 0;
- iconReg.extents.x2 = iconReg.extents.x1 + width;
- iconReg.extents.y2 = iconReg.extents.y1 + height;
-
- w->vCount = w->indexCount = 0;
- if (iconReg.extents.x1 < iconReg.extents.x2 &&
- iconReg.extents.y1 < iconReg.extents.y2)
- (*w->screen->addWindowGeometry) (w,
- &icon->texture.matrix, 1,
- &iconReg, &iconReg);
-
- if (w->vCount)
- {
- FragmentAttrib fragment;
- CompTransform wTransform = *transform;
-
- initFragmentAttrib (&fragment, &sAttrib);
-
- matrixScale (&wTransform, scale, scale, 1.0f);
- matrixTranslate (&wTransform, x / scale, y / scale, 0.0f);
-
- glPushMatrix ();
- glLoadMatrixf (wTransform.m);
-
- (*w->screen->drawWindowTexture) (w,
- &icon->texture, &fragment,
- mask);
-
- glPopMatrix ();
- }
- }
+ (*ss->scalePaintDecoration) (w, &sAttrib, transform, region, mask);
}
}
else
@@ -670,6 +554,28 @@ fillInWindows (CompScreen *s)
}
static Bool
+layoutSlotsAndAssignWindows (CompScreen *s)
+{
+ SCALE_SCREEN (s);
+
+ /* create a grid of slots */
+ layoutSlots (s);
+
+ do
+ {
+ /* find most appropriate slots for windows */
+ findBestSlots (s);
+
+ /* sort windows, window with closest distance to a slot first */
+ qsort (ss->windows, ss->nWindows, sizeof (CompWindow *),
+ compareWindowsDistance);
+
+ } while (fillInWindows (s));
+
+ return TRUE;
+}
+
+static Bool
layoutThumbs (CompScreen *s)
{
CompWindow *w;
@@ -716,21 +622,7 @@ layoutThumbs (CompScreen *s)
ss->slotsSize = ss->nWindows;
}
- /* create a grid of slots */
- layoutSlots (s);
-
- do
- {
- /* find most appropriate slots for windows */
- findBestSlots (s);
-
- /* sort windows, window with closest distance to a slot first */
- qsort (ss->windows, ss->nWindows, sizeof (CompWindow *),
- compareWindowsDistance);
-
- } while (fillInWindows (s));
-
- return TRUE;
+ return (*ss->layoutSlotsAndAssignWindows) (s);
}
static int
@@ -1755,17 +1647,28 @@ scaleSetDisplayOption (CompPlugin *plugin,
CompOptionValue *value)
{
CompOption *o;
+ int index;
SCALE_DISPLAY (display);
- o = compFindOption (sd->opt, NUM_OPTIONS (sd), name, NULL);
+ o = compFindOption (sd->opt, NUM_OPTIONS (sd), name, &index);
if (!o)
return FALSE;
- return compSetDisplayOption (display, o, value);
+ switch (index) {
+ case SCALE_DISPLAY_OPTION_ABI:
+ case SCALE_DISPLAY_OPTION_INDEX:
+ break;
+ default:
+ return compSetDisplayOption (display, o, value);
+ }
+
+ return FALSE;
}
static const CompMetadataOptionInfo scaleDisplayOptionInfo[] = {
+ { "abi", "int", 0, 0, 0 },
+ { "index", "int", 0, 0, 0 },
{ "initiate", "action", 0, scaleInitiate, scaleTerminate },
{ "initiate_all", "action", 0, scaleInitiateAll, scaleTerminate },
{ "initiate_group", "action", 0, scaleInitiateGroup, scaleTerminate },
@@ -1793,6 +1696,9 @@ scaleInitDisplay (CompPlugin *p,
return FALSE;
}
+ sd->opt[SCALE_DISPLAY_OPTION_ABI].value.i = SCALE_ABIVERSION;
+ sd->opt[SCALE_DISPLAY_OPTION_INDEX].value.i = displayPrivateIndex;
+
sd->screenPrivateIndex = allocateScreenPrivateIndex (d);
if (sd->screenPrivateIndex < 0)
{
@@ -1890,6 +1796,9 @@ scaleInitScreen (CompPlugin *p,
ss->opacity =
(OPAQUE * ss->opt[SCALE_SCREEN_OPTION_OPACITY].value.i) / 100;
+ ss->layoutSlotsAndAssignWindows = layoutSlotsAndAssignWindows;
+ ss->scalePaintDecoration = scalePaintDecoration;
+
WRAP (ss, s, preparePaintScreen, scalePreparePaintScreen);
WRAP (ss, s, donePaintScreen, scaleDonePaintScreen);
WRAP (ss, s, paintOutput, scalePaintOutput);
More information about the commits
mailing list