tile-preview: Remove non-composited case

The main reason for handling the non-composited case was to keep
code differences with metacity small, but the tiling patch[0] never
got merged. In mutter itself, the compositor is not optional, so
there's no good reason for keeping those untested code chunks around.

[0] https://bugzilla.gnome.org/show_bug.cgi?id=607694

https://bugzilla.gnome.org/show_bug.cgi?id=666039
This commit is contained in:
Florian Müllner 2011-12-12 20:14:44 +01:00
parent 478f1020a4
commit 44f362ad87
3 changed files with 37 additions and 90 deletions

View File

@ -1925,7 +1925,6 @@ meta_screen_tile_preview_update_timeout (gpointer data)
{ {
MetaScreen *screen = data; MetaScreen *screen = data;
MetaWindow *window = screen->display->grab_window; MetaWindow *window = screen->display->grab_window;
gboolean composited = screen->display->compositor != NULL;
gboolean needs_preview = FALSE; gboolean needs_preview = FALSE;
screen->tile_preview_timeout_id = 0; screen->tile_preview_timeout_id = 0;
@ -1935,8 +1934,7 @@ meta_screen_tile_preview_update_timeout (gpointer data)
Window xwindow; Window xwindow;
gulong create_serial; gulong create_serial;
screen->tile_preview = meta_tile_preview_new (screen->number, screen->tile_preview = meta_tile_preview_new (screen->number);
composited);
xwindow = meta_tile_preview_get_xwindow (screen->tile_preview, xwindow = meta_tile_preview_get_xwindow (screen->tile_preview,
&create_serial); &create_serial);
meta_stack_tracker_record_add (screen->stack_tracker, meta_stack_tracker_record_add (screen->stack_tracker,

View File

@ -39,8 +39,6 @@ struct _MetaTilePreview {
GdkRGBA *preview_color; GdkRGBA *preview_color;
MetaRectangle tile_rect; MetaRectangle tile_rect;
gboolean has_alpha: 1;
}; };
static gboolean static gboolean
@ -52,8 +50,6 @@ meta_tile_preview_draw (GtkWidget *widget,
cairo_set_line_width (cr, 1.0); cairo_set_line_width (cr, 1.0);
if (preview->has_alpha)
{
/* Fill the preview area with a transparent color */ /* Fill the preview area with a transparent color */
gdk_cairo_set_source_rgba (cr, preview->preview_color); gdk_cairo_set_source_rgba (cr, preview->preview_color);
@ -65,17 +61,6 @@ meta_tile_preview_draw (GtkWidget *widget,
preview->preview_color->red, preview->preview_color->red,
preview->preview_color->green, preview->preview_color->green,
preview->preview_color->blue); preview->preview_color->blue);
}
else
{
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
cairo_rectangle (cr,
OUTLINE_WIDTH - 0.5, OUTLINE_WIDTH - 0.5,
preview->tile_rect.width - 2 * (OUTLINE_WIDTH - 1) - 1,
preview->tile_rect.height - 2 * (OUTLINE_WIDTH - 1) - 1);
cairo_stroke (cr);
}
cairo_rectangle (cr, cairo_rectangle (cr,
0.5, 0.5, 0.5, 0.5,
@ -87,11 +72,13 @@ meta_tile_preview_draw (GtkWidget *widget,
} }
MetaTilePreview * MetaTilePreview *
meta_tile_preview_new (int screen_number, meta_tile_preview_new (int screen_number)
gboolean composited)
{ {
MetaTilePreview *preview; MetaTilePreview *preview;
GdkScreen *screen; GdkScreen *screen;
GtkStyleContext *context;
GtkWidgetPath *path;
guchar selection_alpha = 0xFF;
screen = gdk_display_get_screen (gdk_display_get_default (), screen_number); screen = gdk_display_get_screen (gdk_display_get_default (), screen_number);
@ -107,15 +94,6 @@ meta_tile_preview_new (int screen_number,
preview->tile_rect.x = preview->tile_rect.y = 0; preview->tile_rect.x = preview->tile_rect.y = 0;
preview->tile_rect.width = preview->tile_rect.height = 0; preview->tile_rect.width = preview->tile_rect.height = 0;
preview->has_alpha = composited &&
(gdk_screen_get_rgba_visual (screen) != NULL);
if (preview->has_alpha)
{
GtkStyleContext *context;
GtkWidgetPath *path;
guchar selection_alpha = 0xFF;
gtk_widget_set_visual (preview->preview_window, gtk_widget_set_visual (preview->preview_window,
gdk_screen_get_rgba_visual (screen)); gdk_screen_get_rgba_visual (screen));
@ -144,7 +122,6 @@ meta_tile_preview_new (int screen_number,
preview->preview_color->alpha = (double)selection_alpha / 0xFF; preview->preview_color->alpha = (double)selection_alpha / 0xFF;
g_object_unref (context); g_object_unref (context);
}
/* We make an assumption that XCreateWindow will be the first operation /* We make an assumption that XCreateWindow will be the first operation
* when calling gtk_widget_realize() (via gdk_window_new()), or that it * when calling gtk_widget_realize() (via gdk_window_new()), or that it
@ -200,33 +177,6 @@ meta_tile_preview_show (MetaTilePreview *preview,
gdk_window_move_resize (window, gdk_window_move_resize (window,
preview->tile_rect.x, preview->tile_rect.y, preview->tile_rect.x, preview->tile_rect.y,
preview->tile_rect.width, preview->tile_rect.height); preview->tile_rect.width, preview->tile_rect.height);
if (!preview->has_alpha)
{
cairo_region_t *outer_region, *inner_region;
GdkRectangle outer_rect, inner_rect;
GdkRGBA black = { 0.0, 0.0, 0.0, 1.0 };
gdk_window_set_background_rgba (window, &black);
outer_rect.x = outer_rect.y = 0;
outer_rect.width = preview->tile_rect.width;
outer_rect.height = preview->tile_rect.height;
inner_rect.x = OUTLINE_WIDTH;
inner_rect.y = OUTLINE_WIDTH;
inner_rect.width = outer_rect.width - 2 * OUTLINE_WIDTH;
inner_rect.height = outer_rect.height - 2 * OUTLINE_WIDTH;
outer_region = cairo_region_create_rectangle (&outer_rect);
inner_region = cairo_region_create_rectangle (&inner_rect);
cairo_region_subtract (outer_region, inner_region);
cairo_region_destroy (inner_region);
gdk_window_shape_combine_region (window, outer_region, 0, 0);
cairo_region_destroy (outer_region);
}
} }
void void

View File

@ -27,8 +27,7 @@
typedef struct _MetaTilePreview MetaTilePreview; typedef struct _MetaTilePreview MetaTilePreview;
MetaTilePreview *meta_tile_preview_new (int screen_number, MetaTilePreview *meta_tile_preview_new (int screen_number);
gboolean composited);
void meta_tile_preview_free (MetaTilePreview *preview); void meta_tile_preview_free (MetaTilePreview *preview);
void meta_tile_preview_show (MetaTilePreview *preview, void meta_tile_preview_show (MetaTilePreview *preview,
MetaRectangle *rect); MetaRectangle *rect);