Re: Getting to handle the events before the child widget.
- From: Adam Huuva <sventon easter-eggs com>
- To: gtk-app-devel-list <gtk-app-devel-list gnome org>
- Subject: Re: Getting to handle the events before the child widget.
- Date: Tue, 12 Sep 2000 03:14:56 +0000
Adam Huuva wrote:
How do I accomplish the following, that is, I wan't the callback to be
called
despite the fact that there is a child widget taking up all of the
window.
#include <gtk/gtk.h>
void mouse_click(GtkWidget *widget, GdkEventButton* buttonEv)
{
g_print("Hey, I'm in the right click callback!\n");
}
int main (int argc, char *argv[])
{
GtkWidget *win, *great_button, *button_label;
gtk_init(&argc, &argv);
win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_set_events (win, GDK_BUTTON_PRESS_MASK );
gtk_widget_set_usize(GTK_WIDGET(win), 100, 100);
great_button = gtk_button_new();
button_label = gtk_label_new("Press me!");
gtk_container_add(GTK_CONTAINER(great_button), button_label);
gtk_container_add(GTK_CONTAINER(win), great_button);
gtk_signal_connect(GTK_OBJECT(win),
"button_press_event",
GTK_SIGNAL_FUNC(mouse_click),
NULL);
gtk_widget_show_all (win);
gtk_main ();
return 0;
}
Since I had no response last night I will clarify my needs. I have a
stolen (gtk_socket_steal)
X window that is put inside gtk code. The stolen x window takes up all
of the application "surface". I would like to be able to steal the mouse
click events in any of the gtk widgets that are used to pack it because
I want to show a pop-up menu on mouse right click. I haven't succeded
and I assumed that the essence of the problem is described by the above
code snippet. The widget hierachy is as follows: GtkSocket steals X
window; GtkSocket is put in a GtkLayout; GtkLayout is put in a
GtkScrolledWindow; GtkScrolledWindow goes into a vbox which goes into
the toplevel GtkWindow.
Thanks,
--
Adam Huuva / Easter-eggs Spécialiste GNU/Linux
44-46 rue de l'Ouest - 75014 Paris - France - Métro Gaité
Phone: +33 (0) 1 43 35 00 37 - Fax: +33 (0) 1 41 35 00 76
mailto:sventon easter-eggs com - http://www.easter-eggs.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]