redirect GdkEvents
- From: Stefan Kost <ensonic hora-obscura de>
- To: gtk-app-devel-list <gtk-app-devel-list gnome org>
- Subject: redirect GdkEvents
- Date: Fri, 02 Feb 2007 20:59:33 +0200
hi,
I need to do a hack :( I once submitted this together with a pack, but its not
beeing accepted.
http://bugzilla.gnome.org/show_bug.cgi?id=338271
Now I try to do a workaround for my use case. I am already able to get the
events the button inside the treeview header got. I now I want the children in
the container (=button) to handle them instead. I am currentl trying with the
code below, but I can't get the widget on the column header to do something :(
Any ideas?
Stfean
static void
forward_event(GtkWidget *widget,gpointer user_data) {
gtk_widget_event(widget,(GdkEvent *)user_data);
}
static gboolean
on_column_header_event(GtkWidget *widget,GdkEvent *event,gpointer user_data)
{
GtkWidget *child=GTK_WIDGET(user_data);
puts("header widget parent event: type=0x%x\n",event->type);
/* forward some events to child */
switch(event->type) {
case GDK_MOTION_NOTIFY:
case GDK_BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
case GDK_ENTER_NOTIFY:
case GDK_LEAVE_NOTIFY:
// this still does not cause the button clicks to work
//gtk_widget_event(child,event);
gtk_container_foreach(GTK_CONTAINER(child),forward_event,event);
return(TRUE);
default:
break;
}
return(FALSE);
}
static void
on_header_realize(GtkWidget *widget,gpointer user_data)
{
GtkTreeViewColumn *tree_col=GTK_TREE_VIEW_COLUMN(user_data);
GtkWidget *button=tree_col->button;
g_signal_handlers_disconnect_matched(button,G_SIGNAL_MATCH_DATA,0,0,
NULL,NULL,tree_col);
g_signal_connect(G_OBJECT(button),"event",G_CALLBACK(on_column_header_event),
(gpointer)widget);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]