Re: Win32 WM_NCDESTROY to GDK Window to GTK Widget signal



You are right, this is on GTK3. Hopefully, once GTK4 becomes predominant, it might not be useful to have foreign windows. But TBD!

The problem is as follows:

>      if ((window != NULL) && (msg->hwnd != GetDesktopWindow ()))
> gdk_window_destroy_notify (window);

This line actually destroys the window, so GDK_WINDOW_DESTROYED becomes true at that point. This is due to:

> static void gdk_win32_window_destroy_notify (GdkWindow *window)

where

> if (!GDK_WINDOW_DESTROYED (window)),

it

>       _gdk_window_destroy (window, TRUE);

So the line after, once the window is actually destroyed, it breaks

>      if (window == NULL || GDK_WINDOW_DESTROYED (window))
> break;

and never enters the following lines.

>      event = gdk_event_new (GDK_DESTROY);
>      event->any.window = window;
>
>      _gdk_win32_append_event (event);



On Tue, Sep 18, 2018 at 12:27 PM LRN via gtk-list <gtk-list gnome org> wrote:
On 18.09.2018 18:59, Michel Donais wrote:
> What seems to happen is the WM_NCDESTROY event is being sent out to GDK
> because its hierarchy is getting destroyed by Win32, and then, it seems GDK
> does the good thing destroying all its structures and pushes the destruction
> to all its known children, but it doesn’t propagate the good news to the
> Widget. It doesn’t seem to send events internally nor externally, and I
> don’t seem to get any event on the GTK side to tell I don’t have a surface,
> or got destroyed or anything.

Is far as i can see from the source code, GDK W32 backend emits GDK_DESTROY
event. On the GTK side it is, i think, supposed to be handled in
gtk_widget_event_internal(), which should emit a DESTROY_EVENT signal. If that
doesn't happen, then the best way to debug it is to get GTK with debug info,
run under gdb, and set up breapoints in all important places to see how
everything happens.

I assume you're using GTK3, by the way. Haven't looked at GTK2 yet.

Do note that foreign windows are highly unlikely to be supported in GTK4 (just
FYI).

_______________________________________________
gtk-list mailing list
gtk-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-list


--
  
Michel Donais
Développeur logiciel senior
mdonais audiokinetic com


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]