bsnes-emu / bsnes

bsnes is a Super Nintendo (SNES) emulator focused on performance, features, and ease of use.
Other
1.69k stars 158 forks source link

hiro: add CSS for GTK+3 #168

Closed Screwtapello closed 3 years ago

Screwtapello commented 3 years ago

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:

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:

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.