mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-03-31 12:52:03 +00:00
x11: Dynamically update the scale factor
If the text-scaling-factor setting is available via D-Bus, add a listener and update the content scale values for the displays if the value is changed during runtime. Factors out the D-Bus message pump from the system theme detection code to the general D-Bus code, as it's now used for more purposes than just the system theme.
This commit is contained in:
committed by
Sam Lantinga
parent
068d3da366
commit
d5f07730be
@@ -498,4 +498,16 @@ SDL_DBus_ScreensaverInhibit(SDL_bool inhibit)
|
||||
|
||||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
void SDL_DBus_PumpEvents(void)
|
||||
{
|
||||
if (dbus.session_conn) {
|
||||
dbus.connection_read_write(dbus.session_conn, 0);
|
||||
|
||||
while (dbus.connection_dispatch(dbus.session_conn) == DBUS_DISPATCH_DATA_REMAINS) {
|
||||
/* Do nothing, actual work happens in DBus_MessageFilter */
|
||||
SDL_DelayNS(SDL_US_TO_NS(10));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -94,6 +94,8 @@ extern SDL_bool SDL_DBus_QueryPropertyOnConnection(DBusConnection *conn, const c
|
||||
extern void SDL_DBus_ScreensaverTickle(void);
|
||||
extern SDL_bool SDL_DBus_ScreensaverInhibit(SDL_bool inhibit);
|
||||
|
||||
extern void SDL_DBus_PumpEvents(void);
|
||||
|
||||
#endif /* HAVE_DBUS_DBUS_H */
|
||||
|
||||
#endif /* SDL_dbus_h_ */
|
||||
|
||||
@@ -158,18 +158,3 @@ SDL_SystemTheme_Get(void)
|
||||
{
|
||||
return system_theme_data.theme;
|
||||
}
|
||||
|
||||
void
|
||||
SDL_SystemTheme_PumpEvents(void)
|
||||
{
|
||||
SDL_DBusContext *dbus = system_theme_data.dbus;
|
||||
DBusConnection *conn;
|
||||
if (dbus == NULL) return;
|
||||
conn = dbus->session_conn;
|
||||
dbus->connection_read_write(conn, 0);
|
||||
|
||||
while (dbus->connection_dispatch(conn) == DBUS_DISPATCH_DATA_REMAINS) {
|
||||
/* Do nothing, actual work happens in DBus_MessageFilter */
|
||||
usleep(10);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,5 @@
|
||||
|
||||
extern SDL_bool SDL_SystemTheme_Init(void);
|
||||
extern SDL_SystemTheme SDL_SystemTheme_Get(void);
|
||||
extern void SDL_SystemTheme_PumpEvents(void);
|
||||
|
||||
#endif /* SDL_system_theme_h_ */
|
||||
|
||||
Reference in New Issue
Block a user