summaryrefslogtreecommitdiff
path: root/src/ui/window.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-03-17 21:35:11 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-03-17 21:35:11 +0200
commit59462f7c4f35c75b2951827a81a5cc0ca4d7dbec (patch)
treefc40d83dcc15f2861a4e3323dab9cb9cde8e60c8 /src/ui/window.c
parent292b81a0a635204fa588a73e352ac8e6ffa98f40 (diff)
InputWidget: In a narrow window, omit the default URL scheme
The default URL scheme is "gemini". If missing, it will always be added back when making requests. This allows it to be omitted from the URL input field if space needs saving. Other schemes, like "gopher", won't be omitted.
Diffstat (limited to 'src/ui/window.c')
-rw-r--r--src/ui/window.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/ui/window.c b/src/ui/window.c
index 6e81c14c..5d5b8e0c 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -536,10 +536,14 @@ static int navBarAvailableSpace_(iWidget *navBar) {
536 return avail; 536 return avail;
537} 537}
538 538
539iBool isNarrow_Window(const iWindow *d) {
540 return width_Rect(safeRootRect_Window(d)) / gap_UI < 140;
541}
542
539static iBool handleNavBarCommands_(iWidget *navBar, const char *cmd) { 543static iBool handleNavBarCommands_(iWidget *navBar, const char *cmd) {
540 if (equal_Command(cmd, "window.resized") || equal_Command(cmd, "metrics.changed")) { 544 if (equal_Command(cmd, "window.resized") || equal_Command(cmd, "metrics.changed")) {
541 const iBool isPhone = deviceType_App() == phone_AppDeviceType; 545 const iBool isPhone = deviceType_App() == phone_AppDeviceType;
542 const iBool isNarrow = !isPhone && width_Rect(bounds_Widget(navBar)) / gap_UI < 140; 546 const iBool isNarrow = !isPhone && isNarrow_Window(get_Window());
543 /* Adjust navbar padding. */ { 547 /* Adjust navbar padding. */ {
544 int hPad = isPhone || isNarrow ? gap_UI / 2 : gap_UI * 3 / 2; 548 int hPad = isPhone || isNarrow ? gap_UI / 2 : gap_UI * 3 / 2;
545 int vPad = gap_UI * 3 / 2; 549 int vPad = gap_UI * 3 / 2;