Re: Win32 WM_NCDESTROY to GDK Window to GTK Widget signal



On 18.09.2018 19:38, Michel Donais wrote:
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);


I see. I've looked at X11 backend, and it does things a bit differently - it
always queues a GDK_DESTROY event (due to how event processing is being done in
X11 - any notification results in an event, it seems), while also maybe calling
destory_notify() in the process.

If you rewrite WM_NCDESTROY handling to:

if ((pointer_grab != NULL && pointer_grab -> window == window) ||
    (keyboard_grab && keyboard_grab -> window == window))
  {
    GdkDevice *device = gdk_device_manager_get_client_pointer (device_manager);
    gdk_device_ungrab (device, msg -> time);
  }

if (window != NULL)
  {
    event = gdk_event_new (GDK_DESTROY);
    event->any.window = window;

    _gdk_win32_append_event (event);
  }

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

return_val = TRUE;
break;

then what happens in your application?

Attachment: signature.asc
Description: OpenPGP digital signature



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