summaryrefslogtreecommitdiff
path: root/src/ui/util.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-03-10 12:37:09 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-03-10 12:37:09 +0200
commit8670b7d2e6e4c6063bc86b24998721a3726949d6 (patch)
treef6175e9209b7ea5479e826bd2023bf3b5749e418 /src/ui/util.c
parentd36529d053f7e4f2915e51e7cfbf01aa1c80adf9 (diff)
Edge-dragging preference panels
Diffstat (limited to 'src/ui/util.c')
-rw-r--r--src/ui/util.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/ui/util.c b/src/ui/util.c
index 0d34658e..826a965c 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -607,11 +607,12 @@ void closeMenu_Widget(iWidget *d) {
607 postRefresh_App(); 607 postRefresh_App();
608 postCommand_Widget(d, "menu.closed"); 608 postCommand_Widget(d, "menu.closed");
609 if (isPortrait_App() && deviceType_App() == phone_AppDeviceType) { 609 if (isPortrait_App() && deviceType_App() == phone_AppDeviceType) {
610 const iBool wasDragged = iAbs(value_Anim(&d->visualOffset) - 0) > 1;
610 setVisualOffset_Widget(d, 611 setVisualOffset_Widget(d,
611 flags_Widget(d) & horizontalOffset_WidgetFlag ? 612 flags_Widget(d) & horizontalOffset_WidgetFlag ?
612 width_Widget(d) : height_Widget(d), 613 width_Widget(d) : height_Widget(d),
613 200, 614 wasDragged ? 100 : 200,
614 easeIn_AnimFlag | softer_AnimFlag); 615 wasDragged ? 0 : easeIn_AnimFlag | softer_AnimFlag);
615 } 616 }
616} 617}
617 618
@@ -904,7 +905,7 @@ static iBool slidePanelHandler_(iWidget *d, const char *cmd) {
904 iWidget *button = pointer_Command(cmd); 905 iWidget *button = pointer_Command(cmd);
905 iWidget *panel = userData_Object(button); 906 iWidget *panel = userData_Object(button);
906 openMenu_Widget(panel, zero_I2()); 907 openMenu_Widget(panel, zero_I2());
907 updateTextCStr_LabelWidget(findWidget_App("panel.back"), "Settings"); 908// updateTextCStr_LabelWidget(findWidget_App("panel.back"), "");
908 return iTrue; 909 return iTrue;
909 } 910 }
910 if (equal_Command(cmd, "mouse.clicked") && arg_Command(cmd) && 911 if (equal_Command(cmd, "mouse.clicked") && arg_Command(cmd) &&
@@ -912,25 +913,6 @@ static iBool slidePanelHandler_(iWidget *d, const char *cmd) {
912 postCommand_App("panel.close"); 913 postCommand_App("panel.close");
913 return iTrue; 914 return iTrue;
914 } 915 }
915 if (equal_Command(cmd, "window.resized")) {
916 iWidget *sheet = parent_Widget(d);
917#if defined (iPlatformAppleMobile)
918 float left, top, right, bottom;
919 safeAreaInsets_iOS(&left, &top, &right, &bottom);
920 /* TODO: incorrect */
921 if (isLandscape_App()) {
922 setPadding_Widget(sheet, left, 0, right, 0);
923 }
924 else {
925 setPadding1_Widget(sheet, 0);
926 }
927#endif
928 }
929 if (equal_Command(cmd, "panel.showhelp")) {
930 postCommand_App("prefs.dismiss");
931 postCommand_App("open url:about:help");
932 return iTrue;
933 }
934 if (equal_Command(cmd, "panel.close")) { 916 if (equal_Command(cmd, "panel.close")) {
935 iBool wasClosed = iFalse; 917 iBool wasClosed = iFalse;
936 iForEach(ObjectList, i, children_Widget(parent_Widget(d))) { 918 iForEach(ObjectList, i, children_Widget(parent_Widget(d))) {
@@ -947,7 +929,25 @@ static iBool slidePanelHandler_(iWidget *d, const char *cmd) {
947 } 929 }
948 return iTrue; 930 return iTrue;
949 } 931 }
950 return iFalse; 932 if (equal_Command(cmd, "panel.showhelp")) {
933 postCommand_App("prefs.dismiss");
934 postCommand_App("open url:about:help");
935 return iTrue;
936 }
937 if (equal_Command(cmd, "window.resized")) {
938 iWidget *sheet = parent_Widget(d);
939#if defined (iPlatformAppleMobile)
940 float left, top, right, bottom;
941 safeAreaInsets_iOS(&left, &top, &right, &bottom);
942 /* TODO: incorrect */
943 if (isLandscape_App()) {
944 setPadding_Widget(sheet, left, 0, right, 0);
945 }
946 else {
947 setPadding1_Widget(sheet, 0);
948 }
949#endif
950 } return iFalse;
951} 951}
952 952
953static iBool isTwoColumnPage_(iWidget *d) { 953static iBool isTwoColumnPage_(iWidget *d) {