[gtk-vnc-devel] PATCH: configurable pointer hiding
- From: "Daniel P. Berrange" <berrange redhat com>
- To: gtk-vnc-devel <gtk-vnc-devel lists sourceforge net>
- Subject: [gtk-vnc-devel] PATCH: configurable pointer hiding
- Date: Fri, 6 Jul 2007 19:08:40 +0100
Following on from the previous patch, this patch makes the local pointer
hiding configurable. By default no local pointer is shown when the mouse
is over the VNC widget. If using the vnc_display_set_pointer_local method
the app can turn on the visibility of a local pointer.
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 -=|
changeset: 26:06fb3b1e2320
user: "Daniel P. Berrange <berrange redhat com>"
date: Fri Jul 06 11:40:33 2007 -0400
summary: Allow local pointer hiding to be configurable
diff -r f0724efc82b7 -r 06fb3b1e2320 examples/gvncviewer.c
--- a/examples/gvncviewer.c Fri Jul 06 10:57:07 2007 -0400
+++ b/examples/gvncviewer.c Fri Jul 06 11:40:33 2007 -0400
@@ -123,6 +123,7 @@ int main(int argc, char **argv)
vnc_display_set_keyboard_grab(VNC_DISPLAY(vnc), TRUE);
vnc_display_set_pointer_grab(VNC_DISPLAY(vnc), TRUE);
+ //vnc_display_set_pointer_local(VNC_DISPLAY(vnc), TRUE);
vnc_display_open_name(VNC_DISPLAY(vnc), argv[1], argv[2]);
gtk_signal_connect(GTK_OBJECT(window), "delete-event",
diff -r f0724efc82b7 -r 06fb3b1e2320 examples/gvncviewer.py
--- a/examples/gvncviewer.py Fri Jul 06 10:57:07 2007 -0400
+++ b/examples/gvncviewer.py Fri Jul 06 11:40:33 2007 -0400
@@ -69,6 +69,7 @@ v.realize()
v.realize()
v.set_pointer_grab(True)
v.set_keyboard_grab(True)
+#v.set_pointer_local(True)
if len(sys.argv) == 4:
v.set_credential(gtkvnc.CREDENTIAL_PASSWORD, sys.argv[3])
diff -r f0724efc82b7 -r 06fb3b1e2320 src/libgtk-vnc_sym.version
--- a/src/libgtk-vnc_sym.version Fri Jul 06 10:57:07 2007 -0400
+++ b/src/libgtk-vnc_sym.version Fri Jul 06 11:40:33 2007 -0400
@@ -15,6 +15,7 @@
vnc_display_get_pixbuf;
vnc_display_set_use_shm;
+ vnc_display_set_pointer_local;
vnc_display_set_pointer_grab;
vnc_display_set_keyboard_grab;
diff -r f0724efc82b7 -r 06fb3b1e2320 src/vncdisplay.c
--- a/src/vncdisplay.c Fri Jul 06 10:57:07 2007 -0400
+++ b/src/vncdisplay.c Fri Jul 06 11:40:33 2007 -0400
@@ -48,6 +48,7 @@ struct _VncDisplayPrivate
gboolean use_shm;
gboolean grab_pointer;
gboolean grab_keyboard;
+ gboolean local_pointer;
};
/* Signals */
@@ -171,6 +172,18 @@ static void do_pointer_ungrab(VncDisplay
g_signal_emit(obj, signals[VNC_POINTER_UNGRAB], 0);
}
+static void do_pointer_hide(VncDisplay *obj)
+{
+ VncDisplayPrivate *priv = obj->priv;
+ gdk_window_set_cursor(GTK_WIDGET(obj)->window,
+ priv->null_cursor);
+}
+
+static void do_pointer_show(VncDisplay *obj)
+{
+ gdk_window_set_cursor(GTK_WIDGET(obj)->window,
+ NULL);
+}
static gboolean button_event(GtkWidget *widget, GdkEventButton *button,
@@ -376,8 +389,10 @@ static gboolean on_resize(void *opaque,
if (priv->gc == NULL) {
priv->null_cursor = create_null_cursor();
- gdk_window_set_cursor(GTK_WIDGET(obj)->window,
- priv->null_cursor);
+ if (priv->local_pointer)
+ do_pointer_show(obj);
+ else
+ do_pointer_hide(obj);
priv->gc = gdk_gc_new(GTK_WIDGET(obj)->window);
}
@@ -416,12 +431,8 @@ static gboolean on_pointer_type_change(v
VncDisplay *obj = VNC_DISPLAY(opaque);
VncDisplayPrivate *priv = obj->priv;
- if (absolute) {
- if (priv->in_pointer_grab && !priv->grab_pointer)
- do_pointer_ungrab(obj);
- gdk_window_set_cursor(GTK_WIDGET(obj)->window, priv->null_cursor);
- } else
- gdk_window_set_cursor(GTK_WIDGET(obj)->window, NULL);
+ if (absolute && priv->in_pointer_grab && !priv->grab_pointer)
+ do_pointer_ungrab(obj);
priv->absolute = absolute;
return TRUE;
@@ -800,6 +811,17 @@ void vnc_display_set_use_shm(VncDisplay
obj->priv->use_shm = enable;
}
+void vnc_display_set_pointer_local(VncDisplay *obj, gboolean enable)
+{
+ if (obj->priv->gc) {
+ if (enable)
+ do_pointer_show(obj);
+ else
+ do_pointer_hide(obj);
+ }
+ obj->priv->local_pointer = enable;
+}
+
void vnc_display_set_pointer_grab(VncDisplay *obj, gboolean enable)
{
VncDisplayPrivate *priv = obj->priv;
diff -r f0724efc82b7 -r 06fb3b1e2320 src/vncdisplay.h
--- a/src/vncdisplay.h Fri Jul 06 10:57:07 2007 -0400
+++ b/src/vncdisplay.h Fri Jul 06 11:40:33 2007 -0400
@@ -75,6 +75,7 @@ gboolean vnc_display_set_credential(VncD
gboolean vnc_display_set_credential(VncDisplay *obj, int type, const gchar *data);
void vnc_display_set_use_shm(VncDisplay *obj, gboolean enable);
+void vnc_display_set_pointer_local(VncDisplay *obj, gboolean enable);
void vnc_display_set_pointer_grab(VncDisplay *obj, gboolean enable);
void vnc_display_set_keyboard_grab(VncDisplay *obj, gboolean enable);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]