[gtk-vnc-devel] [PATCH] Add interface to force pointer grab



I'll commit push this to outgoing tomorrow if there are no objections. I've updated the full screen mode in gvncviewer to use it too. I think this is what we're looking for semantically.

Regards,

Anthony Liguori
# HG changeset patch
# User Anthony Liguori <anthony codemonkey ws>
# Date 1202358039 21600
# Node ID 1e6a5272ef00477ae3af9a2e2448eae3bde642f9
# Parent  a6afe49858ba12f430767a00a70982c330e67d6d
Add interface to force pointer grab.

diff -r a6afe49858ba -r 1e6a5272ef00 examples/gvncviewer.c
--- a/examples/gvncviewer.c	Wed Feb 06 22:15:32 2008 -0600
+++ b/examples/gvncviewer.c	Wed Feb 06 22:20:39 2008 -0600
@@ -18,6 +18,8 @@
 #if WITH_GTKGLEXT
 #include <gtk/gtkgl.h>
 #endif
+
+static GtkWidget *vnc;
 
 static void set_title(VncDisplay *vnc, GtkWidget *window, gboolean grabbed)
 {
@@ -242,10 +244,13 @@ static gboolean window_state_event(GtkWi
 	ViewAutoDrawer *drawer = VIEW_AUTODRAWER(data);
 
 	if (event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN) {
-		if (event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN)
+		if (event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN) {
+			vnc_display_force_grab(VNC_DISPLAY(vnc), TRUE);
 			ViewAutoDrawer_SetActive(drawer, TRUE);
-		else
+		} else {
+			vnc_display_force_grab(VNC_DISPLAY(vnc), FALSE);
 			ViewAutoDrawer_SetActive(drawer, FALSE);
+		}
 	}
 
 	return FALSE;
@@ -257,7 +262,6 @@ int main(int argc, char **argv)
 	char port[1024], hostname[1024];
 	char *display;
 	GtkWidget *window;
-	GtkWidget *vnc;
 	GtkWidget *layout;
 	GtkWidget *menubar;
 	GtkWidget *sendkey, *view;
diff -r a6afe49858ba -r 1e6a5272ef00 src/libgtk-vnc_sym.version
--- a/src/libgtk-vnc_sym.version	Wed Feb 06 22:15:32 2008 -0600
+++ b/src/libgtk-vnc_sym.version	Wed Feb 06 22:20:39 2008 -0600
@@ -31,6 +31,7 @@
 
     vnc_display_set_lossy_encoding;
     vnc_display_set_scaling;
+    vnc_display_force_grab;
 
   local:
       *;
diff -r a6afe49858ba -r 1e6a5272ef00 src/vncdisplay.c
--- a/src/vncdisplay.c	Wed Feb 06 22:15:32 2008 -0600
+++ b/src/vncdisplay.c	Wed Feb 06 22:20:39 2008 -0600
@@ -344,6 +344,14 @@ static void do_pointer_ungrab(VncDisplay
 	priv->in_pointer_grab = FALSE;
 	if (!quiet)
 		g_signal_emit(obj, signals[VNC_POINTER_UNGRAB], 0);
+}
+
+void vnc_display_force_grab(VncDisplay *obj, gboolean enable)
+{
+	if (enable)
+		do_pointer_grab(obj, FALSE);
+	else
+		do_pointer_ungrab(obj, FALSE);
 }
 
 static void do_pointer_hide(VncDisplay *obj)
diff -r a6afe49858ba -r 1e6a5272ef00 src/vncdisplay.h
--- a/src/vncdisplay.h	Wed Feb 06 22:15:32 2008 -0600
+++ b/src/vncdisplay.h	Wed Feb 06 22:20:39 2008 -0600
@@ -107,6 +107,8 @@ void		vnc_display_set_lossy_encoding(Vnc
 
 gboolean	vnc_display_set_scaling(VncDisplay *obj, gboolean enable);
 
+void		vnc_display_force_grab(VncDisplay *obj, gboolean enable);
+
 G_END_DECLS
 
 #endif


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