summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorSam Spilsbury <smspillaz@XPS-FEDORA.(none)>2009-08-12 20:47:23 +0800
committerSam Spilsbury <smspillaz@XPS-FEDORA.(none)>2009-08-12 20:47:23 +0800
commit9ac4fd0a4b0afadb41385481529ce39879bdb23f (patch)
tree706fdebc53dbc191eb7bdac75f22e576ea22b864 /legacy
parent72f8f1df208cc25ce39119293790ccc50a362c35 (diff)
downloadzcomp-9ac4fd0a4b0afadb41385481529ce39879bdb23f.tar.gz
zcomp-9ac4fd0a4b0afadb41385481529ce39879bdb23f.tar.bz2
Remove annotate and clone from legacy
Diffstat (limited to 'legacy')
-rw-r--r--legacy/annotate.cpp962
-rw-r--r--legacy/annotate.xml.in62
-rw-r--r--legacy/clone.cpp936
-rw-r--r--legacy/clone.xml.in13
4 files changed, 0 insertions, 1973 deletions
diff --git a/legacy/annotate.cpp b/legacy/annotate.cpp
deleted file mode 100644
index c377dee..0000000
--- a/legacy/annotate.cpp
+++ /dev/null
@@ -1,962 +0,0 @@
-/*
- * Copyright © 2006 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@novell.com>
- */
-
-#include <stdlib.h>
-#include <math.h>
-#include <string.h>
-#include <cairo-xlib-xrender.h>
-
-#include <compiz-core.h>
-
-static CompMetadata annoMetadata;
-
-static int displayPrivateIndex;
-
-static int annoLastPointerX = 0;
-static int annoLastPointerY = 0;
-
-#define ANNO_DISPLAY_OPTION_INITIATE_BUTTON 0
-#define ANNO_DISPLAY_OPTION_DRAW_BUTTON 1
-#define ANNO_DISPLAY_OPTION_ERASE_BUTTON 2
-#define ANNO_DISPLAY_OPTION_CLEAR_KEY 3
-#define ANNO_DISPLAY_OPTION_CLEAR_BUTTON 4
-#define ANNO_DISPLAY_OPTION_FILL_COLOR 5
-#define ANNO_DISPLAY_OPTION_STROKE_COLOR 6
-#define ANNO_DISPLAY_OPTION_LINE_WIDTH 7
-#define ANNO_DISPLAY_OPTION_STROKE_WIDTH 8
-#define ANNO_DISPLAY_OPTION_NUM 9
-
-typedef struct _AnnoDisplay {
- int screenPrivateIndex;
- HandleEventProc handleEvent;
-
- CompOption opt[ANNO_DISPLAY_OPTION_NUM];
-} AnnoDisplay;
-
-typedef struct _AnnoScreen {
- PaintOutputProc paintOutput;
- int grabIndex;
-
- Pixmap pixmap;
- CompTexture texture;
- cairo_surface_t *surface;
- cairo_t *cairo;
- Bool content;
-
- Bool eraseMode;
-} AnnoScreen;
-
-#define GET_ANNO_DISPLAY(d) \
- ((AnnoDisplay *) (d)->base.privates[displayPrivateIndex].ptr)
-
-#define ANNO_DISPLAY(d) \
- AnnoDisplay *ad = GET_ANNO_DISPLAY (d)
-
-#define GET_ANNO_SCREEN(s, ad) \
- ((AnnoScreen *) (s)->base.privates[(ad)->screenPrivateIndex].ptr)
-
-#define ANNO_SCREEN(s) \
- AnnoScreen *as = GET_ANNO_SCREEN (s, GET_ANNO_DISPLAY (s->display))
-
-#define NUM_OPTIONS(s) (sizeof ((s)->opt) / sizeof (CompOption))
-
-
-#define NUM_TOOLS (sizeof (tools) / sizeof (tools[0]))
-
-static void
-annoCairoClear (CompScreen *s,
- cairo_t *cr)
-{
- ANNO_SCREEN (s);
-
- cairo_save (cr);
- cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
- cairo_paint (cr);
- cairo_restore (cr);
-
- as->content = FALSE;
-}
-
-static cairo_t *
-annoCairoContext (CompScreen *s)
-{
- ANNO_SCREEN (s);
-
- if (!as->cairo)
- {
- XRenderPictFormat *format;
- Screen *screen;
- int w, h;
-
- screen = ScreenOfDisplay (s->display->display, s->screenNum);
-
- w = s->width;
- h = s->height;
-
- format = XRenderFindStandardFormat (s->display->display,
- PictStandardARGB32);
-
- as->pixmap = XCreatePixmap (s->display->display, s->root, w, h, 32);
-
- if (!bindPixmapToTexture (s, &as->texture, as->pixmap, w, h, 32))
- {
- compLogMessage (s->display, "annotate", CompLogLevelError,
- "Couldn't bind pixmap 0x%x to texture",
- (int) as->pixmap);
-
- XFreePixmap (s->display->display, as->pixmap);
-
- return NULL;
- }
-
- as->surface =
- cairo_xlib_surface_create_with_xrender_format (s->display->display,
- as->pixmap, screen,
- format, w, h);
-
- as->cairo = cairo_create (as->surface);
-
- annoCairoClear (s, as->cairo);
- }
-
- return as->cairo;
-}
-
-static void
-annoSetSourceColor (cairo_t *cr,
- unsigned short *color)
-{
- cairo_set_source_rgba (cr,
- (double) color[0] / 0xffff,
- (double) color[1] / 0xffff,
- (double) color[2] / 0xffff,
- (double) color[3] / 0xffff);
-}
-
-static void
-annoDrawCircle (CompScreen *s,
- double xc,
- double yc,
- double radius,
- unsigned short *fillColor,
- unsigned short *strokeColor,
- double strokeWidth)
-{
- REGION reg;
- cairo_t *cr;
-
- ANNO_SCREEN (s);
-
- cr = annoCairoContext (s);
- if (cr)
- {
- double ex1, ey1, ex2, ey2;
-
- annoSetSourceColor (cr, fillColor);
- cairo_arc (cr, xc, yc, radius, 0, 2 * M_PI);
- cairo_fill_preserve (cr);
- cairo_set_line_width (cr, strokeWidth);
- cairo_stroke_extents (cr, &ex1, &ey1, &ex2, &ey2);
- annoSetSourceColor (cr, strokeColor);
- cairo_stroke (cr);
-
- reg.rects = &reg.extents;
- reg.numRects = 1;
-
- reg.extents.x1 = ex1;
- reg.extents.y1 = ey1;
- reg.extents.x2 = ex2;
- reg.extents.y2 = ey2;
-
- as->content = TRUE;
- damageScreenRegion (s, &reg);
- }
-}
-
-static void
-annoDrawRectangle (CompScreen *s,
- double x,
- double y,
- double w,
- double h,
- unsigned short *fillColor,
- unsigned short *strokeColor,
- double strokeWidth)
-{
- REGION reg;
- cairo_t *cr;
-
- ANNO_SCREEN (s);
-
- cr = annoCairoContext (s);
- if (cr)
- {
- double ex1, ey1, ex2, ey2;
-
- annoSetSourceColor (cr, fillColor);
- cairo_rectangle (cr, x, y, w, h);
- cairo_fill_preserve (cr);
- cairo_set_line_width (cr, strokeWidth);
- cairo_stroke_extents (cr, &ex1, &ey1, &ex2, &ey2);
- annoSetSourceColor (cr, strokeColor);
- cairo_stroke (cr);
-
- reg.rects = &reg.extents;
- reg.numRects = 1;
-
- reg.extents.x1 = ex1;
- reg.extents.y1 = ey1;
- reg.extents.x2 = ex2 + 2.0;
- reg.extents.y2 = ey2 + 2.0;
-
- as->content = TRUE;
- damageScreenRegion (s, &reg);
- }
-}
-
-static void
-annoDrawLine (CompScreen *s,
- double x1,
- double y1,
- double x2,
- double y2,
- double width,
- unsigned short *color)
-{
- REGION reg;
- cairo_t *cr;
-
- ANNO_SCREEN (s);
-
- cr = annoCairoContext (s);
- if (cr)
- {
- double ex1, ey1, ex2, ey2;
-
- cairo_set_line_width (cr, width);
- cairo_move_to (cr, x1, y1);
- cairo_line_to (cr, x2, y2);
- cairo_stroke_extents (cr, &ex1, &ey1, &ex2, &ey2);
- cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
- annoSetSourceColor (cr, color);
- cairo_stroke (cr);
-
- reg.rects = &reg.extents;
- reg.numRects = 1;
-
- reg.extents.x1 = ex1;
- reg.extents.y1 = ey1;
- reg.extents.x2 = ex2;
- reg.extents.y2 = ey2;
-
- as->content = TRUE;
- damageScreenRegion (s, &reg);
- }
-}
-
-static void
-annoDrawText (CompScreen *s,
- double x,
- double y,
- char *text,
- char *fontFamily,
- double fontSize,
- int fontSlant,
- int fontWeight,
- unsigned short *fillColor,
- unsigned short *strokeColor,
- double strokeWidth)
-{
- REGION reg;
- cairo_t *cr;
-
- ANNO_SCREEN (s);
-
- cr = annoCairoContext (s);
- if (cr)
- {
- cairo_text_extents_t extents;
-
- cairo_set_line_width (cr, strokeWidth);
- annoSetSourceColor (cr, fillColor);
- cairo_select_font_face (cr, fontFamily, fontSlant, fontWeight);
- cairo_set_font_size (cr, fontSize);
- cairo_text_extents (cr, text, &extents);
- cairo_save (cr);
- cairo_move_to (cr, x, y);
- cairo_text_path (cr, text);
- cairo_fill_preserve (cr);
- annoSetSourceColor (cr, strokeColor);
- cairo_stroke (cr);
- cairo_restore (cr);
-
- reg.rects = &reg.extents;
- reg.numRects = 1;
-
- reg.extents.x1 = x;
- reg.extents.y1 = y + extents.y_bearing - 2.0;
- reg.extents.x2 = x + extents.width + 20.0;
- reg.extents.y2 = y + extents.height;
-
- as->content = TRUE;
- damageScreenRegion (s, &reg);
- }
-}
-
-static Bool
-annoDraw (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption)
-{
- CompScreen *s;
- Window xid;
-
- xid = getIntOptionNamed (option, nOption, "root", 0);
-
- s = findScreenAtDisplay (d, xid);
- if (s)
- {
- cairo_t *cr;
-
- cr = annoCairoContext (s);
- if (cr)
- {
- char *tool;
- unsigned short *fillColor, *strokeColor;
- double lineWidth, strokeWidth;
-
- ANNO_DISPLAY (d);
-
- tool = getStringOptionNamed (option, nOption, "tool", "line");
-
- cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
- cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
-
- fillColor = ad->opt[ANNO_DISPLAY_OPTION_FILL_COLOR].value.c;
- fillColor = getColorOptionNamed (option, nOption, "fill_color",
- fillColor);
-
- strokeColor = ad->opt[ANNO_DISPLAY_OPTION_STROKE_COLOR].value.c;
- strokeColor = getColorOptionNamed (option, nOption,
- "stroke_color", strokeColor);
-
- strokeWidth = ad->opt[ANNO_DISPLAY_OPTION_STROKE_WIDTH].value.f;
- strokeWidth = getFloatOptionNamed (option, nOption, "stroke_width",
- strokeWidth);
-
- lineWidth = ad->opt[ANNO_DISPLAY_OPTION_LINE_WIDTH].value.f;
- lineWidth = getFloatOptionNamed (option, nOption, "line_width",
- lineWidth);
-
- if (strcasecmp (tool, "rectangle") == 0)
- {
- double x, y, w, h;
-
- x = getFloatOptionNamed (option, nOption, "x", 0);
- y = getFloatOptionNamed (option, nOption, "y", 0);
- w = getFloatOptionNamed (option, nOption, "w", 100);
- h = getFloatOptionNamed (option, nOption, "h", 100);
-
- annoDrawRectangle (s, x, y, w, h, fillColor, strokeColor,
- strokeWidth);
- }
- else if (strcasecmp (tool, "circle") == 0)
- {
- double xc, yc, r;
-
- xc = getFloatOptionNamed (option, nOption, "xc", 0);
- yc = getFloatOptionNamed (option, nOption, "yc", 0);
- r = getFloatOptionNamed (option, nOption, "radius", 100);
-
- annoDrawCircle (s, xc, yc, r, fillColor, strokeColor,
- strokeWidth);
- }
- else if (strcasecmp (tool, "line") == 0)
- {
- double x1, y1, x2, y2;
-
- x1 = getFloatOptionNamed (option, nOption, "x1", 0);
- y1 = getFloatOptionNamed (option, nOption, "y1", 0);
- x2 = getFloatOptionNamed (option, nOption, "x2", 100);
- y2 = getFloatOptionNamed (option, nOption, "y2", 100);
-
- annoDrawLine (s, x1, y1, x2, y2, lineWidth, fillColor);
- }
- else if (strcasecmp (tool, "text") == 0)
- {
- double x, y, size;
- char *text, *family;
- unsigned int slant, weight;
- char *str;
-
- str = getStringOptionNamed (option, nOption, "slant", "");
- if (strcasecmp (str, "oblique") == 0)
- slant = CAIRO_FONT_SLANT_OBLIQUE;
- else if (strcasecmp (str, "italic") == 0)
- slant = CAIRO_FONT_SLANT_ITALIC;
- else
- slant = CAIRO_FONT_SLANT_NORMAL;
-
- str = getStringOptionNamed (option, nOption, "weight", "");
- if (strcasecmp (str, "bold") == 0)
- weight = CAIRO_FONT_WEIGHT_BOLD;
- else
- weight = CAIRO_FONT_WEIGHT_NORMAL;
-
- x = getFloatOptionNamed (option, nOption, "x", 0);
- y = getFloatOptionNamed (option, nOption, "y", 0);
- text = getStringOptionNamed (option, nOption, "text", "");
- family = getStringOptionNamed (option, nOption, "family",
- "Sans");
- size = getFloatOptionNamed (option, nOption, "size", 36.0);
-
- annoDrawText (s, x, y, text, family, size, slant, weight,
- fillColor, strokeColor, strokeWidth);
- }
- }
- }
-
- return FALSE;
-}
-
-static Bool
-annoInitiate (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption)
-{
- CompScreen *s;
- Window xid;
-
- xid = getIntOptionNamed (option, nOption, "root", 0);
-
- s = findScreenAtDisplay (d, xid);
- if (s)
- {
- ANNO_SCREEN (s);
-
- if (otherScreenGrabExist (s, 0))
- return FALSE;
-
- if (!as->grabIndex)
- as->grabIndex = pushScreenGrab (s, None, "annotate");
-
- if (state & CompActionStateInitButton)
- action->state |= CompActionStateTermButton;
-
- if (state & CompActionStateInitKey)
- action->state |= CompActionStateTermKey;
-
- annoLastPointerX = pointerX;
- annoLastPointerY = pointerY;
-
- as->eraseMode = FALSE;
- }
-
- return TRUE;
-}
-
-static Bool
-annoTerminate (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption)
-{
- CompScreen *s;
- Window xid;
-
- xid = getIntOptionNamed (option, nOption, "root", 0);
-
- for (s = d->screens; s; s = s->next)
- {
- ANNO_SCREEN (s);
-
- if (xid && s->root != xid)
- continue;
-
- if (as->grabIndex)
- {
- removeScreenGrab (s, as->grabIndex, NULL);
- as->grabIndex = 0;
- }
- }
-
- action->state &= ~(CompActionStateTermKey | CompActionStateTermButton);
-
- return FALSE;
-}
-
-static Bool
-annoEraseInitiate (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption)
-{
- CompScreen *s;
- Window xid;
-
- xid = getIntOptionNamed (option, nOption, "root", 0);
-
- s = findScreenAtDisplay (d, xid);
- if (s)
- {
- ANNO_SCREEN (s);
-
- if (otherScreenGrabExist (s, 0))
- return FALSE;
-
- if (!as->grabIndex)
- as->grabIndex = pushScreenGrab (s, None, "annotate");
-
- if (state & CompActionStateInitButton)
- action->state |= CompActionStateTermButton;
-
- if (state & CompActionStateInitKey)
- action->state |= CompActionStateTermKey;
-
- annoLastPointerX = pointerX;
- annoLastPointerY = pointerY;
-
- as->eraseMode = TRUE;
- }
-
- return FALSE;
-}
-
-static Bool
-annoClear (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption)
-{
- CompScreen *s;
- Window xid;
-
- xid = getIntOptionNamed (option, nOption, "root", 0);
-
- s = findScreenAtDisplay (d, xid);
- if (s)
- {
- ANNO_SCREEN (s);
-
- if (as->content)
- {
- cairo_t *cr;
-
- cr = annoCairoContext (s);
- if (cr)
- annoCairoClear (s, as->cairo);
-
- damageScreen (s);
- }
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-static Bool
-annoPaintOutput (CompScreen *s,
- const ScreenPaintAttrib *sAttrib,
- const CompTransform *transform,
- Region region,
- CompOutput *output,
- unsigned int mask)
-{
- Bool status;
-
- ANNO_SCREEN (s);
-
- UNWRAP (as, s, paintOutput);
- status = (*s->paintOutput) (s, sAttrib, transform, region, output, mask);
- WRAP (as, s, paintOutput, annoPaintOutput);
-
- if (status && as->content && region->numRects)
- {
- BoxPtr pBox;
- int nBox;
-
- glPushMatrix ();
-
- prepareXCoords (s, output, -DEFAULT_Z_CAMERA);
-
- glDisableClientState (GL_TEXTURE_COORD_ARRAY);
- glEnable (GL_BLEND);
-
- enableTexture (s, &as->texture, COMP_TEXTURE_FILTER_FAST);
-
- pBox = region->rects;
- nBox = region->numRects;
-
- glBegin (GL_QUADS);
-
- while (nBox--)
- {
- glTexCoord2f (COMP_TEX_COORD_X (&as->texture.matrix, pBox->x1),
- COMP_TEX_COORD_Y (&as->texture.matrix, pBox->y2));
- glVertex2i (pBox->x1, pBox->y2);
- glTexCoord2f (COMP_TEX_COORD_X (&as->texture.matrix, pBox->x2),
- COMP_TEX_COORD_Y (&as->texture.matrix, pBox->y2));
- glVertex2i (pBox->x2, pBox->y2);
- glTexCoord2f (COMP_TEX_COORD_X (&as->texture.matrix, pBox->x2),
- COMP_TEX_COORD_Y (&as->texture.matrix, pBox->y1));
- glVertex2i (pBox->x2, pBox->y1);
- glTexCoord2f (COMP_TEX_COORD_X (&as->texture.matrix, pBox->x1),
- COMP_TEX_COORD_Y (&as->texture.matrix, pBox->y1));
- glVertex2i (pBox->x1, pBox->y1);
-
- pBox++;
- }
-
- glEnd ();
-
- disableTexture (s, &as->texture);
-
- glDisable (GL_BLEND);
- glEnableClientState (GL_TEXTURE_COORD_ARRAY);
-
- glPopMatrix ();
- }
-
- return status;
-}
-
-static void
-annoHandleMotionEvent (CompScreen *s,
- int xRoot,
- int yRoot)
-{
- ANNO_SCREEN (s);
-
- if (as->grabIndex)
- {
- if (as->eraseMode)
- {
- static unsigned short color[] = { 0, 0, 0, 0 };
-
- annoDrawLine (s,
- annoLastPointerX, annoLastPointerY,
- xRoot, yRoot,
- 20.0, color);
- }
- else
- {
- ANNO_DISPLAY(s->display);
-
- annoDrawLine (s,
- annoLastPointerX, annoLastPointerY,
- xRoot, yRoot,
- ad->opt[ANNO_DISPLAY_OPTION_LINE_WIDTH].value.f,
- ad->opt[ANNO_DISPLAY_OPTION_FILL_COLOR].value.c);
- }
-
- annoLastPointerX = xRoot;
- annoLastPointerY = yRoot;
- }
-}
-
-static void
-annoHandleEvent (CompDisplay *d,
- XEvent *event)
-{
- CompScreen *s;
-
- ANNO_DISPLAY (d);
-
- switch (event->type) {
- case MotionNotify:
- s = findScreenAtDisplay (d, event->xmotion.root);
- if (s)
- annoHandleMotionEvent (s, pointerX, pointerY);
- break;
- case EnterNotify:
- case LeaveNotify:
- s = findScreenAtDisplay (d, event->xcrossing.root);
- if (s)
- annoHandleMotionEvent (s, pointerX, pointerY);
- default:
- break;
- }
-
- UNWRAP (ad, d, handleEvent);
- (*d->handleEvent) (d, event);
- WRAP (ad, d, handleEvent, annoHandleEvent);
-}
-
-static CompOption *
-annoGetDisplayOptions (CompPlugin *plugin,
- CompDisplay *display,
- int *count)
-{
- ANNO_DISPLAY (display);
-
- *count = NUM_OPTIONS (ad);
- return ad->opt;
-}
-
-static Bool
-annoSetDisplayOption (CompPlugin *plugin,
- CompDisplay *display,
- const char *name,
- CompOptionValue *value)
-{
- CompOption *o;
-
- ANNO_DISPLAY (display);
-
- o = compFindOption (ad->opt, NUM_OPTIONS (ad), name, NULL);
- if (!o)
- return FALSE;
-
- return compSetDisplayOption (display, o, value);
-}
-
-static const CompMetadataOptionInfo annoDisplayOptionInfo[] = {
- { "initiate_button", "button", 0, annoInitiate, annoTerminate },
- { "draw", "action", 0, annoDraw, 0 },
- { "erase_button", "button", 0, annoEraseInitiate, annoTerminate },
- { "clear_key", "key", 0, annoClear, 0 },
- { "clear_button", "button", 0, annoClear, 0 },
- { "fill_color", "color", 0, 0, 0 },
- { "stroke_color", "color", 0, 0, 0 },
- { "line_width", "float", 0, 0, 0 },
- { "stroke_width", "float", 0, 0, 0 }
-};
-
-static Bool
-annoInitDisplay (CompPlugin *p,
- CompDisplay *d)
-{
- AnnoDisplay *ad;
-
- if (!checkPluginABI ("core", CORE_ABIVERSION))
- return FALSE;
-
- ad = malloc (sizeof (AnnoDisplay));
- if (!ad)
- return FALSE;
-
- if (!compInitDisplayOptionsFromMetadata (d,
- &annoMetadata,
- annoDisplayOptionInfo,
- ad->opt,
- ANNO_DISPLAY_OPTION_NUM))
- {
- free (ad);
- return FALSE;
- }
-
- ad->screenPrivateIndex = allocateScreenPrivateIndex (d);
- if (ad->screenPrivateIndex < 0)
- {
- compFiniDisplayOptions (d, ad->opt, ANNO_DISPLAY_OPTION_NUM);
- free (ad);
- return FALSE;
- }
-
- WRAP (ad, d, handleEvent, annoHandleEvent);
-
- d->base.privates[displayPrivateIndex].ptr = ad;
-
- return TRUE;
-}
-
-static void
-annoFiniDisplay (CompPlugin *p,
- CompDisplay *d)
-{
- ANNO_DISPLAY (d);
-
- freeScreenPrivateIndex (d, ad->screenPrivateIndex);
-
- UNWRAP (ad, d, handleEvent);
-
- compFiniDisplayOptions (d, ad->opt, ANNO_DISPLAY_OPTION_NUM);
-
- free (ad);
-}
-
-static Bool
-annoInitScreen (CompPlugin *p,
- CompScreen *s)
-{
- AnnoScreen *as;
-
- ANNO_DISPLAY (s->display);
-
- as = malloc (sizeof (AnnoScreen));
- if (!as)
- return FALSE;
-
- as->grabIndex = 0;
- as->surface = NULL;
- as->pixmap = None;
- as->cairo = NULL;
- as->content = FALSE;
-
- initTexture (s, &as->texture);
-
- WRAP (as, s, paintOutput, annoPaintOutput);
-
- s->base.privates[ad->screenPrivateIndex].ptr = as;
-
- return TRUE;
-}
-
-static void
-annoFiniScreen (CompPlugin *p,
- CompScreen *s)
-{
- ANNO_SCREEN (s);
-
- if (as->cairo)
- cairo_destroy (as->cairo);
-
- if (as->surface)
- cairo_surface_destroy (as->surface);
-
- finiTexture (s, &as->texture);
-
- if (as->pixmap)
- XFreePixmap (s->display->display, as->pixmap);
-
- UNWRAP (as, s, paintOutput);
-
- free (as);
-}
-
-static CompBool
-annoInitObject (CompPlugin *p,
- CompObject *o)
-{
- static InitPluginObjectProc dispTab[] = {
- (InitPluginObjectProc) 0, /* InitCore */
- (InitPluginObjectProc) annoInitDisplay,
- (InitPluginObjectProc) annoInitScreen
- };
-
- RETURN_DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), TRUE, (p, o));
-}
-
-static void
-annoFiniObject (CompPlugin *p,
- CompObject *o)
-{
- static FiniPluginObjectProc dispTab[] = {
- (FiniPluginObjectProc) 0, /* FiniCore */
- (FiniPluginObjectProc) annoFiniDisplay,
- (FiniPluginObjectProc) annoFiniScreen
- };
-
- DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), (p, o));
-}
-
-static CompOption *
-annoGetObjectOptions (CompPlugin *plugin,
- CompObject *object,
- int *count)
-{
- static GetPluginObjectOptionsProc dispTab[] = {
- (GetPluginObjectOptionsProc) 0, /* GetCoreOptions */
- (GetPluginObjectOptionsProc) annoGetDisplayOptions
- };
-
- RETURN_DISPATCH (object, dispTab, ARRAY_SIZE (dispTab),
- (void *) (*count = 0), (plugin, object, count));
-}
-
-static CompBool
-annoSetObjectOption (CompPlugin *plugin,
- CompObject *object,
- const char *name,
- CompOptionValue *value)
-{
- static SetPluginObjectOptionProc dispTab[] = {
- (SetPluginObjectOptionProc) 0, /* SetCoreOption */
- (SetPluginObjectOptionProc) annoSetDisplayOption
- };
-
- RETURN_DISPATCH (object, dispTab, ARRAY_SIZE (dispTab), FALSE,
- (plugin, object, name, value));
-}
-
-static Bool
-annoInit (CompPlugin *p)
-{
- if (!compInitPluginMetadataFromInfo (&annoMetadata,
- p->vTable->name,
- annoDisplayOptionInfo,
- ANNO_DISPLAY_OPTION_NUM,
- 0, 0))
- return FALSE;
-
- displayPrivateIndex = allocateDisplayPrivateIndex ();
- if (displayPrivateIndex < 0)
- {
- compFiniMetadata (&annoMetadata);
- return FALSE;
- }
-
- compAddMetadataFromFile (&annoMetadata, p->vTable->name);
-
- return TRUE;
-}
-
-static void
-annoFini (CompPlugin *p)
-{
- freeDisplayPrivateIndex (displayPrivateIndex);
- compFiniMetadata (&annoMetadata);
-}
-
-static CompMetadata *
-annoGetMetadata (CompPlugin *plugin)
-{
- return &annoMetadata;
-}
-
-static CompPluginVTable annoVTable = {
- "annotate",
- annoGetMetadata,
- annoInit,
- annoFini,
- annoInitObject,
- annoFiniObject,
- annoGetObjectOptions,
- annoSetObjectOption
-};
-
-CompPluginVTable *
-getCompPluginInfo20070830 (void)
-{
- return &annoVTable;
-}
diff --git a/legacy/annotate.xml.in b/legacy/annotate.xml.in
deleted file mode 100644
index 46a2b09..0000000
--- a/legacy/annotate.xml.in
+++ /dev/null
@@ -1,62 +0,0 @@
-<compiz>
- <plugin name="annotate">
- <_short>Annotate</_short>
- <_long>Annotate plugin</_long>
- <display>
- <option name="initiate_button" type="button">
- <_short>Initiate</_short>
- <_long>Initiate annotate drawing</_long>
- <default>&lt;Super&gt;&lt;Alt&gt;Button1</default>
- </option>
- <option name="draw" type="action">
- <_short>Draw</_short>
- <_long>Draw using tool</_long>
- <allowed/>
- </option>
- <option name="erase_button" type="button">
- <_short>Initiate erase</_short>
- <_long>Initiate annotate erasing</_long>
- <default>&lt;Super&gt;&lt;Alt&gt;Button3</default>
- </option>
- <option name="clear_key" type="key">
- <_short>Clear</_short>
- <_long>Clear</_long>
- <default>&lt;Super&gt;&lt;Alt&gt;k</default>
- </option>
- <option name="clear_button" type="button">
- <_short>Clear</_short>
- <_long>Clear</_long>
- </option>
- <option name="fill_color" type="color">
- <_short>Annotate Fill Color</_short>
- <_long>Fill color for annotations</_long>
- <default>
- <red>0xffff</red>
- </default>
- </option>
- <option name="stroke_color" type="color">
- <_short>Annotate Stroke Color</_short>
- <_long>Stroke color for annotations</_long>
- <default>
- <green>0xffff</green>
- </default>
- </option>
- <option name="line_width" type="float">
- <_short>Line width</_short>
- <_long>Line width for annotations</_long>
- <default>3.0</default>
- <min>0.1</min>
- <max>100.0</max>
- <precision>0.1</precision>
- </option>
- <option name="stroke_width" type="float">
- <_short>Stroke width</_short>
- <_long>Stroke width for annotations</_long>
- <default>1.0</default>
- <min>0.1</min>
- <max>20.0</max>
- <precision>0.1</precision>
- </option>
- </display>
- </plugin>
-</compiz>
diff --git a/legacy/clone.cpp b/legacy/clone.cpp
deleted file mode 100644
index 31b78a6..0000000
--- a/legacy/clone.cpp
+++ /dev/null
@@ -1,936 +0,0 @@
-/*
- * Copyright © 2006 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@novell.com>
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <sys/time.h>
-
-#include <compiz-core.h>
-
-static CompMetadata cloneMetadata;
-
-static int displayPrivateIndex;
-
-#define CLONE_DISPLAY_OPTION_INITIATE_BUTTON 0
-#define CLONE_DISPLAY_OPTION_NUM 1
-
-typedef struct _CloneDisplay {
- int screenPrivateIndex;
- HandleEventProc handleEvent;
-
- CompOption opt[CLONE_DISPLAY_OPTION_NUM];
-} CloneDisplay;
-
-typedef struct _CloneClone {
- int src;
- int dst;
- Region region;
- Window input;
-} CloneClone;
-
-typedef struct _CloneScreen {
- PreparePaintScreenProc preparePaintScreen;
- DonePaintScreenProc donePaintScreen;
- PaintOutputProc paintOutput;
- PaintWindowProc paintWindow;
- OutputChangeNotifyProc outputChangeNotify;
-
- int grabIndex;
- Bool grab;
-
- float offset;
-
- Bool transformed;
-
- CloneClone *clone;
- int nClone;
-
- int x, y;
- int grabbedOutput;
- int src, dst;
-} CloneScreen;
-
-#define GET_CLONE_DISPLAY(d) \
- ((CloneDisplay *) (d)->base.privates[displayPrivateIndex].ptr)
-
-#define CLONE_DISPLAY(d) \
- CloneDisplay *cd = GET_CLONE_DISPLAY (d)
-
-#define GET_CLONE_SCREEN(s, cd) \
- ((CloneScreen *) (s)->base.privates[(cd)->screenPrivateIndex].ptr)
-
-#define CLONE_SCREEN(s) \
- CloneScreen *cs = GET_CLONE_SCREEN (s, GET_CLONE_DISPLAY (s->display))
-
-#define NUM_OPTIONS(d) (sizeof ((d)->opt) / sizeof (CompOption))
-
-static void
-cloneRemove (CompScreen *s,
- int i)
-{
- CloneClone *clone;
-
- CLONE_SCREEN (s);
-
- clone = malloc (sizeof (CloneClone) * (cs->nClone - 1));
- if (clone)
- {
- int j, k = 0;
-
- for (j = 0; j < cs->nClone; j++)
- if (j != i)
- memcpy (&clone[k++], &cs->clone[j],
- sizeof (CloneClone));
-
- XDestroyRegion (cs->clone[i].region);
- XDestroyWindow (s->display->display, cs->clone[i].input);
-
- free (cs->clone);
-
- cs->clone = clone;
- cs->nClone--;
- }
-}
-
-static void
-cloneFinish (CompScreen *s)
-{
- CloneClone *clone;
- int i;
-
- CLONE_SCREEN (s);
-
- cs->grab = FALSE;
-
- if (cs->src != cs->dst)
- {
- clone = NULL;
-
- /* check if we should replace current clone */
- for (i = 0; i < cs->nClone; i++)
- {
- if (cs->clone[i].dst == cs->dst)
- {
- clone = &cs->clone[i];
- break;
- }
- }
-
- /* no existing clone for this destination, we must allocate one */
- if (!clone)
- {
- Region region;
-
- region = XCreateRegion ();
- if (region)
- {
- clone =
- realloc (cs->clone,
- sizeof (CloneClone) * (cs->nClone + 1));
- if (clone)
- {
- XSetWindowAttributes attr;
- int x, y;
-
- cs->clone = clone;
- clone = &cs->clone[cs->nClone++];
- clone->region = region;
-
- attr.override_redirect = TRUE;
-
- x = s->outputDev[cs->dst].region.extents.x1;
- y = s->outputDev[cs->dst].region.extents.y1;
-
- clone->input =
- XCreateWindow (s->display->display,
- s->root, x, y,
- s->outputDev[cs->dst].width,
- s->outputDev[cs->dst].height,
- 0, 0, InputOnly, CopyFromParent,
- CWOverrideRedirect, &attr);
- XMapRaised (s->display->display, clone->input);
- }
- else
- {
- XDestroyRegion (region);
- }
- }
- }
-
- if (clone)
- {
- clone->src = cs->src;
- clone->dst = cs->dst;
- }
- }
-
- if (cs->grabbedOutput != cs->dst)
- {
- /* remove clone */
- for (i = 0; i < cs->nClone; i++)
- {
- if (cs->clone[i].dst == cs->grabbedOutput)
- {
- cloneRemove (s, i);
- break;
- }
- }
- }
-}
-
-static void
-clonePreparePaintScreen (CompScreen *s,
- int msSinceLastPaint)
-{
- int i;
-
- CLONE_SCREEN (s);
-
- if (cs->grab)
- {
- if (cs->grabIndex)
- {
- cs->offset -= msSinceLastPaint * 0.005f;
- if (cs->offset < 0.0f)
- cs->offset = 0.0f;
- }
- else
- {
- cs->offset += msSinceLastPaint * 0.005f;
- if (cs->offset >= 1.0f)
- cs->offset = 1.0f;
- }
- }
-
- UNWRAP (cs, s, preparePaintScreen);
- (*s->preparePaintScreen) (s, msSinceLastPaint);
- WRAP (cs, s, preparePaintScreen, clonePreparePaintScreen);
-
- for (i = 0; i < cs->nClone; i++)
- {
- CompOutput *src = &s->outputDev[cs->clone[i].src];
- CompOutput *dst = &s->outputDev[cs->clone[i].dst];
- int dx, dy;
-
- dx = dst->region.extents.x1 - src->region.extents.x1;
- dy = dst->region.extents.y1 - src->region.extents.y1;
-
- if (s->damageMask & COMP_SCREEN_DAMAGE_REGION_MASK)
- {
- if (src->width != dst->width || src->height != dst->height)
- {
- XSubtractRegion (&dst->region, &emptyRegion,
- cs->clone[i].region);
- XUnionRegion (s->damage, cs->clone[i].region, s->damage);
- XSubtractRegion (&src->region, &emptyRegion,
- cs->clone[i].region);
- }
- else
- {
- XSubtractRegion (s->damage, &dst->region, cs->clone[i].region);
- XOffsetRegion (cs->clone[i].region, dx, dy);
- XUnionRegion (s->damage, cs->clone[i].region, s->damage);
- XSubtractRegion (s->damage, &src->region, cs->clone[i].region);
- XOffsetRegion (cs->clone[i].region, -dx, -dy);
- }
- }
- else
- {
- XSubtractRegion (&src->region, &emptyRegion, cs->clone[i].region);
- }
- }
-}
-
-static void
-cloneDonePaintScreen (CompScreen *s)
-{
- CLONE_SCREEN (s);
-
- if (cs->grab)
- {
- if (cs->offset == 1.0f)
- cloneFinish (s);
-
- damageScreen (s);
- }
-
- UNWRAP (cs, s, donePaintScreen);
- (*s->donePaintScreen) (s);
- WRAP (cs, s, donePaintScreen, cloneDonePaintScreen);
-}
-
-static Bool
-clonePaintOutput (CompScreen *s,
- const ScreenPaintAttrib *sAttrib,
- const CompTransform *transform,
- Region region,
- CompOutput *outputPtr,
- unsigned int mask)
-{
- Bool status;
- int i, dst, output = 0;
-
- CLONE_SCREEN (s);
-
- dst = output = (outputPtr->id != ~0) ? outputPtr->id : 0;
-
- if (!cs->grab || cs->grabbedOutput != output)
- {
- for (i = 0; i < cs->nClone; i++)
- {
- if (cs->clone[i].dst == output)
- {
- region = cs->clone[i].region;
- dst = cs->clone[i].src;
-
- if (s->outputDev[dst].width != s->outputDev[output].width ||
- s->outputDev[dst].height != s->outputDev[output].height )
- cs->transformed = TRUE;
- else
- cs->transformed = FALSE;
-
- break;
- }
- }
- }
-
- UNWRAP (cs, s, paintOutput);
- if (outputPtr->id != ~0)
- status = (*s->paintOutput) (s, sAttrib, transform, region,
- &s->outputDev[dst], mask);
- else
- status = (*s->paintOutput) (s, sAttrib, transform, region,
- outputPtr, mask);
- WRAP (cs, s, paintOutput, clonePaintOutput);
-
- if (cs->grab)
- {
- CompTransform sTransform = *transform;
- CompWindow *w;
- GLenum filter;
- float zoom1, zoom2x, zoom2y, x1, y1, x2, y2;
- float zoomX, zoomY;
- int dx, dy;
-
- zoom1 = 160.0f / s->outputDev[cs->src].height;
-
- x1 = cs->x - (s->outputDev[cs->src].region.extents.x1 * zoom1);
- y1 = cs->y - (s->outputDev[cs->src].region.extents.y1 * zoom1);
-
- x1 -= (s->outputDev[cs->src].width * zoom1) / 2;
- y1 -= (s->outputDev[cs->src].height * zoom1) / 2;
-
- if (cs->grabIndex)
- {
- x2 = s->outputDev[cs->grabbedOutput].region.extents.x1 -
- s->outputDev[cs->src].region.extents.x1;
- y2 = s->outputDev[cs->grabbedOutput].region.extents.y1 -
- s->outputDev[cs->src].region.extents.y1;
-
- zoom2x = (float) s->outputDev[cs->grabbedOutput].width /
- s->outputDev[cs->src].width;
- zoom2y = (float) s->outputDev[cs->grabbedOutput].height /
- s->outputDev[cs->src].height;
- }
- else
- {
- x2 = s->outputDev[cs->dst].region.extents.x1 -
- s->outputDev[cs->src].region.extents.x1;
- y2 = s->outputDev[cs->dst].region.extents.y1 -
- s->outputDev[cs->src].region.extents.y1;
-
- zoom2x = (float) s->outputDev[cs->dst].width /
- s->outputDev[cs->src].width;
- zoom2y = (float) s->outputDev[cs->dst].height /
- s->outputDev[cs->src].height;
- }
-
- /* XXX: hmm.. why do I need this.. */
- if (x2 < 0.0f)
- x2 *= zoom2x;
- if (y2 < 0.0f)
- y2 *= zoom2y;
-
- dx = x1 * (1.0f - cs->offset) + x2 * cs->offset;
- dy = y1 * (1.0f - cs->offset) + y2 * cs->offset;
-
- zoomX = zoom1 * (1.0f - cs->offset) + zoom2x * cs->offset;
- zoomY = zoom1 * (1.0f - cs->offset) + zoom2y * cs->offset;
-
- matrixTranslate (&sTransform, -0.5f, -0.5f, -DEFAULT_Z_CAMERA);
- matrixScale (&sTransform,
- 1.0f / s->outputDev[output].width,
- -1.0f / s->outputDev[output].height,
- 1.0f);
- matrixTranslate (&sTransform,
- dx - s->outputDev[output].region.extents.x1,
- dy - s->outputDev[output].region.extents.y2,
- 0.0f);
- matrixScale (&sTransform, zoomX, zoomY, 1.0f);
-
- glPushMatrix ();
- glLoadMatrixf (sTransform.m);
-
- filter = s->display->textureFilter;
-
- if (cs->offset == 0.0f)
- s->display->textureFilter = GL_LINEAR_MIPMAP_LINEAR;
-
- for (w = s->windows; w; w = w->next)
- {
- if (w->destroyed)
- continue;
-
- if (!w->shaded)
- {
- if (w->attrib.map_state != IsViewable || !w->damaged)
- continue;
- }
-
- (*s->paintWindow) (w, &w->paint, &sTransform,
- &s->outputDev[cs->src].region,
- PAINT_WINDOW_ON_TRANSFORMED_SCREEN_MASK);
- }
-
- s->display->textureFilter = filter;
-
- glPopMatrix ();
- }
-
- return status;
-}
-
-static Bool
-clonePaintWindow (CompWindow *w,
- const WindowPaintAttrib *attrib,
- const CompTransform *transform,
- Region region,
- unsigned int mask)
-{
- Bool status;
-
- CLONE_SCREEN (w->screen);
-
- if (cs->nClone && cs->transformed)
- mask |= PAINT_WINDOW_ON_TRANSFORMED_SCREEN_MASK;
-
- UNWRAP (cs, w->screen, paintWindow);
- status = (*w->screen->paintWindow) (w, attrib, transform, region, mask);
- WRAP (cs, w->screen, paintWindow, clonePaintWindow);
-
- return status;
-}
-
-static Bool
-cloneInitiate (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption)
-{
- CompScreen *s;
- Window xid;
-
- xid = getIntOptionNamed (option, nOption, "root", 0);
-
- s = findScreenAtDisplay (d, xid);
- if (s)
- {
- int i;
-
- CLONE_SCREEN (s);
-
- if (cs->grab || otherScreenGrabExist (s, "clone", 0))
- return FALSE;
-
- if (!cs->grabIndex)
- cs->grabIndex = pushScreenGrab (s, None, "clone");
-
- cs->grab = TRUE;
-
- cs->x = getIntOptionNamed (option, nOption, "x", 0);
- cs->y = getIntOptionNamed (option, nOption, "y", 0);
-
- cs->src = cs->grabbedOutput = outputDeviceForPoint (s, cs->x, cs->y);
-
- /* trace source */
- i = 0;
- while (i < cs->nClone)
- {
- if (cs->clone[i].dst == cs->src)
- {
- cs->src = cs->clone[i].src;
- i = 0;
- }
- else
- {
- i++;
- }
- }
-
- if (state & CompActionStateInitButton)
- action->state |= CompActionStateTermButton;
- }
-
- return FALSE;
-}
-
-static Bool
-cloneTerminate (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption)
-{
- CompScreen *s;
- Window xid;
-
- xid = getIntOptionNamed (option, nOption, "root", 0);
-
- for (s = d->screens; s; s = s->next)
- {
- CLONE_SCREEN (s);
-
- if (xid && s->root != xid)
- continue;
-
- if (cs->grabIndex)
- {
- int x, y;
-
- removeScreenGrab (s, cs->grabIndex, NULL);
- cs->grabIndex = 0;
-
- x = getIntOptionNamed (option, nOption, "x", 0);
- y = getIntOptionNamed (option, nOption, "y", 0);
-
- cs->dst = outputDeviceForPoint (s, x, y);
-
- damageScreen (s);
- }
- }
-
- action->state &= ~(CompActionStateTermKey | CompActionStateTermButton);
-
- return FALSE;
-}
-
-static void
-cloneSetStrutsForCloneWindow (CompScreen *s,
- CloneClone *clone)
-{
- CompOutput *output = &s->outputDev[clone->dst];
- XRectangle *rect = NULL;
- CompStruts *struts;
- CompWindow *w;
-
- w = findWindowAtScreen (s, clone->input);
- if (!w)
- return;
-
- struts = malloc (sizeof (CompStruts));
- if (!struts)
- return;
-
- if (w->struts)
- free (w->struts);
-
- struts->left.x = 0;
- struts->left.y = 0;
- struts->left.width = 0;
- struts->left.height = s->height;
-
- struts->right.x = s->width;
- struts->right.y = 0;
- struts->right.width = 0;
- struts->right.height = s->height;
-
- struts->top.x = 0;
- struts->top.y = 0;
- struts->top.width = s->width;
- struts->top.height = 0;
-
- struts->bottom.x = 0;
- struts->bottom.y = s->height;
- struts->bottom.width = s->width;
- struts->bottom.height = 0;
-
- /* create struts relative to a screen edge that this output is next to */
- if (output->region.extents.x1 == 0)
- rect = &struts->left;
- else if (output->region.extents.x2 == s->width)
- rect = &struts->right;
- else if (output->region.extents.y1 == 0)
- rect = &struts->top;
- else if (output->region.extents.y2 == s->height)
- rect = &struts->bottom;
-
- if (rect)
- {
- rect->x = output->region.extents.x1;
- rect->y = output->region.extents.y1;
- rect->width = output->width;
- rect->height = output->height;
- }
-
- w->struts = struts;
-}
-
-static void
-cloneHandleMotionEvent (CompScreen *s,
- int xRoot,
- int yRoot)
-{
- CLONE_SCREEN (s);
-
- if (cs->grabIndex)
- {
- cs->x = xRoot;
- cs->y = yRoot;
-
- damageScreen (s);
- }
-}
-
-static void
-cloneHandleEvent (CompDisplay *d,
- XEvent *event)
-{
- CompScreen *s;
-
- CLONE_DISPLAY (d);
-
- switch (event->type) {
- case MotionNotify:
- s = findScreenAtDisplay (d, event->xmotion.root);
- if (s)
- cloneHandleMotionEvent (s, pointerX, pointerY);
- break;
- case EnterNotify:
- case LeaveNotify:
- s = findScreenAtDisplay (d, event->xcrossing.root);
- if (s)
- cloneHandleMotionEvent (s, pointerX, pointerY);
- default:
- break;
- }
-
- UNWRAP (cd, d, handleEvent);
- (*d->handleEvent) (d, event);
- WRAP (cd, d, handleEvent, cloneHandleEvent);
-
- switch (event->type) {
- case CreateNotify:
- s = findScreenAtDisplay (d, event->xcreatewindow.parent);
- if (s)
- {
- int i;
-
- CLONE_SCREEN (s);
-
- for (i = 0; i < cs->nClone; i++)
- if (event->xcreatewindow.window == cs->clone[i].input)
- cloneSetStrutsForCloneWindow (s, &cs->clone[i]);
- }
- default:
- break;
- }
-}
-
-static void
-cloneOutputChangeNotify (CompScreen *s)
-{
- int i;
-
- CLONE_SCREEN (s);
-
- /* remove clones with destination or source that doesn't exist */
- for (i = 0; i < cs->nClone; i++)
- {
- if (cs->clone[i].dst >= s->nOutputDev ||
- cs->clone[i].src >= s->nOutputDev)
- {
- cloneRemove (s, i);
- i = 0;
- continue;
- }
- }
-
- UNWRAP (cs, s, outputChangeNotify);
- (*s->outputChangeNotify) (s);
- WRAP (cs, s, outputChangeNotify, cloneOutputChangeNotify);
-}
-
-static CompOption *
-cloneGetDisplayOptions (CompPlugin *plugin,
- CompDisplay *display,
- int *count)
-{
- CLONE_DISPLAY (display);
-
- *count = NUM_OPTIONS (cd);
- return cd->opt;
-}
-
-static Bool
-cloneSetDisplayOption (CompPlugin *plugin,
- CompDisplay *display,
- const char *name,
- CompOptionValue *value)
-{
- CompOption *o;
-
- CLONE_DISPLAY (display);
-
- o = compFindOption (cd->opt, NUM_OPTIONS (cd), name, NULL);
- if (!o)
- return FALSE;
-
- return compSetDisplayOption (display, o, value);
-}
-
-static const CompMetadataOptionInfo cloneDisplayOptionInfo[] = {
- { "initiate_button", "button", 0, cloneInitiate, cloneTerminate }
-};
-
-static Bool
-cloneInitDisplay (CompPlugin *p,
- CompDisplay *d)
-{
- CloneDisplay *cd;
-
- if (!checkPluginABI ("core", CORE_ABIVERSION))
- return FALSE;
-
- cd = malloc (sizeof (CloneDisplay));
- if (!cd)
- return FALSE;
-
- if (!compInitDisplayOptionsFromMetadata (d,
- &cloneMetadata,
- cloneDisplayOptionInfo,
- cd->opt,
- CLONE_DISPLAY_OPTION_NUM))
- {
- free (cd);
- return FALSE;
- }
-
- cd->screenPrivateIndex = allocateScreenPrivateIndex (d);
- if (cd->screenPrivateIndex < 0)
- {
- compFiniDisplayOptions (d, cd->opt, CLONE_DISPLAY_OPTION_NUM);
- free (cd);
- return FALSE;
- }
-
- WRAP (cd, d, handleEvent, cloneHandleEvent);
-
- d->base.privates[displayPrivateIndex].ptr = cd;
-
- return TRUE;
-}
-
-static void
-cloneFiniDisplay (CompPlugin *p,
- CompDisplay *d)
-{
- CLONE_DISPLAY (d);
-
- freeScreenPrivateIndex (d, cd->screenPrivateIndex);
-
- UNWRAP (cd, d, handleEvent);
-
- compFiniDisplayOptions (d, cd->opt, CLONE_DISPLAY_OPTION_NUM);
-
- free (cd);
-}
-
-static Bool
-cloneInitScreen (CompPlugin *p,
- CompScreen *s)
-{
- CloneScreen *cs;
-
- CLONE_DISPLAY (s->display);
-
- cs = malloc (sizeof (CloneScreen));
- if (!cs)
- return FALSE;
-
- cs->grabIndex = 0;
- cs->grab = FALSE;
-
- cs->offset = 1.0f;
-
- cs->transformed = FALSE;
-
- cs->nClone = 0;
- cs->clone = NULL;
-
- cs->src = 0;
-
- WRAP (cs, s, preparePaintScreen, clonePreparePaintScreen);
- WRAP (cs, s, donePaintScreen, cloneDonePaintScreen);
- WRAP (cs, s, paintOutput, clonePaintOutput);
- WRAP (cs, s, paintWindow, clonePaintWindow);
- WRAP (cs, s, outputChangeNotify, cloneOutputChangeNotify);
-
- s->base.privates[cd->screenPrivateIndex].ptr = cs;
-
- return TRUE;
-}
-
-static void
-cloneFiniScreen (CompPlugin *p,
- CompScreen *s)
-{
- int i;
-
- CLONE_SCREEN (s);
-
- for (i = 0; i < cs->nClone; i++)
- cloneRemove (s, i);
-
- if (cs->clone)
- free (cs->clone);
-
- UNWRAP (cs, s, preparePaintScreen);
- UNWRAP (cs, s, donePaintScreen);
- UNWRAP (cs, s, paintOutput);
- UNWRAP (cs, s, paintWindow);
- UNWRAP (cs, s, outputChangeNotify);
-
- free (cs);
-}
-
-static CompBool
-cloneInitObject (CompPlugin *p,
- CompObject *o)
-{
- static InitPluginObjectProc dispTab[] = {
- (InitPluginObjectProc) 0, /* InitCore */
- (InitPluginObjectProc) cloneInitDisplay,
- (InitPluginObjectProc) cloneInitScreen
- };
-
- RETURN_DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), TRUE, (p, o));
-}
-
-static void
-cloneFiniObject (CompPlugin *p,
- CompObject *o)
-{
- static FiniPluginObjectProc dispTab[] = {
- (FiniPluginObjectProc) 0, /* FiniCore */
- (FiniPluginObjectProc) cloneFiniDisplay,
- (FiniPluginObjectProc) cloneFiniScreen
- };
-
- DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), (p, o));
-}
-
-static CompOption *
-cloneGetObjectOptions (CompPlugin *plugin,
- CompObject *object,
- int *count)
-{
- static GetPluginObjectOptionsProc dispTab[] = {
- (GetPluginObjectOptionsProc) 0, /* GetCoreOptions */
- (GetPluginObjectOptionsProc) cloneGetDisplayOptions
- };
-
- RETURN_DISPATCH (object, dispTab, ARRAY_SIZE (dispTab),
- (void *) (*count = 0), (plugin, object, count));
-}
-
-static CompBool
-cloneSetObjectOption (CompPlugin *plugin,
- CompObject *object,
- const char *name,
- CompOptionValue *value)
-{
- static SetPluginObjectOptionProc dispTab[] = {
- (SetPluginObjectOptionProc) 0, /* SetCoreOption */
- (SetPluginObjectOptionProc) cloneSetDisplayOption
- };
-
- RETURN_DISPATCH (object, dispTab, ARRAY_SIZE (dispTab), FALSE,
- (plugin, object, name, value));
-}
-
-static Bool
-cloneInit (CompPlugin *p)
-{
- if (!compInitPluginMetadataFromInfo (&cloneMetadata,
- p->vTable->name,
- cloneDisplayOptionInfo,
- CLONE_DISPLAY_OPTION_NUM,
- 0, 0))
- return FALSE;
-
- displayPrivateIndex = allocateDisplayPrivateIndex ();
- if (displayPrivateIndex < 0)
- {
- compFiniMetadata (&cloneMetadata);
- return FALSE;
- }
-
- compAddMetadataFromFile (&cloneMetadata, p->vTable->name);
-
- return TRUE;
-}
-
-static void
-cloneFini (CompPlugin *p)
-{
- freeDisplayPrivateIndex (displayPrivateIndex);
- compFiniMetadata (&cloneMetadata);
-}
-
-static CompMetadata *
-cloneGetMetadata (CompPlugin *plugin)
-{
- return &cloneMetadata;
-}
-
-CompPluginVTable cloneVTable = {
- "clone",
- cloneGetMetadata,
- cloneInit,
- cloneFini,
- cloneInitObject,
- cloneFiniObject,
- cloneGetObjectOptions,
- cloneSetObjectOption
-};
-
-CompPluginVTable *
-getCompPluginInfo20070830 (void)
-{
- return &cloneVTable;
-}
diff --git a/legacy/clone.xml.in b/legacy/clone.xml.in
deleted file mode 100644
index d7c7ce4..0000000
--- a/legacy/clone.xml.in
+++ /dev/null
@@ -1,13 +0,0 @@
-<compiz>
- <plugin name="clone">
- <_short>Clone Output</_short>
- <_long>Output clone handler</_long>
- <display>
- <option name="initiate_button" type="button">
- <_short>Initiate</_short>
- <_long>Initiate clone selection</_long>
- <default>&lt;Super&gt;&lt;Shift&gt;Button1</default>
- </option>
- </display>
- </plugin>
-</compiz>