I’m writing a virtual on-screen numpad keyboard app in GTK. It stays on top and is unfocused when user clicks buttons on it. However, Adwaita dims inactive windows’ buttons, so I would like to make them styled the same way as focused window is.
I’ve tried sending unset_state_flags on state-flags-changed to main window, but it doesn’t work properly (only top bar is themed as focused, and the rest of the app stays the same).
You’re not “completely disabling” backdrop; you’re just removing a state from a widget, but GTK is entirely free to reset that state any time that it wants, and there’s nothing that lets you prevent that programmatically.
The only way to avoid that is to literally side-load a theme in your application that has no rules for the backdrop CSS classes, but then you get to maintain your own theme.
Yes; though I would not recommend using GtkApplication and GtkApplicationWindow. To be fair, what you’re describing seems to be the job of an input method, more than an application.
Additionally, since you’re writing what amounts to a virtual keyboard, you’re going to have to fight against the system itself; I’d recommend making it part of the window manager/system compositor, as that would remove the need for dealing with client-related functionality, like dealing with the stacking order, or with the backdrop state.