summaryrefslogtreecommitdiff
path: root/gtk/window-decorator
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2010-09-06 23:55:39 +0800
committerSam Spilsbury <smspillaz@gmail.com>2010-09-06 23:55:39 +0800
commit64ee56f3619a537f29cfe34a37678b947e1532fd (patch)
tree2a578e61ec6150525338844ea672311e66383e74 /gtk/window-decorator
parent346440e1f010fcb3921bc5312a719d188c371bcc (diff)
downloadcompiz-with-glib-mainloop-64ee56f3619a537f29cfe34a37678b947e1532fd.tar.gz
compiz-with-glib-mainloop-64ee56f3619a537f29cfe34a37678b947e1532fd.tar.bz2
[PATCH] Replace old gdk_draw_drawable method calls with cairo equivalents.
Diffstat (limited to 'gtk/window-decorator')
-rw-r--r--gtk/window-decorator/cairo.c13
-rw-r--r--gtk/window-decorator/decorator.c21
-rw-r--r--gtk/window-decorator/gtk-window-decorator.h7
-rw-r--r--gtk/window-decorator/metacity.c13
-rw-r--r--gtk/window-decorator/switcher.c30
-rw-r--r--gtk/window-decorator/wnck.c10
6 files changed, 37 insertions, 57 deletions
diff --git a/gtk/window-decorator/cairo.c b/gtk/window-decorator/cairo.c
index 85e48d8..82c7f6a 100644
--- a/gtk/window-decorator/cairo.c
+++ b/gtk/window-decorator/cairo.c
@@ -668,16 +668,7 @@ draw_window_decoration (decor_t *d)
cairo_destroy (cr);
- if (d->buffer_pixmap)
- gdk_draw_drawable (d->pixmap,
- d->gc,
- d->buffer_pixmap,
- 0,
- 0,
- 0,
- 0,
- d->width,
- d->height);
+ copy_to_front_buffer (d);
if (d->frame_window)
{
@@ -883,4 +874,4 @@ update_border_extents (gint text_height)
_max_win_extents = _default_win_extents;
max_titlebar_height = titlebar_height =
(text_height < 17) ? 17 : text_height;
-} \ No newline at end of file
+}
diff --git a/gtk/window-decorator/decorator.c b/gtk/window-decorator/decorator.c
index 38f6d1c..19d41f4 100644
--- a/gtk/window-decorator/decorator.c
+++ b/gtk/window-decorator/decorator.c
@@ -385,15 +385,15 @@ update_window_decoration_size (WnckWindow *win)
if (d->buffer_pixmap)
g_object_unref (G_OBJECT (d->buffer_pixmap));
- if (d->gc)
- g_object_unref (G_OBJECT (d->gc));
-
if (d->picture)
XRenderFreePicture (xdisplay, d->picture);
+ if (d->cr)
+ cairo_destroy (d->cr);
+
d->pixmap = pixmap;
d->buffer_pixmap = buffer_pixmap;
- d->gc = gdk_gc_new (pixmap);
+ d->cr = gdk_cairo_create (pixmap);
d->picture = picture;
@@ -798,4 +798,15 @@ update_default_decorations (GdkScreen *screen)
if (d.layout)
g_object_unref (G_OBJECT (d.layout));
-} \ No newline at end of file
+}
+
+void
+copy_to_front_buffer (decor_t *d)
+{
+ if (!d->buffer_pixmap)
+ return;
+
+ cairo_set_operator (d->cr, CAIRO_OPERATOR_SOURCE);
+ gdk_cairo_set_source_pixmap (d->cr, d->buffer_pixmap, 0, 0);
+ cairo_paint (d->cr);
+}
diff --git a/gtk/window-decorator/gtk-window-decorator.h b/gtk/window-decorator/gtk-window-decorator.h
index 808becc..0f418fe 100644
--- a/gtk/window-decorator/gtk-window-decorator.h
+++ b/gtk/window-decorator/gtk-window-decorator.h
@@ -361,7 +361,7 @@ typedef struct _decor {
GtkWidget *decor_window;
GtkWidget *decor_event_box;
GtkWidget *decor_image;
- GdkGC *gc;
+ cairo_t *cr;
decor_layout_t border_layout;
decor_context_t *context;
decor_shadow_t *shadow;
@@ -505,6 +505,11 @@ update_window_decoration (WnckWindow *win);
void
queue_decor_draw (decor_t *d);
+void
+copy_to_front_buffer (decor_t *d);
+
+
+
/* wnck.c*/
void
diff --git a/gtk/window-decorator/metacity.c b/gtk/window-decorator/metacity.c
index 8e5817c..cf3d3eb 100644
--- a/gtk/window-decorator/metacity.c
+++ b/gtk/window-decorator/metacity.c
@@ -842,16 +842,7 @@ meta_draw_window_decoration (decor_t *d)
XRenderFreePicture (xdisplay, src);
}
- if (d->buffer_pixmap)
- gdk_draw_drawable (d->pixmap,
- d->gc,
- d->buffer_pixmap,
- 0,
- 0,
- 0,
- 0,
- d->width,
- d->height);
+ copy_to_front_buffer (d);
if (d->frame_window)
{
@@ -1575,4 +1566,4 @@ meta_update_border_extents (gint text_height)
max_titlebar_height = top_height - _max_win_extents.top;
}
-#endif \ No newline at end of file
+#endif
diff --git a/gtk/window-decorator/switcher.c b/gtk/window-decorator/switcher.c
index 74a23d7..0b840bd 100644
--- a/gtk/window-decorator/switcher.c
+++ b/gtk/window-decorator/switcher.c
@@ -178,15 +178,7 @@ draw_switcher_background (decor_t *d)
cairo_destroy (cr);
- gdk_draw_drawable (d->pixmap,
- d->gc,
- d->buffer_pixmap,
- 0,
- 0,
- 0,
- 0,
- d->width,
- d->height);
+ copy_to_front_buffer (d);
pixel = ((((a * style->bg[GTK_STATE_NORMAL].blue ) >> 24) & 0x0000ff) |
(((a * style->bg[GTK_STATE_NORMAL].green) >> 16) & 0x00ff00) |
@@ -253,15 +245,7 @@ draw_switcher_foreground (decor_t *d)
cairo_destroy (cr);
- gdk_draw_drawable (d->pixmap,
- d->gc,
- d->buffer_pixmap,
- 0,
- 0,
- 0,
- 0,
- d->width,
- d->height);
+ copy_to_front_buffer (d);
}
void
@@ -388,8 +372,6 @@ update_switcher_window (WnckWindow *win,
if (width == d->width && height == d->height)
{
- if (!d->gc)
- d->gc = gdk_gc_new (d->pixmap);
if (!d->picture)
{
@@ -428,8 +410,8 @@ update_switcher_window (WnckWindow *win,
if (d->buffer_pixmap)
g_object_unref (G_OBJECT (d->buffer_pixmap));
- if (d->gc)
- g_object_unref (G_OBJECT (d->gc));
+ if (d->cr)
+ cairo_destroy (d->cr);
if (d->picture)
XRenderFreePicture (xdisplay, d->picture);
@@ -445,7 +427,7 @@ update_switcher_window (WnckWindow *win,
d->pixmap = pixmap;
d->buffer_pixmap = buffer_pixmap;
- d->gc = gdk_gc_new (pixmap);
+ d->cr = gdk_cairo_create (pixmap);
format = get_format_for_drawable (d, GDK_DRAWABLE (d->buffer_pixmap));
d->picture = XRenderCreatePicture (xdisplay, GDK_PIXMAP_XID (buffer_pixmap),
@@ -459,4 +441,4 @@ update_switcher_window (WnckWindow *win,
queue_decor_draw (d);
return TRUE;
-} \ No newline at end of file
+}
diff --git a/gtk/window-decorator/wnck.c b/gtk/window-decorator/wnck.c
index cd8dc80..a4794e5 100644
--- a/gtk/window-decorator/wnck.c
+++ b/gtk/window-decorator/wnck.c
@@ -350,10 +350,10 @@ remove_frame_window (WnckWindow *win)
d->buffer_pixmap = NULL;
}
- if (d->gc)
+ if (d->cr)
{
- g_object_unref (G_OBJECT (d->gc));
- d->gc = NULL;
+ cairo_destroy (d->cr);
+ d->cr = NULL;
}
if (d->picture && !d->frame_window)
@@ -533,7 +533,7 @@ window_opened (WnckScreen *screen,
d->created = FALSE;
d->pixmap = NULL;
- d->gc = NULL;
+ d->cr = NULL;
d->buffer_pixmap = NULL;
d->picture = None;
@@ -598,4 +598,4 @@ connect_screen (WnckScreen *screen)
window_opened (screen, windows->data);
windows = windows->next;
}
-} \ No newline at end of file
+}