Getting to handle the events before the child widget.



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;
}                    

Ciao,
-- 
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]