diff options
-rw-r--r-- | src/app.c | 26 | ||||
-rw-r--r-- | src/ui/window.c | 19 |
2 files changed, 24 insertions, 21 deletions
@@ -762,7 +762,7 @@ static void init_App_(iApp *d, int argc, char **argv) { | |||
762 | mulfv_I2(&d->initialWindowRect.size, desktopDPI_Win32()); | 762 | mulfv_I2(&d->initialWindowRect.size, desktopDPI_Win32()); |
763 | #endif | 763 | #endif |
764 | #if defined (iPlatformLinux) | 764 | #if defined (iPlatformLinux) |
765 | /* Scale by the primary (?) monitor DPI. */ | 765 | /* Scale by the primary (?) monitor DPI. */ |
766 | if (isRunningUnderWindowSystem_App()) { | 766 | if (isRunningUnderWindowSystem_App()) { |
767 | float vdpi; | 767 | float vdpi; |
768 | SDL_GetDisplayDPI(0, NULL, NULL, &vdpi); | 768 | SDL_GetDisplayDPI(0, NULL, NULL, &vdpi); |
@@ -1061,7 +1061,7 @@ void trimMemory_App(void) { | |||
1061 | init_ObjectListIterator(&i, docs); | 1061 | init_ObjectListIterator(&i, docs); |
1062 | } | 1062 | } |
1063 | } | 1063 | } |
1064 | iRelease(docs); | 1064 | iRelease(docs); |
1065 | } | 1065 | } |
1066 | 1066 | ||
1067 | iLocalDef iBool isWaitingAllowed_App_(iApp *d) { | 1067 | iLocalDef iBool isWaitingAllowed_App_(iApp *d) { |
@@ -1249,7 +1249,7 @@ void processEvents_App(enum iAppEventMode eventMode) { | |||
1249 | } | 1249 | } |
1250 | else if (ev.type == SDL_MOUSEMOTION) { | 1250 | else if (ev.type == SDL_MOUSEMOTION) { |
1251 | if (~ev.motion.state & SDL_BUTTON(SDL_BUTTON_LEFT)) { | 1251 | if (~ev.motion.state & SDL_BUTTON(SDL_BUTTON_LEFT)) { |
1252 | continue; /* only when pressing a button */ | 1252 | continue; /* only when pressing a button */ |
1253 | } | 1253 | } |
1254 | const float xf = (d->window->pixelRatio * ev.motion.x) / (float) d->window->size.x; | 1254 | const float xf = (d->window->pixelRatio * ev.motion.x) / (float) d->window->size.x; |
1255 | const float yf = (d->window->pixelRatio * ev.motion.y) / (float) d->window->size.y; | 1255 | const float yf = (d->window->pixelRatio * ev.motion.y) / (float) d->window->size.y; |
@@ -1263,7 +1263,7 @@ void processEvents_App(enum iAppEventMode eventMode) { | |||
1263 | ev.tfinger.fingerId = 0x1234; | 1263 | ev.tfinger.fingerId = 0x1234; |
1264 | ev.tfinger.pressure = 1.0f; | 1264 | ev.tfinger.pressure = 1.0f; |
1265 | ev.tfinger.timestamp = SDL_GetTicks(); | 1265 | ev.tfinger.timestamp = SDL_GetTicks(); |
1266 | ev.tfinger.touchId = SDL_TOUCH_MOUSEID; | 1266 | ev.tfinger.touchId = SDL_TOUCH_MOUSEID; |
1267 | } | 1267 | } |
1268 | } | 1268 | } |
1269 | #endif | 1269 | #endif |
@@ -1307,7 +1307,7 @@ void processEvents_App(enum iAppEventMode eventMode) { | |||
1307 | if (root) { | 1307 | if (root) { |
1308 | arrange_Widget(root->widget); | 1308 | arrange_Widget(root->widget); |
1309 | } | 1309 | } |
1310 | } | 1310 | } |
1311 | } | 1311 | } |
1312 | } | 1312 | } |
1313 | if (!wasUsed) { | 1313 | if (!wasUsed) { |
@@ -1374,11 +1374,11 @@ static int resizeWatcher_(void *user, SDL_Event *event) { | |||
1374 | if (event->type == SDL_WINDOWEVENT && event->window.event == SDL_WINDOWEVENT_SIZE_CHANGED) { | 1374 | if (event->type == SDL_WINDOWEVENT && event->window.event == SDL_WINDOWEVENT_SIZE_CHANGED) { |
1375 | const SDL_WindowEvent *winev = &event->window; | 1375 | const SDL_WindowEvent *winev = &event->window; |
1376 | #if defined (iPlatformMsys) | 1376 | #if defined (iPlatformMsys) |
1377 | resetFonts_Text(); { | 1377 | resetFonts_Text(text_Window(d->window)); { |
1378 | SDL_Event u = { .type = SDL_USEREVENT }; | 1378 | SDL_Event u = { .type = SDL_USEREVENT }; |
1379 | u.user.code = command_UserEventCode; | 1379 | u.user.code = command_UserEventCode; |
1380 | u.user.data1 = strdup("theme.changed auto:1"); | 1380 | u.user.data1 = strdup("theme.changed auto:1"); |
1381 | dispatchEvent_Window(d->window, &u); | 1381 | dispatchEvent_Window(as_Window(d->window), &u); |
1382 | } | 1382 | } |
1383 | #endif | 1383 | #endif |
1384 | drawWhileResizing_MainWindow(d->window, winev->data1, winev->data2); | 1384 | drawWhileResizing_MainWindow(d->window, winev->data1, winev->data2); |
@@ -1420,7 +1420,7 @@ void refresh_App(void) { | |||
1420 | #endif | 1420 | #endif |
1421 | const iPtrArray *windows = listWindows_App_(d); | 1421 | const iPtrArray *windows = listWindows_App_(d); |
1422 | /* Destroy pending widgets. */ { | 1422 | /* Destroy pending widgets. */ { |
1423 | iConstForEach(PtrArray, j, windows) { | 1423 | iConstForEach(PtrArray, j, windows) { |
1424 | iWindow *win = j.ptr; | 1424 | iWindow *win = j.ptr; |
1425 | setCurrent_Window(win); | 1425 | setCurrent_Window(win); |
1426 | iForIndices(i, win->roots) { | 1426 | iForIndices(i, win->roots) { |
@@ -1449,7 +1449,7 @@ void refresh_App(void) { | |||
1449 | break; | 1449 | break; |
1450 | default: | 1450 | default: |
1451 | draw_Window(win); | 1451 | draw_Window(win); |
1452 | break; | 1452 | break; |
1453 | } | 1453 | } |
1454 | } | 1454 | } |
1455 | } | 1455 | } |
@@ -1807,7 +1807,7 @@ static iBool handlePrefsCommands_(iWidget *d, const char *cmd) { | |||
1807 | updateFontButton_(findChild_Widget(d, "prefs.headingfont"), arg_Command(cmd)); | 1807 | updateFontButton_(findChild_Widget(d, "prefs.headingfont"), arg_Command(cmd)); |
1808 | return iFalse; | 1808 | return iFalse; |
1809 | } | 1809 | } |
1810 | else if (startsWith_CStr(cmd, "input.ended id:prefs.linespacing")) { | 1810 | else if (startsWith_CStr(cmd, "input.ended id:prefs.linespacing")) { |
1811 | /* Apply line spacing changes immediately. */ | 1811 | /* Apply line spacing changes immediately. */ |
1812 | const iInputWidget *lineSpacing = findWidget_App("prefs.linespacing"); | 1812 | const iInputWidget *lineSpacing = findWidget_App("prefs.linespacing"); |
1813 | postCommandf_App("linespacing.set arg:%f", toFloat_String(text_InputWidget(lineSpacing))); | 1813 | postCommandf_App("linespacing.set arg:%f", toFloat_String(text_InputWidget(lineSpacing))); |
@@ -1895,7 +1895,7 @@ static iBool handleIdentityCreationCommands_(iWidget *dlg, const char *cmd) { | |||
1895 | } | 1895 | } |
1896 | setFlags_Widget(pointer_Command(cmd), disabled_WidgetFlag, iTrue); | 1896 | setFlags_Widget(pointer_Command(cmd), disabled_WidgetFlag, iTrue); |
1897 | arrange_Widget(dlg); | 1897 | arrange_Widget(dlg); |
1898 | refresh_Widget(dlg); | 1898 | refresh_Widget(dlg); |
1899 | return iTrue; | 1899 | return iTrue; |
1900 | } | 1900 | } |
1901 | if (equal_Command(cmd, "ident.scope")) { | 1901 | if (equal_Command(cmd, "ident.scope")) { |
@@ -2027,7 +2027,7 @@ const iString *searchQueryUrl_App(const iString *queryStringUnescaped) { | |||
2027 | static void resetFonts_App_(iApp *d) { | 2027 | static void resetFonts_App_(iApp *d) { |
2028 | iConstForEach(PtrArray, win, listWindows_App_(d)) { | 2028 | iConstForEach(PtrArray, win, listWindows_App_(d)) { |
2029 | resetFonts_Text(text_Window(win.ptr)); | 2029 | resetFonts_Text(text_Window(win.ptr)); |
2030 | } | 2030 | } |
2031 | } | 2031 | } |
2032 | 2032 | ||
2033 | iBool handleCommand_App(const char *cmd) { | 2033 | iBool handleCommand_App(const char *cmd) { |
@@ -2875,7 +2875,7 @@ iBool handleCommand_App(const char *cmd) { | |||
2875 | write_Ipc(argLabel_Command(cmd, "pid"), | 2875 | write_Ipc(argLabel_Command(cmd, "pid"), |
2876 | collectNewFormat_String("%s\n", cstr_String(url_DocumentWidget(document_App()))), | 2876 | collectNewFormat_String("%s\n", cstr_String(url_DocumentWidget(document_App()))), |
2877 | response_IpcWrite); | 2877 | response_IpcWrite); |
2878 | return iTrue; | 2878 | return iTrue; |
2879 | } | 2879 | } |
2880 | else if (equal_Command(cmd, "ipc.signal")) { | 2880 | else if (equal_Command(cmd, "ipc.signal")) { |
2881 | if (argLabel_Command(cmd, "raise")) { | 2881 | if (argLabel_Command(cmd, "raise")) { |
diff --git a/src/ui/window.c b/src/ui/window.c index e9a34ace..27ef2bc3 100644 --- a/src/ui/window.c +++ b/src/ui/window.c | |||
@@ -240,7 +240,7 @@ static void updateSize_MainWindow_(iMainWindow *d, iBool notifyAlways) { | |||
240 | } | 240 | } |
241 | 241 | ||
242 | void drawWhileResizing_MainWindow(iMainWindow *d, int w, int h) { | 242 | void drawWhileResizing_MainWindow(iMainWindow *d, int w, int h) { |
243 | draw_MainWindow(d); | 243 | draw_MainWindow(d); |
244 | } | 244 | } |
245 | 245 | ||
246 | static float pixelRatio_Window_(const iWindow *d) { | 246 | static float pixelRatio_Window_(const iWindow *d) { |
@@ -438,7 +438,7 @@ void init_Window(iWindow *d, enum iWindowType type, iRect rect, uint32_t flags) | |||
438 | if (left_Rect(rect) >= 0 || top_Rect(rect) >= 0) { | 438 | if (left_Rect(rect) >= 0 || top_Rect(rect) >= 0) { |
439 | SDL_SetWindowPosition(d->win, left_Rect(rect), top_Rect(rect)); | 439 | SDL_SetWindowPosition(d->win, left_Rect(rect), top_Rect(rect)); |
440 | } | 440 | } |
441 | SDL_GetRendererOutputSize(d->render, &d->size.x, &d->size.y); | 441 | SDL_GetRendererOutputSize(d->render, &d->size.x, &d->size.y); |
442 | drawBlank_Window_(d); | 442 | drawBlank_Window_(d); |
443 | d->pixelRatio = pixelRatio_Window_(d); /* point/pixel conversion */ | 443 | d->pixelRatio = pixelRatio_Window_(d); /* point/pixel conversion */ |
444 | d->displayScale = displayScale_Window_(d); | 444 | d->displayScale = displayScale_Window_(d); |
@@ -472,7 +472,7 @@ void deinit_Window(iWindow *d) { | |||
472 | if (d->cursors[i]) { | 472 | if (d->cursors[i]) { |
473 | SDL_FreeCursor(d->cursors[i]); | 473 | SDL_FreeCursor(d->cursors[i]); |
474 | } | 474 | } |
475 | } | 475 | } |
476 | } | 476 | } |
477 | 477 | ||
478 | void init_MainWindow(iMainWindow *d, iRect rect) { | 478 | void init_MainWindow(iMainWindow *d, iRect rect) { |
@@ -522,7 +522,7 @@ void init_MainWindow(iMainWindow *d, iRect rect) { | |||
522 | #endif | 522 | #endif |
523 | } | 523 | } |
524 | #if defined(iPlatformMsys) | 524 | #if defined(iPlatformMsys) |
525 | SDL_SetWindowMinimumSize(d->win, minSize.x * d->base.displayScale, minSize.y * d->base.displayScale); | 525 | SDL_SetWindowMinimumSize(d->base.win, minSize.x * d->base.displayScale, minSize.y * d->base.displayScale); |
526 | useExecutableIconResource_SDLWindow(d->base.win); | 526 | useExecutableIconResource_SDLWindow(d->base.win); |
527 | #endif | 527 | #endif |
528 | #if defined (iPlatformLinux) | 528 | #if defined (iPlatformLinux) |
@@ -538,7 +538,7 @@ void init_MainWindow(iMainWindow *d, iRect rect) { | |||
538 | setupWindow_iOS(as_Window(d)); | 538 | setupWindow_iOS(as_Window(d)); |
539 | #endif | 539 | #endif |
540 | setCurrent_Text(d->base.text); | 540 | setCurrent_Text(d->base.text); |
541 | SDL_GetRendererOutputSize(d->base.render, &d->base.size.x, &d->base.size.y); | 541 | SDL_GetRendererOutputSize(d->base.render, &d->base.size.x, &d->base.size.y); |
542 | setupUserInterface_MainWindow(d); | 542 | setupUserInterface_MainWindow(d); |
543 | postCommand_App("~bindings.changed"); /* update from bindings */ | 543 | postCommand_App("~bindings.changed"); /* update from bindings */ |
544 | /* Load the border shadow texture. */ { | 544 | /* Load the border shadow texture. */ { |
@@ -800,7 +800,7 @@ static iBool handleWindowEvent_MainWindow_(iMainWindow *d, const SDL_WindowEvent | |||
800 | // printf("normal rect set (move)\n"); fflush(stdout); | 800 | // printf("normal rect set (move)\n"); fflush(stdout); |
801 | iInt2 border = zero_I2(); | 801 | iInt2 border = zero_I2(); |
802 | #if !defined(iPlatformApple) | 802 | #if !defined(iPlatformApple) |
803 | SDL_GetWindowBordersSize(d->win, &border.y, &border.x, NULL, NULL); | 803 | SDL_GetWindowBordersSize(d->base.win, &border.y, &border.x, NULL, NULL); |
804 | #endif | 804 | #endif |
805 | d->place.normalRect.pos = | 805 | d->place.normalRect.pos = |
806 | max_I2(zero_I2(), sub_I2(d->place.normalRect.pos, border)); | 806 | max_I2(zero_I2(), sub_I2(d->place.normalRect.pos, border)); |
@@ -1055,7 +1055,7 @@ iBool dispatchEvent_Window(iWindow *d, const SDL_Event *ev) { | |||
1055 | if (!isEscapeKeypress_(ev)) { | 1055 | if (!isEscapeKeypress_(ev)) { |
1056 | /* Key events go only to the root with keyboard focus, with the exception | 1056 | /* Key events go only to the root with keyboard focus, with the exception |
1057 | of Escape that will also affect the entire window. */ | 1057 | of Escape that will also affect the entire window. */ |
1058 | continue; | 1058 | continue; |
1059 | } | 1059 | } |
1060 | } | 1060 | } |
1061 | if (ev->type == SDL_MOUSEWHEEL && !contains_Rect(rect_Root(root), | 1061 | if (ev->type == SDL_MOUSEWHEEL && !contains_Rect(rect_Root(root), |
@@ -1126,7 +1126,7 @@ void draw_Window(iWindow *d) { | |||
1126 | #if !defined (NDEBUG) | 1126 | #if !defined (NDEBUG) |
1127 | draw_Text(defaultBold_FontId, safeRect_Root(root).pos, red_ColorId, "%d", drawCount_); | 1127 | draw_Text(defaultBold_FontId, safeRect_Root(root).pos, red_ColorId, "%d", drawCount_); |
1128 | drawCount_ = 0; | 1128 | drawCount_ = 0; |
1129 | #endif | 1129 | #endif |
1130 | } | 1130 | } |
1131 | // drawRectThickness_Paint(&p, (iRect){ zero_I2(), sub_I2(d->size, one_I2()) }, gap_UI / 4, uiSeparator_ColorId); | 1131 | // drawRectThickness_Paint(&p, (iRect){ zero_I2(), sub_I2(d->size, one_I2()) }, gap_UI / 4, uiSeparator_ColorId); |
1132 | setCurrent_Root(NULL); | 1132 | setCurrent_Root(NULL); |
@@ -1587,6 +1587,9 @@ iWindow *newPopup_Window(iInt2 screenPos, iWidget *rootWidget) { | |||
1587 | new_Window(popup_WindowType, | 1587 | new_Window(popup_WindowType, |
1588 | (iRect){ screenPos, divf_I2(rootWidget->rect.size, get_Window()->pixelRatio) }, | 1588 | (iRect){ screenPos, divf_I2(rootWidget->rect.size, get_Window()->pixelRatio) }, |
1589 | SDL_WINDOW_ALWAYS_ON_TOP | | 1589 | SDL_WINDOW_ALWAYS_ON_TOP | |
1590 | #if !defined (iPlatformAppleDesktop) | ||
1591 | SDL_WINDOW_BORDERLESS | | ||
1592 | #endif | ||
1590 | SDL_WINDOW_POPUP_MENU | | 1593 | SDL_WINDOW_POPUP_MENU | |
1591 | SDL_WINDOW_SKIP_TASKBAR); | 1594 | SDL_WINDOW_SKIP_TASKBAR); |
1592 | #if defined (iPlatformAppleDesktop) | 1595 | #if defined (iPlatformAppleDesktop) |