The last few weeks I have been working on the Gtk+ win32 port. Since the client side windows work landed in Gtk+ 2.18 the Windows port has been a bit broken, but now I finally sat down and fixed the remaining issues. So, the newly released Gtk+ 2.24.8 is now officially the best ever Gtk+ 2.x release on windows.
Then I forward ported all the work to the current Gtk 3 tree. It was mostly trivial, but one thing that changed a lot in Gtk3 is theming. The old windows theme was mostly a custom themeing engine, but in Gtk+ 3 we want to use engines less in favour of CSS. So, I had to completely redo the windows theme using CSS.
I added a few CSS extensions that access the win32 theming APIs, so you can get theme backgrounds, theme colors and theme sizes. Then the rest is just traditional CSS to bind the things together.
Here is an image of the current state:
There are clearly still some issues that need fixing, but it works impressively well for just being some CSS. Check it out.
55 thoughts on “Gtk+ work on windows”
Is it possible that we will have official win32 runtime builds on gtk.org anytime soon?
Dieter is working on a binary release. It will be announced any day now.
Very glad to see GTK getting revived love on Windows. I’d love to have my favourite Gnome apps on working well on Windows; epiphany, rhythmbox, evince, etc. Though I wonder how many hard dependencies these apps are getting that make GTK the least of the porting concerns.
Thank you so much for your work !
This is going to be a big help for our Windows port of Banshee.
I am now testing the GTK 2.24.8 for Windows as found here:
As far as I could see the distribution on this page is missing libxml2 dependency. Additionally intl.dll is provided, but when the compiled program is started, it does not start because it requires libintl-8.dll.
Perhaps it would be good to have an proper installers (runtime and development) similar to ones available here:
Thank you for your work.
I’m glad that GTK 2.24.8 solved most of the issues I had with GTK on Windows.
If only this one would be solved soon 🙂
First of all, thank you for your effort working on a windows port.
It is very important for opensource applications to be cross platform, but there is also space for gtk use in the windows environment.
I would like to ask if there is a place where we could download binaries to test.
Is it possible to theme GTK3 with CSS on Windows to make a custom look for one application? 🙂
Kris: For sure you can use CSS to create a custom app look with gtk on *any* platform.
This is very cool; one thing I’ve noticed for donkeys years but not repported is that gtk apps in windows often have white text on menus when it should be black in windows (on the highlighted item IIRC).
Great work, can’t wait to see it in all my fave gtk apps on windows 🙂
I have two questions:
1. Why are there the old Icons and not the Tango Icons?
2. Is it possible to change the look of the filedialogs with css?
1: I just didn’t have any icon theme installed, you can chose whichever you want.
2: You can do some custom tweaking of the CSS that changes the fileselector only, but you can’t change it however you want, just how its rendered.
3: You have to know CSS, and have some level of knowledge in how Gtk+ work and the win32 theming APIs, but you don’t really need to be a programmer, no.
And a third question:
Is it possible to help this the theming as a not Programmer?
Does DPI scaling work well in windows 7?
Not sure exactly what you refer to by DPI scaling, but we don’t do anything special with respect to DPI on windows.
The On/Off switches are still so VERY UNINTUITIVE. No real switch here is left-right, and I always wonder if it’s on on the left or off.
And in particular: in order to turn it ON, I have to drag the slider ONTO OFF?
I remember when GNOME was still about usability, and not about “oooh, pretty buttons. With drag effects!”
[WORDPRESS HASHCASH] The poster sent us ‘0 which is not a hashcash value.
Gtk crashes on a server 2008R2 machine to which I connect using remote desktop: _gdk_pixmap_new returns NULL because ‘depth’ parameter is 16. Any idea?
#0 _gdk_pixmap_new (drawable=0x354a010, width=48, height=48, depth=16)
#1 0x6c356567 in gdk_pixmap_new (drawable=0x354a010, width=48, height=48,
#2 0x6c356131 in gdk_pixbuf_render_pixmap_and_mask_for_colormap (
pixbuf=0x354d548, colormap=0x3546040, pixmap_return=0x550d19c,
#3 0x013ebaf1 in get_pixmap_and_mask (window=0x354a220, parent_info=0x0,
is_default_list=1, icon_list=0x5507a20, pmap_return=0x550d19c,
#4 0x013ebefb in gtk_window_realize_icon (window=0x35e0020)
#5 0x013ee29d in gtk_window_realize (widget=0x35e0020)
Yevgen: Can you try something like:
@@ -175,6 +175,7 @@ _gdk_pixmap_new (GdkDrawable *drawable,
format = CAIRO_FORMAT_A8;
+ case 16:
format = CAIRO_FORMAT_RGB24;
Returning CAIRO_FORMAT_RGB24 for depth=16 does fix the crash. It’s not perfect, button icons are missing (no log messages about those). I am also using the same build of gtk on a windows 7 with a real display, where it works pretty well; so it seems that only remote desktop is broken. Should I open a bug? (I’d rather not.) Thanks!
Yevgen: The underlying issue is that cairo doesn’t support rendering to 16bit native win32 surfaces.
I opened a bug at:
If you want you could try to have gdk return a cairo_image_surface based pixmap for 16 bit. This will be kinda busted as you can’t e.g use such a pixmap with win32 calls that expect a real dibsection, like setting a cursor, but it might work well enough for pure gdk rendering.
I don’t have remote rendering set up, so i can’t really test this stuff.
>Not sure exactly what you refer to by DPI scaling, but we don’t do anything special with respect to DPI on windows.
I don’t know exactly myself, but if in application doesn’t react in proper wat to non standard dpi in Windows 7, then windows will just scale it by interpolation leading to blurriness.
FINALLY CSS SUPPORT!
CSS makes customizing really easy.
Did you merge that into master? When?
I’ve tried gtk+-3.3.4, after some coercing it compiled, but the apps look horrible (like, half of the things are not drawn).
There were some theme fixes after 3.3.4, but it should not be that bad before those.
Got a screenshot?
What Windows version did you use? (I’ve just tested win7 with the theming stuff so far).
alexl, something like this: http://lrn.no-ip.info/other/gtk-3.3.4-w32.png
Hope to see a Windows Installer on the web-site soon. It’s about time! Looking forward to making classy GTK 3 Apps, hope it works fine with Vala though, or else I’ll have to write all the C Boiler-plate code again.
intermediate_hacker, AFAIU, you need working gobject-introspection to be able to use Vala, and last time i checked, gobject-introspection didn’t work well on W32.
alexl, also http://lrn.no-ip.info/other/gtk-3.3.4-w32_themed.png and http://lrn.no-ip.info/other/gtk-3.3.4-w32_non-themed.png
Partially fixed the problem. After taking a look at http://optionexplicit.be/projects/gnome-windows/GTK+3/ , i’ve discovered that you’re using a patched version of cairo. After i’ve applied the same patches to my build, lots of problems have disappeared.
Non-themed (or should i say “classic”?) look is still b0rked though, but i guess you’ve just never paid any attention to it.
Yeah. You need the cairo fix. I’ve been trying to get them into a release, but no luck so far. As for classic theme, yeah that is just not done yet. I think we need an alternative css file for it.
Just a question: is hard to create a backend for GTK? I need to use GTK with DirectFB, but the original backend was drop in 3.0 because it was broken since GTK 2.18. Where can I find info about how to create it?
Sergio: There isn’t a lot of information about writing such backends, because its something that happens very rarely. You need to read the code for the existing backends basically.
Thanks for your hard works.
Here a bug I found:
The content in Tabpage will disappear when switching between Tabpages.
To test it:
Run gtk-demo.exe, click [Source] tabpage, and then [Info], now the content in [Info] disappeared.
Cool!! Is it available for download or you´re build it directly from git?
[WORDPRESS HASHCASH] The poster sent us ‘0 which is not a hashcash value.
Any chance to get GTK+ 2.24.9 build soon, not that this version has been released?
I found a bug, when you keep resizing the window over and over again the ram consumption keeps growing, and the application crashes once you reach 70MB or so.
If you use the microsoft theme, the ram consumption grows much faster and the more widgets in the window the more faster it grows. Maybe it is a bug in the theme engine or gtk+ itself. Also it may be just related to ram consumption, it would be weird though.
And I know most people wont keep resizing the window, but I found the same behavior in other escenaries.
I must add, it seems to only happen if you have multiple tabs (notebooks) with many widgets on it (or a treeview). And with the MS-Window theme.
Many thanks for all your work on this!
Funny thing, it only happens when you set the tabs position at the bottom (notebook.set_tab_pos(gtk.POS_BOTTOM)) .
Really looking forward to using GTK+3 on Windows. Thanks for your amazing work !
Hi! I just have a question… Where can I find information about the patch for cairo?? Like LNR, I have the same problem… but I don’t know how to fix it! Thanks!
cairo patches are in:
It works! Thank You!
great work , kudos