[1mdiff --git a/CMakeLists.txt b/CMakeLists.txt[m
[1mindex e0d12d4d..1db57832 100644[m
[1m--- a/CMakeLists.txt[m
[1m+++ b/CMakeLists.txt[m
[36m@@ -26,6 +26,7 @@[m [mset (IOS_BUNDLE_VERSION 7)[m
set (COPYRIGHT_YEAR 2021)[m
[m
[32m+[m[32moption (ENABLE_IPC "Use IPC to communicate between running instances" ON)[m
option (ENABLE_MPG123 "Use mpg123 for decoding MPEG audio" ON)[m
option (ENABLE_X11_SWRENDER "Use software rendering under X11" OFF)[m
option (ENABLE_KERNING "Enable kerning in font renderer (slower)" ON)[m
[36m@@ -115,8 +116,6 @@[m [mset (SOURCES[m
src/gopher.h[m
src/history.c[m
src/history.h[m
[31m- src/ipc.c[m
[31m- src/ipc.h[m
src/lang.c[m
src/lang.h[m
src/lookup.c[m
[36m@@ -198,6 +197,12 @@[m [mset (SOURCES[m
${CMAKE_CURRENT_BINARY_DIR}/embedded.c[m
${CMAKE_CURRENT_BINARY_DIR}/embedded.h[m
)[m
[32m+[m[32mif (ENABLE_IPC)[m
[32m+[m[32m list (APPEND SOURCES[m
[32m+[m[32m src/ipc.c[m
[32m+[m[32m src/ipc.h[m
[32m+[m[32m )[m
[32m+[m[32mendif ()[m
if (ANDROID)[m
set (MOBILE 1)[m
add_definitions (-DiPlatformAndroidMobile=1)[m
[36m@@ -254,6 +259,9 @@[m [mtarget_compile_options (app PUBLIC[m
-DSTB_VORBIS_NO_INTEGER_CONVERSION=1[m
)[m
target_compile_definitions (app PUBLIC LAGRANGE_APP_VERSION="${PROJECT_VERSION}")[m
[32m+[m[32mif (ENABLE_IPC)[m
[32m+[m[32m target_compile_definitions (app PUBLIC LAGRANGE_ENABLE_IPC=1)[m
[32m+[m[32mendif ()[m
if (ENABLE_X11_SWRENDER)[m
target_compile_definitions (app PUBLIC LAGRANGE_ENABLE_X11_SWRENDER=1)[m
endif ()[m
[36m@@ -268,13 +276,13 @@[m [mif (ENABLE_MPG123 AND MPG123_FOUND)[m
target_link_libraries (app PUBLIC PkgConfig::MPG123)[m
endif ()[m
if (ENABLE_IDLE_SLEEP)[m
[31m- target_compile_definitions (app PUBLIC LAGRANGE_IDLE_SLEEP=1)[m
[32m+[m[32m target_compile_definitions (app PUBLIC LAGRANGE_ENABLE_IDLE_SLEEP=1)[m
endif ()[m
if (ENABLE_DOWNLOAD_EDIT)[m
[31m- target_compile_definitions (app PUBLIC LAGRANGE_DOWNLOAD_EDIT=1)[m
[32m+[m[32m target_compile_definitions (app PUBLIC LAGRANGE_ENABLE_DOWNLOAD_EDIT=1)[m
endif ()[m
if (ENABLE_CUSTOM_FRAME AND MSYS)[m
[31m- target_compile_definitions (app PUBLIC LAGRANGE_CUSTOM_FRAME=1)[m
[32m+[m[32m target_compile_definitions (app PUBLIC LAGRANGE_ENABLE_CUSTOM_FRAME=1)[m
endif ()[m
target_link_libraries (app PUBLIC the_Foundation::the_Foundation)[m
target_link_libraries (app PUBLIC ${SDL2_LDFLAGS})[m
[1mdiff --git a/src/app.c b/src/app.c[m
[1mindex 5f8bdade..3792d35c 100644[m
[1m--- a/src/app.c[m
[1m+++ b/src/app.c[m
[36m@@ -117,7 +117,7 @@[m [mstruct Impl_App {[m
uint32_t lastTickerTime;[m
uint32_t elapsedSinceLastTicker;[m
iBool isRunning;[m
[31m-#if defined (LAGRANGE_IDLE_SLEEP)[m
[32m+[m[32m#if defined (LAGRANGE_ENABLE_IDLE_SLEEP)[m
iBool isIdling;[m
uint32_t lastEventTime;[m
int sleepTimer;[m
[36m@@ -169,7 +169,7 @@[m [mstatic iString *serializePrefs_App_(const iApp *d) {[m
iString *str = new_String();[m
const iSidebarWidget *sidebar = findWidget_App("sidebar");[m
const iSidebarWidget *sidebar2 = findWidget_App("sidebar2");[m
[31m-#if defined (LAGRANGE_CUSTOM_FRAME)[m
[32m+[m[32m#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)[m
appendFormat_String(str, "customframe arg:%d\n", d->prefs.customFrame);[m
#endif[m
appendFormat_String(str, "window.retain arg:%d\n", d->prefs.retainWindowSize);[m
[36m@@ -184,7 +184,7 @@[m [mstatic iString *serializePrefs_App_(const iApp *d) {[m
appendFormat_String(str, "sidebar2.width arg:%f gaps:1\n", width_SidebarWidget(sidebar2));[m
/* On macOS, maximization should be applied at creation time or the window will take[m
a moment to animate to its maximized size. */[m
[31m-#if defined (LAGRANGE_CUSTOM_FRAME)[m
[32m+[m[32m#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)[m
if (snap_Window(d->window)) {[m
if (~SDL_GetWindowFlags(d->window->win) & SDL_WINDOW_MINIMIZED) {[m
/* Save the actual visible window position, too, because snapped windows may[m
[36m@@ -337,7 +337,7 @@[m [mstatic void loadPrefs_App_(iApp *d) {[m
d->initialWindowRect = init_Rect([m
pos.x, pos.y, argLabel_Command(cmd, "width"), argLabel_Command(cmd, "height"));[m
}[m
[31m-#if !defined (LAGRANGE_DOWNLOAD_EDIT)[m
[32m+[m[32m#if !defined (LAGRANGE_ENABLE_DOWNLOAD_EDIT)[m
else if (equal_Command(cmd, "downloads")) {[m
continue; /* can't change downloads directory */[m
}[m
[36m@@ -353,7 +353,7 @@[m [mstatic void loadPrefs_App_(iApp *d) {[m
/* Default CA setup. */[m
setCACertificates_TlsRequest(&d->prefs.caFile, &d->prefs.caPath);[m
}[m
[31m-#if !defined (LAGRANGE_CUSTOM_FRAME)[m
[32m+[m[32m#if !defined (LAGRANGE_ENABLE_CUSTOM_FRAME)[m
d->prefs.customFrame = iFalse;[m
#endif[m
iRelease(f);[m
[36m@@ -447,7 +447,7 @@[m [mstatic void saveState_App_(const iApp *d) {[m
iRelease(f);[m
}[m
[m
[31m-#if defined (LAGRANGE_IDLE_SLEEP)[m
[32m+[m[32m#if defined (LAGRANGE_ENABLE_IDLE_SLEEP)[m
static uint32_t checkAsleep_App_(uint32_t interval, void *param) {[m
iApp *d = param;[m
iUnused(d);[m
[36m@@ -470,6 +470,7 @@[m [mstatic void terminate_App_(int rc) {[m
exit(rc);[m
}[m
[m
[32m+[m[32m#if defined (LAGRANGE_ENABLE_IPC)[m
static void communicateWithRunningInstance_App_(iApp *d, iProcessId instance,[m
const iStringList *openCmds) {[m
iString *cmds = new_String();[m
[36m@@ -520,6 +521,7 @@[m [mstatic void communicateWithRunningInstance_App_(iApp *d, iProcessId instance,[m
// }[m
terminate_App_(0);[m
}[m
[32m+[m[32m#endif /* defined (LAGRANGE_ENABLE_IPC) */[m
[m
static void init_App_(iApp *d, int argc, char **argv) {[m
init_CommandLine(&d->args, argc, argv);[m
[36m@@ -600,6 +602,7 @@[m [mstatic void init_App_(iApp *d, int argc, char **argv) {[m
}[m
}[m
}[m
[32m+[m[32m#if defined (LAGRANGE_ENABLE_IPC)[m
/* Only one instance is allowed to run at a time; the runtime files (bookmarks, etc.)[m
are not shareable. */ {[m
init_Ipc(dataDir_App_());[m
[36m@@ -614,6 +617,7 @@[m [mstatic void init_App_(iApp *d, int argc, char **argv) {[m
}[m
listen_Ipc(); /* We'll respond to commands from other instances. */[m
}[m
[32m+[m[32m#endif[m
printf("Lagrange: A Beautiful Gemini Client\n");[m
const iBool isFirstRun =[m
!fileExistsCStr_FileInfo(cleanedPath_CStr(concatPath_CStr(dataDir_App_(), "prefs.cfg")));[m
[36m@@ -686,7 +690,7 @@[m [mstatic void init_App_(iApp *d, int argc, char **argv) {[m
postCommand_App("window.unfreeze");[m
d->autoReloadTimer = SDL_AddTimer(60 * 1000, postAutoReloadCommand_App_, NULL);[m
postCommand_App("document.autoreload");[m
[31m-#if defined (LAGRANGE_IDLE_SLEEP)[m
[32m+[m[32m#if defined (LAGRANGE_ENABLE_IDLE_SLEEP)[m
d->isIdling = iFalse;[m
d->lastEventTime = 0;[m
d->sleepTimer = SDL_AddTimer(1000, checkAsleep_App_, d);[m
[36m@@ -707,7 +711,7 @@[m [mstatic void init_App_(iApp *d, int argc, char **argv) {[m
}[m
[m
static void deinit_App(iApp *d) {[m
[31m-#if defined (LAGRANGE_IDLE_SLEEP)[m
[32m+[m[32m#if defined (LAGRANGE_ENABLE_IDLE_SLEEP)[m
SDL_RemoveTimer(d->sleepTimer);[m
#endif[m
SDL_RemoveTimer(d->autoReloadTimer);[m
[36m@@ -729,7 +733,9 @@[m [mstatic void deinit_App(iApp *d) {[m
deinit_CommandLine(&d->args);[m
iRelease(d->launchCommands);[m
delete_String(d->execPath);[m
[32m+[m[32m#if defined (LAGRANGE_ENABLE_IPC)[m
deinit_Ipc();[m
[32m+[m[32m#endif[m
deinit_SortedArray(&d->tickers);[m
deinit_Periodic(&d->periodic);[m
deinit_Lang();[m
[36m@@ -875,7 +881,7 @@[m [miLocalDef iBool isWaitingAllowed_App_(iApp *d) {[m
if (d->warmupFrames > 0) {[m
return iFalse;[m
}[m
[31m-#if defined (LAGRANGE_IDLE_SLEEP)[m
[32m+[m[32m#if defined (LAGRANGE_ENABLE_IDLE_SLEEP)[m
if (d->isIdling) {[m
return iFalse;[m
}[m
[36m@@ -928,7 +934,7 @@[m [mvoid processEvents_App(enum iAppEventMode eventMode) {[m
case SDL_APP_DIDENTERFOREGROUND:[m
gotEvents = iTrue;[m
d->warmupFrames = 5;[m
[31m-#if defined (LAGRANGE_IDLE_SLEEP)[m
[32m+[m[32m#if defined (LAGRANGE_ENABLE_IDLE_SLEEP)[m
d->isIdling = iFalse;[m
d->lastEventTime = SDL_GetTicks();[m
#endif[m
[36m@@ -961,7 +967,7 @@[m [mvoid processEvents_App(enum iAppEventMode eventMode) {[m
break;[m
}[m
default: {[m
[31m-#if defined (LAGRANGE_IDLE_SLEEP)[m
[32m+[m[32m#if defined (LAGRANGE_ENABLE_IDLE_SLEEP)[m
if (ev.type == SDL_USEREVENT && ev.user.code == asleep_UserEventCode) {[m
if (SDL_GetTicks() - d->lastEventTime > idleThreshold_App_ &&[m
isEmpty_SortedArray(&d->tickers)) {[m
[36m@@ -1050,7 +1056,7 @@[m [mvoid processEvents_App(enum iAppEventMode eventMode) {[m
}[m
}[m
}[m
[31m-#if defined (LAGRANGE_IDLE_SLEEP)[m
[32m+[m[32m#if defined (LAGRANGE_ENABLE_IDLE_SLEEP)[m
if (d->isIdling && !gotEvents && isFinished_Anim(&d->window->rootOffset)) {[m
/* This is where we spend most of our time when idle. 60 Hz still quite a lot but we[m
can't wait too long after the user tries to interact again with the app. In any[m
[36m@@ -1123,7 +1129,7 @@[m [mstatic int run_App_(iApp *d) {[m
void refresh_App(void) {[m
iApp *d = &app_;[m
destroyPending_Widget();[m
[31m-#if defined (LAGRANGE_IDLE_SLEEP)[m
[32m+[m[32m#if defined (LAGRANGE_ENABLE_IDLE_SLEEP)[m
if (d->warmupFrames == 0 && d->isIdling) {[m
return;[m
}[m
[36m@@ -1200,7 +1206,7 @@[m [mint run_App(int argc, char **argv) {[m
[m
void postRefresh_App(void) {[m
iApp *d = &app_;[m
[31m-#if defined (LAGRANGE_IDLE_SLEEP)[m
[32m+[m[32m#if defined (LAGRANGE_ENABLE_IDLE_SLEEP)[m
d->isIdling = iFalse;[m
#endif[m
const iBool wasPending = exchange_Atomic(&d->pendingRefresh, iTrue);[m
[36m@@ -1341,7 +1347,7 @@[m [mstatic iBool handlePrefsCommands_(iWidget *d, const char *cmd) {[m
if (equal_Command(cmd, "prefs.dismiss") || equal_Command(cmd, "preferences")) {[m
setUiScale_Window(get_Window(),[m
toFloat_String(text_InputWidget(findChild_Widget(d, "prefs.uiscale"))));[m
[31m-#if defined (LAGRANGE_DOWNLOAD_EDIT)[m
[32m+[m[32m#if defined (LAGRANGE_ENABLE_DOWNLOAD_EDIT)[m
postCommandf_App("downloads path:%s",[m
cstr_String(text_InputWidget(findChild_Widget(d, "prefs.downloads"))));[m
#endif[m
[36m@@ -2140,6 +2146,7 @@[m [miBool handleCommand_App(const char *cmd) {[m
}[m
return iFalse;[m
}[m
[32m+[m[32m#if defined (LAGRANGE_ENABLE_IPC)[m
else if (equal_Command(cmd, "ipc.list.urls")) {[m
iProcessId pid = argLabel_Command(cmd, "pid");[m
if (pid) {[m
[36m@@ -2156,6 +2163,7 @@[m [miBool handleCommand_App(const char *cmd) {[m
signal_Ipc(arg_Command(cmd));[m
return iTrue;[m
}[m
[32m+[m[32m#endif /* defined (LAGRANGE_ENABLE_IPC) */[m
else {[m
return iFalse;[m
}[m
[1mdiff --git a/src/ipc.h b/src/ipc.h[m
[1mindex 8127bf86..69852876 100644[m
[1m--- a/src/ipc.h[m
[1m+++ b/src/ipc.h[m
[36m@@ -21,6 +21,7 @@[m [mANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT[m
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */[m
[m
#pragma once[m
[32m+[m[32m#if defined (LAGRANGE_ENABLE_IPC)[m
[m
#include <the_Foundation/string.h>[m
#include <the_Foundation/process.h>[m
[36m@@ -39,3 +40,5 @@[m [menum iIpcWrite {[m
};[m
[m
iBool write_Ipc (iProcessId pid, const iString *input, enum iIpcWrite type);[m
[32m+[m
[32m+[m[32m#endif /* defined (LAGRANGE_ENABLE_IPC) */[m
[1mdiff --git a/src/prefs.h b/src/prefs.h[m
[1mindex 6be7fd41..160bb974 100644[m
[1m--- a/src/prefs.h[m
[1m+++ b/src/prefs.h[m
[36m@@ -45,7 +45,7 @@[m [mstruct Impl_Prefs {[m
iBool useSystemTheme;[m
enum iColorTheme theme;[m
enum iColorAccent accent;[m
[31m- iBool customFrame; /* when LAGRANGE_CUSTOM_FRAME is defined */[m
[32m+[m[32m iBool customFrame; /* when LAGRANGE_ENABLE_CUSTOM_FRAME is defined */[m
iBool retainWindowSize;[m
float uiScale;[m
int zoomPercent;[m
[1mdiff --git a/src/ui/util.c b/src/ui/util.c[m
[1mindex f56baa36..ddaccd68 100644[m
[1m--- a/src/ui/util.c[m
[1m+++ b/src/ui/util.c[m
[36m@@ -1936,7 +1936,7 @@[m [miWidget *makePreferences_Widget(void) {[m
const int bigGap = lineHeight_Text(uiLabel_FontId) * 3 / 4;[m
/* General preferences. */ {[m
appendTwoColumnPage_(tabs, "${heading.prefs.general}", '1', &headings, &values);[m
[31m-#if defined (LAGRANGE_DOWNLOAD_EDIT)[m
[32m+[m[32m#if defined (LAGRANGE_ENABLE_DOWNLOAD_EDIT)[m
addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.downloads}")));[m
setId_Widget(addChild_Widget(values, iClob(new_InputWidget(0))), "prefs.downloads");[m
#endif[m
[36m@@ -2014,7 +2014,7 @@[m [miWidget *makePreferences_Widget(void) {[m
}[m
addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.accent}")));[m
addChildFlags_Widget(values, iClob(accent), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag);[m
[31m-#if defined (LAGRANGE_CUSTOM_FRAME)[m
[32m+[m[32m#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)[m
addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.customframe}")));[m
addChild_Widget(values, iClob(makeToggle_Widget("prefs.customframe")));[m
#endif[m
[1mdiff --git a/src/ui/window.c b/src/ui/window.c[m
[1mindex bda645f7..a3633580 100644[m
[1m--- a/src/ui/window.c[m
[1m+++ b/src/ui/window.c[m
[36m@@ -923,7 +923,7 @@[m [mstatic void setupUserInterface_Window(iWindow *d) {[m
setId_Widget(div, "navdiv");[m
addChild_Widget(d->root, iClob(div));[m
[m
[31m-#if defined (LAGRANGE_CUSTOM_FRAME)[m
[32m+[m[32m#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)[m
/* Window title bar. */[m
if (prefs_App()->customFrame) {[m
setPadding1_Widget(div, 1);[m
[36m@@ -1358,7 +1358,7 @@[m [mstatic void drawBlank_Window_(iWindow *d) {[m
SDL_RenderPresent(d->render);[m
}[m
[m
[31m-#if defined (LAGRANGE_CUSTOM_FRAME)[m
[32m+[m[32m#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)[m
static SDL_HitTestResult hitTest_Window_(SDL_Window *win, const SDL_Point *pos, void *data) {[m
iWindow *d = data;[m
iAssert(d->win == win);[m
[36m@@ -1411,7 +1411,7 @@[m [mSDL_HitTestResult hitTest_Window(const iWindow *d, iInt2 pos) {[m
[m
iBool create_Window_(iWindow *d, iRect rect, uint32_t flags) {[m
flags |= SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_HIDDEN;[m
[31m-#if defined (LAGRANGE_CUSTOM_FRAME)[m
[32m+[m[32m#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)[m
if (prefs_App()->customFrame) {[m
/* We are drawing a custom frame so hide the default one. */[m
flags |= SDL_WINDOW_BORDERLESS;[m
[36m@@ -1421,7 +1421,7 @@[m [miBool create_Window_(iWindow *d, iRect rect, uint32_t flags) {[m
width_Rect(rect), height_Rect(rect), flags, &d->win, &d->render)) {[m
return iFalse;[m
}[m
[31m-#if defined (LAGRANGE_CUSTOM_FRAME)[m
[32m+[m[32m#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)[m
if (prefs_App()->customFrame) {[m
/* Register a handler for window hit testing (drag, resize). */[m
SDL_SetWindowHitTest(d->win, hitTest_Window_, d);[m
[36m@@ -1540,7 +1540,7 @@[m [mvoid init_Window(iWindow *d, iRect rect) {[m
SDL_FreeSurface(surf);[m
}[m
d->appIcon = NULL;[m
[31m-#if defined (LAGRANGE_CUSTOM_FRAME)[m
[32m+[m[32m#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)[m
/* Load the app icon for drawing in the title bar. */[m
if (prefs_App()->customFrame) {[m
SDL_Surface *surf = loadImage_(&imageLagrange64_Embedded, appIconSize_());[m
[36m@@ -1603,7 +1603,7 @@[m [mstatic iBool isNormalPlacement_Window_(const iWindow *d) {[m
}[m
[m
static iBool unsnap_Window_(iWindow *d, const iInt2 *newPos) {[m
[31m-#if defined (LAGRANGE_CUSTOM_FRAME)[m
[32m+[m[32m#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)[m
if (!prefs_App()->customFrame) {[m
return iFalse;[m
}[m
[36m@@ -1693,7 +1693,7 @@[m [mstatic iBool handleWindowEvent_Window_(iWindow *d, const SDL_WindowEvent *ev) {[m
d->isMinimized = iTrue;[m
return iFalse;[m
}[m
[31m-#if defined (LAGRANGE_CUSTOM_FRAME)[m
[32m+[m[32m#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)[m
/* Set the snap position depending on where the mouse cursor is. */[m
if (prefs_App()->customFrame) {[m
SDL_Rect usable;[m
[36m@@ -1723,7 +1723,7 @@[m [mstatic iBool handleWindowEvent_Window_(iWindow *d, const SDL_WindowEvent *ev) {[m
return iTrue;[m
}[m
}[m
[31m-#endif /* defined LAGRANGE_CUSTOM_FRAME */[m
[32m+[m[32m#endif /* defined LAGRANGE_ENABLE_CUSTOM_FRAME */[m
//printf("MOVED: %d, %d\n", ev->data1, ev->data2); fflush(stdout);[m
if (unsnap_Window_(d, &newPos)) {[m
return iTrue;[m
[36m@@ -1813,7 +1813,7 @@[m [mstatic void applyCursor_Window_(iWindow *d) {[m
[m
iBool processEvent_Window(iWindow *d, const SDL_Event *ev) {[m
switch (ev->type) {[m
[31m-#if defined (LAGRANGE_CUSTOM_FRAME)[m
[32m+[m[32m#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)[m
case SDL_SYSWMEVENT: {[m
/* We observe native Win32 messages for better user interaction with the[m
window frame. Mouse clicks especially will not generate normal SDL[m
[36m@@ -1966,25 +1966,27 @@[m [mvoid draw_Window(iWindow *d) {[m
}[m
/* Draw widgets. */[m
d->frameTime = SDL_GetTicks();[m
[31m- draw_Widget(d->root);[m
[31m-#if defined (LAGRANGE_CUSTOM_FRAME)[m
[31m- /* App icon. */[m
[31m- const iWidget *appIcon = findChild_Widget(d->root, "winbar.icon");[m
[31m- if (isVisible_Widget(appIcon)) {[m
[31m- const int size = appIconSize_();[m
[31m- const iRect rect = bounds_Widget(appIcon);[m
[31m- const iInt2 mid = mid_Rect(rect);[m
[31m- const iBool isLight = isLight_ColorTheme(colorTheme_App());[m
[31m- iColor iconColor = get_Color(gotFocus || isLight ? white_ColorId : uiAnnotation_ColorId);[m
[31m- SDL_SetTextureColorMod(d->appIcon, iconColor.r, iconColor.g, iconColor.b);[m
[31m- SDL_SetTextureAlphaMod(d->appIcon, gotFocus || !isLight ? 255 : 92);[m
[31m- SDL_RenderCopy([m
[31m- d->render,[m
[31m- d->appIcon,[m
[31m- NULL,[m
[31m- &(SDL_Rect){ left_Rect(rect) + gap_UI * 1.25f, mid.y - size / 2, size, size });[m
[31m- }[m
[32m+[m[32m if (isExposed_Window(d)) {[m
[32m+[m[32m draw_Widget(d->root);[m
[32m+[m[32m#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)[m
[32m+[m[32m /* App icon. */[m
[32m+[m[32m const iWidget *appIcon = findChild_Widget(d->root, "winbar.icon");[m
[32m+[m[32m if (isVisible_Widget(appIcon)) {[m
[32m+[m[32m const int size = appIconSize_();[m
[32m+[m[32m const iRect rect = bounds_Widget(appIcon);[m
[32m+[m[32m const iInt2 mid = mid_Rect(rect);[m
[32m+[m[32m const iBool isLight = isLight_ColorTheme(colorTheme_App());[m
[32m+[m[32m iColor iconColor = get_Color(gotFocus || isLight ? white_ColorId : uiAnnotation_ColorId);[m
[32m+[m[32m SDL_SetTextureColorMod(d->appIcon, iconColor.r, iconColor.g, iconColor.b);[m
[32m+[m[32m SDL_SetTextureAlphaMod(d->appIcon, gotFocus || !isLight ? 255 : 92);[m
[32m+[m[32m SDL_RenderCopy([m
[32m+[m[32m d->render,[m
[32m+[m[32m d->appIcon,[m
[32m+[m[32m NULL,[m
[32m+[m[32m &(SDL_Rect){ left_Rect(rect) + gap_UI * 1.25f, mid.y - size / 2, size, size });[m
[32m+[m[32m }[m
#endif[m
[32m+[m[32m }[m
#if 0[m
/* Text cache debugging. */ {[m
SDL_Texture *cache = glyphCache_Text();[m
[36m@@ -2112,7 +2114,7 @@[m [mvoid setSnap_Window(iWindow *d, int snapMode) {[m
}[m
return;[m
}[m
[31m-#if defined (LAGRANGE_CUSTOM_FRAME)[m
[32m+[m[32m#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)[m
if (d->place.snap == snapMode) {[m
return;[m
}[m
[36m@@ -2178,7 +2180,7 @@[m [mvoid setSnap_Window(iWindow *d, int snapMode) {[m
arrange_Widget(d->root);[m
postRefresh_App();[m
}[m
[31m-#endif /* defined (LAGRANGE_CUSTOM_FRAME) */[m
[32m+[m[32m#endif /* defined (LAGRANGE_ENABLE_CUSTOM_FRAME) */[m
}[m
[m
int snap_Window(const iWindow *d) {[m
[1mdiff --git a/src/ui/window.h b/src/ui/window.h[m
[1mindex e3d8b22b..052f8828 100644[m
[1m--- a/src/ui/window.h[m
[1m+++ b/src/ui/window.h[m
[36m@@ -52,7 +52,7 @@[m [mstruct Impl_WindowPlacement {[m
iInt2 initialPos;[m
iRect normalRect; /* updated when window is moved/resized */[m
iInt2 lastNotifiedSize; /* keep track of horizontal/vertical notifications */[m
[31m- int snap; /* LAGRANGE_CUSTOM_FRAME */[m
[32m+[m[32m int snap; /* LAGRANGE_ENABLE_CUSTOM_FRAME */[m
int lastHit;[m
};[m
[m
[36m@@ -111,7 +111,7 @@[m [miBool isNarrow_Window (const iWindow *);[m
[m
iWindow * get_Window (void);[m
[m
[31m-#if defined (LAGRANGE_CUSTOM_FRAME)[m
[32m+[m[32m#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)[m
SDL_HitTestResult hitTest_Window(const iWindow *d, iInt2 pos);[m
#endif[m
[m
[1mdiff --git a/src/win32.c b/src/win32.c[m
[1mindex 01ec73bf..d040d8a9 100644[m
[1m--- a/src/win32.c[m
[1m+++ b/src/win32.c[m
[36m@@ -64,7 +64,7 @@[m [mvoid useExecutableIconResource_SDLWindow(SDL_Window *win) {[m
}[m
}[m
[m
[31m-#if defined (LAGRANGE_CUSTOM_FRAME)[m
[32m+[m[32m#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)[m[41m [m
iInt2 cursor_Win32(void) {[m
POINT p;[m
GetPhysicalCursorPos(&p);[m
[36m@@ -191,4 +191,4 @@[m [mvoid processNativeEvent_Win32(const struct SDL_SysWMmsg *msg, iWindow *window) {[m
#endif[m
}[m
}[m
[31m-#endif /* defined (LAGRANGE_CUSTOM_FRAME) */[m
[32m+[m[32m#endif /* defined (LAGRANGE_ENABLE_CUSTOM_FRAME) */[m[41m [m
[1mdiff --git a/src/win32.h b/src/win32.h[m
[1mindex 27aa0539..d53a2fe8 100644[m
[1m--- a/src/win32.h[m
[1m+++ b/src/win32.h[m
[36m@@ -32,7 +32,7 @@[m [mvoid setDPIAware_Win32(void);[m
float desktopDPI_Win32(void);[m
void useExecutableIconResource_SDLWindow(SDL_Window *win);[m
[m
[31m-#if defined (LAGRANGE_CUSTOM_FRAME)[m
[32m+[m[32m#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)[m[41m [m
iInt2 cursor_Win32(void);[m
void processNativeEvent_Win32(const struct SDL_SysWMmsg *msg, iWindow *window);[m
void setup_SDLWindow(SDL_Window *);[m
text/plain
This content has been proxied by September (ba2dc).