Add portal interface to support SDL_GetSystemTheme in linux

This commit is contained in:
Guldoman
2023-03-09 22:26:33 +01:00
committed by Sam Lantinga
parent c304fbded6
commit ad95c93bf4
7 changed files with 237 additions and 0 deletions

View File

@@ -26,6 +26,7 @@
#include "../../core/unix/SDL_poll.h"
#include "../../events/SDL_events_c.h"
#include "../../events/SDL_scancode_tables_c.h"
#include "../../core/linux/SDL_system_theme.h"
#include "../SDL_sysvideo.h"
#include "SDL_waylandvideo.h"
@@ -386,6 +387,10 @@ int Wayland_WaitEventTimeout(_THIS, Sint64 timeoutNS)
}
#endif
#ifdef SDL_USE_LIBDBUS
SDL_SystemTheme_PumpEvents();
#endif
/* If key repeat is active, we'll need to cap our maximum wait time to handle repeats */
if (input && keyboard_repeat_is_set(&input->keyboard_repeat)) {
const Uint64 elapsed = SDL_GetTicksNS() - input->keyboard_repeat.sdl_press_time_ns;
@@ -455,6 +460,10 @@ void Wayland_PumpEvents(_THIS)
}
#endif
#ifdef SDL_USE_LIBDBUS
SDL_SystemTheme_PumpEvents();
#endif
#ifdef HAVE_LIBDECOR_H
if (d->shell.libdecor) {
libdecor_dispatch(d->shell.libdecor, 0);

View File

@@ -24,6 +24,7 @@
#if SDL_VIDEO_DRIVER_WAYLAND
#include "../../events/SDL_events_c.h"
#include "../../core/linux/SDL_system_theme.h"
#include "SDL_waylandvideo.h"
#include "SDL_waylandevents_c.h"
@@ -249,6 +250,11 @@ static SDL_VideoDevice *Wayland_CreateDevice(void)
device->FlashWindow = Wayland_FlashWindow;
device->HasScreenKeyboardSupport = Wayland_HasScreenKeyboardSupport;
#ifdef SDL_USE_LIBDBUS
if (SDL_SystemTheme_Init())
device->system_theme = SDL_SystemTheme_Get();
#endif
device->SetClipboardText = Wayland_SetClipboardText;
device->GetClipboardText = Wayland_GetClipboardText;
device->HasClipboardText = Wayland_HasClipboardText;

View File

@@ -36,6 +36,7 @@
#include "../../events/SDL_events_c.h"
#include "../../events/SDL_mouse_c.h"
#include "../../events/SDL_touch_c.h"
#include "../../core/linux/SDL_system_theme.h"
#include <SDL3/SDL_syswm.h>
@@ -1683,6 +1684,10 @@ int X11_WaitEventTimeout(_THIS, Sint64 timeoutNS)
SDL_IME_PumpEvents();
}
#endif
#ifdef SDL_USE_LIBDBUS
SDL_SystemTheme_PumpEvents();
#endif
return 1;
}
@@ -1725,6 +1730,10 @@ void X11_PumpEvents(_THIS)
}
#endif
#ifdef SDL_USE_LIBDBUS
SDL_SystemTheme_PumpEvents();
#endif
/* FIXME: Only need to do this when there are pending focus changes */
X11_HandleFocusChanges(_this);

View File

@@ -26,6 +26,7 @@
#include "../SDL_sysvideo.h"
#include "../SDL_pixels_c.h"
#include "../../core/linux/SDL_system_theme.h"
#include "SDL_x11video.h"
#include "SDL_x11framebuffer.h"
@@ -315,6 +316,11 @@ static SDL_VideoDevice *X11_CreateDevice(void)
device->Vulkan_CreateSurface = X11_Vulkan_CreateSurface;
#endif
#ifdef SDL_USE_LIBDBUS
if (SDL_SystemTheme_Init())
device->system_theme = SDL_SystemTheme_Get();
#endif
return device;
}