summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-02-20 22:46:47 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-02-20 22:46:47 +0200
commitc8f441acb0adc85584cd137a043d13f044779bcc (patch)
tree05edd6959c139bc6f3d530d5f459bff778b20960 /src
parent3b16b823d5840096402ec0bddc3d35f6028b75f6 (diff)
iOS: More spacing for lists
Diffstat (limited to 'src')
-rw-r--r--src/ui/listwidget.c4
-rw-r--r--src/ui/touch.c23
-rw-r--r--src/ui/window.c5
3 files changed, 21 insertions, 11 deletions
diff --git a/src/ui/listwidget.c b/src/ui/listwidget.c
index 2130400c..fe53c595 100644
--- a/src/ui/listwidget.c
+++ b/src/ui/listwidget.c
@@ -26,6 +26,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
26#include "util.h" 26#include "util.h"
27#include "command.h" 27#include "command.h"
28#include "visbuf.h" 28#include "visbuf.h"
29#include "app.h"
29 30
30#include <the_Foundation/intset.h> 31#include <the_Foundation/intset.h>
31 32
@@ -136,6 +137,9 @@ void updateVisible_ListWidget(iListWidget *d) {
136 137
137void setItemHeight_ListWidget(iListWidget *d, int itemHeight) { 138void setItemHeight_ListWidget(iListWidget *d, int itemHeight) {
138 d->itemHeight = itemHeight; 139 d->itemHeight = itemHeight;
140 if (deviceType_App() != desktop_AppDeviceType) {
141 d->itemHeight += gap_UI;
142 }
139 invalidate_ListWidget(d); 143 invalidate_ListWidget(d);
140} 144}
141 145
diff --git a/src/ui/touch.c b/src/ui/touch.c
index 8c39793e..505b85f9 100644
--- a/src/ui/touch.c
+++ b/src/ui/touch.c
@@ -102,6 +102,17 @@ static iBool isStationary_Touch_(const iTouch *d) {
102 length_F3(sub_F3(d->pos[0], d->startPos)) < tapRadiusPt_ * get_Window()->pixelRatio; 102 length_F3(sub_F3(d->pos[0], d->startPos)) < tapRadiusPt_ * get_Window()->pixelRatio;
103} 103}
104 104
105static void dispatchMotion_Touch_(iFloat3 pos, int buttonState) {
106 dispatchEvent_Widget(get_Window()->root, (SDL_Event *) &(SDL_MouseMotionEvent){
107 .type = SDL_MOUSEMOTION,
108 .timestamp = SDL_GetTicks(),
109 .which = SDL_TOUCH_MOUSEID,
110 .state = buttonState,
111 .x = x_F3(pos),
112 .y = y_F3(pos)
113 });
114}
115
105static void dispatchClick_Touch_(const iTouch *d, int button) { 116static void dispatchClick_Touch_(const iTouch *d, int button) {
106 const iFloat3 tapPos = d->pos[0]; 117 const iFloat3 tapPos = d->pos[0];
107 SDL_MouseButtonEvent btn = { 118 SDL_MouseButtonEvent btn = {
@@ -120,6 +131,7 @@ static void dispatchClick_Touch_(const iTouch *d, int button) {
120 btn.state = SDL_RELEASED; 131 btn.state = SDL_RELEASED;
121 btn.timestamp = SDL_GetTicks(); 132 btn.timestamp = SDL_GetTicks();
122 dispatchEvent_Widget(get_Window()->root, (SDL_Event *) &btn); 133 dispatchEvent_Widget(get_Window()->root, (SDL_Event *) &btn);
134 dispatchMotion_Touch_(zero_F3(), 0);
123} 135}
124 136
125static void clearWidgetMomentum_TouchState_(iTouchState *d, iWidget *widget) { 137static void clearWidgetMomentum_TouchState_(iTouchState *d, iWidget *widget) {
@@ -188,17 +200,6 @@ static void update_TouchState_(void *ptr) {
188 } 200 }
189} 201}
190 202
191static void dispatchMotion_Touch_(iFloat3 pos, int buttonState) {
192 dispatchEvent_Widget(get_Window()->root, (SDL_Event *) &(SDL_MouseMotionEvent){
193 .type = SDL_MOUSEMOTION,
194 .timestamp = SDL_GetTicks(),
195 .which = SDL_TOUCH_MOUSEID,
196 .state = buttonState,
197 .x = x_F3(pos),
198 .y = y_F3(pos)
199 });
200}
201
202static void dispatchButtonUp_Touch_(iFloat3 pos) { 203static void dispatchButtonUp_Touch_(iFloat3 pos) {
203 dispatchEvent_Widget(get_Window()->root, (SDL_Event *) &(SDL_MouseButtonEvent){ 204 dispatchEvent_Widget(get_Window()->root, (SDL_Event *) &(SDL_MouseButtonEvent){
204 .type = SDL_MOUSEBUTTONUP, 205 .type = SDL_MOUSEBUTTONUP,
diff --git a/src/ui/window.c b/src/ui/window.c
index c096c00b..4d6a197a 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -540,6 +540,11 @@ static iBool handleNavBarCommands_(iWidget *navBar, const char *cmd) {
540 iInputWidget *url = findChild_Widget(navBar, "url"); 540 iInputWidget *url = findChild_Widget(navBar, "url");
541 setTextCStr_InputWidget(url, suffixPtr_Command(cmd, "url")); 541 setTextCStr_InputWidget(url, suffixPtr_Command(cmd, "url"));
542 checkLoadAnimation_Window_(get_Window()); 542 checkLoadAnimation_Window_(get_Window());
543 if (deviceType_App() == phone_AppDeviceType && isPortrait_App()) {
544 if (isVisible_Widget(findWidget_App("sidebar"))) {
545 postCommand_App("sidebar.toggle");
546 }
547 }
543 return iFalse; 548 return iFalse;
544 } 549 }
545 } 550 }