mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
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:
parent
478f1020a4
commit
44f362ad87
@ -1925,7 +1925,6 @@ meta_screen_tile_preview_update_timeout (gpointer data)
|
||||
{
|
||||
MetaScreen *screen = data;
|
||||
MetaWindow *window = screen->display->grab_window;
|
||||
gboolean composited = screen->display->compositor != NULL;
|
||||
gboolean needs_preview = FALSE;
|
||||
|
||||
screen->tile_preview_timeout_id = 0;
|
||||
@ -1935,8 +1934,7 @@ meta_screen_tile_preview_update_timeout (gpointer data)
|
||||
Window xwindow;
|
||||
gulong create_serial;
|
||||
|
||||
screen->tile_preview = meta_tile_preview_new (screen->number,
|
||||
composited);
|
||||
screen->tile_preview = meta_tile_preview_new (screen->number);
|
||||
xwindow = meta_tile_preview_get_xwindow (screen->tile_preview,
|
||||
&create_serial);
|
||||
meta_stack_tracker_record_add (screen->stack_tracker,
|
||||
|
@ -39,8 +39,6 @@ struct _MetaTilePreview {
|
||||
GdkRGBA *preview_color;
|
||||
|
||||
MetaRectangle tile_rect;
|
||||
|
||||
gboolean has_alpha: 1;
|
||||
};
|
||||
|
||||
static gboolean
|
||||
@ -52,8 +50,6 @@ meta_tile_preview_draw (GtkWidget *widget,
|
||||
|
||||
cairo_set_line_width (cr, 1.0);
|
||||
|
||||
if (preview->has_alpha)
|
||||
{
|
||||
/* Fill the preview area with a transparent 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->green,
|
||||
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,
|
||||
0.5, 0.5,
|
||||
@ -87,11 +72,13 @@ meta_tile_preview_draw (GtkWidget *widget,
|
||||
}
|
||||
|
||||
MetaTilePreview *
|
||||
meta_tile_preview_new (int screen_number,
|
||||
gboolean composited)
|
||||
meta_tile_preview_new (int screen_number)
|
||||
{
|
||||
MetaTilePreview *preview;
|
||||
GdkScreen *screen;
|
||||
GtkStyleContext *context;
|
||||
GtkWidgetPath *path;
|
||||
guchar selection_alpha = 0xFF;
|
||||
|
||||
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.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,
|
||||
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;
|
||||
|
||||
g_object_unref (context);
|
||||
}
|
||||
|
||||
/* We make an assumption that XCreateWindow will be the first operation
|
||||
* 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,
|
||||
preview->tile_rect.x, preview->tile_rect.y,
|
||||
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
|
||||
|
@ -27,8 +27,7 @@
|
||||
|
||||
typedef struct _MetaTilePreview MetaTilePreview;
|
||||
|
||||
MetaTilePreview *meta_tile_preview_new (int screen_number,
|
||||
gboolean composited);
|
||||
MetaTilePreview *meta_tile_preview_new (int screen_number);
|
||||
void meta_tile_preview_free (MetaTilePreview *preview);
|
||||
void meta_tile_preview_show (MetaTilePreview *preview,
|
||||
MetaRectangle *rect);
|
||||
|
Loading…
Reference in New Issue
Block a user