rpms/compiz/devel plane.patch,NONE,1.1 compiz.spec,1.24,1.25
fedora-cvs-commits at redhat.com
fedora-cvs-commits at redhat.com
Fri Sep 1 18:24:41 UTC 2006
Author: sandmann
Update of /cvs/dist/rpms/compiz/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv15106
Modified Files:
compiz.spec
Added Files:
plane.patch
Log Message:
Add patch to put viewports on a plane
plane.patch:
include/compiz.h | 11
plugins/Makefile.am | 5
plugins/cube.c | 66 +--
plugins/plane.c | 923 ++++++++++++++++++++++++++++++++++++++++++++++++++++
plugins/rotate.c | 57 +--
src/screen.c | 142 +++++---
src/window.c | 64 ++-
7 files changed, 1134 insertions(+), 134 deletions(-)
--- NEW FILE plane.patch ---
--- compiz-3173a142efe5e7af83ebb534a074d9d2a0c67a86/plugins/Makefile.am.plane 2006-09-01 14:09:17.000000000 -0400
+++ compiz-3173a142efe5e7af83ebb534a074d9d2a0c67a86/plugins/Makefile.am 2006-09-01 14:09:44.000000000 -0400
@@ -46,6 +46,10 @@
libwater_la_LIBADD = @COMPIZ_LIBS@
libwater_la_SOURCES = water.c
+libplane_la_LDFLAGS = -module -avoid-version -no-undefined
+libplane_la_LIBADD = @COMPIZ_LIBS@
+libplane_la_SOURCES = plane.c
+
if GCONF_PLUGIN
libgconf_la_LDFLAGS = -module -avoid-version -no-undefined
libgconf_la_LIBADD = @COMPIZ_LIBS@ @GCONF_LIBS@
@@ -130,6 +134,7 @@
$(libdbus_module) \
libswitcher.la \
libwater.la \
+ libplane.la \
$(libgconf_dump_module)
EXTRA_DIST = $(schema_in_files)
--- compiz-3173a142efe5e7af83ebb534a074d9d2a0c67a86/plugins/rotate.c.plane 2006-08-17 17:36:07.000000000 -0400
+++ compiz-3173a142efe5e7af83ebb534a074d9d2a0c67a86/plugins/rotate.c 2006-09-01 14:05:12.000000000 -0400
@@ -419,15 +419,15 @@
rs->xrot += rs->xVelocity * chunk;
rs->yrot += rs->yVelocity * chunk;
- if (rs->xrot > 360.0f / s->size)
+ if (rs->xrot > 360.0f / s->hsize)
{
- rs->baseXrot += 360.0f / s->size;
- rs->xrot -= 360.0f / s->size;
+ rs->baseXrot += 360.0f / s->hsize;
+ rs->xrot -= 360.0f / s->hsize;
}
else if (rs->xrot < 0.0f)
{
- rs->baseXrot -= 360.0f / s->size;
- rs->xrot += 360.0f / s->size;
+ rs->baseXrot -= 360.0f / s->hsize;
+ rs->xrot += 360.0f / s->hsize;
}
if (rs->invert == -1)
@@ -467,7 +467,7 @@
if (fabs (rs->yVelocity) < 0.01f)
rs->yVelocity = 0.0f;
}
- else if (adjustVelocity (rs, s->size))
+ else if (adjustVelocity (rs, s->hsize))
{
rs->xVelocity = 0.0f;
rs->yVelocity = 0.0f;
@@ -479,11 +479,11 @@
xrot = rs->baseXrot + rs->xrot;
if (xrot < 0.0f)
- tx = (s->size * xrot / 360.0f) - 0.5f;
+ tx = (s->hsize * xrot / 360.0f) - 0.5f;
else
- tx = (s->size * xrot / 360.0f) + 0.5f;
+ tx = (s->hsize * xrot / 360.0f) + 0.5f;
- moveScreenViewport (s, tx, TRUE);
+ moveScreenViewport (s, tx, 0, TRUE);
rs->xrot = 0.0f;
rs->yrot = 0.0f;
@@ -524,7 +524,7 @@
w = findWindowAtScreen (s, rs->moveWindow);
if (w)
{
- float xrot = (s->size * (rs->baseXrot + rs->xrot)) / 360.0f;
+ float xrot = (s->hsize * (rs->baseXrot + rs->xrot)) / 360.0f;
moveWindowToViewportPosition (w,
rs->moveWindowX - xrot * s->width,
@@ -737,7 +737,7 @@
}
rs->moving = TRUE;
- rs->moveTo += (360.0f / s->size) * direction;
+ rs->moveTo += (360.0f / s->hsize) * direction;
rs->grabbed = FALSE;
damageScreen (s);
@@ -814,7 +814,7 @@
if (rs->grabIndex)
{
rs->moving = TRUE;
- rs->moveTo += (360.0f / s->size) * direction;
+ rs->moveTo += (360.0f / s->hsize) * direction;
rs->grabbed = FALSE;
damageScreen (s);
@@ -1130,7 +1130,7 @@
compAddTimeout (rd->flipTime, rotateFlipLeft, s);
rs->moving = TRUE;
- rs->moveTo -= 360.0f / s->size;
+ rs->moveTo -= 360.0f / s->hsize;
rs->slow = TRUE;
if (state & CompActionStateInitEdge)
@@ -1170,7 +1170,7 @@
compAddTimeout (rd->flipTime, rotateFlipRight, s);
rs->moving = TRUE;
- rs->moveTo += 360.0f / s->size;
+ rs->moveTo += 360.0f / s->hsize;
rs->slow = TRUE;
if (state & CompActionStateInitEdge)
@@ -1270,11 +1270,11 @@
ROTATE_SCREEN (s);
- delta = face - s->x - (rs->moveTo / (360.0f / s->size));
- if (delta > s->size / 2)
- delta -= s->size;
- else if (delta < -(s->size / 2))
- delta += s->size;
+ delta = face - s->x - (rs->moveTo / (360.0f / s->hsize));
+ if (delta > s->hsize / 2)
+ delta -= s->hsize;
+ else if (delta < -(s->hsize / 2))
+ delta += s->hsize;
return delta;
}
@@ -1473,7 +1473,8 @@
rs->moving = FALSE;
rs->moveTo = 0.0f;
- dx = defaultViewportForWindow (w) - s->x;
+ defaultViewportForWindow (w, &dx, NULL);
+ dx -= s->x;
if (dx)
{
Window win;
@@ -1484,10 +1485,10 @@
XQueryPointer (d->display, s->root,
&win, &win, &x, &y, &i, &i, &ui);
- if (dx > (s->size + 1) / 2)
- dx -= s->size;
- else if (dx < -(s->size + 1) / 2)
- dx += s->size;
+ if (dx > (s->hsize + 1) / 2)
+ dx -= s->hsize;
+ else if (dx < -(s->hsize + 1) / 2)
+ dx += s->hsize;
o[0].type = CompOptionTypeInt;
o[0].name = "x";
@@ -1530,10 +1531,10 @@
XQueryPointer (d->display, s->root,
&win, &win, &x, &y, &i, &i, &ui);
- if (dx > (s->size + 1) / 2)
- dx -= s->size;
- else if (dx < -(s->size + 1) / 2)
- dx += s->size;
+ if (dx > (s->hsize + 1) / 2)
+ dx -= s->hsize;
+ else if (dx < -(s->hsize + 1) / 2)
+ dx += s->hsize;
o[0].type = CompOptionTypeInt;
o[0].name = "x";
--- /dev/null 2006-08-31 19:15:36.944167750 -0400
+++ compiz-3173a142efe5e7af83ebb534a074d9d2a0c67a86/plugins/plane.c 2006-09-01 14:05:12.000000000 -0400
@@ -0,0 +1,923 @@
+/*
+ * Copyright © 2006 Red Hat, 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
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * Red Hat, Inc. makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL RED HAT, 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: Soren Sandmann <sandmann at redhat.com>
+ */
+
+#define _GNU_SOURCE /* for asprintf */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <sys/time.h>
+
+#include <X11/Xatom.h>
+#include <X11/Xproto.h>
+
+#include <compiz.h>
+
+static int displayPrivateIndex;
+
+#define PLANE_LEFT_KEY_DEFAULT "Left"
+#define PLANE_LEFT_MODIFIERS_DEFAULT (ControlMask | CompAltMask)
+
+#define PLANE_RIGHT_KEY_DEFAULT "Right"
+#define PLANE_RIGHT_MODIFIERS_DEFAULT (ControlMask | CompAltMask)
+
+#define PLANE_UP_KEY_DEFAULT "Up"
+#define PLANE_UP_MODIFIERS_DEFAULT (ControlMask | CompAltMask)
+
+#define PLANE_DOWN_KEY_DEFAULT "Down"
+#define PLANE_DOWN_MODIFIERS_DEFAULT (ControlMask | CompAltMask)
+
+enum
+{
+ PLANE_DISPLAY_OPTION_LEFT,
+ PLANE_DISPLAY_OPTION_RIGHT,
+ PLANE_DISPLAY_OPTION_DOWN,
+ PLANE_DISPLAY_OPTION_UP,
+ PLANE_DISPLAY_OPTION_TO_1,
+ PLANE_DISPLAY_OPTION_TO_2,
+ PLANE_DISPLAY_OPTION_TO_3,
+ PLANE_DISPLAY_OPTION_TO_4,
+ PLANE_DISPLAY_OPTION_TO_5,
+ PLANE_DISPLAY_OPTION_TO_6,
+ PLANE_DISPLAY_OPTION_TO_7,
+ PLANE_DISPLAY_OPTION_TO_8,
+ PLANE_DISPLAY_OPTION_TO_9,
+ PLANE_DISPLAY_OPTION_TO_10,
+ PLANE_DISPLAY_OPTION_TO_11,
+ PLANE_DISPLAY_OPTION_TO_12,
+ PLANE_N_DISPLAY_OPTIONS
+};
+
+typedef struct _PlaneDisplay {
+ int screenPrivateIndex;
+ HandleEventProc handleEvent;
+
+ CompOption opt[PLANE_N_DISPLAY_OPTIONS];
+
+ int flipTime;
+} PlaneDisplay;
+
+typedef struct _PlaneScreen {
+ PaintTransformedScreenProc paintTransformedScreen;
+ PreparePaintScreenProc preparePaintScreen;
+ DonePaintScreenProc donePaintScreen;
+ PaintScreenProc paintScreen;
+
+ SetScreenOptionForPluginProc setScreenOptionForPlugin;
+ WindowGrabNotifyProc windowGrabNotify;
+ WindowUngrabNotifyProc windowUngrabNotify;
+
+ CompTimeoutHandle timeout_handle;
+ int timer;
+
+ double cur_x;
+ double cur_y;
+ double dest_x;
+ double dest_y;
+} PlaneScreen;
+
+#define GET_PLANE_DISPLAY(d) \
+ ((PlaneDisplay *) (d)->privates[displayPrivateIndex].ptr)
+
+#define PLANE_DISPLAY(d) \
+ PlaneDisplay *pd = GET_PLANE_DISPLAY (d)
+
+#define GET_PLANE_SCREEN(s, pd) \
+ ((PlaneScreen *) (s)->privates[(pd)->screenPrivateIndex].ptr)
+
+#define PLANE_SCREEN(s) \
+ PlaneScreen *ps = GET_PLANE_SCREEN (s, GET_PLANE_DISPLAY (s->display))
+
+#define NUM_OPTIONS(s) (sizeof ((s)->opt) / sizeof (CompOption))
+
+static Bool
+end_move (void *data)
+{
+ CompScreen *screen = data;
+ PLANE_SCREEN (screen);
+
+ moveScreenViewport (screen, -ps->dest_x, -ps->dest_y, TRUE);
+
+ ps->dest_x = 0;
+ ps->dest_y = 0;
+
+ ps->timeout_handle = 0;
+ return FALSE;
+}
+
+#define SCROLL_TIME 250
+
+static void
+compute_translation (PlaneScreen *ps,
+ double *x,
+ double *y)
+{
+ double dx, dy;
+ double elapsed = 1 - (ps->timer / (double)SCROLL_TIME);
+
+ if (elapsed < 0.0)
+ elapsed = 0.0;
+ if (elapsed > 1.0)
+ elapsed = 1.0;
+
+ /* Use temporary variables to you can pass in &ps->cur_x */
+ dx = (ps->dest_x - ps->cur_x) * elapsed + ps->cur_x;
+ dy = (ps->dest_y - ps->cur_y) * elapsed + ps->cur_y;
+
+ *x = dx;
+ *y = dy;
+}
+
+static void
+move_viewport (CompScreen *screen,
+ int dx,
+ int dy)
+{
+ PLANE_SCREEN (screen);
+
+ if (ps->timeout_handle)
+ {
+ compute_translation (ps, &ps->cur_x, &ps->cur_y);
+
+ ps->dest_x += dx;
+ ps->dest_y += dy;
+
+ compRemoveTimeout (ps->timeout_handle);
+ }
+ else
+ {
+ ps->cur_x = 0.0;
+ ps->cur_y = 0.0;
+ ps->dest_x = dx;
+ ps->dest_y = dy;
+ }
+
+ if (ps->dest_x + screen->x > screen->hsize - 1)
+ ps->dest_x = screen->hsize - screen->x - 1;
+
+ if (ps->dest_x + screen->x < 0)
+ ps->dest_x = -screen->x;
+
+ if (ps->dest_y + screen->y > screen->vsize - 1)
+ ps->dest_y = screen->vsize - screen->y - 1;
+
+ if (ps->dest_y + screen->y < 0)
+ ps->dest_y = -screen->y;
+
+ ps->timer = SCROLL_TIME;
+ ps->timeout_handle = compAddTimeout (SCROLL_TIME, end_move, screen);
+
+ damageScreen (screen);
+}
+
+static void
+planePreparePaintScreen (CompScreen *s,
+ int msSinceLastPaint)
+{
+ PLANE_SCREEN (s);
+
+ ps->timer -= msSinceLastPaint;
+
+ UNWRAP (ps, s, preparePaintScreen);
+
+ (* s->preparePaintScreen) (s, msSinceLastPaint);
+
+ WRAP (ps, s, preparePaintScreen, planePreparePaintScreen);
+}
+
+static void
+planePaintTransformedScreen (CompScreen *screen,
+ const ScreenPaintAttrib *sAttrib,
+ unsigned int mask)
+{
+ PLANE_SCREEN (screen);
+
+ glPushMatrix ();
+ UNWRAP (ps, screen, paintTransformedScreen);
+
+ if (ps->timeout_handle)
+ {
+ double dx, dy, tx, ty;
+ int vx, vy;
+
+ glClearColor (0.0, 0.0, 0.0, 1.0);
+ glClear (GL_COLOR_BUFFER_BIT);
+
+ compute_translation (ps, &dx, &dy);
+
+ dx *= -1;
+ dy *= -1;
+
+ tx = dy;
+ ty = dy;
+ vx = 0;
+ vy = 0;
+
+ while (dx > 1)
+ {
+ dx -= 1.0;
+ moveScreenViewport (screen, 1, 0, FALSE);
+ vx++;
+ }
+
+ while (dx < -1)
+ {
+ dx += 1.0;
+ moveScreenViewport (screen, -1, 0, FALSE);
+ vx--;
+ }
+
+ while (dy > 1)
+ {
+ dy -= 1.0;
+ moveScreenViewport (screen, 0, 1, FALSE);
+ vy++;
+ }
+
+ while (dy < -1)
+ {
+ dy += 1.0;
+ moveScreenViewport (screen, 0, -1, FALSE);
+ vy--;
+ }
+
+#if 0
+ glPushMatrix ();
+
+ if (dx > 0)
+ {
+ glTranslatef (dx, dy, 0.0);
+
+ (* screen->paintTransformedScreen) (screen, sAttrib, mask);
+
+ glTranslatef (-1.0, 0.0, 0.0);
+
+ moveScreenViewport (screen, 1, 0, FALSE);
+
+ (* screen->paintTransformedScreen) (screen, sAttrib, mask);
+
+ moveScreenViewport (screen, -1, 0, FALSE);
+ }
+ else
+ {
+ glTranslatef (dx, dy, 0.0);
+
+ (* screen->paintTransformedScreen) (screen, sAttrib, mask);
+
+ glTranslatef (1.0, 0.0, 0.0);
+
+ moveScreenViewport (screen, -1, 0, FALSE);
+
+ (* screen->paintTransformedScreen) (screen, sAttrib, mask);
+
+ moveScreenViewport (screen, 1, 0, FALSE);
+ }
+
+ glPopMatrix ();
+#endif
+
+ glPushMatrix ();
+
+ glTranslatef (dx, -dy, 0.0);
+ (* screen->paintTransformedScreen) (screen, sAttrib, mask);
+ if (dx > 0)
+ {
+ glTranslatef (-1.0, 0.0, 0.0);
+ moveScreenViewport (screen, 1, 0, FALSE);
+ }
+ else
+ {
+ glTranslatef (1.0, 0.0, 0.0);
+ moveScreenViewport (screen, -1, 0, FALSE);
+ }
+ (* screen->paintTransformedScreen) (screen, sAttrib, mask);
+ if (dy > 0)
+ {
+ glTranslatef (0.0, 1.0, 0.0);
+ moveScreenViewport (screen, 0, 1, FALSE);
+ }
+ else
+ {
+ glTranslatef (0.0, -1.0, 0.0);
+ moveScreenViewport (screen, 0, -1, FALSE);
+ }
+ (* screen->paintTransformedScreen) (screen, sAttrib, mask);
+ if (dx > 0)
+ {
+ glTranslatef (1.0, 0.0, 0.0);
+ moveScreenViewport (screen, -1, 0, FALSE);
+ }
+ else
+ {
+ glTranslatef (-1.0, 0.0, 0.0);
+ moveScreenViewport (screen, 1, 0, FALSE);
+ }
+ (* screen->paintTransformedScreen) (screen, sAttrib, mask);
+ if (dy > 0)
+ {
+ glTranslatef (0.0, -1.0, 0.0);
+ moveScreenViewport (screen, 0, -1, FALSE);
+ }
+ else
+ {
+ glTranslatef (0.0, 1.0, 0.0);
+ moveScreenViewport (screen, 0, 1, FALSE);
+ }
+ glTranslatef (-dx, -dy, 0.0);
+ glPopMatrix ();
+
+ moveScreenViewport (screen, -vx, -vy, FALSE);
+ }
+
+ WRAP (ps, screen, paintTransformedScreen, planePaintTransformedScreen);
+ glPopMatrix ();
+
+}
+
+static void
+planeDonePaintScreen (CompScreen *s)
+{
+ PLANE_SCREEN (s);
+
+ if (ps->timeout_handle)
+ damageScreen (s);
+
+ UNWRAP (ps, s, donePaintScreen);
+
+ (* s->donePaintScreen) (s);
+
+ WRAP (ps, s, donePaintScreen, planeDonePaintScreen);
+}
+
+static Bool
+planePaintScreen (CompScreen *s,
+ const ScreenPaintAttrib *sAttrib,
+ Region region,
+ unsigned int mask)
+{
+ ScreenPaintAttrib sa = *sAttrib;
+ Bool status;
+
+ PLANE_SCREEN (s);
+
+ if (ps->timeout_handle)
+ {
+ mask &= ~PAINT_SCREEN_REGION_MASK;
+ mask |= PAINT_SCREEN_TRANSFORMED_MASK;
+ }
+
+ UNWRAP (ps, s, paintScreen);
+ status = (*s->paintScreen) (s, sAttrib, region, mask);
+ WRAP (ps, s, paintScreen, planePaintScreen);
+
+ return status;
+}
+
+static void
+planeHandleEvent (CompDisplay *d,
+ XEvent *event)
+{
+ CompScreen *s;
+
+ PLANE_DISPLAY (d);
+
+ switch (event->type) {
+ case ClientMessage:
+ if (event->xclient.message_type == d->winActiveAtom)
+ {
+ CompWindow *w;
+
+ w = findWindowAtDisplay (d, event->xclient.window);
+ if (w)
+ {
+ int dx, dy;
+
+ s = w->screen;
+
+ /* window must be placed */
+ if (!w->placed)
+ break;
+
+ if (otherScreenGrabExist (s, "plane", "switcher", "cube", 0))
+ break;
+
+ defaultViewportForWindow (w, &dx, &dy);
+ dx -= s->x;
+ dy -= s->y;
+
+ move_viewport (s, dx, dy);
+ }
+ }
+ else if (event->xclient.message_type == d->desktopViewportAtom)
+ {
+ int dx, dy;
+
+ s = findScreenAtDisplay (d, event->xclient.window);
+ if (!s)
+ break;
+
+ if (otherScreenGrabExist (s, "plane", "switcher", "cube", 0))
+ break;
+
+ dx = event->xclient.data.l[0] / s->width - s->x;
+ dy = event->xclient.data.l[1] / s->height - s->y;
+
+ if (!dx && !dy)
+ break;
+
+ move_viewport (s, dx, dy);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ UNWRAP (pd, d, handleEvent);
+ (*d->handleEvent) (d, event);
+ WRAP (pd, d, handleEvent, planeHandleEvent);
+}
+
+static void
+planeWindowGrabNotify (CompWindow *w,
+ int x,
+ int y,
+ unsigned int state,
+ unsigned int mask)
+{
+ PLANE_SCREEN (w->screen);
+
+ UNWRAP (ps, w->screen, windowGrabNotify);
+ (*w->screen->windowGrabNotify) (w, x, y, state, mask);
+ WRAP (ps, w->screen, windowGrabNotify, planeWindowGrabNotify);
+}
+
+static void
+planeWindowUngrabNotify (CompWindow *w)
+{
+ PLANE_SCREEN (w->screen);
+
+ UNWRAP (ps, w->screen, windowUngrabNotify);
+ (*w->screen->windowUngrabNotify) (w);
+ WRAP (ps, w->screen, windowUngrabNotify, planeWindowUngrabNotify);
+}
+
+static Bool
+planeSetScreenOptionForPlugin (CompScreen *s,
+ char *plugin,
+ char *name,
+ CompOptionValue *value)
+{
+ PLANE_SCREEN (s);
+ Bool status;
+
+ UNWRAP (ps, s, setScreenOptionForPlugin);
+ status = (*s->setScreenOptionForPlugin) (s, plugin, name, value);
+ WRAP (ps, s, setScreenOptionForPlugin, planeSetScreenOptionForPlugin);
+
+ return status;
+}
+
+static CompOption *
+planeGetDisplayOptions (CompDisplay *display,
+ int *count)
+{
+ PLANE_DISPLAY (display);
+
+ *count = NUM_OPTIONS (pd);
+ return pd->opt;
+}
+
+static Bool
+planeSetDisplayOption (CompDisplay *display,
+ char *name,
+ CompOptionValue *value)
+{
+ CompOption *o;
+ int index;
+
+ PLANE_DISPLAY (display);
+
+ o = compFindOption (pd->opt, NUM_OPTIONS (pd), name, &index);
+ if (!o)
+ return FALSE;
+
+ switch (index) {
+ case PLANE_DISPLAY_OPTION_LEFT:
+ case PLANE_DISPLAY_OPTION_RIGHT:
+ case PLANE_DISPLAY_OPTION_UP:
+ case PLANE_DISPLAY_OPTION_DOWN:
+
+ case PLANE_DISPLAY_OPTION_TO_1:
+ case PLANE_DISPLAY_OPTION_TO_2:
+ case PLANE_DISPLAY_OPTION_TO_3:
+ case PLANE_DISPLAY_OPTION_TO_4:
+ case PLANE_DISPLAY_OPTION_TO_5:
+ case PLANE_DISPLAY_OPTION_TO_6:
+ case PLANE_DISPLAY_OPTION_TO_7:
+ case PLANE_DISPLAY_OPTION_TO_8:
+ case PLANE_DISPLAY_OPTION_TO_9:
+ case PLANE_DISPLAY_OPTION_TO_10:
+ case PLANE_DISPLAY_OPTION_TO_11:
+ case PLANE_DISPLAY_OPTION_TO_12:
+ if (setDisplayAction (display, o, value))
+ return TRUE;
+ break;
+ default:
+ break;
+ }
+
+ return FALSE;
+}
+
+static CompScreen *
+get_screen (CompDisplay *d,
+ CompOption *option,
+ int n_options)
+{
+ XID root_window = getIntOptionNamed (option, n_options, "root", 0);
+
+ return findScreenAtDisplay (d, root_window);
+}
+
+static Bool
+planeLeft (CompDisplay *d,
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int n_options)
+{
+ CompScreen *screen = get_screen (d, option, n_options);
+
+ move_viewport (screen, -1, 0);
+ return FALSE;
+}
+
+static Bool
+planeRight (CompDisplay *d,
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int n_options)
+{
+ CompScreen *screen = get_screen (d, option, n_options);
+
+ move_viewport (screen, 1, 0);
+ return FALSE;
+}
+
+static Bool
+planeUp (CompDisplay *d,
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int n_options)
+{
+ CompScreen *screen = get_screen (d, option, n_options);
+
+ move_viewport (screen, 0, -1);
+ return FALSE;
+}
+
+static Bool
+planeDown (CompDisplay *d,
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int n_options)
+{
+ CompScreen *screen = get_screen (d, option, n_options);
+
+ move_viewport (screen, 0, 1);
+ return FALSE;
+}
+
+static Bool
+planeTo (CompDisplay *d,
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int n_options)
+{
+ int i, new_x, new_y, cur_x, cur_y;
+ CompScreen *screen = get_screen (d, option, n_options);
+ PLANE_DISPLAY (d);
+
+ new_x = new_y = -1;
+ for (i = PLANE_DISPLAY_OPTION_TO_1; i <= PLANE_DISPLAY_OPTION_TO_12; ++i)
+ {
+ if (action == &pd->opt[i].value.action)
+ {
+ int viewport_no = i - PLANE_DISPLAY_OPTION_TO_1;
+
+ new_x = viewport_no % screen->hsize;
+ new_y = viewport_no / screen->hsize;
+
+ break;
+ }
+ }
+
+ if (new_x == -1 || new_y == -1)
+ return FALSE;
+
+ cur_x = screen->x;
+ cur_y = screen->y;
+
+ move_viewport (screen, new_x - cur_x, new_y - cur_y);
+
+ return FALSE;
+}
+
+static void
+planeDisplayInitOptions (PlaneDisplay *pd,
+ Display *display)
+{
+ CompOption *o;
+ char *str;
+
+ o = &pd->opt[PLANE_DISPLAY_OPTION_LEFT];
+ o->name = "plane_left";
+ o->shortDesc = N_("Plane Left");
+ o->longDesc = N_("Plane left");
+ o->type = CompOptionTypeAction;
+ o->value.action.initiate = planeLeft;
+ o->value.action.terminate = 0;
+ o->value.action.bell = FALSE;
+ o->value.action.edgeMask = 0;
+ o->value.action.state = CompActionStateInitEdge;
+ o->value.action.state |= CompActionStateInitEdgeDnd;
+ o->value.action.state |= CompActionStateInitKey;
+ o->value.action.state |= CompActionStateInitButton;
+ o->value.action.type = CompBindingTypeKey;
+ o->value.action.key.modifiers = PLANE_LEFT_MODIFIERS_DEFAULT;
+ o->value.action.key.keycode =
+ XKeysymToKeycode (display,
+ XStringToKeysym (PLANE_LEFT_KEY_DEFAULT));
+
+ o = &pd->opt[PLANE_DISPLAY_OPTION_RIGHT];
+ o->name = "plane_right";
+ o->shortDesc = N_("Plane Right");
+ o->longDesc = N_("Plane right");
+ o->type = CompOptionTypeAction;
+ o->value.action.initiate = planeRight;
+ o->value.action.terminate = 0;
+ o->value.action.bell = FALSE;
+ o->value.action.edgeMask = 0;
+ o->value.action.state = CompActionStateInitEdge;
+ o->value.action.state |= CompActionStateInitEdgeDnd;
+ o->value.action.state |= CompActionStateInitKey;
+ o->value.action.state |= CompActionStateInitButton;
+ o->value.action.type = CompBindingTypeKey;
+ o->value.action.key.modifiers = PLANE_RIGHT_MODIFIERS_DEFAULT;
+ o->value.action.key.keycode =
+ XKeysymToKeycode (display,
+ XStringToKeysym (PLANE_RIGHT_KEY_DEFAULT));
+
+ o = &pd->opt[PLANE_DISPLAY_OPTION_DOWN];
+ o->name = "plane_down";
+ o->shortDesc = N_("Plane Down");
+ o->longDesc = N_("Plane down");
+ o->type = CompOptionTypeAction;
+ o->value.action.initiate = planeDown;
+ o->value.action.terminate = 0;
+ o->value.action.bell = FALSE;
+ o->value.action.edgeMask = 0;
+ o->value.action.state = CompActionStateInitEdge;
+ o->value.action.state |= CompActionStateInitEdgeDnd;
+ o->value.action.state |= CompActionStateInitKey;
+ o->value.action.state |= CompActionStateInitButton;
+ o->value.action.type = CompBindingTypeKey;
+ o->value.action.key.modifiers = PLANE_DOWN_MODIFIERS_DEFAULT;
+ o->value.action.key.keycode =
+ XKeysymToKeycode (display,
+ XStringToKeysym (PLANE_DOWN_KEY_DEFAULT));
+
+ o = &pd->opt[PLANE_DISPLAY_OPTION_UP];
+ o->name = "plane_up";
+ o->shortDesc = N_("Plane Up");
+ o->longDesc = N_("Plane up");
+ o->type = CompOptionTypeAction;
+ o->value.action.initiate = planeUp;
+ o->value.action.terminate = 0;
+ o->value.action.bell = FALSE;
+ o->value.action.edgeMask = 0;
+ o->value.action.state = CompActionStateInitEdge;
+ o->value.action.state |= CompActionStateInitEdgeDnd;
+ o->value.action.state |= CompActionStateInitKey;
+ o->value.action.state |= CompActionStateInitButton;
+ o->value.action.type = CompBindingTypeKey;
+ o->value.action.key.modifiers = PLANE_UP_MODIFIERS_DEFAULT;
+ o->value.action.key.keycode =
+ XKeysymToKeycode (display,
+ XStringToKeysym (PLANE_UP_KEY_DEFAULT));
+
+#define PLANE_TO_SHORT N_("Plane To Face %d")
+#define PLANE_TO_LONG N_("Plane to face %d")
+#define PLANE_TO_WINDOW_SHORT N_("Plane To Face %d with Window")
+#define PLANE_TO_WINDOW_LONG N_("Plane to face %d and bring active " \
+ "window along")
+
+#define PLANE_TO_OPTION(n) \
+ o = &pd->opt[PLANE_DISPLAY_OPTION_TO_ ## n]; \
+ o->name = "plane_to_" #n; \
+ asprintf (&str, PLANE_TO_SHORT, n); \
+ o->shortDesc = str; \
+ asprintf (&str, PLANE_TO_LONG, n); \
+ o->longDesc = str; \
+ o->type = CompOptionTypeAction; \
+ o->value.action.initiate = planeTo; \
+ o->value.action.terminate = 0; \
+ o->value.action.bell = FALSE; \
+ o->value.action.edgeMask = 0; \
+ o->value.action.state = CompActionStateInitKey; \
+ o->value.action.state |= CompActionStateInitButton; \
+ o->value.action.type = CompBindingTypeNone;
+
+ PLANE_TO_OPTION (1);
+ PLANE_TO_OPTION (2);
+ PLANE_TO_OPTION (3);
+ PLANE_TO_OPTION (4);
+ PLANE_TO_OPTION (5);
+ PLANE_TO_OPTION (6);
+ PLANE_TO_OPTION (7);
+ PLANE_TO_OPTION (8);
+ PLANE_TO_OPTION (9);
+ PLANE_TO_OPTION (10);
+ PLANE_TO_OPTION (11);
+ PLANE_TO_OPTION (12);
+}
+
+static Bool
+planeInitDisplay (CompPlugin *p,
+ CompDisplay *d)
+{
+ PlaneDisplay *pd;
+
+ pd = malloc (sizeof (PlaneDisplay));
+ if (!pd)
+ return FALSE;
+
+ pd->screenPrivateIndex = allocateScreenPrivateIndex (d);
+ if (pd->screenPrivateIndex < 0)
+ {
+ free (pd);
+ return FALSE;
+ }
+
+ planeDisplayInitOptions (pd, d->display);
+
+ WRAP (pd, d, handleEvent, planeHandleEvent);
+
+ d->privates[displayPrivateIndex].ptr = pd;
+
+ return TRUE;
+}
+
+static void
+planeFiniDisplay (CompPlugin *p,
+ CompDisplay *d)
+{
+ PLANE_DISPLAY (d);
+
+ freeScreenPrivateIndex (d, pd->screenPrivateIndex);
+
+ UNWRAP (pd, d, handleEvent);
+
+ free (pd);
+}
+
+static Bool
+planeInitScreen (CompPlugin *p,
+ CompScreen *s)
+{
+ PlaneScreen *ps;
+
+ PLANE_DISPLAY (s->display);
+
+ ps = malloc (sizeof (PlaneScreen));
+ if (!ps)
+ return FALSE;
+
+ ps->timeout_handle = 0;
+
+ addScreenAction (s, &pd->opt[PLANE_DISPLAY_OPTION_LEFT].value.action);
+ addScreenAction (s, &pd->opt[PLANE_DISPLAY_OPTION_RIGHT].value.action);
+ addScreenAction (s, &pd->opt[PLANE_DISPLAY_OPTION_DOWN].value.action);
+ addScreenAction (s, &pd->opt[PLANE_DISPLAY_OPTION_UP].value.action);
+
+ addScreenAction (s, &pd->opt[PLANE_DISPLAY_OPTION_TO_1].value.action);
+ addScreenAction (s, &pd->opt[PLANE_DISPLAY_OPTION_TO_2].value.action);
+ addScreenAction (s, &pd->opt[PLANE_DISPLAY_OPTION_TO_3].value.action);
+ addScreenAction (s, &pd->opt[PLANE_DISPLAY_OPTION_TO_4].value.action);
+ addScreenAction (s, &pd->opt[PLANE_DISPLAY_OPTION_TO_5].value.action);
+ addScreenAction (s, &pd->opt[PLANE_DISPLAY_OPTION_TO_6].value.action);
+ addScreenAction (s, &pd->opt[PLANE_DISPLAY_OPTION_TO_7].value.action);
+ addScreenAction (s, &pd->opt[PLANE_DISPLAY_OPTION_TO_8].value.action);
+ addScreenAction (s, &pd->opt[PLANE_DISPLAY_OPTION_TO_9].value.action);
+ addScreenAction (s, &pd->opt[PLANE_DISPLAY_OPTION_TO_10].value.action);
+ addScreenAction (s, &pd->opt[PLANE_DISPLAY_OPTION_TO_11].value.action);
+ addScreenAction (s, &pd->opt[PLANE_DISPLAY_OPTION_TO_12].value.action);
+
+ WRAP (ps, s, paintTransformedScreen, planePaintTransformedScreen);
+ WRAP (ps, s, preparePaintScreen, planePreparePaintScreen);
+ WRAP (ps, s, donePaintScreen, planeDonePaintScreen);
+ WRAP (ps, s, paintScreen, planePaintScreen);
+ WRAP (ps, s, setScreenOptionForPlugin, planeSetScreenOptionForPlugin);
+ WRAP (ps, s, windowGrabNotify, planeWindowGrabNotify);
+ WRAP (ps, s, windowUngrabNotify, planeWindowUngrabNotify);
+
+ s->privates[pd->screenPrivateIndex].ptr = ps;
+
+ return TRUE;
+}
+
+static void
+planeFiniScreen (CompPlugin *p,
+ CompScreen *s)
+{
+ PLANE_SCREEN (s);
+
+ UNWRAP (ps, s, paintTransformedScreen);
+ UNWRAP (ps, s, preparePaintScreen);
+ UNWRAP (ps, s, donePaintScreen);
+ UNWRAP (ps, s, paintScreen);
+ UNWRAP (ps, s, setScreenOptionForPlugin);
+ UNWRAP (ps, s, windowGrabNotify);
+ UNWRAP (ps, s, windowUngrabNotify);
+
+ free (ps);
+}
+
+static Bool
+planeInit (CompPlugin *p)
+{
+ displayPrivateIndex = allocateDisplayPrivateIndex ();
+ if (displayPrivateIndex < 0)
+ return FALSE;
+
+ return TRUE;
+}
+
+static void
+planeFini (CompPlugin *p)
+{
+ if (displayPrivateIndex >= 0)
+ freeDisplayPrivateIndex (displayPrivateIndex);
+}
+
+CompPluginDep planeDeps[] = {
+#if 0
+ /* We need a new CompPluginRuleConflicts */
+ { CompPluginRuleConflicts, "rotate" },
+ { CompPluginRuleConflicts, "cube" },
+#endif
+};
+
+CompPluginVTable planeVTable = {
+ "plane",
+ N_("Desktop Plane"),
+ N_("Place windows on a plane"),
+ planeInit, /* planeInit, */
+ planeFini, /* planeFini, */
+ planeInitDisplay,
+ planeFiniDisplay,
+ planeInitScreen,
+ planeFiniScreen,
+ 0, /* InitWindow */
+ 0, /* FiniWindow */
+ planeGetDisplayOptions,
+ planeSetDisplayOption,
+ NULL, /* planeGetScreenOptions, */
+ NULL, /* planeSetScreenOption, */
+ planeDeps,
+ sizeof (planeDeps) / sizeof (planeDeps[0])
+};
+
+CompPluginVTable *
+getCompPluginInfo (void)
+{
+ return &planeVTable;
+}
--- compiz-3173a142efe5e7af83ebb534a074d9d2a0c67a86/plugins/cube.c.plane 2006-09-01 14:05:12.000000000 -0400
+++ compiz-3173a142efe5e7af83ebb534a074d9d2a0c67a86/plugins/cube.c 2006-09-01 14:05:12.000000000 -0400
@@ -741,7 +741,7 @@
case CUBE_SCREEN_OPTION_IN:
if (compSetBoolOption (o, value))
{
- if (cubeUpdateGeometry (screen, screen->size, o->value.b ? -1 : 1))
+ if (cubeUpdateGeometry (screen, screen->hsize, o->value.b ? -1 : 1))
return TRUE;
}
break;
@@ -1042,7 +1042,7 @@
{
ScreenPaintAttrib sa = *sAttrib;
int xMove = 0;
- float size = s->size;
+ float size = s->hsize;
CUBE_SCREEN (s);
@@ -1100,18 +1100,18 @@
sa.xRotate = sAttrib->xRotate * cs->invert;
if (sa.xRotate > 0.0f)
{
- cs->xrotations = (int) (s->size * sa.xRotate) / 360;
- sa.xRotate = sa.xRotate - (360.0f * cs->xrotations) / s->size;
+ cs->xrotations = (int) (s->hsize * sa.xRotate) / 360;
+ sa.xRotate = sa.xRotate - (360.0f * cs->xrotations) / s->hsize;
}
else
{
- cs->xrotations = (int) (s->size * sa.xRotate) / 360;
+ cs->xrotations = (int) (s->hsize * sa.xRotate) / 360;
sa.xRotate = sa.xRotate -
- (360.0f * cs->xrotations) / s->size + 360.0f / s->size;
+ (360.0f * cs->xrotations) / s->hsize + 360.0f / s->hsize;
cs->xrotations--;
}
- sa.xRotate = sa.xRotate / size * s->size;
+ sa.xRotate = sa.xRotate / size * s->hsize;
}
else
{
@@ -1160,7 +1160,7 @@
glNormal3f (0.0f, -1.0f, 0.0f);
- if (cs->invert == 1 && s->size == 4 && cs->texture.name)
+ if (cs->invert == 1 && s->hsize == 4 && cs->texture.name)
{
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
@@ -1207,23 +1207,23 @@
/* outside cube */
if (cs->invert == 1)
{
- if (cs->grabIndex || s->size > 4)
+ if (cs->grabIndex || s->hsize > 4)
{
GLenum filter;
int i;
- xMove = cs->xrotations - ((s->size >> 1) - 1);
- sa.yRotate += (360.0f / size) * ((s->size >> 1) - 1);
+ xMove = cs->xrotations - ((s->hsize >> 1) - 1);
+ sa.yRotate += (360.0f / size) * ((s->hsize >> 1) - 1);
filter = s->display->textureFilter;
if (cs->grabIndex && cs->opt[CUBE_SCREEN_OPTION_MIPMAP].value.b)
s->display->textureFilter = GL_LINEAR_MIPMAP_LINEAR;
- for (i = 0; i < s->size; i++)
+ for (i = 0; i < s->hsize; i++)
{
- moveScreenViewport (s, xMove, FALSE);
+ moveScreenViewport (s, xMove, 0, FALSE);
(*s->paintTransformedScreen) (s, &sa, mask);
- moveScreenViewport (s, -xMove, FALSE);
+ moveScreenViewport (s, -xMove, 0, FALSE);
sa.yRotate -= 360.0f / size;
xMove++;
@@ -1237,19 +1237,19 @@
{
xMove = cs->xrotations;
- moveScreenViewport (s, xMove, FALSE);
+ moveScreenViewport (s, xMove, 0, FALSE);
(*s->paintTransformedScreen) (s, &sa, mask);
- moveScreenViewport (s, -xMove, FALSE);
+ moveScreenViewport (s, -xMove, 0, FALSE);
xMove++;
- moveScreenViewport (s, xMove, FALSE);
+ moveScreenViewport (s, xMove, 0, FALSE);
}
sa.yRotate -= 360.0f / size;
(*s->paintTransformedScreen) (s, &sa, mask);
- moveScreenViewport (s, -xMove, FALSE);
+ moveScreenViewport (s, -xMove, 0, FALSE);
}
}
else
@@ -1274,20 +1274,20 @@
if (sa.xRotate > 180.0f / size)
{
- xMove -= ((s->size >> 1) - 2);
- sa.yRotate -= (360.0f / size) * ((s->size >> 1) - 2);
+ xMove -= ((s->hsize >> 1) - 2);
+ sa.yRotate -= (360.0f / size) * ((s->hsize >> 1) - 2);
}
else
{
- xMove -= ((s->size >> 1) - 1);
- sa.yRotate -= (360.0f / size) * ((s->size >> 1) - 1);
+ xMove -= ((s->hsize >> 1) - 1);
+ sa.yRotate -= (360.0f / size) * ((s->hsize >> 1) - 1);
}
- for (i = 0; i < s->size; i++)
+ for (i = 0; i < s->hsize; i++)
{
- moveScreenViewport (s, xMove, FALSE);
+ moveScreenViewport (s, xMove, 0, FALSE);
(*s->paintTransformedScreen) (s, &sa, mask);
- moveScreenViewport (s, -xMove, FALSE);
+ moveScreenViewport (s, -xMove, 0, FALSE);
sa.yRotate += 360.0f / size;
xMove++;
@@ -1297,23 +1297,23 @@
}
else
{
- moveScreenViewport (s, xMove, FALSE);
+ moveScreenViewport (s, xMove, 0, FALSE);
(*s->paintTransformedScreen) (s, &sa, mask);
- moveScreenViewport (s, -xMove, FALSE);
+ moveScreenViewport (s, -xMove, 0, FALSE);
sa.yRotate += 360.0f / size;
xMove = -cs->xrotations;
- moveScreenViewport (s, xMove, FALSE);
+ moveScreenViewport (s, xMove, 0, FALSE);
(*s->paintTransformedScreen) (s, &sa, mask);
- moveScreenViewport (s, -xMove, FALSE);
+ moveScreenViewport (s, -xMove, 0, FALSE);
sa.yRotate += 360.0f / size;
xMove = 1 - cs->xrotations;
- moveScreenViewport (s, xMove, FALSE);
+ moveScreenViewport (s, xMove, 0, FALSE);
(*s->paintTransformedScreen) (s, &sa, mask);
- moveScreenViewport (s, -xMove, FALSE);
+ moveScreenViewport (s, -xMove, 0, FALSE);
}
}
@@ -1472,7 +1472,7 @@
WRAP (cs, s, setScreenOption, cubeSetGlobalScreenOption);
if (status && strcmp (name, "size") == 0)
- cubeUpdateGeometry (s, s->size, cs->invert);
+ cubeUpdateGeometry (s, s->hsize, cs->invert);
return status;
}
@@ -1679,7 +1679,7 @@
WRAP (cs, s, paintBackground, cubePaintBackground);
WRAP (cs, s, setScreenOption, cubeSetGlobalScreenOption);
- if (!cubeUpdateGeometry (s, s->size, cs->invert))
+ if (!cubeUpdateGeometry (s, s->hsize, cs->invert))
return FALSE;
if (cs->imgNFile)
--- compiz-3173a142efe5e7af83ebb534a074d9d2a0c67a86/include/compiz.h.plane 2006-09-01 14:05:12.000000000 -0400
+++ compiz-3173a142efe5e7af83ebb534a074d9d2a0c67a86/include/compiz.h 2006-09-01 14:05:12.000000000 -0400
@@ -1281,7 +1281,9 @@
int width;
int height;
int x;
- int size;
+ int y;
+ int hsize; /* Number of horizontal viewports */
+ int vsize; /* Number of vertical viewports */
REGION region;
Region damage;
unsigned long damageMask;
@@ -1541,6 +1543,7 @@
void
moveScreenViewport (CompScreen *s,
int tx,
+ int ty,
Bool sync);
void
@@ -2010,8 +2013,10 @@
void
redirectWindow (CompWindow *w);
-int
-defaultViewportForWindow (CompWindow *w);
+void
+defaultViewportForWindow (CompWindow *w,
+ int *vx,
+ int *vy);
CompIcon *
getWindowIcon (CompWindow *w,
--- compiz-3173a142efe5e7af83ebb534a074d9d2a0c67a86/src/screen.c.plane 2006-09-01 14:05:12.000000000 -0400
+++ compiz-3173a142efe5e7af83ebb534a074d9d2a0c67a86/src/screen.c 2006-09-01 14:05:12.000000000 -0400
@@ -104,19 +104,21 @@
static void
setVirtualScreenSize (CompScreen *screen,
- int size)
+ int hsize,
+ int vsize)
{
unsigned long data[2];
- data[0] = screen->width * size;
- data[1] = screen->height;
+ data[0] = screen->width * hsize;
+ data[1] = screen->height * vsize;
XChangeProperty (screen->display->display, screen->root,
screen->display->desktopGeometryAtom,
XA_CARDINAL, 32, PropModeReplace,
(unsigned char *) data, 2);
- screen->size = size;
+ screen->hsize = hsize;
+ screen->vsize = vsize;
}
static Bool
@@ -198,10 +200,13 @@
case COMP_SCREEN_OPTION_SIZE:
if (compSetIntOption (o, value))
{
+ /* FIXME */
+ int vsize = 4;
+
if (o->value.i * screen->width > MAXSHORT)
return FALSE;
- setVirtualScreenSize (screen, o->value.i);
+ setVirtualScreenSize (screen, o->value.i, vsize);
return TRUE;
}
break;
@@ -826,22 +831,25 @@
{
memcpy (data, propData, sizeof (unsigned long));
- if (data[0] / s->width < s->size - 1)
+ if (data[0] / s->width < s->hsize - 1)
s->x = data[0] / s->width;
+
+ if (data[1] / s->height < s->vsize - 1)
+ s->y = data[1] / s->height;
}
XFree (propData);
}
data[0] = s->x * s->width;
- data[1] = 0;
+ data[1] = s->y * s->height;
XChangeProperty (d->display, s->root, d->desktopViewportAtom,
XA_CARDINAL, 32, PropModeReplace,
(unsigned char *) data, 2);
- data[0] = s->width * s->size;
- data[1] = s->height;
+ data[0] = s->width * s->hsize;
+ data[1] = s->height * s->vsize;
XChangeProperty (d->display, s->root, d->desktopGeometryAtom,
XA_CARDINAL, 32, PropModeReplace,
@@ -865,7 +873,7 @@
d->showingDesktopAtom, 0L, 1L, FALSE,
XA_CARDINAL, &actual, &format,
&n, &left, &propData);
-
+
if (result == Success && n && propData)
{
memcpy (data, propData, sizeof (unsigned long));
@@ -956,8 +964,10 @@
if (!s->damage)
return FALSE;
- s->x = 0;
- s->size = 4;
+ s->x = 0;
+ s->y = 0;
+ s->hsize = 4;
+ s->vsize = 4;
for (i = 0; i < SCREEN_EDGE_NUM; i++)
{
@@ -2493,61 +2503,89 @@
void
moveScreenViewport (CompScreen *s,
int tx,
+ int ty,
Bool sync)
{
+ CompWindow *w;
+ int m, wx, wy, vWidth, vHeight;
+
tx = s->x - tx;
- tx = MOD (tx, s->size);
+ tx = MOD (tx, s->hsize);
tx -= s->x;
- if (tx)
- {
- CompWindow *w;
- int m, wx, vWidth = s->width * s->size;
-
- s->x += tx;
+ ty = s->y - ty;
+ ty = MOD (ty, s->vsize);
+ ty -= s->y;
- tx *= -s->width;
+ if (!tx && !ty)
+ return;
- for (w = s->windows; w; w = w->next)
- {
- if (w->attrib.override_redirect)
- continue;
+ s->x += tx;
+ s->y += ty;
- if (w->type & (CompWindowTypeDesktopMask | CompWindowTypeDockMask))
- continue;
+ tx *= -s->width;
+ ty *= -s->height;
- if (w->state & CompWindowStateStickyMask)
- continue;
+ vWidth = s->width * s->hsize;
+ vHeight = s->height * s->vsize;
+
+ for (w = s->windows; w; w = w->next)
+ {
+ if (w->attrib.override_redirect)
+ continue;
+
+ if (w->type & (CompWindowTypeDesktopMask | CompWindowTypeDockMask))
+ continue;
+
+ if (w->state & CompWindowStateStickyMask)
+ continue;
- m = w->attrib.x + tx;
- if (m - w->output.left < s->width - vWidth)
- wx = tx + vWidth;
- else if (m + w->width + w->output.right > vWidth)
- wx = tx - vWidth;
- else
- wx = tx;
+ /* x */
+ m = w->attrib.x + tx;
+ if (m - w->output.left < s->width - vWidth)
+ wx = tx + vWidth;
+ else if (m + w->width + w->output.right > vWidth)
+ wx = tx - vWidth;
+ else
+ wx = tx;
+
+ if (w->saveMask & CWX)
+ w->saveWc.x += wx;
- if (w->saveMask & CWX)
- w->saveWc.x += wx;
- moveWindow (w, wx, 0, sync, TRUE);
+ /* y */
+ m = w->attrib.y + ty;
+ if (m - w->output.top < s->height - vHeight)
+ wy = ty + vHeight;
+ else if (m + w->height + w->output.bottom > vHeight)
+ wy = ty - vHeight;
+ else
+ wy = ty;
- if (sync)
- syncWindowPosition (w);
- }
+ if (w->saveMask & CWY)
+ w->saveWc.y += wy;
+ /* move */
+
+ moveWindow (w, wx, wy, sync, TRUE);
+
if (sync)
- {
- unsigned long data[2];
-
- data[0] = s->x * s->width;
- data[1] = 0;
+ syncWindowPosition (w);
+ }
+
+ if (sync)
+ {
+ unsigned long data[2];
- XChangeProperty (s->display->display, s->root,
- s->display->desktopViewportAtom,
- XA_CARDINAL, 32, PropModeReplace,
- (unsigned char *) data, 2);
- }
+ data[0] = s->x * s->width;
+ data[1] = s->y * s->height;
+
+ printf ("new position: %d %d\n", data[0], data[1]);
+
+ XChangeProperty (s->display->display, s->root,
+ s->display->desktopViewportAtom,
+ XA_CARDINAL, 32, PropModeReplace,
+ (unsigned char *) data, 2);
}
}
@@ -2556,7 +2594,7 @@
int x,
Bool sync)
{
- int tx, vWidth = w->screen->width * w->screen->size;
+ int tx, vWidth = w->screen->width * w->screen->hsize;
x += w->screen->x * w->screen->width;
x = MOD (x, vWidth);
--- compiz-3173a142efe5e7af83ebb534a074d9d2a0c67a86/src/window.c.plane 2006-09-01 14:05:12.000000000 -0400
+++ compiz-3173a142efe5e7af83ebb534a074d9d2a0c67a86/src/window.c 2006-09-01 14:05:12.000000000 -0400
@@ -2903,9 +2903,13 @@
int oldBorderWidth)
{
int mask = 0;
- int x;
+ int x, y;
+ int vx, vy;
- x = (defaultViewportForWindow (w) - w->screen->x) * w->screen->width;
+ defaultViewportForWindow (w, &vx, &vy);
+
+ x = (vx - w->screen->x) * w->screen->width;
+ y = (vy - w->screen->y) * w->screen->height;
if (w->type & CompWindowTypeFullscreenMask)
{
@@ -2969,7 +2973,7 @@
if (w->type & CompWindowTypeFullscreenMask)
{
xwc->x = x;
- xwc->y = 0;
+ xwc->y = y;
mask |= CWX | CWY;
}
@@ -2993,16 +2997,16 @@
if (w->state & CompWindowStateMaximizedVertMask)
{
- if (oldY < w->screen->workArea.y + w->input.top)
+ if (oldY < y + w->screen->workArea.y + w->input.top)
{
- xwc->y = w->screen->workArea.y + w->input.top;
+ xwc->y = y + w->screen->workArea.y + w->input.top;
mask |= CWY;
}
else
{
height = xwc->height + oldBorderWidth * 2;
- max = w->screen->workArea.y + w->screen->workArea.height;
+ max = y + w->screen->workArea.y + w->screen->workArea.height;
if (oldY + oldHeight + w->input.bottom > max)
{
xwc->y = max - height - w->input.bottom;
@@ -3393,9 +3397,9 @@
return;
x1 = w->screen->workArea.x - w->screen->width * w->screen->x;
- y1 = w->screen->workArea.y;
- x2 = x1 + w->screen->workArea.width + w->screen->size * w->screen->width;
- y2 = y1 + w->screen->workArea.height;
+ y1 = w->screen->workArea.y - w->screen->height * w->screen->y;
+ x2 = x1 + w->screen->workArea.width + w->screen->hsize * w->screen->width;
+ y2 = y1 + w->screen->workArea.height + w->screen->vsize * w->screen->height;
if (w->attrib.x - w->input.left >= x2)
dx = (x2 - 25) - w->attrib.x;
@@ -3880,20 +3884,44 @@
currently computed as the viewport where the center of the window is
located, except for when the window is visible in the current viewport as
the current viewport is then always returned. */
-int
-defaultViewportForWindow (CompWindow *w)
+void
+defaultViewportForWindow (CompWindow *w,
+ int *vx,
+ int *vy)
{
CompScreen *s = w->screen;
int x;
+ int y;
- if (w->attrib.x < s->width && w->attrib.x + w->width > 0)
- return s->x;
+ if ((w->attrib.x < s->width && w->attrib.x + w->width > 0) &&
+ (w->attrib.y < s->height && w->attrib.y + w->height > 0))
+ {
+ if (vx)
+ *vx = s->x;
- x = w->attrib.x + (w->width >> 1);
- if (x < 0)
- return s->x + ((x / s->width) - 1) % s->size;
- else
- return s->x + (x / s->width) % s->size;
+ if (vy)
+ *vy = s->y;
+
+ return;
+ }
+
+ if (vx)
+ {
+ x = w->attrib.x + (w->width >> 1);
+ if (x < 0)
+ *vx = s->x + ((x / s->width) - 1) % s->hsize;
+ else
+ *vx = s->x + (x / s->width) % s->hsize;
+ }
+
+ if (vy)
+ {
+ y = w->attrib.y + (w->height >> 1);
+ if (y < 0)
+ *vy = s->y + ((y / s->height) - 1) % s->vsize;
+ else
+ *vy = s->y + (y / s->height) % s->vsize;
+ }
}
Index: compiz.spec
===================================================================
RCS file: /cvs/dist/rpms/compiz/devel/compiz.spec,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- compiz.spec 31 Aug 2006 00:50:04 -0000 1.24
+++ compiz.spec 1 Sep 2006 18:24:39 -0000 1.25
@@ -10,7 +10,7 @@
License: X11/MIT/GPL
Group: User Interface/Desktops
Version: 0.0.13
-Release: 0.21.%{snapshot}git%{?dist}
+Release: 0.22.%{snapshot}git%{?dist}
Summary: OpenGL window and compositing manager
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -34,6 +34,11 @@
Source0: %{name}-%{sha1}.tar.bz2
Source1: desktop-effects-%{dialogversion}.tar.bz2
+# Patches already upstream
+Patch000: resize-move-keybindings.patch
+Patch001: sync-override-redirect-windows.patch
+
+# Patches that are not upstream
Patch101: aiglx-defaults.patch
Patch102: tfp-server-extension.patch
Patch103: composite-cube-logo.patch
@@ -41,10 +46,7 @@
Patch105: fedora-logo.patch
Patch106: glfinish.patch
Patch107: cow.patch
-
-# Patches already upstream
-Patch200: resize-move-keybindings.patch
-Patch201: sync-override-redirect-windows.patch
+Patch108: plane.patch
%description
Compiz is one of the first OpenGL-accelerated compositing window
@@ -71,6 +73,9 @@
%setup -q -T -b1 -n desktop-effects-%{dialogversion}
%setup -q -n %{name}-%{sha1}
+%patch000 -p1 -b .resize-move-keybindings
+%patch001 -p1 -b .sync-override-redirect-windows
+
%patch101 -p1 -b .aiglx-defaults
%patch102 -p1 -b .tfp-server-extension
%patch103 -p1 -b .composite-cube-logo
@@ -78,11 +83,16 @@
%patch105 -p1 -b .fedora-logo
%patch106 -p1 -b .glfinish
%patch107 -p1 -b .cow
-
-%patch200 -p1 -b .resize-move-keybindings
-%patch201 -p1 -b .sync-override-redirect-windows
+%patch108 -p1 -b .plane
%build
+rm -rf $RPM_BUILD_ROOT
+
+CPPFLAGS="$CPPFLAGS -I$RPM_BUILD_ROOT%{_includedir}"
+export CPPFLAGS
+
+autoreconf
+
%configure --disable-libsvg-cairo
make %{?_smp_mflags}
@@ -142,6 +152,9 @@
%{_includedir}/compiz
%changelog
+* Fri Sep 1 2006 Soren Sandmann <sandmann at redhat.com> - 0.0.13-0.22.20060817git.fc6
+- Add a patch to put viewports on a plane.
+
* Wed Aug 30 2006 Kristian Høgsberg <krh at redhat.com> - 0.0.13-0.21.20060817git.fc6
- Drop gl-include-inferiors.patch now that compiz uses COW and the X
server evicts offscreen pixmaps automatically on
More information about the fedora-cvs-commits
mailing list