gtkD window centering message up and no app on taskbar

Mike Wey via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Aug 9 08:10:46 PDT 2017


On 09-08-17 01:00, Johnson Jones wrote:
> But, finally, this does seem to work:
> 
> 
> // Fixup missing taskbar icon
> void SetTaskBarIcon(gtk.ApplicationWindow window)
> {
> 
>      version(Windows)
>          version(X86)
>          {
>              import core.sys.windows.winuser, gdk.Window;
>              auto handle = 
> cast(core.sys.windows.winuser.HANDLE)gdk_win32_window_get_handle(gtk.gtk_widget_get_window(window.getWidgetStruct())); 
> 
>              ShowWindow(handle, SW_HIDE);
> //            SetParent(handle, null);
>              SetWindowLong(handle, GWL_EXSTYLE, GetWindowLong(handle, 
> GWL_EXSTYLE) | WS_EX_APPWINDOW);
>              ShowWindow(handle, SW_SHOW);
>          }
>      return;
> }
> 
> Of course, along with this:
> 
> 
> MainWindow.addOnShow((Widget widget) { MainWindow.SetTaskBarIcon(); });

`gdk_win32_window_get_handle` I spend way to much time looking for a 
function like this, before giving up and doing the pointer arithmetic.

This should do it for getting the function:
```
import gtkd.Loader;
import gdk.c.functions; //Still at gtkc.gdk for 3.6.

__gshared extern(C) HANDLE function(GdkWindow*) gdk_win32_window_get_handle;
Linker.link(gdk_win32_window_get_handle, "gdk_win32_window_get_handle", 
LIBRARY_GDK);
```

I did find out that gdk set the Desktop window as the parent window and 
doesn't set `WS_EX_APPWINDOW` i should try if setting it for top level 
windows would fix this from within gdk.

-- 
Mike Wey


More information about the Digitalmars-d-learn mailing list