mirror of
https://github.com/brl/mutter.git
synced 2024-12-24 20:12:06 +00:00
Move begin_paint() handling to expose handler
This way, we can remove the special casing in meta_frames_paint_to_drawable(). Since the setup in meta_frames_paint_to_drawable() is relatively cheap, doing it once per rectangle in the expose area should be fine. https://bugzilla.gnome.org/show_bug.cgi?id=630203
This commit is contained in:
parent
b4344b5ab5
commit
0a88329526
@ -2329,7 +2329,9 @@ meta_frames_expose_event (GtkWidget *widget,
|
|||||||
MetaUIFrame *frame;
|
MetaUIFrame *frame;
|
||||||
MetaFrames *frames;
|
MetaFrames *frames;
|
||||||
CachedPixels *pixels;
|
CachedPixels *pixels;
|
||||||
MetaRegion *region;
|
MetaRegion *region, *area_region;
|
||||||
|
GdkRectangle *areas;
|
||||||
|
int i, n_areas;
|
||||||
|
|
||||||
frames = META_FRAMES (widget);
|
frames = META_FRAMES (widget);
|
||||||
|
|
||||||
@ -2355,7 +2357,22 @@ meta_frames_expose_event (GtkWidget *widget,
|
|||||||
clip_to_screen (region, frame);
|
clip_to_screen (region, frame);
|
||||||
subtract_client_area (region, frame);
|
subtract_client_area (region, frame);
|
||||||
|
|
||||||
meta_frames_paint_to_drawable (frames, frame, frame->window, region, 0, 0);
|
meta_region_get_rectangles (region, &areas, &n_areas);
|
||||||
|
|
||||||
|
for (i = 0; i < n_areas; i++)
|
||||||
|
{
|
||||||
|
area_region = meta_region_new_from_rectangle (&areas[i]);
|
||||||
|
|
||||||
|
gdk_window_begin_paint_region (event->window, area_region);
|
||||||
|
|
||||||
|
meta_frames_paint_to_drawable (frames, frame, event->window, area_region, 0, 0);
|
||||||
|
|
||||||
|
gdk_window_end_paint (event->window);
|
||||||
|
|
||||||
|
meta_region_destroy (area_region);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free (areas);
|
||||||
|
|
||||||
meta_region_destroy (region);
|
meta_region_destroy (region);
|
||||||
|
|
||||||
@ -2494,21 +2511,6 @@ meta_frames_paint_to_drawable (MetaFrames *frames,
|
|||||||
|
|
||||||
meta_prefs_get_button_layout (&button_layout);
|
meta_prefs_get_button_layout (&button_layout);
|
||||||
|
|
||||||
if (G_LIKELY (GDK_IS_WINDOW (drawable)))
|
|
||||||
{
|
|
||||||
/* A window; happens about 2/3 of the time */
|
|
||||||
|
|
||||||
GdkRectangle *areas;
|
|
||||||
int n_areas;
|
|
||||||
|
|
||||||
meta_region_get_rectangles (region, &areas, &n_areas);
|
|
||||||
|
|
||||||
for (i = 0; i < n_areas; i++)
|
|
||||||
{
|
|
||||||
/* Okay, so let's start painting. */
|
|
||||||
|
|
||||||
gdk_window_begin_paint_rect (drawable, &areas[i]);
|
|
||||||
|
|
||||||
meta_theme_draw_frame_with_style (meta_theme_get_current (),
|
meta_theme_draw_frame_with_style (meta_theme_get_current (),
|
||||||
frame->style,
|
frame->style,
|
||||||
widget,
|
widget,
|
||||||
@ -2523,33 +2525,6 @@ meta_frames_paint_to_drawable (MetaFrames *frames,
|
|||||||
&button_layout,
|
&button_layout,
|
||||||
button_states,
|
button_states,
|
||||||
mini_icon, icon);
|
mini_icon, icon);
|
||||||
|
|
||||||
gdk_window_end_paint (drawable);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_free (areas);
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Not a window; happens about 1/3 of the time */
|
|
||||||
|
|
||||||
meta_theme_draw_frame_with_style (meta_theme_get_current (),
|
|
||||||
frame->style,
|
|
||||||
widget,
|
|
||||||
drawable,
|
|
||||||
NULL,
|
|
||||||
x_offset, y_offset,
|
|
||||||
type,
|
|
||||||
flags,
|
|
||||||
w, h,
|
|
||||||
frame->layout,
|
|
||||||
frame->text_height,
|
|
||||||
&button_layout,
|
|
||||||
button_states,
|
|
||||||
mini_icon, icon);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user