[gtk-vnc-devel] [PATCH] Add an interface for making widget read-only
- From: Anthony Liguori <anthony codemonkey ws>
- To: gtk-vnc-devel List <gtk-vnc-devel lists sourceforge net>
- Subject: [gtk-vnc-devel] [PATCH] Add an interface for making widget read-only
- Date: Tue, 23 Oct 2007 22:27:23 -0500
Regards,
Anthony Liguori
Add a mechanism to prevent any guest input from being sent to the guest (read
only mode).
diff -r 6cb6fdab1881 src/libgtk-vnc_sym.version
--- a/src/libgtk-vnc_sym.version Tue Oct 23 22:13:27 2007 -0500
+++ b/src/libgtk-vnc_sym.version Tue Oct 23 22:16:04 2007 -0500
@@ -18,6 +18,7 @@
vnc_display_set_pointer_local;
vnc_display_set_pointer_grab;
vnc_display_set_keyboard_grab;
+ vnc_display_set_read_only;
vnc_display_get_pixbuf;
diff -r 6cb6fdab1881 src/vncdisplay.c
--- a/src/vncdisplay.c Tue Oct 23 22:13:27 2007 -0500
+++ b/src/vncdisplay.c Tue Oct 23 22:16:04 2007 -0500
@@ -56,6 +56,7 @@ struct _VncDisplayPrivate
gboolean grab_pointer;
gboolean grab_keyboard;
gboolean local_pointer;
+ gboolean read_only;
};
G_DEFINE_TYPE(VncDisplay, vnc_display, GTK_TYPE_DRAWING_AREA)
@@ -239,6 +240,9 @@ static gboolean button_event(GtkWidget *
if (priv->gvnc == NULL || !gvnc_is_initialized(priv->gvnc))
return TRUE;
+ if (priv->read_only)
+ return TRUE;
+
if ((priv->grab_pointer || !priv->absolute) &&
!priv->in_pointer_grab &&
button->button == 1 && button->type == GDK_BUTTON_PRESS)
@@ -268,6 +272,9 @@ static gboolean scroll_event(GtkWidget *
int mask;
if (priv->gvnc == NULL || !gvnc_is_initialized(priv->gvnc))
+ return TRUE;
+
+ if (priv->read_only)
return TRUE;
if (scroll->direction == GDK_SCROLL_UP)
@@ -308,6 +315,9 @@ static gboolean motion_event(GtkWidget *
if (!priv->absolute && !priv->in_pointer_grab)
return TRUE;
+ if (priv->read_only)
+ return TRUE;
+
if (!priv->absolute && priv->in_pointer_grab) {
GdkDrawable *drawable = GDK_DRAWABLE(widget->window);
GdkDisplay *display = gdk_drawable_get_display(drawable);
@@ -355,6 +365,9 @@ static gboolean key_event(GtkWidget *wid
GdkModifierType consumed;
if (priv->gvnc == NULL || !gvnc_is_initialized(priv->gvnc))
+ return TRUE;
+
+ if (priv->read_only)
return TRUE;
/*
@@ -1197,6 +1210,11 @@ void vnc_display_set_keyboard_grab(VncDi
}
+void vnc_display_set_read_only(VncDisplay *obj, gboolean enable)
+{
+ obj->priv->read_only = enable;
+}
+
GType vnc_display_credential_get_type(void)
{
static GType etype = 0;
diff -r 6cb6fdab1881 src/vncdisplay.h
--- a/src/vncdisplay.h Tue Oct 23 22:13:27 2007 -0500
+++ b/src/vncdisplay.h Tue Oct 23 22:16:04 2007 -0500
@@ -81,6 +81,7 @@ void vnc_display_set_pointer_local(VncD
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);
+void vnc_display_set_read_only(VncDisplay *obj, gboolean enable);
GdkPixbuf * vnc_display_get_pixbuf(VncDisplay *obj);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]