From 147073e27db0f115c7e5bbdab245824313b02f33 Mon Sep 17 00:00:00 2001 From: Guillaume Seguin Date: Mon, 15 Feb 2010 21:24:13 +0100 Subject: Addd libXext and libdl to core links --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b06e1d9..caf094d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -52,7 +52,7 @@ add_executable (compiz ) target_link_libraries ( - compiz ${COMPIZ_LIBRARIES} m pthread + compiz ${COMPIZ_LIBRARIES} m pthread Xext dl ) install ( -- cgit v1.1 From 36cd7758f0cf718de02b84897df0c58fdbf95cce Mon Sep 17 00:00:00 2001 From: Guillaume Seguin Date: Mon, 15 Feb 2010 21:39:05 +0100 Subject: Cleaner Xext dep --- CMakeLists.txt | 1 + src/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2e4acc9..b760c6c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,6 +45,7 @@ set (COMPIZ_REQUIRES x11-xcb xrandr xinerama + xext ice sm libxml-2.0 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index caf094d..5c0290e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -52,7 +52,7 @@ add_executable (compiz ) target_link_libraries ( - compiz ${COMPIZ_LIBRARIES} m pthread Xext dl + compiz ${COMPIZ_LIBRARIES} m pthread dl ) install ( -- cgit v1.1 From 6da1124112165f35bea278281e709d96066125fa Mon Sep 17 00:00:00 2001 From: Scott Moreau Date: Mon, 15 Feb 2010 14:32:41 -0700 Subject: Fix longstanding damage issue. --- plugins/annotate/src/annotate.cpp | 40 +++++++++++---------------------------- plugins/annotate/src/annotate.h | 2 ++ 2 files changed, 13 insertions(+), 29 deletions(-) diff --git a/plugins/annotate/src/annotate.cpp b/plugins/annotate/src/annotate.cpp index b64d262..4cae5d0 100644 --- a/plugins/annotate/src/annotate.cpp +++ b/plugins/annotate/src/annotate.cpp @@ -70,6 +70,9 @@ AnnoScreen::cairoContext () return NULL; } + damage = XDamageCreate (screen->dpy (), pixmap, + XDamageReportRawRectangles); + surface = cairo_xlib_surface_create_with_xrender_format (screen->dpy (), pixmap, xScreen, @@ -117,12 +120,7 @@ AnnoScreen::drawCircle (double xc, setSourceColor (cr, strokeColor); cairo_stroke (cr); - CompRegion reg (xc - radius - strokeWidth, yc - radius - strokeWidth, - (radius * 2) + (strokeWidth * 2), - (radius * 2) + (strokeWidth * 2)); - content = true; - cScreen->damageRegion (reg); } } @@ -150,12 +148,7 @@ AnnoScreen::drawRectangle (double x, setSourceColor (cr, strokeColor); cairo_stroke (cr); - CompRegion reg (x - strokeWidth, y - strokeWidth, - w + (strokeWidth * 2), h + (strokeWidth * 2)); - content = true; - - cScreen->damageRegion (reg); } } @@ -182,13 +175,7 @@ AnnoScreen::drawLine (double x1, setSourceColor (cr, color); cairo_stroke (cr); - CompRegion reg (ex1 - width, ey1 - width, - (ex2 - ex1) + (width * 2), - (ey2 - ey1) + (width * 2)); - content = true; - - cScreen->damageRegion (reg); } } @@ -233,13 +220,7 @@ AnnoScreen::drawText (double x, reg.extents.x2 = x + extents.width + 20.0; reg.extents.y2 = y + extents.height; - CompRegion region (reg.extents.x1, reg.extents.y1, - reg.extents.x2 - reg.extents.x1, - reg.extents.y2 - reg.extents.y1); - content = true; - - cScreen->damageRegion (region); } } @@ -453,10 +434,6 @@ AnnoScreen::terminate (CompAction *action, drawMode = NoMode; - /* No need to handle motion events for now */ - - screen->handleEventSetEnabled (this, false); - return false; } @@ -559,9 +536,6 @@ AnnoScreen::clear (CompAction *action, cairoClear (cairo); cScreen->damageScreen (); - - /* We don't need to refresh the screen anymore */ - gScreen->glPaintOutputSetEnabled (this, false); } return true; @@ -795,6 +769,12 @@ AnnoScreen::handleEvent (XEvent *event) case LeaveNotify: handleMotionEvent (pointerX, pointerY); default: + if (event->type == cScreen->damageEvent () + XDamageNotify) + { + XDamageNotifyEvent *de = (XDamageNotifyEvent *) event; + if (pixmap == de->drawable) + cScreen->damageRegion ((CompRegion)de->area); + } break; } @@ -844,6 +824,8 @@ AnnoScreen::~AnnoScreen () cairo_surface_destroy (surface); if (pixmap) XFreePixmap (screen->dpy (), pixmap); + if (damage) + XDamageDestroy (screen->dpy (), damage); } bool diff --git a/plugins/annotate/src/annotate.h b/plugins/annotate/src/annotate.h index 124e81d..7673788 100644 --- a/plugins/annotate/src/annotate.h +++ b/plugins/annotate/src/annotate.h @@ -72,6 +72,8 @@ class AnnoScreen : cairo_surface_t *surface; cairo_t *cairo; bool content; + Damage damage; + int initialPointerX, initialPointerY; CompRect rectangle, lastRect; DrawMode drawMode; -- cgit v1.1 From 98960b7d74f61715f9c0f46085f84496feefde94 Mon Sep 17 00:00:00 2001 From: Dennis Kasprzyk Date: Mon, 15 Feb 2010 22:40:40 +0100 Subject: Revert "Fix longstanding damage issue." This reverts commit 6da1124112165f35bea278281e709d96066125fa. --- plugins/annotate/src/annotate.cpp | 40 ++++++++++++++++++++++++++++----------- plugins/annotate/src/annotate.h | 2 -- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/plugins/annotate/src/annotate.cpp b/plugins/annotate/src/annotate.cpp index 4cae5d0..b64d262 100644 --- a/plugins/annotate/src/annotate.cpp +++ b/plugins/annotate/src/annotate.cpp @@ -70,9 +70,6 @@ AnnoScreen::cairoContext () return NULL; } - damage = XDamageCreate (screen->dpy (), pixmap, - XDamageReportRawRectangles); - surface = cairo_xlib_surface_create_with_xrender_format (screen->dpy (), pixmap, xScreen, @@ -120,7 +117,12 @@ AnnoScreen::drawCircle (double xc, setSourceColor (cr, strokeColor); cairo_stroke (cr); + CompRegion reg (xc - radius - strokeWidth, yc - radius - strokeWidth, + (radius * 2) + (strokeWidth * 2), + (radius * 2) + (strokeWidth * 2)); + content = true; + cScreen->damageRegion (reg); } } @@ -148,7 +150,12 @@ AnnoScreen::drawRectangle (double x, setSourceColor (cr, strokeColor); cairo_stroke (cr); + CompRegion reg (x - strokeWidth, y - strokeWidth, + w + (strokeWidth * 2), h + (strokeWidth * 2)); + content = true; + + cScreen->damageRegion (reg); } } @@ -175,7 +182,13 @@ AnnoScreen::drawLine (double x1, setSourceColor (cr, color); cairo_stroke (cr); + CompRegion reg (ex1 - width, ey1 - width, + (ex2 - ex1) + (width * 2), + (ey2 - ey1) + (width * 2)); + content = true; + + cScreen->damageRegion (reg); } } @@ -220,7 +233,13 @@ AnnoScreen::drawText (double x, reg.extents.x2 = x + extents.width + 20.0; reg.extents.y2 = y + extents.height; + CompRegion region (reg.extents.x1, reg.extents.y1, + reg.extents.x2 - reg.extents.x1, + reg.extents.y2 - reg.extents.y1); + content = true; + + cScreen->damageRegion (region); } } @@ -434,6 +453,10 @@ AnnoScreen::terminate (CompAction *action, drawMode = NoMode; + /* No need to handle motion events for now */ + + screen->handleEventSetEnabled (this, false); + return false; } @@ -536,6 +559,9 @@ AnnoScreen::clear (CompAction *action, cairoClear (cairo); cScreen->damageScreen (); + + /* We don't need to refresh the screen anymore */ + gScreen->glPaintOutputSetEnabled (this, false); } return true; @@ -769,12 +795,6 @@ AnnoScreen::handleEvent (XEvent *event) case LeaveNotify: handleMotionEvent (pointerX, pointerY); default: - if (event->type == cScreen->damageEvent () + XDamageNotify) - { - XDamageNotifyEvent *de = (XDamageNotifyEvent *) event; - if (pixmap == de->drawable) - cScreen->damageRegion ((CompRegion)de->area); - } break; } @@ -824,8 +844,6 @@ AnnoScreen::~AnnoScreen () cairo_surface_destroy (surface); if (pixmap) XFreePixmap (screen->dpy (), pixmap); - if (damage) - XDamageDestroy (screen->dpy (), damage); } bool diff --git a/plugins/annotate/src/annotate.h b/plugins/annotate/src/annotate.h index 7673788..124e81d 100644 --- a/plugins/annotate/src/annotate.h +++ b/plugins/annotate/src/annotate.h @@ -72,8 +72,6 @@ class AnnoScreen : cairo_surface_t *surface; cairo_t *cairo; bool content; - Damage damage; - int initialPointerX, initialPointerY; CompRect rectangle, lastRect; DrawMode drawMode; -- cgit v1.1 From 4c52e497d8daab2cc71db0d66c6e9b89f18178a0 Mon Sep 17 00:00:00 2001 From: Scott Moreau Date: Mon, 15 Feb 2010 15:31:11 -0700 Subject: Fix longstanding damage issue. --- plugins/annotate/src/annotate.cpp | 40 +++++++++++++-------------------------- plugins/annotate/src/annotate.h | 2 ++ 2 files changed, 15 insertions(+), 27 deletions(-) diff --git a/plugins/annotate/src/annotate.cpp b/plugins/annotate/src/annotate.cpp index b64d262..520a1c9 100644 --- a/plugins/annotate/src/annotate.cpp +++ b/plugins/annotate/src/annotate.cpp @@ -70,6 +70,9 @@ AnnoScreen::cairoContext () return NULL; } + damage = XDamageCreate (screen->dpy (), pixmap, + XDamageReportRawRectangles); + surface = cairo_xlib_surface_create_with_xrender_format (screen->dpy (), pixmap, xScreen, @@ -117,12 +120,7 @@ AnnoScreen::drawCircle (double xc, setSourceColor (cr, strokeColor); cairo_stroke (cr); - CompRegion reg (xc - radius - strokeWidth, yc - radius - strokeWidth, - (radius * 2) + (strokeWidth * 2), - (radius * 2) + (strokeWidth * 2)); - content = true; - cScreen->damageRegion (reg); } } @@ -150,12 +148,7 @@ AnnoScreen::drawRectangle (double x, setSourceColor (cr, strokeColor); cairo_stroke (cr); - CompRegion reg (x - strokeWidth, y - strokeWidth, - w + (strokeWidth * 2), h + (strokeWidth * 2)); - content = true; - - cScreen->damageRegion (reg); } } @@ -182,13 +175,7 @@ AnnoScreen::drawLine (double x1, setSourceColor (cr, color); cairo_stroke (cr); - CompRegion reg (ex1 - width, ey1 - width, - (ex2 - ex1) + (width * 2), - (ey2 - ey1) + (width * 2)); - content = true; - - cScreen->damageRegion (reg); } } @@ -233,13 +220,7 @@ AnnoScreen::drawText (double x, reg.extents.x2 = x + extents.width + 20.0; reg.extents.y2 = y + extents.height; - CompRegion region (reg.extents.x1, reg.extents.y1, - reg.extents.x2 - reg.extents.x1, - reg.extents.y2 - reg.extents.y1); - content = true; - - cScreen->damageRegion (region); } } @@ -453,10 +434,6 @@ AnnoScreen::terminate (CompAction *action, drawMode = NoMode; - /* No need to handle motion events for now */ - - screen->handleEventSetEnabled (this, false); - return false; } @@ -560,7 +537,8 @@ AnnoScreen::clear (CompAction *action, cScreen->damageScreen (); - /* We don't need to refresh the screen anymore */ + /* We don't need to refresh the screen or handle events anymore */ + screen->handleEventSetEnabled (this, false); gScreen->glPaintOutputSetEnabled (this, false); } @@ -795,6 +773,12 @@ AnnoScreen::handleEvent (XEvent *event) case LeaveNotify: handleMotionEvent (pointerX, pointerY); default: + if (event->type == cScreen->damageEvent () + XDamageNotify) + { + XDamageNotifyEvent *de = (XDamageNotifyEvent *) event; + if (pixmap == de->drawable) + cScreen->damageRegion (CompRegion (CompRect (de->area))); + } break; } @@ -844,6 +828,8 @@ AnnoScreen::~AnnoScreen () cairo_surface_destroy (surface); if (pixmap) XFreePixmap (screen->dpy (), pixmap); + if (damage) + XDamageDestroy (screen->dpy (), damage); } bool diff --git a/plugins/annotate/src/annotate.h b/plugins/annotate/src/annotate.h index 124e81d..7673788 100644 --- a/plugins/annotate/src/annotate.h +++ b/plugins/annotate/src/annotate.h @@ -72,6 +72,8 @@ class AnnoScreen : cairo_surface_t *surface; cairo_t *cairo; bool content; + Damage damage; + int initialPointerX, initialPointerY; CompRect rectangle, lastRect; DrawMode drawMode; -- cgit v1.1 From b93cac5d0c36f0d7b30e2d1a303859b547dc8586 Mon Sep 17 00:00:00 2001 From: Scott Moreau Date: Mon, 22 Feb 2010 08:43:56 -0700 Subject: Draw ellipses instead of circles. --- plugins/annotate/annotate.xml.in | 8 +-- plugins/annotate/src/annotate.cpp | 130 ++++++++++++++++++++++---------------- plugins/annotate/src/annotate.h | 33 +++++----- 3 files changed, 95 insertions(+), 76 deletions(-) diff --git a/plugins/annotate/annotate.xml.in b/plugins/annotate/annotate.xml.in index 75342ed..84674cc 100644 --- a/plugins/annotate/annotate.xml.in +++ b/plugins/annotate/annotate.xml.in @@ -19,10 +19,10 @@ <_long>Initiate rectangle drawing <Super><Alt>Button2 - - diff --git a/plugins/annotate/src/annotate.cpp b/plugins/annotate/src/annotate.cpp index b418a12..ec294aa 100644 --- a/plugins/annotate/src/annotate.cpp +++ b/plugins/annotate/src/annotate.cpp @@ -281,9 +281,9 @@ AnnoScreen::draw (CompAction *action, cr = cairoContext (); if (cr) { - const char *tool; - unsigned short *fillColor, *strokeColor; - double lineWidth, strokeWidth; + const char *tool; + unsigned short *fillColor, *strokeColor; + double strokeWidth; tool = CompOption::getStringOptionNamed (options, "tool", "line").c_str (); @@ -303,10 +303,6 @@ AnnoScreen::draw (CompAction *action, strokeWidth = CompOption::getFloatOptionNamed (options, "stroke_width", strokeWidth); - lineWidth = optionGetLineWidth (); - lineWidth = CompOption::getFloatOptionNamed (options, "line_width", - lineWidth); - if (strcasecmp (tool, "rectangle") == 0) { double x, y, w, h; @@ -340,7 +336,7 @@ AnnoScreen::draw (CompAction *action, x2 = CompOption::getFloatOptionNamed (options, "x2", 100); y2 = CompOption::getFloatOptionNamed (options, "y2", 100); - drawLine (x1, y1, x2, y2, lineWidth, fillColor); + drawLine (x1, y1, x2, y2, strokeWidth, fillColor); } else if (strcasecmp (tool, "text") == 0) { @@ -401,7 +397,7 @@ AnnoScreen::terminate (CompAction *action, case LineMode: drawLine (initialPointerX, initialPointerY, lineVector.x (), lineVector.y (), - optionGetLineWidth (), + optionGetStrokeWidth (), optionGetStrokeColor ()); break; @@ -671,7 +667,7 @@ AnnoScreen::glPaintOutput (const GLScreenPaintAttrib &attrib, { case LineMode: glColor4usv (optionGetStrokeColor ()); - glLineWidth (optionGetLineWidth ()); + glLineWidth (optionGetStrokeWidth ()); glBegin (GL_LINES); glVertex2i (initialPointerX, initialPointerY); glVertex2i (lineVector.x (), lineVector.y ()); @@ -771,7 +767,7 @@ AnnoScreen::handleMotionEvent (int xRoot, case FreeDrawMode: drawLine (annoLastPointerX, annoLastPointerY, xRoot, yRoot, - optionGetLineWidth (), + optionGetStrokeWidth (), optionGetStrokeColor ()); break; -- cgit v1.1 From 374393a340dfefbac9c6441d6c1a3cbf80d2b220 Mon Sep 17 00:00:00 2001 From: Scott Moreau Date: Mon, 22 Feb 2010 10:41:22 -0700 Subject: Add option to change erase size. --- plugins/annotate/annotate.xml.in | 8 ++++++++ plugins/annotate/src/annotate.cpp | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/annotate/annotate.xml.in b/plugins/annotate/annotate.xml.in index d31dff2..c9a602b 100644 --- a/plugins/annotate/annotate.xml.in +++ b/plugins/annotate/annotate.xml.in @@ -68,6 +68,14 @@ 0xffff +