|
Lines 28-33
Link Here
|
| 28 |
|
28 |
|
| 29 |
#include <string.h> |
29 |
#include <string.h> |
| 30 |
#include <gdk/gdkx.h> |
30 |
#include <gdk/gdkx.h> |
|
|
31 |
#include <cairo.h> |
| 32 |
#include <cairo-xlib.h> //FIXME should be removed when gdk_cairo_set_source_pixmap() is available (GTK+ 2.10) |
| 31 |
|
33 |
|
| 32 |
#include "panel-background-monitor.h" |
34 |
#include "panel-background-monitor.h" |
| 33 |
#include "panel-gdk-pixbuf-extensions.h" |
35 |
#include "panel-gdk-pixbuf-extensions.h" |
|
Lines 146-151
panel_background_prepare (PanelBackgroun
Link Here
|
| 146 |
|
148 |
|
| 147 |
background->prepared = TRUE; |
149 |
background->prepared = TRUE; |
| 148 |
|
150 |
|
|
|
151 |
background->notify_changed (background, background->user_data); |
| 152 |
|
| 149 |
return TRUE; |
153 |
return TRUE; |
| 150 |
} |
154 |
} |
| 151 |
|
155 |
|
|
Lines 326-333
panel_background_composite (PanelBackgro
Link Here
|
| 326 |
|
330 |
|
| 327 |
panel_background_prepare (background); |
331 |
panel_background_prepare (background); |
| 328 |
|
332 |
|
| 329 |
background->notify_changed (background, background->user_data); |
|
|
| 330 |
|
| 331 |
return TRUE; |
333 |
return TRUE; |
| 332 |
} |
334 |
} |
| 333 |
|
335 |
|
|
Lines 477-483
panel_background_transform (PanelBackgro
Link Here
|
| 477 |
|
479 |
|
| 478 |
free_transformed_resources (background); |
480 |
free_transformed_resources (background); |
| 479 |
|
481 |
|
| 480 |
if (background->type == PANEL_BACK_IMAGE) |
482 |
if (background->type == PANEL_BACK_IMAGE) |
| 481 |
background->transformed_image = |
483 |
background->transformed_image = |
| 482 |
get_scaled_and_rotated_pixbuf (background); |
484 |
get_scaled_and_rotated_pixbuf (background); |
| 483 |
|
485 |
|
|
Lines 1050-1082
static void
Link Here
|
| 1050 |
panel_background_set_image_background_on_widget (PanelBackground *background, |
1052 |
panel_background_set_image_background_on_widget (PanelBackground *background, |
| 1051 |
GtkWidget *widget) |
1053 |
GtkWidget *widget) |
| 1052 |
{ |
1054 |
{ |
| 1053 |
const GdkPixmap *bg_pixmap; |
1055 |
const GdkPixmap *bg_pixmap; |
| 1054 |
GdkPixmap *pixmap; |
1056 |
GdkPixmap *pixmap; |
|
|
1057 |
int width; |
| 1058 |
int height; |
| 1059 |
cairo_t *cr; |
| 1060 |
cairo_surface_t *surface; |
| 1061 |
cairo_pattern_t *pattern; |
| 1062 |
cairo_matrix_t matrix; |
| 1055 |
GtkStyle *style; |
1063 |
GtkStyle *style; |
| 1056 |
GdkGC *gc; |
|
|
| 1057 |
|
1064 |
|
| 1058 |
bg_pixmap = panel_background_get_pixmap (background); |
1065 |
bg_pixmap = panel_background_get_pixmap (background); |
| 1059 |
if (!bg_pixmap) |
1066 |
if (!bg_pixmap) |
| 1060 |
return; |
1067 |
return; |
| 1061 |
|
1068 |
|
| 1062 |
gc = gdk_gc_new (widget->window); |
1069 |
gdk_drawable_get_size (GDK_DRAWABLE (bg_pixmap), &width, &height); |
| 1063 |
g_return_if_fail (GDK_IS_GC (gc)); |
1070 |
|
|
|
1071 |
//FIXME gdk_cairo_set_source_pixmap() should do the trick (GTK+ 2.10) |
| 1072 |
surface = cairo_xlib_surface_create (gdk_x11_drawable_get_xdisplay (widget->window), |
| 1073 |
gdk_x11_drawable_get_xid (GDK_DRAWABLE (bg_pixmap)), |
| 1074 |
gdk_x11_visual_get_xvisual (gdk_drawable_get_visual (widget->window)), |
| 1075 |
width, height); |
| 1076 |
|
| 1077 |
pattern = cairo_pattern_create_for_surface (surface); |
| 1078 |
cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT); |
| 1079 |
cairo_matrix_init_translate (&matrix, |
| 1080 |
widget->allocation.x, |
| 1081 |
widget->allocation.y); |
| 1082 |
cairo_pattern_set_matrix (pattern, &matrix); |
| 1064 |
|
1083 |
|
| 1065 |
pixmap = gdk_pixmap_new (widget->window, |
1084 |
pixmap = gdk_pixmap_new (widget->window, |
| 1066 |
widget->allocation.width, |
1085 |
widget->allocation.width, |
| 1067 |
widget->allocation.height, |
1086 |
widget->allocation.height, |
| 1068 |
-1); |
1087 |
-1); |
| 1069 |
|
1088 |
|
| 1070 |
gdk_draw_drawable (GDK_DRAWABLE (pixmap), |
1089 |
cr = gdk_cairo_create (GDK_DRAWABLE (pixmap)); |
| 1071 |
gc, |
1090 |
cairo_set_source (cr, pattern); |
| 1072 |
GDK_DRAWABLE (bg_pixmap), |
1091 |
cairo_rectangle (cr, 0, 0, |
| 1073 |
widget->allocation.x, |
1092 |
widget->allocation.width, widget->allocation.height); |
| 1074 |
widget->allocation.y, |
1093 |
cairo_fill (cr); |
| 1075 |
0, 0, |
1094 |
|
| 1076 |
widget->allocation.width, |
1095 |
cairo_pattern_destroy (pattern); |
| 1077 |
widget->allocation.height); |
1096 |
cairo_surface_destroy (surface); |
| 1078 |
|
1097 |
cairo_destroy (cr); |
| 1079 |
g_object_unref (gc); |
|
|
| 1080 |
|
1098 |
|
| 1081 |
style = gtk_style_copy (widget->style); |
1099 |
style = gtk_style_copy (widget->style); |
| 1082 |
if (style->bg_pixmap[GTK_STATE_NORMAL]) |
1100 |
if (style->bg_pixmap[GTK_STATE_NORMAL]) |