eternal_lands: bump version

This commit is contained in:
Gerasim Troeglazov
2025-04-23 11:41:21 +10:00
parent d50eb5ee0f
commit f98232d3e6
2 changed files with 223 additions and 108 deletions

View File

@@ -17,18 +17,17 @@ minute on a cable modem, and a few minutes on a DSL connection.
* Eternal Lands is a multiplatform game, running on Windows, Linux, Haiku and OSX (Mac). \
The client is open source.."
HOMEPAGE="http://www.eternal-lands.com/"
COPYRIGHT="2003-2021 Eternal Lands Team"
COPYRIGHT="2003-2024 Eternal Lands Team"
LICENSE="ELCPL 1.0"
REVISION="1"
srcGitRev="eadf3ac8cd24ab925391c3dcb27015cc3e81c452"
SOURCE_URI="https://github.com/raduprv/Eternal-Lands/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="a439ae0a40fdde703a367071387d65714b605e9b4e0802ced0d62627580325f5"
SOURCE_DIR="Eternal-Lands-$srcGitRev"
SOURCE_URI_2="https://github.com/raduprv/Eternal-Lands/releases/download/1.9.5.7/el_195_p7_data_files.zip"
CHECKSUM_SHA256_2="32fc28333058955f1b1c11e21ee514d9596743ee6a3628c3bbbba2e4de7d533f"
SOURCE_URI_3="http://www.gm.fh-koeln.de/~linke/EL-Downloads/EL_sound_191.zip"
CHECKSUM_SHA256_3="94dfcb37ab85f154fa33309a7bf10ca9998a68c5865f85f3d31797625da18f86"
SOURCE_URI_4="http://www.gm.fh-koeln.de/~linke/EL-Downloads/EL_music_full.zip"
SOURCE_URI="https://github.com/raduprv/Eternal-Lands/archive/refs/tags/${portVersion}-4.tar.gz"
CHECKSUM_SHA256="3cb78a0057b6621d47c55cca75c668b293b1042b05bf93cb46e24165b5754560"
SOURCE_DIR="Eternal-Lands-${portVersion}-4"
SOURCE_URI_2="https://github.com/raduprv/Eternal-Lands/releases/download/${portVersion}-4/eternallands-data_1.9.7.zip"
CHECKSUM_SHA256_2="2ab4d5549ee66da6bdb10bc86d9dd4ac7ca578aafb291111b330fae8d4c77f98"
SOURCE_URI_3="https://github.com/raduprv/Eternal-Lands/releases/download/${portVersion}-4/eternallands-sound_1.9.6.1.zip"
CHECKSUM_SHA256_3="e8dc68698b42256cb3c69935f892336e2c5de4002b9bef2c21af2124a5274e3f"
SOURCE_URI_4="https://github.com/raduprv/Eternal-Lands/releases/download/${portVersion}-4/eternallands-music_1.9.5.9.zip"
CHECKSUM_SHA256_4="1ea4de25081034ac684aaebf127ab6ca8524ba5367532863d84d63837dd631ec"
PATCHES="eternal_lands-$portVersion.patchset"
@@ -44,6 +43,7 @@ PROVIDES="
REQUIRES="
haiku$secondaryArchSuffix
lib:libcal3d$secondaryArchSuffix
lib:libcrypto$secondaryArchSuffix
lib:libGL$secondaryArchSuffix
lib:libGLU$secondaryArchSuffix
lib:libiconv$secondaryArchSuffix
@@ -55,6 +55,7 @@ REQUIRES="
lib:libSDL2_image_2.0$secondaryArchSuffix
lib:libSDL2_net_2.0$secondaryArchSuffix
lib:libSDL2_ttf_2.0$secondaryArchSuffix
lib:libssl$secondaryArchSuffix
lib:libvorbis$secondaryArchSuffix
lib:libvorbisfile$secondaryArchSuffix
lib:libxml2$secondaryArchSuffix
@@ -75,6 +76,7 @@ BUILD_REQUIRES="
devel:libSDL2_image$secondaryArchSuffix
devel:libSDL2_net$secondaryArchSuffix
devel:libSDL2_ttf$secondaryArchSuffix
devel:libssl$secondaryArchSuffix >= 3
devel:libvorbis$secondaryArchSuffix
devel:libvorbisfile$secondaryArchSuffix
devel:libxml2$secondaryArchSuffix
@@ -95,6 +97,7 @@ BUILD()
cd build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_SKIP_RPATH=ON \
-DSDL2_INCLUDE_DIR=/system/$relativeIncludeDir \
-DSDL2TTF_INCLUDE_DIR=/system/$relativeIncludeDir \
-DFSAA=OFF
@@ -110,8 +113,7 @@ INSTALL()
cp $sourceDir4/* $appsDir/EternalLands/music
cp build/EternalLands $appsDir/EternalLands
cp dev-data-files/cursors2.dds $appsDir/EternalLands/textures
cp dev-data-files/{item_info.txt,item_knowledge_info.txt,main_icon_window.xml} $appsDir/EternalLands
cp -f dev-data-files/sound/* $appsDir/EternalLands/sound
local APP_SIGNATURE="application/x-vnd.eternal-lands"
local MAJOR="`echo "$portVersion" | cut -d. -f1`"

View File

@@ -1,15 +1,15 @@
From 11119f83ed7502365369053c6d0e27595369a542 Mon Sep 17 00:00:00 2001
From 56771272aab3d04a7c1b713d7e6164ebe6d9d8b4 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sun, 28 Feb 2021 16:27:10 +1000
Date: Wed, 23 Apr 2025 11:29:53 +1000
Subject: Fix build for Haiku
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9579a43..de9c108 100644
index 8996fe6..2c51ac9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -119,7 +119,7 @@ find_package(LibXml2 REQUIRED)
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
@@ -123,7 +123,7 @@ find_package(LibXml2 REQUIRED)
if (CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
find_package(X11 REQUIRED)
endif()
-if (CMAKE_SYSTEM_NAME MATCHES "Windows")
@@ -17,7 +17,7 @@ index 9579a43..de9c108 100644
find_package(Iconv REQUIRED)
endif()
# these definitions were re-used from Xapher's opengl client
@@ -243,6 +243,11 @@ if (CMAKE_SYSTEM_NAME MATCHES "Linux")
@@ -261,6 +261,11 @@ if (CMAKE_SYSTEM_NAME MATCHES "Linux")
set(EXEC "el.linux.bin")
endif()
add_definitions(-DLINUX)
@@ -29,11 +29,21 @@ index 9579a43..de9c108 100644
elseif (CMAKE_SYSTEM_NAME MATCHES "Windows")
if (NOT EXEC)
set(EXEC "el")
@@ -357,6 +362,9 @@ if (USE_SSL)
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
target_link_libraries(${EXEC} -lws2_32)
endif()
+ if (HAIKU)
+ target_link_libraries(${EXEC} -lnetwork)
+ endif()
target_link_libraries(${EXEC} ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY})
endif()
diff --git a/consolewin.c b/consolewin.c
index 2b410f3..35768d3 100644
index 6d6fd0d..e67912f 100644
--- a/consolewin.c
+++ b/consolewin.c
@@ -279,7 +279,7 @@ static int click_console_handler(window_info *win, int mx, int my, Uint32 flags)
@@ -321,7 +321,7 @@ static int click_console_handler(window_info *win, int mx, int my, Uint32 flags)
if (hud_click(win, mx, my, flags))
return 1;
@@ -43,20 +53,22 @@ index 2b410f3..35768d3 100644
if ( (flags & ELW_MID_MOUSE) )
{
diff --git a/elconfig.c b/elconfig.c
index d14c4fe..78c71ff 100644
old mode 100755
new mode 100644
index 99221f8..73b0fc9
--- a/elconfig.c
+++ b/elconfig.c
@@ -2663,7 +2663,7 @@ static void init_ELC_vars(void)
@@ -3001,7 +3001,7 @@ static void init_ELC_vars(void)
add_var(OPT_BOOL, "continent_map_boundaries", "cmb", &show_continent_map_boundaries, change_var, 1, "Map Boundaries On Continent Map", "Show map boundaries on the continent map", HUD);
add_var(OPT_BOOL,"enable_user_menus", "user_menus", &enable_user_menus, toggle_user_menus, 0, "Enable User Menus","Create .menu files in your config directory. First line is the menu name. After that, each line is a command using the format \"Menus Text || command || command\". Prompt for input using \"command text <prompt text>\".",HUD);
add_var(OPT_BOOL,"console_scrollbar_enabled", "console_scrollbar", &console_scrollbar_enabled, toggle_console_scrollbar, 1, "Show Console Scrollbar","If enabled, a scrollbar will be shown in the console window.",HUD);
-#if !defined(WINDOWS) && !defined(OSX)
+#if !defined(WINDOWS) && !defined(OSX) && !defined(HAIKU)
-#if !defined(WINDOWS) && !defined(OSX) && !defined(ANDROID)
+#if !defined(WINDOWS) && !defined(OSX) && !defined(ANDROID) && !defined(HAIKU)
add_var(OPT_BOOL,"use_clipboard","uclb",&use_clipboard, change_var, 1, "Use Clipboard For Pasting", "Use CLIPBOARD for pasting (as e.g. GNOME does) or use PRIMARY cutbuffer (as xterm does)",HUD);
#endif
@@ -2775,9 +2775,9 @@ static void init_ELC_vars(void)
add_var(OPT_FLOAT,"chat_win_scale","chatwinscale",get_scale_WM(MW_CHAT),change_win_scale_factor,1.0f,"Chat window scaling factor",win_scale_description,FONT,win_scale_min,win_scale_max,win_scale_step);
@@ -3126,9 +3126,9 @@ static void init_ELC_vars(void)
add_var(OPT_FLOAT,"chancols_win_scale","chancolswinscale",get_scale_WM(MW_CHANCOLS),change_win_scale_factor,1.0f,"Chat channel colours window scaling factor",win_scale_description,FONT,win_scale_min,win_scale_max,win_scale_step);
add_var(OPT_FLOAT,"options_win_scale","optionswinscale",&elconf_custom_scale,change_elconf_win_scale_factor,1.0f,"Options window scaling factor","Multiplied by the user interface scaling factor. Change will take effect after closing then reopening the window.",FONT,win_scale_min,win_scale_max,win_scale_step);
#ifdef NEW_CURSOR
- add_var(OPT_BOOL,"sdl_cursors","sdl_cursors", &sdl_cursors, change_sdl_cursor,1,"Use Standard Black/White Mouse Pointers", "When disabled, use the experimental coloured mouse pointers. Needs the texture from Git dev-data-files/cursor2.dss.", FONT);
@@ -66,34 +78,33 @@ index d14c4fe..78c71ff 100644
+ add_var(OPT_BOOL,"big_cursors","big_cursors", &big_cursors, change_var,1,"Use Large Pointers", "When using the experiment coloured mouse pointers, use the large pointer set.", FONT);
+ add_var(OPT_FLOAT,"pointer_size","pointer_size", &pointer_size, change_float,2.5,"Coloured Pointer Size", "When using the experiment coloured mouse pointers, set the scale of the pointer. 1.0 is 1:1 scale.", FONT,0.25,4.0,0.05);
#endif // NEW_CURSOR
// FONT TAB
@@ -2937,7 +2937,9 @@ static void init_ELC_vars(void)
// default fonts
add_var(OPT_STRING_INI,"def_ui_font", "def_ui_font", def_ui_font_str, change_string, sizeof(def_ui_font_str), "def_ui_font", "Default font for UI", FONT);
@@ -3320,7 +3320,9 @@ static void init_ELC_vars(void)
add_var(OPT_BOOL,"shadows_on","shad",&shadows_on,change_shadows,0,"Shadow Bug","Some video cards have trouble with the shadows. Uncheck this if everything you see is white.", TROUBLESHOOT);
// Grum: attempt to work around bug in Ati linux drivers.
add_var(OPT_BOOL,"ati_click_workaround", "atibug", &ati_click_workaround, change_var, 0, "ATI Bug", "If you are using an ATI graphics card and don't move when you click, try this option to work around a bug in their drivers.", TROUBLESHOOT);
- add_var (OPT_BOOL,"use_old_clicker", "oldmclick", &use_old_clicker, change_var, 0, "Mouse Bug", "Unrelated to ATI graphics cards, if clicking to walk doesn't move you, try toggling this option.", TROUBLESHOOT);
+#ifndef HAIKU
+ add_var (OPT_BOOL,"use_old_clicker", "oldmclick", &use_old_clicker, change_var, 1, "Mouse Bug", "Unrelated to ATI graphics cards, if clicking to walk doesn't move you, try toggling this option.", TROUBLESHOOT);
add_var (OPT_BOOL,"use_old_clicker", "oldmclick", &use_old_clicker, change_var, 0, "Mouse Bug", "Unrelated to ATI graphics cards, if clicking to walk doesn't move you, try toggling this option.", TROUBLESHOOT);
+#endif
#endif
add_var(OPT_BOOL,"use_new_selection", "uns", &use_new_selection, change_new_selection, 1, "New selection", "Using new selection can give you a higher framerate. However, if your cursor does not change when over characters or items, try disabling this option.", TROUBLESHOOT);
add_var(OPT_BOOL,"clear_mod_keys_on_focus", "clear_mod_keys_on_focus", &clear_mod_keys_on_focus, change_var, 0, "Clear modifier keys when window focused","If you have trouble with modifier keys (shift/ctrl/alt etc) when keyboard focus returns, enable this option to force all modifier keys up.", TROUBLESHOOT);
add_var(OPT_BOOL,"use_compiled_vertex_array","cva",&use_compiled_vertex_array,change_compiled_vertex_array,1,"Compiled Vertex Array","Some systems will not support the new compiled vertex array in EL. Disable this if some 3D objects do not display correctly.",TROUBLESHOOT);
diff --git a/events.c b/events.c
index 53ad5a1..51db744 100644
index f787812..45e548e 100644
--- a/events.c
+++ b/events.c
@@ -207,7 +207,7 @@ int HandleEvent (SDL_Event *event)
switch( event->type )
{
@@ -286,7 +286,7 @@ int HandleEvent (SDL_Event *event)
break;
#endif
-#if !defined(WINDOWS) && !defined(OSX)
+#if !defined(WINDOWS) && !defined(OSX) && !defined(HAIKU)
-#if !defined(WINDOWS) && !defined(OSX) && !defined(ANDROID)
+#if !defined(WINDOWS) && !defined(OSX) && !defined(ANDROID) && !defined(HAIKU)
case SDL_SYSWMEVENT:
if (event->syswm.msg->msg.x11.event.type == SelectionNotify)
finishpaste(event->syswm.msg->msg.x11.event.xselection);
diff --git a/eye_candy/eye_candy.cpp b/eye_candy/eye_candy.cpp
index d30c326..6b8ecf3 100644
index 6e9a07e..a05c5c8 100644
--- a/eye_candy/eye_candy.cpp
+++ b/eye_candy/eye_candy.cpp
@@ -1748,8 +1748,8 @@ namespace ec
@@ -108,10 +119,10 @@ index d30c326..6b8ecf3 100644
void EyeCandy::set_thresholds(const int _max_particles,
diff --git a/font.cpp b/font.cpp
index 4db4a6a..64cac3e 100644
index 2fa8b60..93c229b 100644
--- a/font.cpp
+++ b/font.cpp
@@ -1839,6 +1839,8 @@ float *font_scales = FontManager::font_scales.data();
@@ -2054,6 +2054,8 @@ float *font_scales = FontManager::font_scales.data();
int use_ttf = 0;
#ifdef LINUX
char ttf_directory[TTF_DIR_SIZE] = "/usr/share/fonts/TTF";
@@ -119,12 +130,12 @@ index 4db4a6a..64cac3e 100644
+char ttf_directory[TTF_DIR_SIZE] = "/system/data/fonts/ttfonts";
#elif defined WINDOWS
char ttf_directory[TTF_DIR_SIZE] = "C:/Windows/Fonts";
#else
#elif defined ANDROID
diff --git a/gamewin.c b/gamewin.c
index 89f541a..fe0abc9 100644
index 034c201..96dc08c 100644
--- a/gamewin.c
+++ b/gamewin.c
@@ -63,7 +63,7 @@ int have_mouse = 0;
@@ -64,7 +64,7 @@ int have_mouse = 0;
int game_root_win = -1;
// configuration options exported
@@ -134,32 +145,32 @@ index 89f541a..fe0abc9 100644
int cm_banner_disabled = 0;
int auto_disable_ranging_lock = 1;
diff --git a/gl_init.c b/gl_init.c
index dbd5683..86ba511 100644
index b28b93f..757b934 100644
--- a/gl_init.c
+++ b/gl_init.c
@@ -307,7 +307,7 @@ void init_video(void)
@@ -472,7 +472,7 @@ void init_video(void)
last_texture = -1; //no active texture
video_mode_set = 1; //now you may set the video mode using the %<foo> in-game
-#if !defined OSX && !defined WINDOWS
+#if !defined OSX && !defined WINDOWS && !defined HAIKU
-#if !defined OSX && !defined WINDOWS && !defined ANDROID
+#if !defined OSX && !defined WINDOWS && !defined ANDROID && !defined HAIKU
init_x11_copy_paste();
#endif
diff --git a/io/elpathwrapper.c b/io/elpathwrapper.c
index 741461a..4a2ab8b 100644
index b35c1dd..758a502 100644
--- a/io/elpathwrapper.c
+++ b/io/elpathwrapper.c
@@ -59,6 +59,8 @@ static const char* cfgdirname = CONFIGDIR;
static const char* cfgdirname = "Library/Application\ Support/Eternal\ Lands";
@@ -66,6 +66,8 @@ static const char* cfgdirname = CONFIGDIR;
static const char* cfgdirname = "Library/Application Support/Eternal Lands";
#elif defined(WINDOWS)
static const char* cfgdirname = "Eternal Lands";
+#elif defined(HAIKU)
+static const char* cfgdirname = "config/settings/EternalLands";
#elif defined(ANDROID)
static const char* cfgdirname = "user";
#else /* *nix */
static const char* cfgdirname = ".elc";
#endif // platform check
@@ -856,6 +858,9 @@ int search_files_and_apply(const char* base_path, const char *pattern, void (*fn
@@ -913,6 +915,9 @@ int search_files_and_apply(const char* base_path, const char *pattern, void (*fn
while (1)
{
@@ -169,7 +180,7 @@ index 741461a..4a2ab8b 100644
struct dirent *entry;
errno = 0;
@@ -866,14 +871,22 @@ int search_files_and_apply(const char* base_path, const char *pattern, void (*fn
@@ -923,14 +928,22 @@ int search_files_and_apply(const char* base_path, const char *pattern, void (*fn
LOG_ERROR("Failed to read directory %s: %s\n", base_path, strerror(errno));
break;
}
@@ -194,24 +205,85 @@ index 741461a..4a2ab8b 100644
safe_snprintf(full_path, sizeof(full_path), "%s/%s", base_path, entry->d_name);
fn(full_path);
diff --git a/io/ioapi.h b/io/ioapi.h
index 5c6eeb6..430a7dd 100644
index 159f7ff..1d529b3 100644
--- a/io/ioapi.h
+++ b/io/ioapi.h
@@ -50,7 +50,7 @@
#include <stdlib.h>
#include "zlib.h"
-#if defined(USE_FILE32API) || defined(OSX)
+#if defined(USE_FILE32API) || defined(OSX) || defined(HAIKU)
-#if defined(USE_FILE32API) || defined(OSX) || defined(BSD)
+#if defined(USE_FILE32API) || defined(OSX) || defined(BSD) || defined(HAIKU)
#define fopen64 fopen
#define ftello64 ftell
#define fseeko64 fseek
diff --git a/main.c b/main.c
index 3647581..bb2068b 100644
--- a/main.c
+++ b/main.c
@@ -24,6 +24,10 @@
char *win_command_line;
#endif //WINDOWS
+#ifdef HAIKU
+#include <kernel/image.h>
+#endif
+
#include "2d_objects.h"
#include "3d_objects.h"
#include "actor_scripts.h"
@@ -552,6 +556,22 @@ void setupWorkingDirectory(const char *argv0, size_t len)
}
#endif
+#ifdef HAIKU
+void setupWorkingDirectory(const char *argv0, size_t len)
+{
+ int32 cookie = 0;
+ image_info info;
+ while (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) {
+ if (info.type == B_APP_IMAGE) {
+ char *last_slash = strrchr(info.name, '/');
+ *last_slash = '\0';
+ chdir(info.name);
+ break;
+ }
+ }
+}
+#endif
+
#ifdef WINDOWS
int Main(int argc, char **argv)
#else
@@ -561,7 +581,7 @@ int main(int argc, char **argv)
#ifdef ANDROID
initialize_gl4es();
#endif
-#ifdef OSX
+#if defined OSX || defined HAIKU
if (argc > 0) // should always be true
setupWorkingDirectory(argv[0], strlen(argv[0]));
#endif
diff --git a/new_update.c b/new_update.c
index 667e253..e5455ad 100644
--- a/new_update.c
+++ b/new_update.c
@@ -4,6 +4,9 @@
#ifdef WINDOWS
#include <sys/locking.h>
#endif // WINDOWS
+#ifdef HAIKU
+#include <fcntl.h>
+#endif
#include <time.h>
#include <SDL_net.h>
#include <SDL_thread.h>
diff --git a/paste.c b/paste.c
index 7e70c48..ae6040f 100644
index 9467913..58373fe 100755
--- a/paste.c
+++ b/paste.c
@@ -125,6 +125,16 @@ void copy_to_clipboard(const char* text)
}
@@ -137,6 +137,16 @@ void start_paste(widget_list *widget)
{
}
+#elif defined HAIKU
@@ -228,23 +300,25 @@ index 7e70c48..ae6040f 100644
static widget_list *paste_to_widget = NULL;
diff --git a/paste.h b/paste.h
index ed0ff1a..7f26aea 100644
index a1d8e2f..c644b7c 100644
--- a/paste.h
+++ b/paste.h
@@ -46,7 +46,7 @@ void copy_to_clipboard(const char* text);
void copy_to_primary(const char* text);
#endif
-#if !defined OSX && !defined WINDOWS
+#if !defined OSX && !defined WINDOWS && !defined HAIKU
-#if !defined OSX && !defined WINDOWS && !defined ANDROID
+#if !defined OSX && !defined WINDOWS && !defined ANDROID && !defined HAIKU
#include <X11/Xlib.h>
diff --git a/widgets.c b/widgets.c
index aa08a84..d4d7bfd 100644
old mode 100755
new mode 100644
index 2696bb0..300c6c8
--- a/widgets.c
+++ b/widgets.c
@@ -2516,7 +2516,7 @@ void _text_field_copy_to_clipboard(text_field *tf)
@@ -2546,7 +2546,7 @@ void _text_field_copy_to_clipboard(text_field *tf)
}
}
@@ -253,7 +327,7 @@ index aa08a84..d4d7bfd 100644
#ifdef MIDDLE_MOUSE_PASTE
void _text_field_copy_to_primary(text_field *tf)
{
@@ -2943,7 +2943,7 @@ void update_selection(int x, int y, widget_list* w, int drag)
@@ -2983,7 +2983,7 @@ void update_selection(int x, int y, widget_list* w, int drag)
// drag, set the end position
tf->select.em = tf->select.lines[line].msg;
tf->select.ec = col;
@@ -262,7 +336,7 @@ index aa08a84..d4d7bfd 100644
#ifdef MIDDLE_MOUSE_PASTE
_text_field_copy_to_primary(tf);
#endif
@@ -2976,7 +2976,7 @@ static void update_cursor_selection(widget_list* w, int update_end)
@@ -3016,7 +3016,7 @@ static void update_cursor_selection(widget_list* w, int update_end)
{
tf->select.em = tf->select.lines[line].msg;
tf->select.ec = tf->cursor;
@@ -271,7 +345,7 @@ index aa08a84..d4d7bfd 100644
#ifdef MIDDLE_MOUSE_PASTE
_text_field_copy_to_primary(tf);
#endif
@@ -3026,7 +3026,7 @@ static int text_field_click(widget_list *w, int mx, int my, Uint32 flags)
@@ -3068,7 +3068,7 @@ static int text_field_click(widget_list *w, int mx, int my, Uint32 flags)
_set_edit_pos(tf, mx, my, w->fcat);
@@ -280,48 +354,87 @@ index aa08a84..d4d7bfd 100644
#ifdef MIDDLE_MOUSE_PASTE
if (flags & ELW_MID_MOUSE)
start_paste_from_primary(w);
--
2.30.0
From 09455e2124abf1d2c8634fe45b3c4722358c19ee Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sun, 28 Feb 2021 16:43:59 +1000
Subject: Set resource dir
diff --git a/main.c b/main.c
index e303953..acc7d0a 100644
--- a/main.c
+++ b/main.c
@@ -521,13 +521,26 @@ void setupWorkingDirectory(const char *argv0, size_t len)
@@ -3682,7 +3682,7 @@ static void pword_insert(password_entry *entry, int pos, const unsigned char* te
pword_update_draw_range_after_insert(entry, cat, size, max_width);
}
#endif
+#ifdef HAIKU
+void setupWorkingDirectory(const char *argv0, size_t len)
+{
+ char *binpath = realpath(argv0, NULL);
+ if (binpath != NULL) {
+ char *appdir = strrchr(binpath, '/');
+ *appdir = '\0';
+ chdir(binpath);
+ free(binpath);
+ }
+}
+#endif
+
#ifdef WINDOWS
int Main(int argc, char **argv)
#else
int main(int argc, char **argv)
#endif
-#if !defined OSX && !defined WINDOWS
+#if !defined OSX && !defined WINDOWS && !defined HAIKU
#ifdef MIDDLE_MOUSE_PASTE
static void pword_field_copy_to_primary(const password_entry *entry)
{
-#ifdef OSX
+#if defined OSX || defined HAIKU
if (argc > 0) // should always be true
setupWorkingDirectory(argv[0], strlen(argv[0]));
@@ -3748,7 +3748,7 @@ static int pword_field_keypress(widget_list *w, int mx, int my, SDL_Keycode key_
}
--entry->cursor_pos;
pword_check_after_left_move(entry, w->fcat, w->size, max_width);
-#if !defined OSX && !defined WINDOWS
+#if !defined OSX && !defined WINDOWS && !defined HAIKU
#ifdef MIDDLE_MOUSE_PASTE
pword_field_copy_to_primary(entry);
#endif
@@ -3774,7 +3774,7 @@ static int pword_field_keypress(widget_list *w, int mx, int my, SDL_Keycode key_
}
++entry->cursor_pos;
pword_check_after_right_move(entry, w->fcat, w->size, max_width);
-#if !defined OSX && !defined WINDOWS
+#if !defined OSX && !defined WINDOWS && !defined HAIKU
#ifdef MIDDLE_MOUSE_PASTE
pword_field_copy_to_primary(entry);
#endif
@@ -3793,7 +3793,7 @@ static int pword_field_keypress(widget_list *w, int mx, int my, SDL_Keycode key_
entry->sel_begin = 0;
entry->cursor_pos = 0;
pword_check_after_left_move(entry, w->fcat, w->size, max_width);
-#if !defined OSX && !defined WINDOWS
+#if !defined OSX && !defined WINDOWS && !defined HAIKU
#ifdef MIDDLE_MOUSE_PASTE
pword_field_copy_to_primary(entry);
#endif
@@ -3811,7 +3811,7 @@ static int pword_field_keypress(widget_list *w, int mx, int my, SDL_Keycode key_
entry->sel_end = len;
entry->cursor_pos = len;
pword_check_after_right_move(entry, w->fcat, w->size, max_width);
-#if !defined OSX && !defined WINDOWS
+#if !defined OSX && !defined WINDOWS && !defined HAIKU
#ifdef MIDDLE_MOUSE_PASTE
pword_field_copy_to_primary(entry);
#endif
@@ -3829,7 +3829,7 @@ static int pword_field_keypress(widget_list *w, int mx, int my, SDL_Keycode key_
if (sel_text)
{
copy_to_clipboard(sel_text);
-#if !defined OSX && !defined WINDOWS
+#if !defined OSX && !defined WINDOWS && !defined HAIKU
#ifdef MIDDLE_MOUSE_PASTE
copy_to_primary(sel_text);
#endif
@@ -3846,7 +3846,7 @@ static int pword_field_keypress(widget_list *w, int mx, int my, SDL_Keycode key_
if (sel_text)
{
copy_to_clipboard(sel_text);
-#if !defined OSX && !defined WINDOWS
+#if !defined OSX && !defined WINDOWS && !defined HAIKU
#ifdef MIDDLE_MOUSE_PASTE
copy_to_primary(sel_text);
#endif
@@ -3992,7 +3992,7 @@ static int pword_field_click(widget_list *w, int mx, int my, Uint32 flags)
entry->cursor_pos = pword_pos_under_mouse(entry, mx, space, w->fcat, w->size);
entry->sel_begin = entry->sel_end = -1;
-#if !defined OSX && !defined WINDOWS
+#if !defined OSX && !defined WINDOWS && !defined HAIKU
#ifdef MIDDLE_MOUSE_PASTE
if (flags & ELW_MID_MOUSE)
start_paste_from_primary(w);
@@ -4029,7 +4029,7 @@ static int pword_field_drag(widget_list *w, int mx, int my, Uint32 flags, int dx
entry->sel_end = min2i(len, pos + 1);
}
-#if !defined OSX && !defined WINDOWS
+#if !defined OSX && !defined WINDOWS && !defined HAIKU
#ifdef MIDDLE_MOUSE_PASTE
pword_field_copy_to_primary(entry);
#endif
--
2.30.0
2.48.1