Did all the fixes to have dragndrop work on MOS

This commit is contained in:
George Sokianos 2024-05-23 19:39:06 +01:00
parent 2c0f92766f
commit d74688028c
5 changed files with 20 additions and 8 deletions

View File

@ -43,7 +43,7 @@ LiteXL: $(LiteXL_OBJ)
$(compiler) -c $< -o $*.o $(CFLAGS) $(INCPATH) $(DFLAGS) $(compiler) -c $< -o $*.o $(CFLAGS) $(INCPATH) $(DFLAGS)
src/main.o: src/main.c src/api/api.h src/rencache.h \ src/main.o: src/main.c src/api/api.h src/rencache.h \
src/renderer.h src/platform/morphos.h src/renderer.h src/platform/morphos.h src/platform/codesets.h
src/rencache.o: src/rencache.c src/rencache.o: src/rencache.c
@ -57,7 +57,7 @@ src/api/regex.o: src/api/regex.c
src/api/renderer.o: src/api/renderer.c src/api/renderer.o: src/api/renderer.c
src/api/system.o: src/api/system.c src/api/system.o: src/api/system.c src/platform/morphos.h
src/platform/morphos.o: src/platform/morphos.c src/platform/morphos.o: src/platform/morphos.c

View File

@ -230,10 +230,10 @@ https://git.walkero.gr/walkero/lite-xl/issues
# Changelog # Changelog
## [2.1.4r1] - future ## [2.1.4r1] - 2024-05-23
### Added ### Added
- Added the ability to open files and folders by drag 'n drop them on the - Added the ability to open files and folders by drag 'n drop them on the
LiteXL icon when this is on the AmiDock LiteXL icon when this is on the AmiDock (AmigaOS4) / Panel (MorphOS)
### Updated ### Updated
- Updated the code to the upstream 2.1.4 release - Updated the code to the upstream 2.1.4 release

View File

@ -8,7 +8,7 @@
#include <signal.h> #include <signal.h>
#if defined(__amigaos4__) || defined(__morphos__) #if defined(__amigaos4__) || defined(__morphos__)
#define VSTRING "Lite XL 2.1.3r2 (18.03.2024)" #define VSTRING "Lite XL 2.1.4r1 (23.05.2024)"
#define VERSTAG "\0$VER: " VSTRING #define VERSTAG "\0$VER: " VSTRING
#endif #endif
@ -26,6 +26,7 @@
static CONST_STRPTR stack USED = "$STACK:102400"; static CONST_STRPTR stack USED = "$STACK:102400";
static CONST_STRPTR version USED = VERSTAG; static CONST_STRPTR version USED = VERSTAG;
#elif defined(__morphos__) #elif defined(__morphos__)
#include <workbench/startup.h>
#include "platform/codesets.h" #include "platform/codesets.h"
#include "platform/morphos.h" #include "platform/morphos.h"
unsigned long __stack = 1000000; unsigned long __stack = 1000000;
@ -224,7 +225,7 @@ init_lua:
lua_pushstring(L, argv[i]); lua_pushstring(L, argv[i]);
lua_rawseti(L, -2, i + 1); lua_rawseti(L, -2, i + 1);
} }
#if defined(__amigaos4__) #if defined(__amigaos4__) || defined(__morphos__)
if (!argc) if (!argc)
{ {
struct WBStartup *wbs = (struct WBStartup *)argv; struct WBStartup *wbs = (struct WBStartup *)argv;
@ -233,7 +234,7 @@ init_lua:
char result[MAX_DOS_PATH]; char result[MAX_DOS_PATH];
for (int i = 0; i < wbs->sm_NumArgs; i++) { for (int i = 0; i < wbs->sm_NumArgs; i++) {
getFullPathFromLock(wbs->sm_ArgList[i].wa_Lock, result); getFullPathFromLock(wbs->sm_ArgList[i].wa_Lock, result);
if (result[strlen(result) -1] == ':') if (result[strlen(result) - 1] == ':')
strcat(result, wbs->sm_ArgList[i].wa_Name); strcat(result, wbs->sm_ArgList[i].wa_Name);
else else
sprintf(result, "%s/%s", result, wbs->sm_ArgList[i].wa_Name); sprintf(result, "%s/%s", result, wbs->sm_ArgList[i].wa_Name);

View File

@ -4,7 +4,6 @@
#include <string.h> #include <string.h>
#include "morphos.h" #include "morphos.h"
#define MAX_DOS_NAME FILENAME_MAX
static BOOL getFullPath(const char *path, char *result) static BOOL getFullPath(const char *path, char *result)
{ {
@ -65,3 +64,12 @@ char *_fullpath(const char *path)
return NULL; return NULL;
} }
void getFullPathFromLock(BPTR lock, char *result)
{
if (lock)
{
NameFromLock(lock, result, MAX_DOS_PATH);
return;
}
}

View File

@ -5,6 +5,9 @@
#include <proto/exec.h> #include <proto/exec.h>
#include <locale.h> #include <locale.h>
#define MAX_DOS_NAME FILENAME_MAX
#define MAX_DOS_PATH 4000
char *_fullpath(const char *); char *_fullpath(const char *);
#endif #endif