x11: Refactor dpi hooks, removing GTK dependency and fixing XSettings watcher

- Removed GTK signal handler in x11settings. XSettings events are now properly dispatched to X11_XsettingsNotify.
  Previously events were not being passed to xsettings-client as no SDL xsettings_window was created. Now all events
  are filtered through xsettings_client_process_event allowing it to process the external window events that are selected.
  Global content scale is updated for changes to any recognized dpi settings.

- X11_GetGlobalContent now reads the current RESOURCE_MANAGER prop off of the root window to ensure it sees the
  current value. XResourceManagerString is now only used if getting the current prop fails as it caches the current resource
  manager value per-display connection.

- Clean up some warnings in SDL_gtk.
This commit is contained in:
Sam Lantinga
2025-08-06 09:22:15 -07:00
parent b139821903
commit 31ba7efa48
10 changed files with 87 additions and 115 deletions

View File

@@ -27,7 +27,8 @@
ctx.sub.fn = (void *)SDL_LoadFunction(lib, #sym)
#define SDL_GTK_SYM2(ctx, lib, sub, fn, sym) \
if (!(ctx.sub.fn = (void *)SDL_LoadFunction(lib, #sym))) { \
SDL_GTK_SYM2_OPTIONAL(ctx, lib, sub, fn, sym); \
if (!ctx.sub.fn) { \
return SDL_SetError("Could not load GTK functions"); \
}

View File

@@ -118,7 +118,7 @@ typedef struct SDL_GtkContext
extern bool SDL_Gtk_Init(void);
extern void SDL_Gtk_Quit(void);
extern SDL_GtkContext *SDL_Gtk_EnterContext(void);
extern void SDL_Gtk_ExitContext(SDL_GtkContext *gtk);
extern void SDL_Gtk_ExitContext(SDL_GtkContext *ctx);
extern void SDL_UpdateGtk(void);
#endif // SDL_gtk_h_