A typical GTK application will add widgets to boxes and let GTK figure out what size and shape they should be, based on the current theme and font selections, etc. However, hiro needs to be portable to Win32, which does not support that kind of automatic layout, so hiro-based apps hard-code all their fonts and sizes and layouts. This works reasonably well for the GTK+2 backend for a couple of reasons:
hiro forces GTK to use a font with similar size and metrics to the Windows standard font
GTK+2 widgets are typically fairly close in size to their Windows counterparts
hiro/gtk/application.cpp adds custom style overrides for hiro widgets
Unfortunately, things are not quite as polished for GTK+3. Not only are GTK+3 widgets (typically buttons) much larger than their Windows equivalent, hiro does not apply any custom styles because GTK+3 uses CSS for styling rather than the custom language used for GTK+2 and nobody's bothered to teach hiro how to load custom CSS for GTK+3 yet.
Apparently the replacement for GTK+2's gtk_rc_parse_string() is:
create a GtkCssProvider with gtk_css_provider_new()
give it a CSS string with gtk_css_provider_load_from_data()
apply that style to the entire app with gtk_style_context_add_provider_for_screen()
At a minimum, we'll want to apply the following CSS to shrink buttons down to the size hiro expects:
button { padding: 0; }
There's probably CSS equivalents for the other custom styles hiro used for GTK+2, but I'm not sure what they are. If you build a hiro app with GTK+3, and run it with:
GTK_DEBUG=interactive path/to/your/app
...then it will open an additional inspector window that's like the dev-tools in a browser - you can browse through all the widgets in the application, enter a "picker" mode that lets you click on the exact widget you want, inspect the CSS properties of any widget, and get its CSS selector so you know what to write in the stylesheet, etc.
A typical GTK application will add widgets to boxes and let GTK figure out what size and shape they should be, based on the current theme and font selections, etc. However, hiro needs to be portable to Win32, which does not support that kind of automatic layout, so hiro-based apps hard-code all their fonts and sizes and layouts. This works reasonably well for the GTK+2 backend for a couple of reasons:
hiro/gtk/application.cpp
adds custom style overrides for hiro widgetsUnfortunately, things are not quite as polished for GTK+3. Not only are GTK+3 widgets (typically buttons) much larger than their Windows equivalent, hiro does not apply any custom styles because GTK+3 uses CSS for styling rather than the custom language used for GTK+2 and nobody's bothered to teach hiro how to load custom CSS for GTK+3 yet.
Apparently the replacement for GTK+2's
gtk_rc_parse_string()
is:GtkCssProvider
withgtk_css_provider_new()
gtk_css_provider_load_from_data()
gtk_style_context_add_provider_for_screen()
At a minimum, we'll want to apply the following CSS to shrink buttons down to the size hiro expects:
There's probably CSS equivalents for the other custom styles hiro used for GTK+2, but I'm not sure what they are. If you build a hiro app with GTK+3, and run it with:
...then it will open an additional inspector window that's like the dev-tools in a browser - you can browse through all the widgets in the application, enter a "picker" mode that lets you click on the exact widget you want, inspect the CSS properties of any widget, and get its CSS selector so you know what to write in the stylesheet, etc.