=> cd1a7cbe630e4c7a7ffbfd50c5245db5612feb6f
[1mdiff --git a/CMakeLists.txt b/CMakeLists.txt[m [1mindex ebc3e263..672fefd4 100644[m [1m--- a/CMakeLists.txt[m [1m+++ b/CMakeLists.txt[m [36m@@ -66,6 +66,7 @@[m [moption (ENABLE_TUI "Enable the Curses TUI instead of GUI" OFF)[m option (ENABLE_WEBP "Use libwebp to decode .webp images (via pkg-config)" ON)[m option (ENABLE_WINDOWPOS_FIX "Set position after showing window (workaround for SDL bug)" OFF)[m option (ENABLE_WINSPARKLE "Use WinSparkle for automatic updates (Windows)" OFF)[m [32m+[m[32moption (ENABLE_X11_XLIB "Use Xlib directly, if available (X11)" ON)[m option (ENABLE_X11_SWRENDER "Use software rendering (X11)" OFF)[m set (CACERT_PEM_PATH "" CACHE FILEPATH "Root CA cacert.pem file to include as a built-in resource")[m [m [36m@@ -303,6 +304,12 @@[m [mif (ENABLE_IPC)[m src/ipc.h[m )[m endif ()[m [32m+[m[32mif (ENABLE_X11_XLIB AND XLIB_FOUND)[m [32m+[m[32m list (APPEND SOURCES[m [32m+[m[32m src/x11.c[m [32m+[m[32m src/x11.h[m [32m+[m[32m )[m [32m+[m[32mendif ()[m if (ANDROID)[m set (MOBILE 1)[m add_definitions (-DiPlatformAndroidMobile=1)[m [36m@@ -432,6 +439,9 @@[m [mendif ()[m if (ENABLE_WINDOWPOS_FIX)[m target_compile_definitions (app PUBLIC LAGRANGE_ENABLE_WINDOWPOS_FIX=1)[m endif ()[m [32m+[m[32mif (TARGET x11-lib)[m [32m+[m[32m target_link_libraries (app PUBLIC x11-lib)[m [32m+[m[32mendif ()[m if (ENABLE_X11_SWRENDER)[m target_compile_definitions (app PUBLIC LAGRANGE_ENABLE_X11_SWRENDER=1)[m endif ()[m [1mdiff --git a/Depends.cmake b/Depends.cmake[m [1mindex 0ffaef90..debd0410 100644[m [1m--- a/Depends.cmake[m [1m+++ b/Depends.cmake[m [36m@@ -1,4 +1,4 @@[m [31m-find_package (PkgConfig)[m [32m+[m[32mfind_package (PkgConfig REQUIRED)[m [m if (IOS)[m include (Depends-iOS.cmake)[m [36m@@ -10,7 +10,6 @@[m [mif (ANDROID)[m return ()[m endif ()[m [m [31m-find_package (PkgConfig)[m find_program (MESON_EXECUTABLE meson DOC "Meson build system")[m find_program (NINJA_EXECUTABLE ninja DOC "Ninja build tool")[m include (ExternalProject)[m [36m@@ -192,7 +191,18 @@[m [mif (ENABLE_WINSPARKLE)[m message (STATUS "Using WinSparkle: ${WINSPARKLE_DLL}")[m endif ()[m [m [31m-find_package (PkgConfig REQUIRED)[m [32m+[m[32mif (ENABLE_X11_XLIB AND NOT ENABLE_TUI)[m [32m+[m[32m find_package (X11)[m [32m+[m[32m if (X11_FOUND)[m [32m+[m[32m set (XLIB_FOUND YES)[m [32m+[m[32m add_library (x11-lib INTERFACE)[m [32m+[m[32m target_link_libraries (x11-lib INTERFACE ${X11_LIBRARIES})[m [32m+[m[32m target_include_directories (x11-lib INTERFACE ${X11_INCLUDE_DIRS})[m [32m+[m[32m target_compile_definitions (x11-lib INTERFACE LAGRANGE_ENABLE_X11_XLIB=1)[m [32m+[m[32m message (STATUS "Using Xlib: ${X11_LIBRARIES}")[m [32m+[m[32m endif ()[m [32m+[m[32mendif ()[m [32m+[m if (ENABLE_TUI)[m pkg_check_modules (SDL2 REQUIRED sealcurses)[m else ()[m [1mdiff --git a/res/about/version.gmi b/res/about/version.gmi[m [1mindex 207d90f2..62f3aa5f 100644[m [1m--- a/res/about/version.gmi[m [1m+++ b/res/about/version.gmi[m [36m@@ -11,6 +11,7 @@[m [mNew features:[m * Indicate that tab autoreloading is enabled by changing the appearance of the navbar reload button.[m [m Changes and enhancements:[m [32m+[m[32m* GTK: Request dark window theme if the app UI color theme is dark.[m [m Fixes:[m [m [1mdiff --git a/src/app.c b/src/app.c[m [1mindex fded9721..9697a7c5 100644[m [1m--- a/src/app.c[m [1m+++ b/src/app.c[m [36m@@ -84,6 +84,9 @@[m [mSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */[m #if defined (iPlatformMsys)[m # include "win32.h"[m #endif[m [32m+[m[32m#if defined (LAGRANGE_ENABLE_X11_XLIB)[m [32m+[m[32m# include "x11.h"[m [32m+[m[32m#endif[m #if SDL_VERSION_ATLEAST(2, 0, 14)[m # include[m #endif[m [36m@@ -2016,6 +2019,9 @@[m [mvoid processEvents_App(enum iAppEventMode eventMode) {[m #endif[m #if defined (iPlatformMsys)[m handleCommand_Win32(command_UserEvent(&ev));[m [32m+[m[32m#endif[m [32m+[m[32m#if defined (LAGRANGE_ENABLE_X11_XLIB)[m [32m+[m[32m handleCommand_X11(command_UserEvent(&ev));[m #endif[m if (isMetricsChange_UserEvent(&ev)) {[m listWindows_App_(d, &windows);[m [1mdiff --git a/src/x11.c b/src/x11.c[m [1mnew file mode 100644[m [1mindex 00000000..e7e0d738[m [1m--- /dev/null[m [1m+++ b/src/x11.c[m [36m@@ -0,0 +1,55 @@[m [32m+[m[32m/* Copyright 2023 Jaakko Keränen [m [32m+[m [32m+[m[32mRedistribution and use in source and binary forms, with or without[m [32m+[m[32mmodification, are permitted provided that the following conditions are met:[m [32m+[m [32m+[m[32m1. Redistributions of source code must retain the above copyright notice, this[m [32m+[m[32m list of conditions and the following disclaimer.[m [32m+[m[32m2. Redistributions in binary form must reproduce the above copyright notice,[m [32m+[m[32m this list of conditions and the following disclaimer in the documentation[m [32m+[m[32m and/or other materials provided with the distribution.[m [32m+[m [32m+[m[32mTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND[m [32m+[m[32mANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED[m [32m+[m[32mWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE[m [32m+[m[32mDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR[m [32m+[m[32mANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES[m [32m+[m[32m(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;[m [32m+[m[32mLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON[m [32m+[m[32mANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT[m [32m+[m[32m(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS[m [32m+[m[32mSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */[m [32m+[m [32m+[m[32m#include "x11.h"[m [32m+[m[32m#include "ui/command.h"[m [32m+[m[32m#include "ui/window.h"[m [32m+[m[32m#include "prefs.h"[m [32m+[m[32m#include "app.h"[m [32m+[m [32m+[m[32m#include [m [32m+[m[32m#include [m [32m+[m[32m#include [m [32m+[m [32m+[m[32mvoid setDarkWindowTheme_SDLWindow(SDL_Window *d, iBool setDark) {[m [32m+[m[32m SDL_SysWMinfo wmInfo;[m [32m+[m[32m SDL_VERSION(&wmInfo.version);[m [32m+[m[32m if (SDL_GetWindowWMInfo(d, &wmInfo)) {[m [32m+[m[32m Display * dpy = wmInfo.info.x11.display;[m [32m+[m[32m Window wnd = wmInfo.info.x11.window;[m [32m+[m[32m Atom prop = XInternAtom(dpy, "_GTK_THEME_VARIANT", False);[m[41m [m [32m+[m[32m const char *value = setDark ? "dark" : "light";[m [32m+[m[32m XChangeProperty(dpy, wnd, prop, XA_STRING, 8, PropModeReplace,[m [32m+[m[32m (unsigned char *) value, strlen(value));[m [32m+[m[32m }[m [32m+[m[32m}[m [32m+[m [32m+[m[32mvoid handleCommand_X11(const char *cmd) {[m [32m+[m[32m if (equal_Command(cmd, "theme.changed")) {[m[41m [m [32m+[m[32m iConstForEach(PtrArray, iter, mainWindows_App()) {[m [32m+[m[32m iMainWindow *mw = iter.ptr;[m [32m+[m[32m setDarkWindowTheme_SDLWindow([m [32m+[m[32m mw->base.win, isDark_ColorTheme(prefs_App()->theme));[m [32m+[m[32m }[m [32m+[m[32m }[m [32m+[m[32m}[m [32m+[m [1mdiff --git a/src/x11.h b/src/x11.h[m [1mnew file mode 100644[m [1mindex 00000000..2eb195ad[m [1m--- /dev/null[m [1m+++ b/src/x11.h[m [36m@@ -0,0 +1,30 @@[m [32m+[m[32m/* Copyright 2023 Jaakko Keränen [m [32m+[m [32m+[m[32mRedistribution and use in source and binary forms, with or without[m [32m+[m[32mmodification, are permitted provided that the following conditions are met:[m [32m+[m [32m+[m[32m1. Redistributions of source code must retain the above copyright notice, this[m [32m+[m[32m list of conditions and the following disclaimer.[m [32m+[m[32m2. Redistributions in binary form must reproduce the above copyright notice,[m [32m+[m[32m this list of conditions and the following disclaimer in the documentation[m [32m+[m[32m and/or other materials provided with the distribution.[m [32m+[m [32m+[m[32mTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND[m [32m+[m[32mANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED[m [32m+[m[32mWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE[m [32m+[m[32mDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR[m [32m+[m[32mANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES[m [32m+[m[32m(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;[m [32m+[m[32mLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON[m [32m+[m[32mANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT[m [32m+[m[32m(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS[m [32m+[m[32mSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */[m [32m+[m [32m+[m[32m#pragma once[m [32m+[m [32m+[m[32m#include [m [32m+[m[32m#include [m [32m+[m [32m+[m[32mvoid setDarkWindowTheme_SDLWindow (SDL_Window *, iBool setDark);[m [32m+[m[32mvoid handleCommand_X11 (const char *cmd);[m [32m+[m
text/gemini; charset=utf-8
This content has been proxied by September (ba2dc).