summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorLars Hamann <lars@gtk.org>1999-03-19 12:36:22 +0000
committerLars Hamann <lars@src.gnome.org>1999-03-19 12:36:22 +0000
commit536673ad386ec404a99392c34049286dc9499772 (patch)
treec7569a586200969a45ce928d3a7f9d70b77d2463 /gtk
parent8b424288ba75721f39e76ffad78dd16497a5bc34 (diff)
downloadgdk-pixbuf-536673ad386ec404a99392c34049286dc9499772.tar.gz
only connect/disconnect to GtkWidgetClass::event to block mouse events.
Fri Mar 19 00:00:22 1999 Lars Hamann <lars@gtk.org> * gtk/gtkclist.c (gtk_clist_column_title_passive) (gtk_clist_column_title_active): only connect/disconnect to GtkWidgetClass::event to block mouse events. * gtk/gtkclist.c (vertical_timeout) (horizontal_timeout): zero initialize event, removed superfluous gdk_window_get_pointer call * gtk/gtklist.c (gtk_list_vertical_timeout) (gtk_list_horizontal_timeout): removed superfluous gdk_window_get_pointer call
Diffstat (limited to 'gtk')
-rw-r--r--gtk/gtkclist.c102
-rw-r--r--gtk/gtklist.c17
2 files changed, 25 insertions, 94 deletions
diff --git a/gtk/gtkclist.c b/gtk/gtkclist.c
index 6d2346dfa..fa4bfc32c 100644
--- a/gtk/gtkclist.c
+++ b/gtk/gtkclist.c
@@ -1294,8 +1294,6 @@ void
gtk_clist_column_title_active (GtkCList *clist,
gint column)
{
- GtkObject *object;
-
g_return_if_fail (clist != NULL);
g_return_if_fail (GTK_IS_CLIST (clist));
@@ -1304,35 +1302,11 @@ gtk_clist_column_title_active (GtkCList *clist,
if (!clist->column[column].button || !clist->column[column].button_passive)
return;
- object = GTK_OBJECT (clist->column[column].button);
-
clist->column[column].button_passive = FALSE;
- gtk_signal_disconnect_by_func (object,
- (GtkSignalFunc) column_title_passive_func,
- GINT_TO_POINTER (gtk_signal_lookup
- ("button_press_event",
- GTK_TYPE_WIDGET)));
- gtk_signal_disconnect_by_func (object,
- (GtkSignalFunc) column_title_passive_func,
- GINT_TO_POINTER (gtk_signal_lookup
- ("button_release_event",
- GTK_TYPE_WIDGET)));
- gtk_signal_disconnect_by_func (object,
+ gtk_signal_disconnect_by_func (GTK_OBJECT (clist->column[column].button),
(GtkSignalFunc) column_title_passive_func,
- GINT_TO_POINTER (gtk_signal_lookup
- ("motion_notify_event",
- GTK_TYPE_WIDGET)));
- gtk_signal_disconnect_by_func (object,
- (GtkSignalFunc) column_title_passive_func,
- GINT_TO_POINTER (gtk_signal_lookup
- ("enter_notify_event",
- GTK_TYPE_WIDGET)));
- gtk_signal_disconnect_by_func (object,
- (GtkSignalFunc) column_title_passive_func,
- GINT_TO_POINTER (gtk_signal_lookup
- ("leave_notify_event",
- GTK_TYPE_WIDGET)));
+ NULL);
GTK_WIDGET_SET_FLAGS (clist->column[column].button, GTK_CAN_FOCUS);
if (GTK_WIDGET_VISIBLE (clist))
@@ -1343,7 +1317,6 @@ void
gtk_clist_column_title_passive (GtkCList *clist,
gint column)
{
- GtkObject *object;
GtkButton *button;
g_return_if_fail (clist != NULL);
@@ -1354,46 +1327,17 @@ gtk_clist_column_title_passive (GtkCList *clist,
if (!clist->column[column].button || clist->column[column].button_passive)
return;
- object = GTK_OBJECT (clist->column[column].button);
button = GTK_BUTTON (clist->column[column].button);
clist->column[column].button_passive = TRUE;
-
-
- gtk_signal_connect (object, "button_press_event",
- (GtkSignalFunc) column_title_passive_func,
- GINT_TO_POINTER (gtk_signal_lookup
- ("button_press_event",
- GTK_TYPE_WIDGET)));
-
if (button->button_down)
gtk_button_released (button);
-
- gtk_signal_connect (object, "button_release_event",
- (GtkSignalFunc) column_title_passive_func,
- GINT_TO_POINTER (gtk_signal_lookup
- ("button_release_event",
- GTK_TYPE_WIDGET)));
- gtk_signal_connect (object, "motion_notify_event",
- (GtkSignalFunc) column_title_passive_func,
- GINT_TO_POINTER (gtk_signal_lookup
- ("motion_notify_event",
- GTK_TYPE_WIDGET)));
- gtk_signal_connect (object, "enter_notify_event",
- (GtkSignalFunc) column_title_passive_func,
- GINT_TO_POINTER (gtk_signal_lookup
- ("enter_notify_event",
- GTK_TYPE_WIDGET)));
-
if (button->in_button)
gtk_button_leave (button);
- gtk_signal_connect (object, "leave_notify_event",
- (GtkSignalFunc) column_title_passive_func,
- GINT_TO_POINTER (gtk_signal_lookup
- ("leave_notify_event",
- GTK_TYPE_WIDGET)));
+ gtk_signal_connect (GTK_OBJECT (clist->column[column].button), "event",
+ (GtkSignalFunc) column_title_passive_func, NULL);
GTK_WIDGET_UNSET_FLAGS (clist->column[column].button, GTK_CAN_FOCUS);
if (GTK_WIDGET_VISIBLE (clist))
@@ -2178,7 +2122,21 @@ column_title_passive_func (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
- gtk_signal_emit_stop (GTK_OBJECT (widget), GPOINTER_TO_INT (data));
+ g_return_val_if_fail (event != NULL, FALSE);
+
+ switch (event->type)
+ {
+ case GDK_MOTION_NOTIFY:
+ case GDK_BUTTON_PRESS:
+ case GDK_2BUTTON_PRESS:
+ case GDK_3BUTTON_PRESS:
+ case GDK_BUTTON_RELEASE:
+ case GDK_ENTER_NOTIFY:
+ case GDK_LEAVE_NOTIFY:
+ return TRUE;
+ default:
+ break;
+ }
return FALSE;
}
@@ -7121,19 +7079,14 @@ move_vertical (GtkCList *clist,
static gint
horizontal_timeout (GtkCList *clist)
{
- gint x, y;
- GdkEventMotion event;
- GdkModifierType mask;
+ GdkEventMotion event = { 0 };
GDK_THREADS_ENTER ();
clist->htimer = 0;
- gdk_window_get_pointer (clist->clist_window, &x, &y, &mask);
- event.is_hint = 0;
- event.x = x;
- event.y = y;
- event.state = mask;
+ event.type = GDK_MOTION_NOTIFY;
+ event.send_event = TRUE;
gtk_clist_motion (GTK_WIDGET (clist), &event);
@@ -7145,19 +7098,14 @@ horizontal_timeout (GtkCList *clist)
static gint
vertical_timeout (GtkCList *clist)
{
- gint x, y;
- GdkEventMotion event;
- GdkModifierType mask;
+ GdkEventMotion event = { 0 };
GDK_THREADS_ENTER ();
clist->vtimer = 0;
- gdk_window_get_pointer (clist->clist_window, &x, &y, &mask);
- event.is_hint = 0;
- event.x = x;
- event.y = y;
- event.state = mask;
+ event.type = GDK_MOTION_NOTIFY;
+ event.send_event = TRUE;
gtk_clist_motion (GTK_WIDGET (clist), &event);
diff --git a/gtk/gtklist.c b/gtk/gtklist.c
index 869494a50..bf4eec56c 100644
--- a/gtk/gtklist.c
+++ b/gtk/gtklist.c
@@ -2409,22 +2409,14 @@ gtk_list_move_focus_child (GtkList *list,
static gint
gtk_list_horizontal_timeout (GtkWidget *list)
{
- gint x, y;
GdkEventMotion event = { 0 };
- GdkModifierType mask;
GDK_THREADS_ENTER ();
GTK_LIST (list)->htimer = 0;
- gdk_window_get_pointer (list->window, &x, &y, &mask);
event.type = GDK_MOTION_NOTIFY;
event.send_event = TRUE;
- event.window = NULL;
- event.is_hint = 0;
- event.x = x;
- event.y = y;
- event.state = mask;
gtk_list_motion_notify (list, &event);
@@ -2436,23 +2428,14 @@ gtk_list_horizontal_timeout (GtkWidget *list)
static gint
gtk_list_vertical_timeout (GtkWidget *list)
{
- gint x;
- gint y;
GdkEventMotion event = { 0 };
- GdkModifierType mask;
GDK_THREADS_ENTER ();
GTK_LIST (list)->vtimer = 0;
- gdk_window_get_pointer (list->window, &x, &y, &mask);
event.type = GDK_MOTION_NOTIFY;
event.send_event = TRUE;
- event.window = NULL;
- event.is_hint = 0;
- event.x = x;
- event.y = y;
- event.state = mask;
gtk_list_motion_notify (list, &event);