[Xfce4-commits] <xfce4-notifyd:xfce4-notifyd-0.1> * xfce4-notifyd/xfce-notify-window.c: Don't set the legacy window shape when the widget is composited (fixes drawing artifacts with the curved corners). Also simplify the painting code a bit when the widget is *not* composited; should be a little faster and will probably look better too.
Jérôme Guelfucci
noreply at xfce.org
Wed Dec 1 21:54:02 CET 2010
Updating branch refs/heads/xfce4-notifyd-0.1
to 070e44ab9bbdf3e6a7900051ae76283acb3f2528 (commit)
from d74aea150451b2bea4e4bcd7fca4d9a65396e6b8 (commit)
commit 070e44ab9bbdf3e6a7900051ae76283acb3f2528
Author: Brian J. Tarricone <bjt23 at cornell.edu>
Date: Wed Nov 26 16:25:07 2008 -0800
* xfce4-notifyd/xfce-notify-window.c: Don't set the legacy window
shape when the widget is composited (fixes drawing artifacts with
the curved corners). Also simplify the painting code a bit when
the widget is *not* composited; should be a little faster and will
probably look better too.
ChangeLog | 14 +++++++++++
xfce4-notifyd/xfce-notify-window.c | 45 +++++++++++++++++++++++++++--------
2 files changed, 48 insertions(+), 11 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 19b4759..81f2fc5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2008-11-26 Brian J. Tarricone <bjt23 at cornell.edu>
+
+ * xfce4-notifyd/xfce-notify-window.c: Don't set the legacy window
+ shape when the widget is composited (fixes drawing artifacts with
+ the curved corners). Also simplify the painting code a bit when
+ the widget is *not* composited; should be a little faster and will
+ probably look better too.
+
+2008-11-26 Brian J. Tarricone <bjt23 at cornell.edu>
+
+ * configure.ac.in: Add 'git' version tag.
+ * xfce4-notifyd-config/xfce4-notifyd-config.1: Add man page,
+ submitted by Evgeni Golov <sargentd at die-welt.net>.
+
2008-11-24 Brian J. Tarricone <bjt23 at cornell.edu>
* configure.ac.in: Remove 'git' version tag for 0.1.0 release.
diff --git a/xfce4-notifyd/xfce-notify-window.c b/xfce4-notifyd/xfce-notify-window.c
index 10f89cf..23fb056 100644
--- a/xfce4-notifyd/xfce-notify-window.c
+++ b/xfce4-notifyd/xfce-notify-window.c
@@ -451,7 +451,13 @@ xfce_notify_window_ensure_bg_path(XfceNotifyWindow *window,
? GDK_WINDING_RULE : GDK_EVEN_ODD_RULE);
region = xfce_gdk_region_from_cairo_flat_path(flat_path, fill_rule);
cairo_path_destroy(flat_path);
- gdk_window_shape_combine_region(widget->window, region, 0, 0);
+ /* only set the window shape if the widget isn't composited; otherwise
+ * the shape might further constrain the window, and because the
+ * path flattening isn't an exact science, it looks ugly. */
+ if(!gtk_widget_is_composited(widget))
+ gdk_window_shape_combine_region(widget->window, region, 0, 0);
+ /* however, of course always set the input shape; it doesn't matter
+ * if this is a pixel or two off here and there */
gdk_window_input_shape_combine_region(widget->window, region, 0, 0);
gdk_region_destroy(region);
@@ -474,18 +480,35 @@ xfce_notify_window_expose(GtkWidget *widget,
return FALSE;
cr = gdk_cairo_create(widget->window);
+ bg_path = xfce_notify_window_ensure_bg_path(window, cr);
- cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR);
- gdk_cairo_region(cr, evt->region);
- cairo_set_source_rgba(cr, 1.0, 1.0, 1.0, 0.0);
- cairo_fill_preserve(cr);
- cairo_clip(cr);
+ /* the idea here is we only do the fancy semi-transparent shaped
+ * painting if the widget is composited. if not, we avoid artifacts
+ * and optimise a bit by just painting the entire thing and relying
+ * on the window shape mask to effectively "clip" drawing for us */
+ if(gtk_widget_is_composited(widget)) {
+ cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR);
+ gdk_cairo_region(cr, evt->region);
+ cairo_set_source_rgba(cr, 1.0, 1.0, 1.0, 0.0);
+ cairo_fill_preserve(cr);
+ cairo_clip(cr);
+
+ cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
+ gdk_cairo_set_source_color(cr, &style->bg[GTK_STATE_NORMAL]);
+ cairo_append_path(cr, bg_path);
+ cairo_fill_preserve(cr);
+ } else {
+ cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
+ gdk_cairo_set_source_color(cr, &style->bg[GTK_STATE_NORMAL]);
+ cairo_fill(cr);
+
+ if(window->mouse_hover) {
+ /* but be sure to set the curved path because the code
+ * below needs it */
+ cairo_append_path(cr, bg_path);
+ }
+ }
- cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
- gdk_cairo_set_source_color(cr, &style->bg[GTK_STATE_NORMAL]);
- bg_path = xfce_notify_window_ensure_bg_path(window, cr);
- cairo_append_path(cr, bg_path);
- cairo_fill_preserve(cr);
if(window->mouse_hover) {
GdkColor *border_color = NULL;
More information about the Xfce4-commits
mailing list