Re: using gdk_win32_window_foreign_new_for_display



On 07.01.2017 18:54, Tilman K. wrote:
Hey guys,

I would like to develop the GUI for a VST synth with gtk. I need to 
embed a gtk gui inside a win32 HWND parent window. I think 
"gdk_win32_window_foreign_new_for_display" could be the right function 
to create a GdkWindow that is embedded inside the native window. is this 
correct?

         auto gdkWindow = 
Glib::wrap(gdk_win32_window_foreign_new_for_display(disp->gobj(),(HWND)systemWindow));
         window.set_parent_window(gdkWindow);

You might need to use gdk_win32_window_reparent() instead of set_parent_window.

To be honest, the whole foreign-window embedding thing is poorly-developed. GTK
does use it to embed its own printer properties page contents into Windows
printing dialog - and it didn't really work, last time i checked.

Also, i think this API is going away in GTK4.

My current fallback plan (in case i encounter a scenario where embedding is
needed, and i fail to make it work, or when the time of GTK4 comes, and it has
no embedding) is to instead just embed a pure W32-API child button (or
something along these lines) that causes a normal, toplevel, non-embedded
GTK-based dialog to pop up.

-- 
O< ascii ribbon - stop html email! - www.asciiribbon.org

Attachment: 0x6759BA74.asc
Description: application/pgp-keys

Attachment: signature.asc
Description: OpenPGP digital signature



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