gtkD window centering message up and no app on taskbar

Johnson via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Aug 9 12:20:00 PDT 2017


On Wednesday, 9 August 2017 at 15:10:46 UTC, Mike Wey wrote:
> 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.


ok, I guess I was still using 3.6 cause I couldn't find anything 
about gdk.c.functions and had to import it myself. Upgraded. 
Actually, searching the install for gdk.c.functions returns 
nothing ;/ Oops, I guess you meant the master on git hub. Could 
you add a link on the main gtkD page to the github site?



Anyways, looks like this problem is solved/nearly solved so I'll 
move on to the next ;)





More information about the Digitalmars-d-learn mailing list