summaryrefslogtreecommitdiff
path: root/src/frames.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@pobox.com>2002-05-05 00:45:01 +0000
committerHavoc Pennington <hp@src.gnome.org>2002-05-05 00:45:01 +0000
commit6f8a7f18702beb2fb8128eea25b532cb0b15ebbb (patch)
tree1be2a5e1fe1d005b657969d0aa7d775d9762853c /src/frames.c
parent7fbbd0200fc914b6d1899564344e758b408b90af (diff)
downloadmetacity-6f8a7f18702beb2fb8128eea25b532cb0b15ebbb.tar.gz
chop out the portion of the region that's outside the screen.
2002-05-04 Havoc Pennington <hp@pobox.com> * src/frames.c (meta_frames_paint_to_drawable): chop out the portion of the region that's outside the screen. * src/core.c (meta_core_get_screen_size): new function (meta_core_get_frame_extents): new function
Diffstat (limited to 'src/frames.c')
-rw-r--r--src/frames.c44
1 files changed, 39 insertions, 5 deletions
diff --git a/src/frames.c b/src/frames.c
index ab56bd54..aadb86bb 100644
--- a/src/frames.c
+++ b/src/frames.c
@@ -1299,10 +1299,11 @@ meta_frames_paint_to_drawable (MetaFrames *frames,
int i;
int top, bottom, left, right;
GdkRegion *edges;
- GdkRegion *client;
+ GdkRegion *tmp_region;
GdkRectangle area;
GdkRectangle *areas;
int n_areas;
+ int screen_width, screen_height;
widget = GTK_WIDGET (frames);
@@ -1380,19 +1381,52 @@ meta_frames_paint_to_drawable (MetaFrames *frames,
/* Repaint each side of the frame */
edges = gdk_region_copy (region);
+
+ /* Punch out the client area */
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);
+ tmp_region = gdk_region_rectangle (&area);
+ gdk_region_subtract (edges, tmp_region);
+ gdk_region_destroy (tmp_region);
+
+ /* Chop off stuff outside the screen; this optimization
+ * is crucial to handle huge client windows,
+ * like "xterm -geometry 1000x1000"
+ */
+ meta_core_get_frame_extents (gdk_display,
+ frame->xwindow,
+ &area.x, &area.y,
+ &area.width, &area.height);
+
+ meta_core_get_screen_size (gdk_display,
+ frame->xwindow,
+ &screen_width, &screen_height);
+ if ((area.x + area.width) > screen_width)
+ area.width = screen_width - area.x;
+ if (area.width < 0)
+ area.width = 0;
+
+ if ((area.y + area.height) > screen_height)
+ area.height = screen_height - area.y;
+ if (area.height < 0)
+ area.height = 0;
+
+ area.x = 0; /* make relative to frame rather than screen */
+ area.y = 0;
+
+ tmp_region = gdk_region_rectangle (&area);
+ gdk_region_intersect (edges, tmp_region);
+ gdk_region_destroy (tmp_region);
+
+ /* Now draw remaining portion of region */
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]);