Re: SubstruvtorNotify and DestroyEvent
- From: Owen Taylor <otaylor redhat com>
- To: gtk-devel-list redhat com
- Subject: Re: SubstruvtorNotify and DestroyEvent
- Date: 06 Dec 1998 17:21:30 -0500
Michael Lausch <mla@gams.co.at> writes:
> I need to get SubstructureNotify events from the root window.
> What i did was:
>
> root_widget = gtk_window_new(GTK_WINDOW_POPUP);
> fprintf(stderr,"root_widget is at %p\n", root_widget);
> gtk_widget_realize(root_widget);
> fprintf(stderr,"root_widget realized\n");
> gdk_window_set_user_data(GDK_ROOT_PARENT(), root_widget);
> gdk_window_ref(GDK_ROOT_PARENT());
> gdk_xid_table_insert(&(GDK_WINDOW_XWINDOW(GDK_ROOT_PARENT())),
> GDK_ROOT_PARENT());
>
> and then
>
> gtk_signal_connect(GTK_OBJECT(root_widget), "event",
> GTK_SIGNAL_FUNC(substruct_notify), 0);
> fprintf(stderr,"root_widget signal connected\n");
> /* i'm not sure if this is really necessary */
> XSelectInput(GDK_DISPLAY(), GDK_WINDOW_XWINDOW(GDK_ROOT_PARENT()),
> SubstructureNotifyMask);
>
> with this setup, i observ DestroyNotify events on the root window. A
> closer look into the XDestroyWindowEvent and the XAnyEvent part of the
> raw X event showed me, that the gdk_translate_event function takes the
> XanyEvent.window part as the target window, which is the root
> window. But the destroyed window is not the root window. It's stored
> in the XDestroyWindowEvent.window data. Is this on purpose and do i
> miss something? If this is so, how do i call a signal function on a
> ClientMessage event, which is sent with an X event mask of
> SubStructureNotifyMask?
First, using SubStructureNotifyMask for that is a bit bizzare.
I would think StructureNotify would be a more reasonable choice.
Basically, something like SubstructureNotify mask goes beyond the
level of detail in which I think GDK should be expected to report X
events. GDK can't report two separate windows for a destroy event, so
it's current behavior IMO, isn't wrong, though it isn't useful.
I'd probably advise using the facilities provided by
gdk_window_add_filter(); redirecting the events from the root window
to a widget is a tricky business and probably not worth the bother.
(GDK probably though, should ignore destroy events with event->event
!= event->window. Patches accepted)
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]