Re: [gtk-vnc-devel] [PATCH 5/7] Use X window backing store for the VNC window 2008-11-24 Federico Mena Quintero <federico novell com>



Federico Mena Quintero wrote:
	* src/vncdisplay.c (add_backing_store): New function; adds a
	backing_store of Always to our window.
	(realize): Add backing store (on the X-server side) to our window,
	so that it sends us as few expose events as possible.  Trick
	stolen from TightVNC.

Is this just double buffering in GTK parlance? If you avoid disabling double buffering, does that help?

Again, this will break the Windows build.

Regards,

Anthony Liguori

Signed-off-by: Federico Mena Quintero <federico novell com>
---
 ChangeLog        |    8 ++++++++
 src/vncdisplay.c |   26 ++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a8cf656..a3d056b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-11-24  Federico Mena Quintero  <federico novell com>
+
+	* src/vncdisplay.c (add_backing_store): New function; adds a
+	backing_store of Always to our window.
+	(realize): Add backing store (on the X-server side) to our window,
+	so that it sends us as few expose events as possible.  Trick
+	stolen from TightVNC.
+
 2008-11-20  Federico Mena Quintero  <federico novell com>
Do compression of motion events, like TightVNC does, so that the
diff --git a/src/vncdisplay.c b/src/vncdisplay.c
index fdec881..e9ba14e 100644
--- a/src/vncdisplay.c
+++ b/src/vncdisplay.c
@@ -298,6 +298,25 @@ eat_pending_motion_events_filter_func (GdkXEvent *xevent,
 }
static void
+add_backing_store(VncDisplay *obj)
+{
+	GdkWindow *window;
+	Display *xdisplay;
+	Window xwindow;
+	XSetWindowAttributes attr;
+	gulong value_mask;
+
+	window = gtk_widget_get_window (GTK_WIDGET (obj));
+	xdisplay = gdk_x11_drawable_get_xdisplay (window);
+	xwindow = GDK_WINDOW_XWINDOW (window);
+
+	attr.backing_store = Always;
+	value_mask = CWBackingStore;
+
+	XChangeWindowAttributes (xdisplay, xwindow, value_mask, &attr);
+}
+
+static void
 realize (GtkWidget *widget)
 {
 	VncDisplay *obj = VNC_DISPLAY(widget);
@@ -311,6 +330,13 @@ realize (GtkWidget *widget)
 	 * motion events.
 	 */
 	gdk_window_add_filter (widget->window, eat_pending_motion_events_filter_func, widget);
+
+	/* TightVNC requests an X window backing_store of "Always".  We'll do
+	 * the same, as this lets VNC viewers displayed on a remote X server
+	 * (a common scenario, it seems) to minimize the number of expose events that
+	 * get received.
+	 */
+	add_backing_store (obj);
 }
static gboolean expose_event(GtkWidget *widget, GdkEventExpose *expose)





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]