*/}}
Explorar o código

Widget fixes for android

YimingWu hai 3 meses
pai
achega
a711c538d7
Modificáronse 3 ficheiros con 9 adicións e 7 borrados
  1. 4 3
      la_kernel.c
  2. 2 2
      resources/la_operators.c
  3. 3 2
      resources/la_widgets.c

+ 4 - 3
la_kernel.c

@@ -1254,6 +1254,9 @@ int laGetReadyWith(laInitArguments* ia){
 #endif
 #ifdef LA_LINUX
     dpi = la_GetDPI(DefaultRootWindow(MAIN.dpy));
+#endif
+#ifdef LAGUI_ANDROID
+    dpi = 144;
 #endif
     if((!dpi) || dpi<144){ dpi=144; } if(dpi>300){ dpi=300; }
     int UiSize=(int)(tnsLinearItp(16.0f,24.0f,tnsGetRatiod(96,144,dpi))+0.5);
@@ -8250,6 +8253,7 @@ static void la_AndroidCommandCallback(struct android_app *app, int32_t cmd){
             }
         }
         break;
+    case APP_CMD_DESTROY:
     case APP_CMD_TERM_WINDOW:
         // Detach OpenGL context and destroy discom.yiming.helloplay surface
         // NOTE 1: This case is used when the user exits the app without closing it. We detach the context to ensure everything is recoverable upon resuming.
@@ -8268,7 +8272,6 @@ static void la_AndroidCommandCallback(struct android_app *app, int32_t cmd){
         break;
     case APP_CMD_SAVE_STATE: break;
     case APP_CMD_STOP: break;
-    case APP_CMD_DESTROY: break;
     case APP_CMD_CONFIG_CHANGED:
     case APP_CMD_WINDOW_RESIZED:
         MAIN.AppWidth=ANativeWindow_getWidth(MAIN.app->window);
@@ -8571,8 +8574,6 @@ static int32_t la_AndroidInputCallback(struct android_app *app, AInputEvent *eve
             if(flags==AMOTION_EVENT_ACTION_HOVER_MOVE){
                 la_SendMouseEvent(0, LA_MOUSEMOVE, rx,ry);
             }
-        }else{
-            la_SendMouseEvent(0, LA_MOUSEMOVE, rx,ry);
         }
         if(!gesture_handled){
             if (flags == AMOTION_EVENT_ACTION_DOWN || flags == AMOTION_EVENT_ACTION_BUTTON_PRESS){

+ 2 - 2
resources/la_operators.c

@@ -23,7 +23,7 @@ extern struct _tnsMain *T;
 
 void la_PanelActiviatorParser(laStringSplitor *ss, uint32_t *IconID, char *DisplayString){
     char *StrArg;
-    if (ss->parts.pFirst){
+    if (ss && ss->parts.pFirst){
         if (StrArg = strGetArgumentString(ss, "text")){
             strCopyFull(DisplayString, StrArg);
         }else if (StrArg = strGetArgumentString(ss, "panel_id")){
@@ -1912,7 +1912,7 @@ int la_ScrollPanel(laGeneralUiExtraData*ex, laPanel*p, laEvent* e){
         ret= 1;
     }
     if(e->type==LA_M_MOUSE_UP){ ex->TargetIndexVali=0; }
-    if (e->type & LA_KEY_MOUSE_SCROLL || e->type==LA_M_MOUSE_DOWN){
+    if (e->type & LA_KEY_MOUSE_SCROLL || (e->type==LA_M_MOUSE_DOWN) || (e->type&LA_KEY_PANNING)){
         laUiItem *pui = 0; laListHandle levels={0}; int dir;
         if (e->type & LA_STATE_DOWN) dir=1;
         elif (e->type & LA_STATE_UP) dir=-1;

+ 3 - 2
resources/la_widgets.c

@@ -3191,8 +3191,9 @@ int OPMOD_Collection(laOperator *a, laEvent *e) {
             &ui->PP,
             &PP); // needed because layout can be switched after set active.
         char *cmd;
-        if ((!(cmd = strGetArgumentString(ui->Instructions, "feedback"))) ||
-            (!strSame(cmd, "NONE"))) {
+        if ((!(ui->Flags&LA_UI_FLAGS_NO_CONFIRM)) &&
+            ((!(cmd = strGetArgumentString(ui->Instructions, "feedback"))) ||
+             (!strSame(cmd, "NONE")))) {
             laConfirmPointer(a, uil->Instance, la_EnsureSubTarget(ui->PP.LastPs->p, uil->Instance), LA_CONFIRM_DATA);
         }
         laSetActiveInstance(ui->PP.LastPs->p, ui->PP.LastPs->UseInstance,