disable automatic GTK double buffering, since it resulted in gigantic

2002-05-04  Havoc Pennington  <hp@pobox.com>

	* src/frames.c (meta_frames_init): disable automatic GTK double
	buffering, since it resulted in gigantic backing pixmaps the size
	of the whole screen.
	(meta_frames_paint_to_drawable): change to take a region argument;
	punch the client area out of the expose region, then iterate over
	rectangles in the region and draw each, manually doing
	begin_paint_rect. Results in 4 long thin backing pixmaps
	per frame repaint, instead of one large backing pixmap.
	Suggested by Owen.
This commit is contained in:
Havoc Pennington 2002-05-05 00:21:17 +00:00 committed by Havoc Pennington
parent cf4ef8cab2
commit 7fbbd0200f
2 changed files with 67 additions and 15 deletions

View File

@ -1,3 +1,15 @@
2002-05-04 Havoc Pennington <hp@pobox.com>
* src/frames.c (meta_frames_init): disable automatic GTK double
buffering, since it resulted in gigantic backing pixmaps the size
of the whole screen.
(meta_frames_paint_to_drawable): change to take a region argument;
punch the client area out of the expose region, then iterate over
rectangles in the region and draw each, manually doing
begin_paint_rect. Results in 4 long thin backing pixmaps
per frame repaint, instead of one large backing pixmap.
Suggested by Owen.
2002-05-05 Bastien Nocera <hadess@hadess.net> 2002-05-05 Bastien Nocera <hadess@hadess.net>
* src/workspace.c: (meta_workspace_get_neighbor): * src/workspace.c: (meta_workspace_get_neighbor):

View File

@ -56,7 +56,7 @@ static gboolean meta_frames_leave_notify_event (GtkWidget *widget,
static void meta_frames_paint_to_drawable (MetaFrames *frames, static void meta_frames_paint_to_drawable (MetaFrames *frames,
MetaUIFrame *frame, MetaUIFrame *frame,
GdkDrawable *drawable, GdkDrawable *drawable,
GdkRectangle *area); GdkRegion *region);
static void meta_frames_calc_geometry (MetaFrames *frames, static void meta_frames_calc_geometry (MetaFrames *frames,
MetaUIFrame *frame, MetaUIFrame *frame,
@ -166,6 +166,8 @@ meta_frames_init (MetaFrames *frames)
frames->tooltip_timeout = 0; frames->tooltip_timeout = 0;
frames->expose_delay_count = 0; frames->expose_delay_count = 0;
gtk_widget_set_double_buffered (GTK_WIDGET (frames), FALSE);
} }
static void static void
@ -1275,7 +1277,7 @@ meta_frames_expose_event (GtkWidget *widget,
return TRUE; return TRUE;
} }
meta_frames_paint_to_drawable (frames, frame, frame->window, &event->area); meta_frames_paint_to_drawable (frames, frame, frame->window, event->region);
return TRUE; return TRUE;
} }
@ -1284,7 +1286,7 @@ static void
meta_frames_paint_to_drawable (MetaFrames *frames, meta_frames_paint_to_drawable (MetaFrames *frames,
MetaUIFrame *frame, MetaUIFrame *frame,
GdkDrawable *drawable, GdkDrawable *drawable,
GdkRectangle *area) GdkRegion *region)
{ {
GtkWidget *widget; GtkWidget *widget;
MetaFrameFlags flags; MetaFrameFlags flags;
@ -1295,6 +1297,12 @@ meta_frames_paint_to_drawable (MetaFrames *frames,
MetaButtonState button_states[META_BUTTON_TYPE_LAST]; MetaButtonState button_states[META_BUTTON_TYPE_LAST];
Window grab_frame; Window grab_frame;
int i; int i;
int top, bottom, left, right;
GdkRegion *edges;
GdkRegion *client;
GdkRectangle area;
GdkRectangle *areas;
int n_areas;
widget = GTK_WIDGET (frames); widget = GTK_WIDGET (frames);
@ -1365,10 +1373,33 @@ meta_frames_paint_to_drawable (MetaFrames *frames,
meta_frames_ensure_layout (frames, frame); meta_frames_ensure_layout (frames, frame);
meta_theme_get_frame_borders (meta_theme_get_current (),
type, frame->text_height, flags,
&top, &bottom, &left, &right);
/* Repaint each side of the frame */
edges = gdk_region_copy (region);
area.x = left;
area.y = top;
area.width = w;
area.height = h;
client = gdk_region_rectangle (&area);
gdk_region_subtract (edges, client);
gdk_region_destroy (client);
gdk_region_get_rectangles (edges, &areas, &n_areas);
i = 0;
while (i < n_areas)
{
if (GDK_IS_WINDOW (drawable))
gdk_window_begin_paint_rect (drawable, &areas[i]);
meta_theme_draw_frame (meta_theme_get_current (), meta_theme_draw_frame (meta_theme_get_current (),
widget, widget,
drawable, drawable,
area, &areas[i],
0, 0, 0, 0,
type, type,
flags, flags,
@ -1377,6 +1408,15 @@ meta_frames_paint_to_drawable (MetaFrames *frames,
frame->text_height, frame->text_height,
button_states, button_states,
mini_icon, icon); mini_icon, icon);
if (GDK_IS_WINDOW (drawable))
gdk_window_end_paint (drawable);
++i;
}
gdk_region_destroy (edges);
g_free (areas);
} }
static gboolean static gboolean