summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-08-29 16:52:04 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-08-29 16:52:04 +0300
commit88a9376327733a06490bd8322fe18f12a85560bc (patch)
treea53dfd851003b73458827b0fe4083bece699f304
parent9895b10c9cb2d69be718dd3847206e98631dc1c0 (diff)
parent7ec39c46f2efdbc084beacdfae7b79ba794042b4 (diff)
Merge branch 'dev' into work/v1.7
m---------lib/the_Foundation0
-rw-r--r--res/about/version.gmi3
-rw-r--r--res/fi.skyjake.Lagrange.appdata.xml31
-rw-r--r--res/fonts/SmolEmoji-Regular.ttfbin57856 -> 58312 bytes
-rw-r--r--src/app.c14
-rw-r--r--src/app.h2
-rw-r--r--src/ui/documentwidget.c15
-rw-r--r--src/ui/inputwidget.c7
-rw-r--r--src/ui/labelwidget.c2
-rw-r--r--src/ui/window.c13
10 files changed, 74 insertions, 13 deletions
diff --git a/lib/the_Foundation b/lib/the_Foundation
Subproject 7ff1adf809c047a349243e6e142a08d52dd6971 Subproject 35acb37d6854204c18782d68c80ab3c70d73c4a
diff --git a/res/about/version.gmi b/res/about/version.gmi
index 35c730c1..c2163c7d 100644
--- a/res/about/version.gmi
+++ b/res/about/version.gmi
@@ -12,8 +12,11 @@
12 12
13## 1.6.5 13## 1.6.5
14* Audio init errors are no longer fatal. SDL's error message will still be printed. 14* Audio init errors are no longer fatal. SDL's error message will still be printed.
15* Fixed appearance of tab buttons (should have no top frame).
15* Fixed a cursor position regression in input fields related to handling of variation selectors (codepoint clusters). Moving the cursor to the start of a wrapped line segment put the cursor in the wrong place. 16* Fixed a cursor position regression in input fields related to handling of variation selectors (codepoint clusters). Moving the cursor to the start of a wrapped line segment put the cursor in the wrong place.
16* Fixed right-clicking on sidebar tab buttons. It was showing the wrong context menu when the list had been scrolled down. 17* Fixed right-clicking on sidebar tab buttons. It was showing the wrong context menu when the list had been scrolled down.
18* Fixed crash when using the SDL2 KMSDRM video driver.
19* Fixed minor visual artifacts in preformatted blocks and near the bottom of the page.
17 20
18## 1.6.4 21## 1.6.4
19* Local files containing UTF-8 text can be viewed regardless of their file extension. 22* Local files containing UTF-8 text can be viewed regardless of their file extension.
diff --git a/res/fi.skyjake.Lagrange.appdata.xml b/res/fi.skyjake.Lagrange.appdata.xml
index 4202a9b6..3386e74f 100644
--- a/res/fi.skyjake.Lagrange.appdata.xml
+++ b/res/fi.skyjake.Lagrange.appdata.xml
@@ -45,6 +45,37 @@
45 <update_contact>jaakko.keranen@iki.fi</update_contact> 45 <update_contact>jaakko.keranen@iki.fi</update_contact>
46 46
47 <releases> 47 <releases>
48 <release version="1.6.5" date="2021-08-29">
49 <description>
50 <p>Version 1.6 adds support for bidirectional text and complex scripts,
51 right-to-left paragraph layout, uploads using the Titan protocol,
52 and has an improved mechanism for tracking trust in server
53 certificates. Page contents can be fully cached in memory for more
54 efficient backward navigation. There are also UI improvements like
55 a reorganized Preferences and a setting for smooth scrolling
56 speed.</p>
57 <p>Changes and fixes in v1.6.5:</p>
58 <ul>
59 <li>Audio init errors are no longer fatal. SDL's error message
60 will still be printed.</li>
61 <li>Fixed appearance of tab buttons (should have
62 no top frame).</li>
63 <li>Fixed a cursor position regression in input fields related
64 to handling of variation selectors (codepoint clusters).
65 Moving the cursor to the start of a wrapped line segment put
66 the cursor in the wrong place.</li>
67 <li>Fixed right-clicking on sidebar tab buttons.
68 It was showing the wrong context menu when the list had been
69 scrolled down.</li>
70 <li>Fixed crash when using the SDL2 KMSDRM video driver.</li>
71 <li>Fixed minor visual artifacts in preformatted blocks and
72 near the bottom of the page.</li>
73 </ul>
74 <p>The full release notes can be viewed inside the app by opening
75 the "about:version" page.</p>
76 </description>
77 <url>https://github.com/skyjake/lagrange/releases/tag/v1.6.5</url>
78 </release>
48 <release version="1.6.4" date="2021-08-22"> 79 <release version="1.6.4" date="2021-08-22">
49 <description> 80 <description>
50 <p>Version 1.6 adds support for bidirectional text and complex scripts, 81 <p>Version 1.6 adds support for bidirectional text and complex scripts,
diff --git a/res/fonts/SmolEmoji-Regular.ttf b/res/fonts/SmolEmoji-Regular.ttf
index cd299e58..a0a95d87 100644
--- a/res/fonts/SmolEmoji-Regular.ttf
+++ b/res/fonts/SmolEmoji-Regular.ttf
Binary files differ
diff --git a/src/app.c b/src/app.c
index 91472075..be96bf6c 100644
--- a/src/app.c
+++ b/src/app.c
@@ -122,6 +122,7 @@ struct Impl_App {
122 uint32_t lastTickerTime; 122 uint32_t lastTickerTime;
123 uint32_t elapsedSinceLastTicker; 123 uint32_t elapsedSinceLastTicker;
124 iBool isRunning; 124 iBool isRunning;
125 iBool isRunningUnderWindowSystem;
125#if defined (LAGRANGE_ENABLE_IDLE_SLEEP) 126#if defined (LAGRANGE_ENABLE_IDLE_SLEEP)
126 iBool isIdling; 127 iBool isIdling;
127 uint32_t lastEventTime; 128 uint32_t lastEventTime;
@@ -626,6 +627,12 @@ static iBool hasCommandLineOpenableScheme_(const iRangecc uri) {
626} 627}
627 628
628static void init_App_(iApp *d, int argc, char **argv) { 629static void init_App_(iApp *d, int argc, char **argv) {
630#if defined (iPlatformLinux)
631 d->isRunningUnderWindowSystem = !iCmpStr(SDL_GetCurrentVideoDriver(), "x11") ||
632 !iCmpStr(SDL_GetCurrentVideoDriver(), "wayland");
633#else
634 d->isRunningUnderWindowSystem = iTrue;
635#endif
629 init_CommandLine(&d->args, argc, argv); 636 init_CommandLine(&d->args, argc, argv);
630 /* Where was the app started from? We ask SDL first because the command line alone is 637 /* Where was the app started from? We ask SDL first because the command line alone is
631 not a reliable source of this information, particularly when it comes to different 638 not a reliable source of this information, particularly when it comes to different
@@ -749,7 +756,8 @@ static void init_App_(iApp *d, int argc, char **argv) {
749 mulfv_I2(&d->initialWindowRect.size, desktopDPI_Win32()); 756 mulfv_I2(&d->initialWindowRect.size, desktopDPI_Win32());
750#endif 757#endif
751#if defined (iPlatformLinux) 758#if defined (iPlatformLinux)
752 /* Scale by the primary (?) monitor DPI. */ { 759 /* Scale by the primary (?) monitor DPI. */
760 if (isRunningUnderWindowSystem_App()) {
753 float vdpi; 761 float vdpi;
754 SDL_GetDisplayDPI(0, NULL, NULL, &vdpi); 762 SDL_GetDisplayDPI(0, NULL, NULL, &vdpi);
755 const float factor = vdpi / 96.0f; 763 const float factor = vdpi / 96.0f;
@@ -1586,6 +1594,10 @@ enum iAppDeviceType deviceType_App(void) {
1586#endif 1594#endif
1587} 1595}
1588 1596
1597iBool isRunningUnderWindowSystem_App(void) {
1598 return app_.isRunningUnderWindowSystem;
1599}
1600
1589iGmCerts *certs_App(void) { 1601iGmCerts *certs_App(void) {
1590 return app_.certs; 1602 return app_.certs;
1591} 1603}
diff --git a/src/app.h b/src/app.h
index 5d1d42e1..55bec5a6 100644
--- a/src/app.h
+++ b/src/app.h
@@ -87,6 +87,8 @@ iBool isLandscape_App (void);
87iLocalDef iBool isPortrait_App (void) { return !isLandscape_App(); } 87iLocalDef iBool isPortrait_App (void) { return !isLandscape_App(); }
88enum iAppDeviceType deviceType_App (void); 88enum iAppDeviceType deviceType_App (void);
89iLocalDef iBool isPortraitPhone_App (void) { return isPortrait_App() && deviceType_App() == phone_AppDeviceType; } 89iLocalDef iBool isPortraitPhone_App (void) { return isPortrait_App() && deviceType_App() == phone_AppDeviceType; }
90iBool isRunningUnderWindowSystem_App (void);
91
90iGmCerts * certs_App (void); 92iGmCerts * certs_App (void);
91iVisited * visited_App (void); 93iVisited * visited_App (void);
92iBookmarks * bookmarks_App (void); 94iBookmarks * bookmarks_App (void);
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index 83f38dee..76e843d5 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -4213,12 +4213,12 @@ static void drawRun_DrawContext_(void *context, const iGmRun *run) {
4213 /* Fill the background. */ { 4213 /* Fill the background. */ {
4214 if (run->linkId && linkFlags & isOpen_GmLinkFlag && ~linkFlags & content_GmLinkFlag) { 4214 if (run->linkId && linkFlags & isOpen_GmLinkFlag && ~linkFlags & content_GmLinkFlag) {
4215 /* Open links get a highlighted background. */ 4215 /* Open links get a highlighted background. */
4216 int bg = tmBackgroundOpenLink_ColorId; 4216 int bg = tmBackgroundOpenLink_ColorId;
4217 const int frame = tmFrameOpenLink_ColorId; 4217 const int frame = tmFrameOpenLink_ColorId;
4218 iRect wideRect = { init_I2(left_Rect(d->widgetBounds), visPos.y), 4218 iRect wideRect = { init_I2(left_Rect(d->widgetBounds), visPos.y),
4219 init_I2(width_Rect(d->widgetBounds) + 4219 init_I2(width_Rect(d->widgetBounds) +
4220 width_Widget(d->widget->scroll), 4220 width_Widget(d->widget->scroll),
4221 height_Rect(run->visBounds)) }; 4221 height_Rect(run->visBounds)) };
4222 /* The first line is composed of two runs that may be drawn in either order, so 4222 /* The first line is composed of two runs that may be drawn in either order, so
4223 only draw half of the background. */ 4223 only draw half of the background. */
4224 if (run->flags & decoration_GmRunFlag) { 4224 if (run->flags & decoration_GmRunFlag) {
@@ -4238,8 +4238,11 @@ static void drawRun_DrawContext_(void *context, const iGmRun *run) {
4238// &d->paint, addY_I2(bottomLeft_Rect(wideRect), -1), width_Rect(wideRect), frame); 4238// &d->paint, addY_I2(bottomLeft_Rect(wideRect), -1), width_Rect(wideRect), frame);
4239// } 4239// }
4240 } 4240 }
4241 else if (run->linkId) { 4241 else {
4242 /* Normal background for runs that may change appearance. */ 4242 /* Normal background for other runs. There are cases when runs get drawn multiple times,
4243 e.g., at the buffer boundary, and there are slightly overlapping characters in
4244 monospace blocks. Clearing the background here ensures a cleaner visual appearance
4245 since only one glyph is visible at any given point. */
4243 fillRect_Paint(&d->paint, (iRect){ visPos, run->visBounds.size }, tmBackground_ColorId); 4246 fillRect_Paint(&d->paint, (iRect){ visPos, run->visBounds.size }, tmBackground_ColorId);
4244 } 4247 }
4245 } 4248 }
diff --git a/src/ui/inputwidget.c b/src/ui/inputwidget.c
index fa65cf3c..690107a2 100644
--- a/src/ui/inputwidget.c
+++ b/src/ui/inputwidget.c
@@ -541,6 +541,11 @@ static int contentHeight_InputWidget_(const iInputWidget *d) {
541 return size_Range(&d->visWrapLines) * lineHeight_Text(d->font); 541 return size_Range(&d->visWrapLines) * lineHeight_Text(d->font);
542} 542}
543 543
544static void updateTextInputRect_InputWidget_(const iInputWidget *d) {
545 const iRect bounds = bounds_Widget(constAs_Widget(d));
546 SDL_SetTextInputRect(&(SDL_Rect){ bounds.pos.x, bounds.pos.y, bounds.size.x, bounds.size.y });
547}
548
544static void updateMetrics_InputWidget_(iInputWidget *d) { 549static void updateMetrics_InputWidget_(iInputWidget *d) {
545 iWidget *w = as_Widget(d); 550 iWidget *w = as_Widget(d);
546 updateSizeForFixedLength_InputWidget_(d); 551 updateSizeForFixedLength_InputWidget_(d);
@@ -553,6 +558,7 @@ static void updateMetrics_InputWidget_(iInputWidget *d) {
553 invalidateBuffered_InputWidget_(d); 558 invalidateBuffered_InputWidget_(d);
554 if (height_Rect(w->rect) != oldHeight) { 559 if (height_Rect(w->rect) != oldHeight) {
555 postCommand_Widget(d, "input.resized"); 560 postCommand_Widget(d, "input.resized");
561 updateTextInputRect_InputWidget_(d);
556 } 562 }
557} 563}
558 564
@@ -988,6 +994,7 @@ void begin_InputWidget(iInputWidget *d) {
988 iZap(d->mark); 994 iZap(d->mark);
989 } 995 }
990 enableEditorKeysInMenus_(iFalse); 996 enableEditorKeysInMenus_(iFalse);
997 updateTextInputRect_InputWidget_(d);
991 updateVisible_InputWidget_(d); 998 updateVisible_InputWidget_(d);
992} 999}
993 1000
diff --git a/src/ui/labelwidget.c b/src/ui/labelwidget.c
index 58294c6a..3bfa600b 100644
--- a/src/ui/labelwidget.c
+++ b/src/ui/labelwidget.c
@@ -311,7 +311,7 @@ static void draw_LabelWidget_(const iLabelWidget *d) {
311#endif 311#endif
312 drawLines_Paint(&p, points + 2, 3, frame2); 312 drawLines_Paint(&p, points + 2, 3, frame2);
313 drawLines_Paint( 313 drawLines_Paint(
314 &p, points, !isHover && flags & d->flags.noTopFrame ? 2 : 3, frame); 314 &p, points, !isHover && d->flags.noTopFrame ? 2 : 3, frame);
315 } 315 }
316 } 316 }
317 setClip_Paint(&p, rect); 317 setClip_Paint(&p, rect);
diff --git a/src/ui/window.c b/src/ui/window.c
index 3bafd9a4..3ac02495 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -278,11 +278,14 @@ static float displayScale_Window_(const iWindow *d) {
278 iUnused(d); 278 iUnused(d);
279 return desktopDPI_Win32(); 279 return desktopDPI_Win32();
280#else 280#else
281 float vdpi = 0.0f; 281 if (isRunningUnderWindowSystem_App()) {
282 SDL_GetDisplayDPI(SDL_GetWindowDisplayIndex(d->win), NULL, NULL, &vdpi); 282 float vdpi = 0.0f;
283// printf("DPI: %f\n", vdpi); 283 SDL_GetDisplayDPI(SDL_GetWindowDisplayIndex(d->win), NULL, NULL, &vdpi);
284 const float factor = vdpi / baseDPI_Window / pixelRatio_Window_(d); 284// printf("DPI: %f\n", vdpi);
285 return iMax(1.0f, factor); 285 const float factor = vdpi / baseDPI_Window / pixelRatio_Window_(d);
286 return iMax(1.0f, factor);
287 }
288 return 1.0f;
286#endif 289#endif
287} 290}
288 291