summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/inputwidget.c12
-rw-r--r--src/ui/labelwidget.c2
-rw-r--r--src/ui/sidebarwidget.c8
3 files changed, 14 insertions, 8 deletions
diff --git a/src/ui/inputwidget.c b/src/ui/inputwidget.c
index 784fabdd..05cd1cc3 100644
--- a/src/ui/inputwidget.c
+++ b/src/ui/inputwidget.c
@@ -148,6 +148,8 @@ iLocalDef iInt2 padding_(void) {
148 return init_I2(gap_UI / 2, gap_UI / 2); 148 return init_I2(gap_UI / 2, gap_UI / 2);
149} 149}
150 150
151#define extraPaddingHeight_ (1.25f * gap_UI)
152
151static iRect contentBounds_InputWidget_(const iInputWidget *d) { 153static iRect contentBounds_InputWidget_(const iInputWidget *d) {
152 const iWidget *w = constAs_Widget(d); 154 const iWidget *w = constAs_Widget(d);
153 // const iRect widgetBounds = bounds_Widget(w); 155 // const iRect widgetBounds = bounds_Widget(w);
@@ -157,7 +159,7 @@ static iRect contentBounds_InputWidget_(const iInputWidget *d) {
157 shrink_Rect(&bounds, init_I2(gap_UI * (flags_Widget(w) & tight_WidgetFlag ? 1 : 2), 0)); 159 shrink_Rect(&bounds, init_I2(gap_UI * (flags_Widget(w) & tight_WidgetFlag ? 1 : 2), 0));
158 bounds.pos.y += padding_().y / 2; 160 bounds.pos.y += padding_().y / 2;
159 if (flags_Widget(w) & extraPadding_WidgetFlag) { 161 if (flags_Widget(w) & extraPadding_WidgetFlag) {
160 bounds.pos.y += gap_UI; 162 bounds.pos.y += extraPaddingHeight_ / 2;
161 } 163 }
162 return bounds; 164 return bounds;
163} 165}
@@ -205,7 +207,7 @@ static void updateSizeForFixedLength_InputWidget_(iInputWidget *d) {
205 /* Set a fixed size based on maximum possible width of the text. */ 207 /* Set a fixed size based on maximum possible width of the text. */
206 iBlock *content = new_Block(d->maxLen); 208 iBlock *content = new_Block(d->maxLen);
207 fill_Block(content, 'M'); 209 fill_Block(content, 'M');
208 int extraHeight = (flags_Widget(as_Widget(d)) & extraPadding_WidgetFlag ? 2 * gap_UI : 0); 210 int extraHeight = (flags_Widget(as_Widget(d)) & extraPadding_WidgetFlag ? extraPaddingHeight_ : 0);
209 setFixedSize_Widget( 211 setFixedSize_Widget(
210 as_Widget(d), 212 as_Widget(d),
211 add_I2(measure_Text(d->font, cstr_Block(content)), 213 add_I2(measure_Text(d->font, cstr_Block(content)),
@@ -299,7 +301,7 @@ static int contentHeight_InputWidget_(const iInputWidget *d, iBool forLayout) {
299 if (forLayout) { 301 if (forLayout) {
300 numLines = iMin(numLines, d->maxLayoutLines); 302 numLines = iMin(numLines, d->maxLayoutLines);
301 } 303 }
302 return numLines * lineHeight_Text(d->font); 304 return (int) numLines * lineHeight_Text(d->font);
303} 305}
304 306
305static void updateMetrics_InputWidget_(iInputWidget *d) { 307static void updateMetrics_InputWidget_(iInputWidget *d) {
@@ -308,7 +310,7 @@ static void updateMetrics_InputWidget_(iInputWidget *d) {
308 /* Caller must arrange the width, but the height is fixed. */ 310 /* Caller must arrange the width, but the height is fixed. */
309 w->rect.size.y = contentHeight_InputWidget_(d, iTrue) + 3.0f * padding_().y; /* TODO: Why 3x? */ 311 w->rect.size.y = contentHeight_InputWidget_(d, iTrue) + 3.0f * padding_().y; /* TODO: Why 3x? */
310 if (flags_Widget(w) & extraPadding_WidgetFlag) { 312 if (flags_Widget(w) & extraPadding_WidgetFlag) {
311 w->rect.size.y += 2 * gap_UI; 313 w->rect.size.y += extraPaddingHeight_;
312 } 314 }
313 invalidateBuffered_InputWidget_(d); 315 invalidateBuffered_InputWidget_(d);
314 postCommand_Widget(d, "input.resized"); 316 postCommand_Widget(d, "input.resized");
@@ -960,7 +962,7 @@ static iRect bounds_InputWidget_(const iInputWidget *d) {
960 } 962 }
961 bounds.size.y = contentHeight_InputWidget_(d, iFalse) + 3 * padding_().y; 963 bounds.size.y = contentHeight_InputWidget_(d, iFalse) + 3 * padding_().y;
962 if (w->flags & extraPadding_WidgetFlag) { 964 if (w->flags & extraPadding_WidgetFlag) {
963 bounds.size.y += 2 * gap_UI; 965 bounds.size.y += extraPaddingHeight_;
964 } 966 }
965 return bounds; 967 return bounds;
966} 968}
diff --git a/src/ui/labelwidget.c b/src/ui/labelwidget.c
index c20be28a..ed023961 100644
--- a/src/ui/labelwidget.c
+++ b/src/ui/labelwidget.c
@@ -66,7 +66,7 @@ static iInt2 padding_LabelWidget_(const iLabelWidget *d, int corner) {
66#if defined (iPlatformAppleMobile) 66#if defined (iPlatformAppleMobile)
67 return add_I2(widgetPad, 67 return add_I2(widgetPad,
68 init_I2(flags & tight_WidgetFlag ? 2 * gap_UI : (4 * gap_UI), 68 init_I2(flags & tight_WidgetFlag ? 2 * gap_UI : (4 * gap_UI),
69 (flags & extraPadding_WidgetFlag ? 1.5f : 1) * 3 * gap_UI / 2)); 69 (flags & extraPadding_WidgetFlag ? 1.5f : 1.0f) * 3 * gap_UI / 2));
70#else 70#else
71 return add_I2(widgetPad, 71 return add_I2(widgetPad,
72 init_I2(flags & tight_WidgetFlag ? 3 * gap_UI / 2 : (3 * gap_UI), 72 init_I2(flags & tight_WidgetFlag ? 3 * gap_UI / 2 : (3 * gap_UI),
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c
index cb6dab65..86410d11 100644
--- a/src/ui/sidebarwidget.c
+++ b/src/ui/sidebarwidget.c
@@ -1142,7 +1142,9 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev)
1142 } 1142 }
1143 if (isCommand_Widget(w, ev, "feed.entry.bookmark")) { 1143 if (isCommand_Widget(w, ev, "feed.entry.bookmark")) {
1144 makeBookmarkCreation_Widget(&item->url, &item->label, item->icon); 1144 makeBookmarkCreation_Widget(&item->url, &item->label, item->icon);
1145 postCommand_App("focus.set id:bmed.title"); 1145 if (deviceType_App() == desktop_AppDeviceType) {
1146 postCommand_App("focus.set id:bmed.title");
1147 }
1146 return iTrue; 1148 return iTrue;
1147 } 1149 }
1148 iBookmark *feedBookmark = get_Bookmarks(bookmarks_App(), item->id); 1150 iBookmark *feedBookmark = get_Bookmarks(bookmarks_App(), item->id);
@@ -1290,7 +1292,9 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev)
1290 &item->url, 1292 &item->url,
1291 collect_String(newRange_String(urlHost_String(&item->url))), 1293 collect_String(newRange_String(urlHost_String(&item->url))),
1292 0x1f310 /* globe */); 1294 0x1f310 /* globe */);
1293 postCommand_App("focus.set id:bmed.title"); 1295 if (deviceType_App() == desktop_AppDeviceType) {
1296 postCommand_App("focus.set id:bmed.title");
1297 }
1294 } 1298 }
1295 } 1299 }
1296 else if (equal_Command(cmd, "history.clear")) { 1300 else if (equal_Command(cmd, "history.clear")) {