[gtk-vnc-devel] PATCH: Clear areas outside of framebuffer region
- From: "Daniel P. Berrange" <berrange redhat com>
- To: gtk-vnc-devel <gtk-vnc-devel lists sourceforge net>
- Subject: [gtk-vnc-devel] PATCH: Clear areas outside of framebuffer region
- Date: Wed, 22 Aug 2007 17:52:31 +0100
If the GTK-VNC widget gets resized to be larger than the region taken up
by the remote framebuffer, the excess space just gets filled with random
garbage. This is seen in Vinagre if you hit "Full Screen"
The attached patch calls gdk_draw_rectangle to fill the excess space with
a solid colour (black). It uses a clip mask to ensure we don't clear the
space where the actual framebuffer is & thus avoids flickr that would entail.
Dan.
--
|=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=|
|=- Perl modules: http://search.cpan.org/~danberr/ -=|
|=- Projects: http://freshmeat.net/~danielpb/ -=|
|=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|
diff -r 453f9ca2a737 src/vncdisplay.c
--- a/src/vncdisplay.c Wed Aug 22 10:40:33 2007 -0400
+++ b/src/vncdisplay.c Wed Aug 22 12:48:09 2007 -0400
@@ -103,6 +103,8 @@ static gboolean expose_event(GtkWidget *
VncDisplay *obj = VNC_DISPLAY(widget);
VncDisplayPrivate *priv = obj->priv;
int x, y, w, h;
+ GdkRectangle drawn;
+ GdkRegion *clear, *copy;
if (priv->shm_image == NULL)
return TRUE;
@@ -114,9 +116,27 @@ static gboolean expose_event(GtkWidget *
w -= x;
h -= y;
+ drawn.x = x;
+ drawn.y = y;
+ drawn.width = w;
+ drawn.height = h;
+
+ clear = gdk_region_rectangle(&expose->area);
+ copy = gdk_region_rectangle(&drawn);
+ gdk_region_subtract(clear, copy);
+
+ gdk_gc_set_clip_region(priv->gc, copy);
vnc_shm_image_draw(priv->shm_image, widget->window,
- priv->gc,
+ priv->gc,
x, y, x, y, w, h);
+
+ gdk_gc_set_clip_region(priv->gc, clear);
+ gdk_draw_rectangle(widget->window, priv->gc, TRUE, expose->area.x, expose->area.y,
+ expose->area.width, expose->area.height);
+
+ gdk_region_destroy(clear);
+ gdk_region_destroy(copy);
+
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]