summaryrefslogtreecommitdiff
path: root/src/ui/window.c
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/window.c
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/window.c')
-rw-r--r--src/ui/window.c24
1 files changed, 12 insertions, 12 deletions
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) {