summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-04-18 14:03:05 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-04-18 14:03:05 +0300
commit70afbe693135d69c3855fc2b5bb28249ce471cc9 (patch)
treee8ba5592e5c82f1ddf9ff45b660d178514f01ae1 /src/ui
parent9fd5f867ae1a3d5ed8278359582cd99ca89a0318 (diff)
Added build option to disable IPC
It may take a while to add D-Bus support, so adding a way to disable the incompatible IPC mechanism for Flatpak builds. IssueID #245
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/util.c4
-rw-r--r--src/ui/window.c24
-rw-r--r--src/ui/window.h4
3 files changed, 16 insertions, 16 deletions
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