summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/app.c38
-rw-r--r--src/ipc.h3
-rw-r--r--src/prefs.h2
-rw-r--r--src/ui/util.c4
-rw-r--r--src/ui/window.c24
-rw-r--r--src/ui/window.h4
-rw-r--r--src/win32.c4
-rw-r--r--src/win32.h2
8 files changed, 46 insertions, 35 deletions
diff --git a/src/app.c b/src/app.c
index bc15183a..c6a80b2c 100644
--- a/src/app.c
+++ b/src/app.c
@@ -117,7 +117,7 @@ struct Impl_App {
117 uint32_t lastTickerTime; 117 uint32_t lastTickerTime;
118 uint32_t elapsedSinceLastTicker; 118 uint32_t elapsedSinceLastTicker;
119 iBool isRunning; 119 iBool isRunning;
120#if defined (LAGRANGE_IDLE_SLEEP) 120#if defined (LAGRANGE_ENABLE_IDLE_SLEEP)
121 iBool isIdling; 121 iBool isIdling;
122 uint32_t lastEventTime; 122 uint32_t lastEventTime;
123 int sleepTimer; 123 int sleepTimer;
@@ -169,7 +169,7 @@ static iString *serializePrefs_App_(const iApp *d) {
169 iString *str = new_String(); 169 iString *str = new_String();
170 const iSidebarWidget *sidebar = findWidget_App("sidebar"); 170 const iSidebarWidget *sidebar = findWidget_App("sidebar");
171 const iSidebarWidget *sidebar2 = findWidget_App("sidebar2"); 171 const iSidebarWidget *sidebar2 = findWidget_App("sidebar2");
172#if defined (LAGRANGE_CUSTOM_FRAME) 172#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)
173 appendFormat_String(str, "customframe arg:%d\n", d->prefs.customFrame); 173 appendFormat_String(str, "customframe arg:%d\n", d->prefs.customFrame);
174#endif 174#endif
175 appendFormat_String(str, "window.retain arg:%d\n", d->prefs.retainWindowSize); 175 appendFormat_String(str, "window.retain arg:%d\n", d->prefs.retainWindowSize);
@@ -184,7 +184,7 @@ static iString *serializePrefs_App_(const iApp *d) {
184 appendFormat_String(str, "sidebar2.width arg:%f gaps:1\n", width_SidebarWidget(sidebar2)); 184 appendFormat_String(str, "sidebar2.width arg:%f gaps:1\n", width_SidebarWidget(sidebar2));
185 /* On macOS, maximization should be applied at creation time or the window will take 185 /* On macOS, maximization should be applied at creation time or the window will take
186 a moment to animate to its maximized size. */ 186 a moment to animate to its maximized size. */
187#if defined (LAGRANGE_CUSTOM_FRAME) 187#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)
188 if (snap_Window(d->window)) { 188 if (snap_Window(d->window)) {
189 if (~SDL_GetWindowFlags(d->window->win) & SDL_WINDOW_MINIMIZED) { 189 if (~SDL_GetWindowFlags(d->window->win) & SDL_WINDOW_MINIMIZED) {
190 /* Save the actual visible window position, too, because snapped windows may 190 /* Save the actual visible window position, too, because snapped windows may
@@ -337,7 +337,7 @@ static void loadPrefs_App_(iApp *d) {
337 d->initialWindowRect = init_Rect( 337 d->initialWindowRect = init_Rect(
338 pos.x, pos.y, argLabel_Command(cmd, "width"), argLabel_Command(cmd, "height")); 338 pos.x, pos.y, argLabel_Command(cmd, "width"), argLabel_Command(cmd, "height"));
339 } 339 }
340#if !defined (LAGRANGE_DOWNLOAD_EDIT) 340#if !defined (LAGRANGE_ENABLE_DOWNLOAD_EDIT)
341 else if (equal_Command(cmd, "downloads")) { 341 else if (equal_Command(cmd, "downloads")) {
342 continue; /* can't change downloads directory */ 342 continue; /* can't change downloads directory */
343 } 343 }
@@ -353,7 +353,7 @@ static void loadPrefs_App_(iApp *d) {
353 /* Default CA setup. */ 353 /* Default CA setup. */
354 setCACertificates_TlsRequest(&d->prefs.caFile, &d->prefs.caPath); 354 setCACertificates_TlsRequest(&d->prefs.caFile, &d->prefs.caPath);
355 } 355 }
356#if !defined (LAGRANGE_CUSTOM_FRAME) 356#if !defined (LAGRANGE_ENABLE_CUSTOM_FRAME)
357 d->prefs.customFrame = iFalse; 357 d->prefs.customFrame = iFalse;
358#endif 358#endif
359 iRelease(f); 359 iRelease(f);
@@ -447,7 +447,7 @@ static void saveState_App_(const iApp *d) {
447 iRelease(f); 447 iRelease(f);
448} 448}
449 449
450#if defined (LAGRANGE_IDLE_SLEEP) 450#if defined (LAGRANGE_ENABLE_IDLE_SLEEP)
451static uint32_t checkAsleep_App_(uint32_t interval, void *param) { 451static uint32_t checkAsleep_App_(uint32_t interval, void *param) {
452 iApp *d = param; 452 iApp *d = param;
453 iUnused(d); 453 iUnused(d);
@@ -470,6 +470,7 @@ static void terminate_App_(int rc) {
470 exit(rc); 470 exit(rc);
471} 471}
472 472
473#if defined (LAGRANGE_ENABLE_IPC)
473static void communicateWithRunningInstance_App_(iApp *d, iProcessId instance, 474static void communicateWithRunningInstance_App_(iApp *d, iProcessId instance,
474 const iStringList *openCmds) { 475 const iStringList *openCmds) {
475 iString *cmds = new_String(); 476 iString *cmds = new_String();
@@ -520,6 +521,7 @@ static void communicateWithRunningInstance_App_(iApp *d, iProcessId instance,
520// } 521// }
521 terminate_App_(0); 522 terminate_App_(0);
522} 523}
524#endif /* defined (LAGRANGE_ENABLE_IPC) */
523 525
524static void init_App_(iApp *d, int argc, char **argv) { 526static void init_App_(iApp *d, int argc, char **argv) {
525 init_CommandLine(&d->args, argc, argv); 527 init_CommandLine(&d->args, argc, argv);
@@ -600,6 +602,7 @@ static void init_App_(iApp *d, int argc, char **argv) {
600 } 602 }
601 } 603 }
602 } 604 }
605#if defined (LAGRANGE_ENABLE_IPC)
603 /* Only one instance is allowed to run at a time; the runtime files (bookmarks, etc.) 606 /* Only one instance is allowed to run at a time; the runtime files (bookmarks, etc.)
604 are not shareable. */ { 607 are not shareable. */ {
605 init_Ipc(dataDir_App_()); 608 init_Ipc(dataDir_App_());
@@ -614,6 +617,7 @@ static void init_App_(iApp *d, int argc, char **argv) {
614 } 617 }
615 listen_Ipc(); /* We'll respond to commands from other instances. */ 618 listen_Ipc(); /* We'll respond to commands from other instances. */
616 } 619 }
620#endif
617 printf("Lagrange: A Beautiful Gemini Client\n"); 621 printf("Lagrange: A Beautiful Gemini Client\n");
618 const iBool isFirstRun = 622 const iBool isFirstRun =
619 !fileExistsCStr_FileInfo(cleanedPath_CStr(concatPath_CStr(dataDir_App_(), "prefs.cfg"))); 623 !fileExistsCStr_FileInfo(cleanedPath_CStr(concatPath_CStr(dataDir_App_(), "prefs.cfg")));
@@ -686,7 +690,7 @@ static void init_App_(iApp *d, int argc, char **argv) {
686 postCommand_App("window.unfreeze"); 690 postCommand_App("window.unfreeze");
687 d->autoReloadTimer = SDL_AddTimer(60 * 1000, postAutoReloadCommand_App_, NULL); 691 d->autoReloadTimer = SDL_AddTimer(60 * 1000, postAutoReloadCommand_App_, NULL);
688 postCommand_App("document.autoreload"); 692 postCommand_App("document.autoreload");
689#if defined (LAGRANGE_IDLE_SLEEP) 693#if defined (LAGRANGE_ENABLE_IDLE_SLEEP)
690 d->isIdling = iFalse; 694 d->isIdling = iFalse;
691 d->lastEventTime = 0; 695 d->lastEventTime = 0;
692 d->sleepTimer = SDL_AddTimer(1000, checkAsleep_App_, d); 696 d->sleepTimer = SDL_AddTimer(1000, checkAsleep_App_, d);
@@ -707,7 +711,7 @@ static void init_App_(iApp *d, int argc, char **argv) {
707} 711}
708 712
709static void deinit_App(iApp *d) { 713static void deinit_App(iApp *d) {
710#if defined (LAGRANGE_IDLE_SLEEP) 714#if defined (LAGRANGE_ENABLE_IDLE_SLEEP)
711 SDL_RemoveTimer(d->sleepTimer); 715 SDL_RemoveTimer(d->sleepTimer);
712#endif 716#endif
713 SDL_RemoveTimer(d->autoReloadTimer); 717 SDL_RemoveTimer(d->autoReloadTimer);
@@ -729,7 +733,9 @@ static void deinit_App(iApp *d) {
729 deinit_CommandLine(&d->args); 733 deinit_CommandLine(&d->args);
730 iRelease(d->launchCommands); 734 iRelease(d->launchCommands);
731 delete_String(d->execPath); 735 delete_String(d->execPath);
736#if defined (LAGRANGE_ENABLE_IPC)
732 deinit_Ipc(); 737 deinit_Ipc();
738#endif
733 deinit_SortedArray(&d->tickers); 739 deinit_SortedArray(&d->tickers);
734 deinit_Periodic(&d->periodic); 740 deinit_Periodic(&d->periodic);
735 deinit_Lang(); 741 deinit_Lang();
@@ -875,7 +881,7 @@ iLocalDef iBool isWaitingAllowed_App_(iApp *d) {
875 if (d->warmupFrames > 0) { 881 if (d->warmupFrames > 0) {
876 return iFalse; 882 return iFalse;
877 } 883 }
878#if defined (LAGRANGE_IDLE_SLEEP) 884#if defined (LAGRANGE_ENABLE_IDLE_SLEEP)
879 if (d->isIdling) { 885 if (d->isIdling) {
880 return iFalse; 886 return iFalse;
881 } 887 }
@@ -928,7 +934,7 @@ void processEvents_App(enum iAppEventMode eventMode) {
928 case SDL_APP_DIDENTERFOREGROUND: 934 case SDL_APP_DIDENTERFOREGROUND:
929 gotEvents = iTrue; 935 gotEvents = iTrue;
930 d->warmupFrames = 5; 936 d->warmupFrames = 5;
931#if defined (LAGRANGE_IDLE_SLEEP) 937#if defined (LAGRANGE_ENABLE_IDLE_SLEEP)
932 d->isIdling = iFalse; 938 d->isIdling = iFalse;
933 d->lastEventTime = SDL_GetTicks(); 939 d->lastEventTime = SDL_GetTicks();
934#endif 940#endif
@@ -962,7 +968,7 @@ void processEvents_App(enum iAppEventMode eventMode) {
962 break; 968 break;
963 } 969 }
964 default: { 970 default: {
965#if defined (LAGRANGE_IDLE_SLEEP) 971#if defined (LAGRANGE_ENABLE_IDLE_SLEEP)
966 if (ev.type == SDL_USEREVENT && ev.user.code == asleep_UserEventCode) { 972 if (ev.type == SDL_USEREVENT && ev.user.code == asleep_UserEventCode) {
967 if (SDL_GetTicks() - d->lastEventTime > idleThreshold_App_ && 973 if (SDL_GetTicks() - d->lastEventTime > idleThreshold_App_ &&
968 isEmpty_SortedArray(&d->tickers)) { 974 isEmpty_SortedArray(&d->tickers)) {
@@ -1051,7 +1057,7 @@ void processEvents_App(enum iAppEventMode eventMode) {
1051 } 1057 }
1052 } 1058 }
1053 } 1059 }
1054#if defined (LAGRANGE_IDLE_SLEEP) 1060#if defined (LAGRANGE_ENABLE_IDLE_SLEEP)
1055 if (d->isIdling && !gotEvents && isFinished_Anim(&d->window->rootOffset)) { 1061 if (d->isIdling && !gotEvents && isFinished_Anim(&d->window->rootOffset)) {
1056 /* This is where we spend most of our time when idle. 60 Hz still quite a lot but we 1062 /* This is where we spend most of our time when idle. 60 Hz still quite a lot but we
1057 can't wait too long after the user tries to interact again with the app. In any 1063 can't wait too long after the user tries to interact again with the app. In any
@@ -1124,7 +1130,7 @@ static int run_App_(iApp *d) {
1124void refresh_App(void) { 1130void refresh_App(void) {
1125 iApp *d = &app_; 1131 iApp *d = &app_;
1126 destroyPending_Widget(); 1132 destroyPending_Widget();
1127#if defined (LAGRANGE_IDLE_SLEEP) 1133#if defined (LAGRANGE_ENABLE_IDLE_SLEEP)
1128 if (d->warmupFrames == 0 && d->isIdling) { 1134 if (d->warmupFrames == 0 && d->isIdling) {
1129 return; 1135 return;
1130 } 1136 }
@@ -1201,7 +1207,7 @@ int run_App(int argc, char **argv) {
1201 1207
1202void postRefresh_App(void) { 1208void postRefresh_App(void) {
1203 iApp *d = &app_; 1209 iApp *d = &app_;
1204#if defined (LAGRANGE_IDLE_SLEEP) 1210#if defined (LAGRANGE_ENABLE_IDLE_SLEEP)
1205 d->isIdling = iFalse; 1211 d->isIdling = iFalse;
1206#endif 1212#endif
1207 const iBool wasPending = exchange_Atomic(&d->pendingRefresh, iTrue); 1213 const iBool wasPending = exchange_Atomic(&d->pendingRefresh, iTrue);
@@ -1342,7 +1348,7 @@ static iBool handlePrefsCommands_(iWidget *d, const char *cmd) {
1342 if (equal_Command(cmd, "prefs.dismiss") || equal_Command(cmd, "preferences")) { 1348 if (equal_Command(cmd, "prefs.dismiss") || equal_Command(cmd, "preferences")) {
1343 setUiScale_Window(get_Window(), 1349 setUiScale_Window(get_Window(),
1344 toFloat_String(text_InputWidget(findChild_Widget(d, "prefs.uiscale")))); 1350 toFloat_String(text_InputWidget(findChild_Widget(d, "prefs.uiscale"))));
1345#if defined (LAGRANGE_DOWNLOAD_EDIT) 1351#if defined (LAGRANGE_ENABLE_DOWNLOAD_EDIT)
1346 postCommandf_App("downloads path:%s", 1352 postCommandf_App("downloads path:%s",
1347 cstr_String(text_InputWidget(findChild_Widget(d, "prefs.downloads")))); 1353 cstr_String(text_InputWidget(findChild_Widget(d, "prefs.downloads"))));
1348#endif 1354#endif
@@ -2142,6 +2148,7 @@ iBool handleCommand_App(const char *cmd) {
2142 } 2148 }
2143 return iFalse; 2149 return iFalse;
2144 } 2150 }
2151#if defined (LAGRANGE_ENABLE_IPC)
2145 else if (equal_Command(cmd, "ipc.list.urls")) { 2152 else if (equal_Command(cmd, "ipc.list.urls")) {
2146 iProcessId pid = argLabel_Command(cmd, "pid"); 2153 iProcessId pid = argLabel_Command(cmd, "pid");
2147 if (pid) { 2154 if (pid) {
@@ -2158,6 +2165,7 @@ iBool handleCommand_App(const char *cmd) {
2158 signal_Ipc(arg_Command(cmd)); 2165 signal_Ipc(arg_Command(cmd));
2159 return iTrue; 2166 return iTrue;
2160 } 2167 }
2168#endif /* defined (LAGRANGE_ENABLE_IPC) */
2161 else { 2169 else {
2162 return iFalse; 2170 return iFalse;
2163 } 2171 }
diff --git a/src/ipc.h b/src/ipc.h
index 8127bf86..69852876 100644
--- a/src/ipc.h
+++ b/src/ipc.h
@@ -21,6 +21,7 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ 21SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
22 22
23#pragma once 23#pragma once
24#if defined (LAGRANGE_ENABLE_IPC)
24 25
25#include <the_Foundation/string.h> 26#include <the_Foundation/string.h>
26#include <the_Foundation/process.h> 27#include <the_Foundation/process.h>
@@ -39,3 +40,5 @@ enum iIpcWrite {
39}; 40};
40 41
41iBool write_Ipc (iProcessId pid, const iString *input, enum iIpcWrite type); 42iBool write_Ipc (iProcessId pid, const iString *input, enum iIpcWrite type);
43
44#endif /* defined (LAGRANGE_ENABLE_IPC) */
diff --git a/src/prefs.h b/src/prefs.h
index 6be7fd41..160bb974 100644
--- a/src/prefs.h
+++ b/src/prefs.h
@@ -45,7 +45,7 @@ struct Impl_Prefs {
45 iBool useSystemTheme; 45 iBool useSystemTheme;
46 enum iColorTheme theme; 46 enum iColorTheme theme;
47 enum iColorAccent accent; 47 enum iColorAccent accent;
48 iBool customFrame; /* when LAGRANGE_CUSTOM_FRAME is defined */ 48 iBool customFrame; /* when LAGRANGE_ENABLE_CUSTOM_FRAME is defined */
49 iBool retainWindowSize; 49 iBool retainWindowSize;
50 float uiScale; 50 float uiScale;
51 int zoomPercent; 51 int zoomPercent;
diff --git a/src/ui/util.c b/src/ui/util.c
index cc17a0d3..8849b289 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -2006,7 +2006,7 @@ iWidget *makePreferences_Widget(void) {
2006 const int bigGap = lineHeight_Text(uiLabel_FontId) * 3 / 4; 2006 const int bigGap = lineHeight_Text(uiLabel_FontId) * 3 / 4;
2007 /* General preferences. */ { 2007 /* General preferences. */ {
2008 appendTwoColumnPage_(tabs, "${heading.prefs.general}", '1', &headings, &values); 2008 appendTwoColumnPage_(tabs, "${heading.prefs.general}", '1', &headings, &values);
2009#if defined (LAGRANGE_DOWNLOAD_EDIT) 2009#if defined (LAGRANGE_ENABLE_DOWNLOAD_EDIT)
2010 addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.downloads}"))); 2010 addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.downloads}")));
2011 setId_Widget(addChild_Widget(values, iClob(new_InputWidget(0))), "prefs.downloads"); 2011 setId_Widget(addChild_Widget(values, iClob(new_InputWidget(0))), "prefs.downloads");
2012#endif 2012#endif
@@ -2083,7 +2083,7 @@ iWidget *makePreferences_Widget(void) {
2083 } 2083 }
2084 addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.accent}"))); 2084 addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.accent}")));
2085 addChildFlags_Widget(values, iClob(accent), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag); 2085 addChildFlags_Widget(values, iClob(accent), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag);
2086#if defined (LAGRANGE_CUSTOM_FRAME) 2086#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)
2087 addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.customframe}"))); 2087 addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.customframe}")));
2088 addChild_Widget(values, iClob(makeToggle_Widget("prefs.customframe"))); 2088 addChild_Widget(values, iClob(makeToggle_Widget("prefs.customframe")));
2089#endif 2089#endif
diff --git a/src/ui/window.c b/src/ui/window.c
index 79073baa..05db9a80 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -934,7 +934,7 @@ static void setupUserInterface_Window(iWindow *d) {
934 setId_Widget(div, "navdiv"); 934 setId_Widget(div, "navdiv");
935 addChild_Widget(d->root, iClob(div)); 935 addChild_Widget(d->root, iClob(div));
936 936
937#if defined (LAGRANGE_CUSTOM_FRAME) 937#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)
938 /* Window title bar. */ 938 /* Window title bar. */
939 if (prefs_App()->customFrame) { 939 if (prefs_App()->customFrame) {
940 setPadding1_Widget(div, 1); 940 setPadding1_Widget(div, 1);
@@ -1401,7 +1401,7 @@ static void drawBlank_Window_(iWindow *d) {
1401 SDL_RenderPresent(d->render); 1401 SDL_RenderPresent(d->render);
1402} 1402}
1403 1403
1404#if defined (LAGRANGE_CUSTOM_FRAME) 1404#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)
1405static SDL_HitTestResult hitTest_Window_(SDL_Window *win, const SDL_Point *pos, void *data) { 1405static SDL_HitTestResult hitTest_Window_(SDL_Window *win, const SDL_Point *pos, void *data) {
1406 iWindow *d = data; 1406 iWindow *d = data;
1407 iAssert(d->win == win); 1407 iAssert(d->win == win);
@@ -1454,7 +1454,7 @@ SDL_HitTestResult hitTest_Window(const iWindow *d, iInt2 pos) {
1454 1454
1455iBool create_Window_(iWindow *d, iRect rect, uint32_t flags) { 1455iBool create_Window_(iWindow *d, iRect rect, uint32_t flags) {
1456 flags |= SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_HIDDEN; 1456 flags |= SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_HIDDEN;
1457#if defined (LAGRANGE_CUSTOM_FRAME) 1457#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)
1458 if (prefs_App()->customFrame) { 1458 if (prefs_App()->customFrame) {
1459 /* We are drawing a custom frame so hide the default one. */ 1459 /* We are drawing a custom frame so hide the default one. */
1460 flags |= SDL_WINDOW_BORDERLESS; 1460 flags |= SDL_WINDOW_BORDERLESS;
@@ -1464,7 +1464,7 @@ iBool create_Window_(iWindow *d, iRect rect, uint32_t flags) {
1464 width_Rect(rect), height_Rect(rect), flags, &d->win, &d->render)) { 1464 width_Rect(rect), height_Rect(rect), flags, &d->win, &d->render)) {
1465 return iFalse; 1465 return iFalse;
1466 } 1466 }
1467#if defined (LAGRANGE_CUSTOM_FRAME) 1467#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)
1468 if (prefs_App()->customFrame) { 1468 if (prefs_App()->customFrame) {
1469 /* Register a handler for window hit testing (drag, resize). */ 1469 /* Register a handler for window hit testing (drag, resize). */
1470 SDL_SetWindowHitTest(d->win, hitTest_Window_, d); 1470 SDL_SetWindowHitTest(d->win, hitTest_Window_, d);
@@ -1583,7 +1583,7 @@ void init_Window(iWindow *d, iRect rect) {
1583 SDL_FreeSurface(surf); 1583 SDL_FreeSurface(surf);
1584 } 1584 }
1585 d->appIcon = NULL; 1585 d->appIcon = NULL;
1586#if defined (LAGRANGE_CUSTOM_FRAME) 1586#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)
1587 /* Load the app icon for drawing in the title bar. */ 1587 /* Load the app icon for drawing in the title bar. */
1588 if (prefs_App()->customFrame) { 1588 if (prefs_App()->customFrame) {
1589 SDL_Surface *surf = loadImage_(&imageLagrange64_Embedded, appIconSize_()); 1589 SDL_Surface *surf = loadImage_(&imageLagrange64_Embedded, appIconSize_());
@@ -1646,7 +1646,7 @@ static iBool isNormalPlacement_Window_(const iWindow *d) {
1646} 1646}
1647 1647
1648static iBool unsnap_Window_(iWindow *d, const iInt2 *newPos) { 1648static iBool unsnap_Window_(iWindow *d, const iInt2 *newPos) {
1649#if defined (LAGRANGE_CUSTOM_FRAME) 1649#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)
1650 if (!prefs_App()->customFrame) { 1650 if (!prefs_App()->customFrame) {
1651 return iFalse; 1651 return iFalse;
1652 } 1652 }
@@ -1736,7 +1736,7 @@ static iBool handleWindowEvent_Window_(iWindow *d, const SDL_WindowEvent *ev) {
1736 d->isMinimized = iTrue; 1736 d->isMinimized = iTrue;
1737 return iFalse; 1737 return iFalse;
1738 } 1738 }
1739#if defined (LAGRANGE_CUSTOM_FRAME) 1739#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)
1740 /* Set the snap position depending on where the mouse cursor is. */ 1740 /* Set the snap position depending on where the mouse cursor is. */
1741 if (prefs_App()->customFrame) { 1741 if (prefs_App()->customFrame) {
1742 SDL_Rect usable; 1742 SDL_Rect usable;
@@ -1766,7 +1766,7 @@ static iBool handleWindowEvent_Window_(iWindow *d, const SDL_WindowEvent *ev) {
1766 return iTrue; 1766 return iTrue;
1767 } 1767 }
1768 } 1768 }
1769#endif /* defined LAGRANGE_CUSTOM_FRAME */ 1769#endif /* defined LAGRANGE_ENABLE_CUSTOM_FRAME */
1770 //printf("MOVED: %d, %d\n", ev->data1, ev->data2); fflush(stdout); 1770 //printf("MOVED: %d, %d\n", ev->data1, ev->data2); fflush(stdout);
1771 if (unsnap_Window_(d, &newPos)) { 1771 if (unsnap_Window_(d, &newPos)) {
1772 return iTrue; 1772 return iTrue;
@@ -1861,7 +1861,7 @@ static void applyCursor_Window_(iWindow *d) {
1861 1861
1862iBool processEvent_Window(iWindow *d, const SDL_Event *ev) { 1862iBool processEvent_Window(iWindow *d, const SDL_Event *ev) {
1863 switch (ev->type) { 1863 switch (ev->type) {
1864#if defined (LAGRANGE_CUSTOM_FRAME) 1864#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)
1865 case SDL_SYSWMEVENT: { 1865 case SDL_SYSWMEVENT: {
1866 /* We observe native Win32 messages for better user interaction with the 1866 /* We observe native Win32 messages for better user interaction with the
1867 window frame. Mouse clicks especially will not generate normal SDL 1867 window frame. Mouse clicks especially will not generate normal SDL
@@ -2015,7 +2015,7 @@ void draw_Window(iWindow *d) {
2015 d->frameTime = SDL_GetTicks(); 2015 d->frameTime = SDL_GetTicks();
2016 if (isExposed_Window(d)) { 2016 if (isExposed_Window(d)) {
2017 draw_Widget(d->root); 2017 draw_Widget(d->root);
2018#if defined (LAGRANGE_CUSTOM_FRAME) 2018#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)
2019 /* App icon. */ 2019 /* App icon. */
2020 const iWidget *appIcon = findChild_Widget(d->root, "winbar.icon"); 2020 const iWidget *appIcon = findChild_Widget(d->root, "winbar.icon");
2021 if (isVisible_Widget(appIcon)) { 2021 if (isVisible_Widget(appIcon)) {
@@ -2161,7 +2161,7 @@ void setSnap_Window(iWindow *d, int snapMode) {
2161 } 2161 }
2162 return; 2162 return;
2163 } 2163 }
2164#if defined (LAGRANGE_CUSTOM_FRAME) 2164#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)
2165 if (d->place.snap == snapMode) { 2165 if (d->place.snap == snapMode) {
2166 return; 2166 return;
2167 } 2167 }
@@ -2227,7 +2227,7 @@ void setSnap_Window(iWindow *d, int snapMode) {
2227 arrange_Widget(d->root); 2227 arrange_Widget(d->root);
2228 postRefresh_App(); 2228 postRefresh_App();
2229 } 2229 }
2230#endif /* defined (LAGRANGE_CUSTOM_FRAME) */ 2230#endif /* defined (LAGRANGE_ENABLE_CUSTOM_FRAME) */
2231} 2231}
2232 2232
2233int snap_Window(const iWindow *d) { 2233int snap_Window(const iWindow *d) {
diff --git a/src/ui/window.h b/src/ui/window.h
index e3d8b22b..052f8828 100644
--- a/src/ui/window.h
+++ b/src/ui/window.h
@@ -52,7 +52,7 @@ struct Impl_WindowPlacement {
52 iInt2 initialPos; 52 iInt2 initialPos;
53 iRect normalRect; /* updated when window is moved/resized */ 53 iRect normalRect; /* updated when window is moved/resized */
54 iInt2 lastNotifiedSize; /* keep track of horizontal/vertical notifications */ 54 iInt2 lastNotifiedSize; /* keep track of horizontal/vertical notifications */
55 int snap; /* LAGRANGE_CUSTOM_FRAME */ 55 int snap; /* LAGRANGE_ENABLE_CUSTOM_FRAME */
56 int lastHit; 56 int lastHit;
57}; 57};
58 58
@@ -111,7 +111,7 @@ iBool isNarrow_Window (const iWindow *);
111 111
112iWindow * get_Window (void); 112iWindow * get_Window (void);
113 113
114#if defined (LAGRANGE_CUSTOM_FRAME) 114#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)
115SDL_HitTestResult hitTest_Window(const iWindow *d, iInt2 pos); 115SDL_HitTestResult hitTest_Window(const iWindow *d, iInt2 pos);
116#endif 116#endif
117 117
diff --git a/src/win32.c b/src/win32.c
index 01ec73bf..d040d8a9 100644
--- a/src/win32.c
+++ b/src/win32.c
@@ -64,7 +64,7 @@ void useExecutableIconResource_SDLWindow(SDL_Window *win) {
64 } 64 }
65} 65}
66 66
67#if defined (LAGRANGE_CUSTOM_FRAME) 67#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)
68iInt2 cursor_Win32(void) { 68iInt2 cursor_Win32(void) {
69 POINT p; 69 POINT p;
70 GetPhysicalCursorPos(&p); 70 GetPhysicalCursorPos(&p);
@@ -191,4 +191,4 @@ void processNativeEvent_Win32(const struct SDL_SysWMmsg *msg, iWindow *window) {
191#endif 191#endif
192 } 192 }
193} 193}
194#endif /* defined (LAGRANGE_CUSTOM_FRAME) */ 194#endif /* defined (LAGRANGE_ENABLE_CUSTOM_FRAME) */
diff --git a/src/win32.h b/src/win32.h
index 27aa0539..d53a2fe8 100644
--- a/src/win32.h
+++ b/src/win32.h
@@ -32,7 +32,7 @@ void setDPIAware_Win32(void);
32float desktopDPI_Win32(void); 32float desktopDPI_Win32(void);
33void useExecutableIconResource_SDLWindow(SDL_Window *win); 33void useExecutableIconResource_SDLWindow(SDL_Window *win);
34 34
35#if defined (LAGRANGE_CUSTOM_FRAME) 35#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)
36iInt2 cursor_Win32(void); 36iInt2 cursor_Win32(void);
37void processNativeEvent_Win32(const struct SDL_SysWMmsg *msg, iWindow *window); 37void processNativeEvent_Win32(const struct SDL_SysWMmsg *msg, iWindow *window);
38void setup_SDLWindow(SDL_Window *); 38void setup_SDLWindow(SDL_Window *);