diff options
Diffstat (limited to 'src/ui/tile-preview.c')
-rw-r--r-- | src/ui/tile-preview.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/src/ui/tile-preview.c b/src/ui/tile-preview.c index ee58600d..e14ffe25 100644 --- a/src/ui/tile-preview.c +++ b/src/ui/tile-preview.c @@ -62,24 +62,16 @@ meta_tile_preview_expose (GtkWidget *widget, { MetaTilePreview *preview = user_data; #if !GTK_CHECK_VERSION (3, 0, 0) - GdkWindow *window; - cairo_t *cr; - - window = gtk_widget_get_window (widget); - cr = gdk_cairo_create (window); + cairo_t *cr = gdk_cairo_create (event->window); #endif cairo_set_line_width (cr, 1.0); if (preview->has_alpha) { -#if GTK_CHECK_VERSION (3, 0, 0) - GdkRGBA preview_color = *preview->preview_color; -#endif - /* Fill the preview area with a transparent color */ #if GTK_CHECK_VERSION (3, 0, 0) - gdk_cairo_set_source_rgba (cr, &preview_color); + gdk_cairo_set_source_rgba (cr, preview->preview_color); #else cairo_set_source_rgba (cr, (double)preview->preview_color->red / 0xFFFF, @@ -93,7 +85,7 @@ meta_tile_preview_expose (GtkWidget *widget, /* Use the opaque color for the border */ #if GTK_CHECK_VERSION (3, 0, 0) - gdk_cairo_set_source_rgba (cr, &preview_color); + gdk_cairo_set_source_rgba (cr, preview->preview_color); #else gdk_cairo_set_source_color (cr, preview->preview_color); #endif @@ -121,6 +113,13 @@ meta_tile_preview_expose (GtkWidget *widget, 0.5, 0.5, preview->tile_rect.width - 1, preview->tile_rect.height - 1); + +#if GTK_CHECK_VERSION (3, 0, 0) + if (preview->has_alpha) { + cairo_fill_preserve (cr); + cairo_set_source_rgba (cr, preview->preview_color->red, preview->preview_color->green, preview->preview_color->blue, 1.0); + } +#endif cairo_stroke (cr); #if !GTK_CHECK_VERSION (3, 0, 0) @@ -264,13 +263,8 @@ meta_tile_preview_show (MetaTilePreview *preview, && preview->tile_rect.height == tile_rect->height) return; /* nothing to do */ - gtk_widget_show (preview->preview_window); window = gtk_widget_get_window (preview->preview_window); -#if GTK_CHECK_VERSION (3, 0, 0) meta_core_lower_beneath_focus_window (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), -#else - meta_core_lower_beneath_focus_window (gdk_display, -#endif GDK_WINDOW_XID (window), gtk_get_current_event_time ()); @@ -280,6 +274,8 @@ meta_tile_preview_show (MetaTilePreview *preview, gdk_window_invalidate_rect (window, &old_rect, FALSE); + gtk_widget_show (preview->preview_window); + preview->tile_rect = *tile_rect; gdk_window_move_resize (window, |