Intercepting X events cleanly?
- From: Ramkumar Chinchani <rc27 cse Buffalo EDU>
- To: "Gustavo J. A. M. Carneiro" <gjc inescporto pt>
- Cc: <gtk-app-devel-list gnome org>
- Subject: Intercepting X events cleanly?
- Date: Tue, 11 Mar 2003 15:55:08 -0500 (EST)
I am just trying to intercept X events cleanly and show a menu popup when
a button click happens on the root window.
If I use gdk_window_add_filter(), then I intercept all events before they
get delivered to GDK. If I do a *gtk_menu_popup* at this point, Xlib
complains.
Is there a cleaner way of doing things?
-Ram
==> Gustavo J. A. M. Carneiro <gjc inescporto pt>/6:19pm/Mar 11, 2003 <==
[On Dom, 2003-03-09 at 05:56, Ramkumar Chinchani wrote:
[> I have overridden the realize() function with my own for a widget that I
[> have written. I am attempting to set the event mask within this funtion as
[> follows.
[>
[> << code start >>
[>
[> void
[> wm_root_realize(GtkWidget *widget)
[> {
[> WmRoot *wm_root;
[>
[> printf("realize\n");
[>
[> g_return_if_fail(widget != NULL);
[> g_return_if_fail(IS_WM_ROOT(widget));
[>
[> GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
[>
[> wm_root = WM_ROOT(widget);
[>
[> widget->window = gdk_get_default_root_window();
[>
[> gtk_widget_set_events(widget, gtk_widget_get_events(widget) |
[> GDK_BUTTON_PRESS_MASK);
[>
[> g_object_ref(gdk_get_default_root_window());
[>
[> gdk_window_set_user_data(widget->window, widget);
[>
[> return;
[> }
[>
[> << code end >>
[>
[> It fails with this message:
[>
[> Gtk-CRITICAL **: file gtkwidget.c: line 4877 (gtk_widget_set_events):
[> assertion `!GTK_WIDGET_REALIZED (widget)' failed
[>
[> GTK_WIDGET_REALIZED just seems to check the flags field, which I have set
[> to GTK_REALIZED already.
[>
[> Why is this failing?
[
[ It's obvious :) You must be missing the little '!' that appears here:
[assertion `!GTK_WIDGET_REALIZED (widget)' failed
[
[You cannot add events to the event mask of an already realized widget.
[And what is it that you are doing? Changing widget's window to a
[reference to the root window? Is that necessary? Is that wise? :)
[
[>
[> Thanks
[>
[> -Ram
[>
[> _______________________________________________
[> gtk-app-devel-list mailing list
[> gtk-app-devel-list gnome org
[> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[--
[Gustavo Joćo Alves Marques Carneiro
[<gjc inescporto pt> <gustavo users sourceforge net>
[
[
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]