Fix key/mouse event propagation (rhbz #454627)

This commit is contained in:
Daniel P. Berrange 2008-08-28 21:56:34 +00:00
parent 13386e637a
commit 7b74faff5b
2 changed files with 209 additions and 1 deletions

View File

@ -0,0 +1,203 @@
diff -rup gtk-vnc-0.3.6.orig/src/vncdisplay.c gtk-vnc-0.3.6.new/src/vncdisplay.c
--- gtk-vnc-0.3.6.orig/src/vncdisplay.c 2008-05-06 03:53:56.000000000 +0100
+++ gtk-vnc-0.3.6.new/src/vncdisplay.c 2008-08-01 12:20:30.000000000 +0100
@@ -268,8 +268,7 @@ static GdkCursor *create_null_cursor(voi
return cursor;
}
-static gboolean expose_event(GtkWidget *widget, GdkEventExpose *expose,
- gpointer data G_GNUC_UNUSED)
+static gboolean expose_event(GtkWidget *widget, GdkEventExpose *expose)
{
VncDisplay *obj = VNC_DISPLAY(widget);
VncDisplayPrivate *priv = obj->priv;
@@ -488,8 +487,7 @@ void vnc_display_force_grab(VncDisplay *
do_pointer_ungrab(obj, FALSE);
}
-static gboolean button_event(GtkWidget *widget, GdkEventButton *button,
- gpointer data G_GNUC_UNUSED)
+static gboolean button_event(GtkWidget *widget, GdkEventButton *button)
{
VncDisplayPrivate *priv = VNC_DISPLAY(widget)->priv;
int n;
@@ -520,11 +518,10 @@ static gboolean button_event(GtkWidget *
0x7FFF, 0x7FFF);
}
- return FALSE;
+ return TRUE;
}
-static gboolean scroll_event(GtkWidget *widget, GdkEventScroll *scroll,
- gpointer data G_GNUC_UNUSED)
+static gboolean scroll_event(GtkWidget *widget, GdkEventScroll *scroll)
{
VncDisplayPrivate *priv = VNC_DISPLAY(widget)->priv;
int mask;
@@ -558,11 +555,10 @@ static gboolean scroll_event(GtkWidget *
0x7FFF, 0x7FFF);
}
- return FALSE;
+ return TRUE;
}
-static gboolean motion_event(GtkWidget *widget, GdkEventMotion *motion,
- gpointer data G_GNUC_UNUSED)
+static gboolean motion_event(GtkWidget *widget, GdkEventMotion *motion)
{
VncDisplayPrivate *priv = VNC_DISPLAY(widget)->priv;
int dx, dy;
@@ -637,11 +633,10 @@ static gboolean motion_event(GtkWidget *
priv->last_x = (int)motion->x;
priv->last_y = (int)motion->y;
- return FALSE;
+ return TRUE;
}
-static gboolean key_event(GtkWidget *widget, GdkEventKey *key,
- gpointer data G_GNUC_UNUSED)
+static gboolean key_event(GtkWidget *widget, GdkEventKey *key)
{
VncDisplayPrivate *priv = VNC_DISPLAY(widget)->priv;
guint keyval;
@@ -746,19 +741,18 @@ static gboolean key_event(GtkWidget *wid
do_pointer_grab(VNC_DISPLAY(widget), FALSE);
}
- return FALSE;
+ return TRUE;
}
-static gboolean enter_event(GtkWidget *widget, GdkEventCrossing *crossing,
- gpointer data G_GNUC_UNUSED)
+static gboolean enter_event(GtkWidget *widget, GdkEventCrossing *crossing)
{
VncDisplayPrivate *priv = VNC_DISPLAY(widget)->priv;
if (priv->gvnc == NULL || !gvnc_is_initialized(priv->gvnc))
- return TRUE;
+ return FALSE;
if (crossing->mode != GDK_CROSSING_NORMAL)
- return TRUE;
+ return FALSE;
if (priv->grab_keyboard)
do_keyboard_grab(VNC_DISPLAY(widget), FALSE);
@@ -766,16 +760,15 @@ static gboolean enter_event(GtkWidget *w
return TRUE;
}
-static gboolean leave_event(GtkWidget *widget, GdkEventCrossing *crossing,
- gpointer data G_GNUC_UNUSED)
+static gboolean leave_event(GtkWidget *widget, GdkEventCrossing *crossing)
{
VncDisplayPrivate *priv = VNC_DISPLAY(widget)->priv;
if (priv->gvnc == NULL || !gvnc_is_initialized(priv->gvnc))
- return TRUE;
+ return FALSE;
if (crossing->mode != GDK_CROSSING_NORMAL)
- return TRUE;
+ return FALSE;
if (priv->grab_keyboard)
do_keyboard_ungrab(VNC_DISPLAY(widget), FALSE);
@@ -784,14 +777,13 @@ static gboolean leave_event(GtkWidget *w
}
-static gboolean focus_event(GtkWidget *widget, GdkEventFocus *focus G_GNUC_UNUSED,
- gpointer data G_GNUC_UNUSED)
+static gboolean focus_event(GtkWidget *widget, GdkEventFocus *focus G_GNUC_UNUSED)
{
VncDisplayPrivate *priv = VNC_DISPLAY(widget)->priv;
int i;
if (priv->gvnc == NULL || !gvnc_is_initialized(priv->gvnc))
- return TRUE;
+ return FALSE;
for (i = 0 ; i < (int)(sizeof(priv->down_keyval)/sizeof(priv->down_keyval[0])) ; i++) {
/* We are currently pressed so... */
@@ -808,7 +800,7 @@ static gboolean focus_event(GtkWidget *w
}
#if WITH_GTKGLEXT
-static void realize_event(GtkWidget *widget, gpointer data G_GNUC_UNUSED)
+static void realize_event(GtkWidget *widget)
{
VncDisplayPrivate *priv = VNC_DISPLAY(widget)->priv;
@@ -1202,8 +1194,7 @@ static void rescale_display(VncDisplay *
}
}
-static gboolean configure_event(GtkWidget *widget, GdkEventConfigure *configure,
- gpointer data G_GNUC_UNUSED)
+static gboolean configure_event(GtkWidget *widget, GdkEventConfigure *configure)
{
VncDisplay *obj = VNC_DISPLAY(widget);
VncDisplayPrivate *priv = obj->priv;
@@ -1781,6 +1772,23 @@ static void vnc_display_class_init(VncDi
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass);
+ GtkWidgetClass *gtkwidget_class = GTK_WIDGET_CLASS (klass);
+
+ gtkwidget_class->expose_event = expose_event;
+ gtkwidget_class->motion_notify_event = motion_event;
+ gtkwidget_class->button_press_event = button_event;
+ gtkwidget_class->button_release_event = button_event;
+ gtkwidget_class->scroll_event = scroll_event;
+ gtkwidget_class->key_press_event = key_event;
+ gtkwidget_class->key_release_event = key_event;
+ gtkwidget_class->enter_notify_event = enter_event;
+ gtkwidget_class->leave_notify_event = leave_event;
+ gtkwidget_class->focus_out_event = focus_event;
+#if WITH_GTKGLEXT
+ gtkwidget_class->realize = realize_event;
+ gtkwidget_class->configure_event = configure_event;
+#endif
+
object_class->finalize = vnc_display_finalize;
object_class->get_property = vnc_display_get_property;
@@ -2062,33 +2070,6 @@ static void vnc_display_init(VncDisplay
GtkWidget *widget = GTK_WIDGET(display);
VncDisplayPrivate *priv;
- g_signal_connect(obj, "expose-event",
- G_CALLBACK(expose_event), NULL);
- g_signal_connect(obj, "motion-notify-event",
- G_CALLBACK(motion_event), NULL);
- g_signal_connect(obj, "button-press-event",
- G_CALLBACK(button_event), NULL);
- g_signal_connect(obj, "button-release-event",
- G_CALLBACK(button_event), NULL);
- g_signal_connect(obj, "scroll-event",
- G_CALLBACK(scroll_event), NULL);
- g_signal_connect(obj, "key-press-event",
- G_CALLBACK(key_event), NULL);
- g_signal_connect(obj, "key-release-event",
- G_CALLBACK(key_event), NULL);
- g_signal_connect(obj, "enter-notify-event",
- G_CALLBACK(enter_event), NULL);
- g_signal_connect(obj, "leave-notify-event",
- G_CALLBACK(leave_event), NULL);
- g_signal_connect(obj, "focus-out-event",
- G_CALLBACK(focus_event), NULL);
-#if WITH_GTKGLEXT
- g_signal_connect(obj, "realize",
- G_CALLBACK(realize_event), NULL);
- g_signal_connect(obj, "configure-event",
- G_CALLBACK(configure_event), NULL);
-#endif
-
GTK_WIDGET_SET_FLAGS(obj, GTK_CAN_FOCUS);
gtk_widget_add_events(widget,

View File

@ -7,10 +7,11 @@
Summary: A GTK widget for VNC clients
Name: gtk-vnc
Version: 0.3.6
Release: 3%{?dist}
Release: 4%{?dist}
License: LGPLv2+
Group: Development/Libraries
Source: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
Patch1: %{name}-%{version}-event-handlers.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
URL: http://gtk-vnc.sf.net/
BuildRequires: gtk2-devel pygtk2-devel python-devel zlib-devel
@ -67,6 +68,7 @@ browsers.
%prep
%setup -q
%patch1 -p1
%build
%if %{with_plugin}
@ -120,6 +122,9 @@ rm -fr %{buildroot}
%endif
%changelog
* Thu Aug 28 2008 Daniel P. Berrange <berrange@redhat.com> - 0.3.6-4.fc9
- Fix key/mouse event propagation (rhbz #454627)
* Mon Jul 7 2008 Tom "spot" Callaway <tcallawa@redhat.com> - 0.3.6-3
- fix conditional comparison