diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-02-26 16:16:53 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-02-26 16:16:53 +0100 |
commit | b3f740695a0199d22cd97aee314f06c7ae32d2ea (patch) | |
tree | 8221662bb578d80a7a044f8a20aef09394a5a1a8 /src | |
parent | d672dde584effd55702ee15efec4cb2a8c77bf85 (diff) |
patch 8.2.0320: no Haiku supportv8.2.0320
Problem: No Haiku support.
Solution: Add support for Haiku. (Emir Sari, closes #5605)
Diffstat (limited to 'src')
-rw-r--r-- | src/INSTALL | 2 | ||||
-rw-r--r-- | src/Makefile | 75 | ||||
-rwxr-xr-x | src/auto/configure | 89 | ||||
-rw-r--r-- | src/configure.ac | 38 | ||||
-rw-r--r-- | src/evalfunc.c | 6 | ||||
-rw-r--r-- | src/feature.h | 19 | ||||
-rw-r--r-- | src/fileio.c | 198 | ||||
-rw-r--r-- | src/globals.h | 2 | ||||
-rw-r--r-- | src/gui.c | 37 | ||||
-rw-r--r-- | src/gui.h | 23 | ||||
-rw-r--r-- | src/gui_haiku.cc | 5242 | ||||
-rw-r--r-- | src/gui_haiku.h | 51 | ||||
-rw-r--r-- | src/mbyte.c | 2 | ||||
-rw-r--r-- | src/menu.c | 2 | ||||
-rw-r--r-- | src/misc1.c | 16 | ||||
-rw-r--r-- | src/mouse.c | 2 | ||||
-rw-r--r-- | src/option.h | 5 | ||||
-rw-r--r-- | src/os_haiku.h | 37 | ||||
-rw-r--r-- | src/os_haiku.rdef | 143 | ||||
-rw-r--r-- | src/os_unix.c | 7 | ||||
-rw-r--r-- | src/os_unix.h | 30 | ||||
-rw-r--r-- | src/osdef1.h.in | 2 | ||||
-rw-r--r-- | src/proto.h | 3 | ||||
-rw-r--r-- | src/proto/gui_haiku.pro | 95 | ||||
-rw-r--r-- | src/pty.c | 2 | ||||
-rw-r--r-- | src/screen.c | 20 | ||||
-rw-r--r-- | src/structs.h | 7 | ||||
-rw-r--r-- | src/term.c | 5 | ||||
-rw-r--r-- | src/version.c | 6 | ||||
-rw-r--r-- | src/vim.h | 11 |
30 files changed, 6032 insertions, 145 deletions
diff --git a/src/INSTALL b/src/INSTALL index 3da9141d22..a404833c8d 100644 --- a/src/INSTALL +++ b/src/INSTALL @@ -16,7 +16,7 @@ See INSTALLvms.txt for VMS See INSTALLx.txt for cross-compiling on Unix See ../READMEdir/README_390.txt for z/OS and OS/390 Unix See ../runtime/doc/os_beos.txt for BeBox - +See ../runtime/doc/os_haiku.txt for Haiku 1. Generic ========== diff --git a/src/Makefile b/src/Makefile index e284530164..d66b270483 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1385,6 +1385,20 @@ CARBONGUI_BUNDLE = gui_bundle APPDIR = $(VIMNAME).app CARBONGUI_TESTARG = VIMPROG=../$(APPDIR)/Contents/MacOS/$(VIMTARGET) +### Haiku GUI +HAIKUGUI_SRC = gui.c gui_haiku.cc +HAIKUGUI_OBJ = objects/gui.o objects/gui_haiku.o +HAIKUGUI_DEFS = -DFEAT_GUI_HAIKU +HAIKUGUI_IPATH = +HAIKUGUI_LIBS_DIR = +HAIKUGUI_LIBS1 = -lbe -lroot -ltracker -ltranslation -lsupc++ -lstdc++ +HAIKUGUI_LIBS2 = +HAIKUGUI_INSTALL = install_normal install_haiku_extra +HAIKUGUI_TARGETS = installglinks_haiku +HAIKUGUI_MAN_TARGETS = +HAIKUGUI_TESTTARGET = gui +HAIKUGUI_BUNDLE = + # All GUI files ALL_GUI_SRC = gui.c gui_gtk.c gui_gtk_f.c gui_motif.c gui_xmdlg.c gui_xmebw.c gui_athena.c gui_gtk_x11.c gui_x11.c gui_at_sb.c gui_at_fs.c ALL_GUI_PRO = gui.pro gui_gtk.pro gui_motif.pro gui_xmdlg.pro gui_athena.pro gui_gtk_x11.pro gui_x11.pro gui_w32.pro gui_photon.pro @@ -3217,6 +3231,9 @@ objects/gui_gtk_gresources.o: auto/gui_gtk_gresources.c objects/gui_gtk_x11.o: gui_gtk_x11.c $(CCC) -o $@ gui_gtk_x11.c +objects/gui_haiku.o: gui_haiku.cc + $(CCC) -o $@ gui_haiku.cc + objects/gui_motif.o: gui_motif.c $(CCC) -o $@ gui_motif.c @@ -3349,6 +3366,9 @@ objects/os_beos.o: os_beos.c objects/os_qnx.o: os_qnx.c $(CCC) -o $@ os_qnx.c +objects/os_haiku.rsrc: os_haiku.rdef + cat $< | $(CCC) -E - | grep -v '^#' | rc -o "$@" - + objects/os_macosx.o: os_macosx.m $(CCC) -o $@ os_macosx.m @@ -3617,6 +3637,61 @@ $(APPDIR)/Contents: objects/gui_gtk_x11.o: version.h ############################################################################### +# +# Haiku installation +# +# This rule: +# - add resources to already installed vim binary to avoid +# stripping them during install; +# - copy rgb.txt to runtime directory; +# - update system MIME database with info about vim application. +# +install_haiku_extra: $(DEST_BIN)/$(VIMTARGET) objects/os_haiku.rsrc + xres -o $(DEST_BIN)/$(VIMTARGET) objects/os_haiku.rsrc + $(INSTALL_DATA) $(SCRIPTSOURCE)/rgb.txt $(DEST_RT) + mimeset $(DEST_BIN)/$(VIMTARGET) + +# List of g*-links that should be replaced with shell script equivalents. +# This solves the problem of them from Tracker. +# +HAIKU_GLINKS = $(DEST_BIN)/$(GVIMTARGET) \ + $(DEST_BIN)/$(GVIEWTARGET) \ + $(DEST_BIN)/$(GVIMDIFFTARGET) \ + $(DEST_BIN)/$(RGVIMTARGET) \ + $(DEST_BIN)/$(RGVIEWTARGET) + +# This rule: +# - Replace gvim link with copy of vim binary. +# - Replace g*-links with shell script equivalents to solve the +# problem of calling them from Tracker, +# - Add icon resources to mentioned g*-link shell scripts +# - in case gui-less vim.con executable available use it. +# +installglinks_haiku: $(HAIKU_GLINKS) install_haiku_extra + @catattr -r "BEOS:ICON" $(DEST_BIN)/$(GVIMTARGET) > ~icon.attr + for i in $(HAIKU_GLINKS); do \ + rm $$i ; \ + echo "#!/bin/sh" > $$i ; \ + case $$i in \ + $(DEST_BIN)/$(GVIMTARGET)) \ + cp $(DEST_BIN)/$(VIMTARGET) $$i ; \ + if [ -f $(VIMTARGET).con ] ; then \ + $(STRIP) $(VIMTARGET).con ; \ + mv $(VIMTARGET).con $(DEST_BIN)/$(VIMTARGET) ; \ + fi ;; \ + $(DEST_BIN)/$(GVIEWTARGET)) printf "%s -R %c%c" $(GVIMTARGET) '$$' '*' >> $$i;; \ + $(DEST_BIN)/$(GVIMDIFFTARGET)) printf "%s -d %c%c" $(GVIMTARGET) '$$' '*' >> $$i;; \ + $(DEST_BIN)/$(RGVIMTARGET)) printf "%s -Z %c%c" $(GVIMTARGET) '$$' '*' >> $$i;; \ + $(DEST_BIN)/$(RGVIEWTARGET)) printf "%s -Z -R %c%c" $(GVIMTARGET) '$$' '*' >> $$i;; \ + *) printf "%s %c%c" $(GVIMTARGET) '$$' '*' >> $$i;; \ + esac ; \ + chmod $(BINMOD) $$i ; \ + addattr -f ~icon.attr -t \'VICN\' BEOS:ICON $$i ; \ + done + addattr -f ~icon.attr -t \'VICN\' BEOS:ICON $(DEST_BIN)/$(VIMNAME)tutor + @rm ~icon.attr + +############################################################################### ### (automatically generated by 'make depend') ### Dependencies: objects/arabic.o: arabic.c vim.h protodef.h auto/config.h feature.h os_unix.h \ diff --git a/src/auto/configure b/src/auto/configure index ff2739c86f..0a140eed8b 100755 --- a/src/auto/configure +++ b/src/auto/configure @@ -1501,7 +1501,7 @@ Optional Features: --disable-farsi Deprecated. --enable-xim Include XIM input support. --enable-fontset Include X fontset output support. - --enable-gui=OPTS X11 GUI. default=auto OPTS=auto/no/gtk2/gnome2/gtk3/motif/athena/neXtaw/photon/carbon + --enable-gui=OPTS X11 GUI. default=auto OPTS=auto/no/gtk2/gnome2/gtk3/motif/athena/neXtaw/haiku/photon/carbon --enable-gtk2-check If auto-select GUI, check for GTK+ 2 default=yes --enable-gnome-check If GTK GUI, check for GNOME default=no --enable-gtk3-check If auto-select GUI, check for GTK+ 3 default=yes @@ -4543,6 +4543,15 @@ $as_echo "yes" >&6; };; $as_echo "no" >&6; };; esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Haiku" >&5 +$as_echo_n "checking for Haiku... " >&6; } +case `uname` in + Haiku) HAIKU=yes; { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; };; + *) HAIKU=no; { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; };; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for QNX" >&5 $as_echo_n "checking for QNX... " >&6; } case `uname` in @@ -7714,7 +7723,55 @@ $as_echo "yes" >&6; } fi if test "$enable_channel" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lsocket" >&5 + + if test "x$HAIKU" = "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lnetwork" >&5 +$as_echo_n "checking for socket in -lnetwork... " >&6; } +if ${ac_cv_lib_network_socket+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lnetwork $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char socket (); +int +main () +{ +return socket (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_network_socket=yes +else + ac_cv_lib_network_socket=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_network_socket" >&5 +$as_echo "$ac_cv_lib_network_socket" >&6; } +if test "x$ac_cv_lib_network_socket" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBNETWORK 1 +_ACEOF + + LIBS="-lnetwork $LIBS" + +fi + + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lsocket" >&5 $as_echo_n "checking for socket in -lsocket... " >&6; } if ${ac_cv_lib_socket_socket+:} false; then : $as_echo_n "(cached) " >&6 @@ -7759,6 +7816,8 @@ _ACEOF fi + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5 $as_echo_n "checking for gethostbyname in -lnsl... " >&6; } if ${ac_cv_lib_nsl_gethostbyname+:} false; then : @@ -9034,7 +9093,7 @@ if test "x$with_x" = xno -a "x$with_x_arg" = xyes; then as_fn_error $? "could not configure X" "$LINENO" 5 fi -test "x$with_x" = xno -a "x$MACOS_X" != "xyes" -a "x$QNX" != "xyes" && enable_gui=no +test "x$with_x" = xno -a "x$HAIKU" != "xyes" -a "x$MACOS_X" != "xyes" -a "x$QNX" != "xyes" && enable_gui=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking --enable-gui argument" >&5 $as_echo_n "checking --enable-gui argument... " >&6; } @@ -9056,10 +9115,27 @@ SKIP_MOTIF=YES SKIP_ATHENA=YES SKIP_NEXTAW=YES SKIP_PHOTON=YES +SKIP_HAIKU=YES SKIP_CARBON=YES GUITYPE=NONE -if test "x$QNX" = "xyes" -a "x$with_x" = "xno" ; then +if test "x$HAIKU" = "xyes"; then + SKIP_HAIKU= + case "$enable_gui_canon" in + no) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no GUI support" >&5 +$as_echo "no GUI support" >&6; } + SKIP_HAIKU=YES ;; + yes|"") { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes - automatic GUI support" >&5 +$as_echo "yes - automatic GUI support" >&6; } ;; + auto) { $as_echo "$as_me:${as_lineno-$LINENO}: result: auto - automatic GUI support" >&5 +$as_echo "auto - automatic GUI support" >&6; } ;; + haiku) { $as_echo "$as_me:${as_lineno-$LINENO}: result: Haiku GUI support" >&5 +$as_echo "Haiku GUI support" >&6; } ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: Sorry, $enable_gui GUI is not supported" >&5 +$as_echo "Sorry, $enable_gui GUI is not supported" >&6; } + SKIP_HAIKU=YES ;; + esac +elif test "x$QNX" = "xyes" -a "x$with_x" = "xno" ; then SKIP_PHOTON= case "$enable_gui_canon" in no) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no GUI support" >&5 @@ -9283,6 +9359,7 @@ $as_echo "yes" >&6; }; SKIP_ATHENA=YES; SKIP_NEXTAW=YES; SKIP_PHOTON=YES; + SKIP_HAIKU=YES; SKIP_CARBON=YES fi @@ -10589,6 +10666,10 @@ $as_echo "GTK+ 2 GUI selected; fontset has been disabled" >&6; } enable_fontset="no" fi +if test -z "$SKIP_HAIKU"; then + GUITYPE=HAIKUGUI +fi + if test -z "$SKIP_PHOTON"; then GUITYPE=PHOTONGUI fi diff --git a/src/configure.ac b/src/configure.ac index fe2022802b..89ae06f739 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -154,6 +154,12 @@ case `uname` in *) BEOS=no; AC_MSG_RESULT(no);; esac +AC_MSG_CHECKING(for Haiku) +case `uname` in + Haiku) HAIKU=yes; AC_MSG_RESULT(yes);; + *) HAIKU=no; AC_MSG_RESULT(no);; +esac + dnl If QNX is found, assume we don't want to use Xphoton dnl unless it was specifically asked for (--with-x) AC_MSG_CHECKING(for QNX) @@ -2033,7 +2039,13 @@ fi if test "$enable_channel" = "yes"; then dnl On Solaris we need the socket and nsl library. - AC_CHECK_LIB(socket, socket) + + if test "x$HAIKU" = "xyes"; then + AC_CHECK_LIB(network, socket) + else + AC_CHECK_LIB(socket, socket) + fi + AC_CHECK_LIB(nsl, gethostbyname) AC_MSG_CHECKING(whether compiling with process communication is possible) AC_TRY_LINK([ @@ -2311,11 +2323,11 @@ if test "x$with_x" = xno -a "x$with_x_arg" = xyes; then AC_MSG_ERROR([could not configure X]) fi -test "x$with_x" = xno -a "x$MACOS_X" != "xyes" -a "x$QNX" != "xyes" && enable_gui=no +test "x$with_x" = xno -a "x$HAIKU" != "xyes" -a "x$MACOS_X" != "xyes" -a "x$QNX" != "xyes" && enable_gui=no AC_MSG_CHECKING(--enable-gui argument) AC_ARG_ENABLE(gui, - [ --enable-gui[=OPTS] X11 GUI. [default=auto] [OPTS=auto/no/gtk2/gnome2/gtk3/motif/athena/neXtaw/photon/carbon]], , enable_gui="auto") + [ --enable-gui[=OPTS] X11 GUI. [default=auto] [OPTS=auto/no/gtk2/gnome2/gtk3/motif/athena/neXtaw/haiku/photon/carbon]], , enable_gui="auto") dnl Canonicalize the --enable-gui= argument so that it can be easily compared. dnl Do not use character classes for portability with old tools. @@ -2330,10 +2342,22 @@ SKIP_MOTIF=YES SKIP_ATHENA=YES SKIP_NEXTAW=YES SKIP_PHOTON=YES +SKIP_HAIKU=YES SKIP_CARBON=YES GUITYPE=NONE -if test "x$QNX" = "xyes" -a "x$with_x" = "xno" ; then +if test "x$HAIKU" = "xyes"; then + SKIP_HAIKU= + case "$enable_gui_canon" in + no) AC_MSG_RESULT(no GUI support) + SKIP_HAIKU=YES ;; + yes|"") AC_MSG_RESULT(yes - automatic GUI support) ;; + auto) AC_MSG_RESULT(auto - automatic GUI support) ;; + haiku) AC_MSG_RESULT(Haiku GUI support) ;; + *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported]) + SKIP_HAIKU=YES ;; + esac +elif test "x$QNX" = "xyes" -a "x$with_x" = "xno" ; then SKIP_PHOTON= case "$enable_gui_canon" in no) AC_MSG_RESULT(no GUI support) @@ -2499,6 +2523,7 @@ if test "x$MACOS_X" = "xyes" -a -z "$SKIP_CARBON" -a "x$CARBON" = "xyes"; then SKIP_ATHENA=YES; SKIP_NEXTAW=YES; SKIP_PHOTON=YES; + SKIP_HAIKU=YES; SKIP_CARBON=YES fi @@ -3112,6 +3137,11 @@ if test "x$GUITYPE:$enable_fontset" = "xGTK:yes"; then enable_fontset="no" fi +dnl There is no test for the Haiku GUI, if it's selected it's used +if test -z "$SKIP_HAIKU"; then + GUITYPE=HAIKUGUI +fi + if test -z "$SKIP_PHOTON"; then GUITYPE=PHOTONGUI fi diff --git a/src/evalfunc.c b/src/evalfunc.c index cad7a969f9..ff891eaa94 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -3264,6 +3264,9 @@ f_has(typval_T *argvars, typval_T *rettv) #ifdef __BEOS__ "beos", #endif +#ifdef __HAIKU__ + "haiku", +#endif #if defined(BSD) && !defined(MACOS_X) "bsd", #endif @@ -3450,6 +3453,9 @@ f_has(typval_T *argvars, typval_T *rettv) #ifdef FEAT_GUI_GNOME "gui_gnome", #endif +#ifdef FEAT_GUI_HAIKU + "gui_haiku", +#endif #ifdef FEAT_GUI_MAC "gui_mac", #endif diff --git a/src/feature.h b/src/feature.h index b25837e1f6..49175272f8 100644 --- a/src/feature.h +++ b/src/feature.h @@ -514,7 +514,11 @@ */ #if defined(FEAT_GUI_MSWIN) && !defined(FEAT_MBYTE_IME) // #define FEAT_MBYTE_IME -# endif +#endif + +#if defined(FEAT_BIG) && defined(FEAT_GUI_HAIKU) && !defined(FEAT_MBYTE_IME) +# define FEAT_MBYTE_IME +#endif // Use iconv() when it's available. #if (defined(HAVE_ICONV_H) && defined(HAVE_ICONV)) || defined(DYNAMIC_ICONV) @@ -604,7 +608,9 @@ || defined(FEAT_GUI_MSWIN) \ || ((defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA)) \ && defined(HAVE_XPM)) \ - || defined(FEAT_GUI_PHOTON)) + || defined(FEAT_GUI_PHOTON) \ + || defined(FEAT_GUI_HAIKU)) + # define FEAT_TOOLBAR #endif @@ -627,6 +633,7 @@ && (defined(FEAT_GUI_GTK) \ || (defined(FEAT_GUI_MOTIF) && defined(HAVE_XM_NOTEBOOK_H)) \ || defined(FEAT_GUI_MAC) \ + || defined(FEAT_GUI_HAIKU) \ || (defined(FEAT_GUI_MSWIN) \ && (!defined(_MSC_VER) || _MSC_VER > 1020))) # define FEAT_GUI_TABLINE @@ -638,7 +645,9 @@ */ #if defined(FEAT_NORMAL) # define FEAT_BROWSE_CMD -# if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_MAC) +# if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA) \ + || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_HAIKU) || defined(FEAT_GUI_PHOTON) \ + || defined(FEAT_GUI_MAC) # define FEAT_BROWSE # endif #endif @@ -663,6 +672,7 @@ && defined(HAVE_X11_XPM_H)) \ || defined(FEAT_GUI_GTK) \ || defined(FEAT_GUI_PHOTON) \ + || defined(FEAT_GUI_HAIKU) \ || defined(FEAT_GUI_MSWIN) \ || defined(FEAT_GUI_MAC) # define FEAT_CON_DIALOG @@ -680,7 +690,8 @@ #if defined(FEAT_GUI_DIALOG) && \ (defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA) \ || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MSWIN) \ - || defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_MAC)) + || defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_MAC) \ + || defined(FEAT_GUI_HAIKU)) # define FEAT_GUI_TEXTDIALOG # ifndef ALWAYS_USE_GUI # define FEAT_CON_DIALOG diff --git a/src/fileio.c b/src/fileio.c index e80009fbe1..6e66a3e862 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -3367,6 +3367,7 @@ shorten_fnames(int force) #if (defined(FEAT_DND) && defined(FEAT_GUI_GTK)) \ || defined(FEAT_GUI_MSWIN) \ || defined(FEAT_GUI_MAC) \ + || defined(FEAT_GUI_HAIKU) \ || defined(PROTO) /* * Shorten all filenames in "fnames[count]" by current directory. @@ -4422,130 +4423,133 @@ readdir_core( void *context, int (*checkitem)(void *context, char_u *name)) { - int failed = FALSE; -# ifdef MSWIN - char_u *buf, *p; - int ok; - HANDLE hFind = INVALID_HANDLE_VALUE; - WIN32_FIND_DATAW wfb; - WCHAR *wn = NULL; // UTF-16 name, NULL when not used. -# endif + int failed = FALSE; + char_u *p; ga_init2(gap, (int)sizeof(char *), 20); # ifdef MSWIN - buf = alloc(MAXPATHL); - if (buf == NULL) - return FAIL; - STRNCPY(buf, path, MAXPATHL-5); - p = buf + STRLEN(buf); - MB_PTR_BACK(buf, p); - if (*p == '\\' || *p == '/') - *p = NUL; - STRCAT(buf, "\\*"); - - wn = enc_to_utf16(buf, NULL); - if (wn != NULL) - hFind = FindFirstFileW(wn, &wfb); - ok = (hFind != INVALID_HANDLE_VALUE); - if (!ok) { - failed = TRUE; - smsg(_(e_notopen), path); - } - else - { - while (ok) + char_u *buf; + int ok; + HANDLE hFind = INVALID_HANDLE_VALUE; + WIN32_FIND_DATAW wfb; + WCHAR *wn = NULL; // UTF-16 name, NULL when not used. + + buf = alloc(MAXPATHL); + if (buf == NULL) + return FAIL; + STRNCPY(buf, path, MAXPATHL-5); + p = buf + STRLEN(buf); + MB_PTR_BACK(buf, p); + if (*p == '\\' || *p == '/') + *p = NUL; + STRCAT(buf, "\\*"); + + wn = enc_to_utf16(buf, NULL); + if (wn != NULL) + hFind = FindFirstFileW(wn, &wfb); + ok = (hFind != INVALID_HANDLE_VALUE); + if (!ok) { - int ignore; - - p = utf16_to_enc(wfb.cFileName, NULL); // p is allocated here - if (p == NULL) - break; // out of memory - - ignore = p[0] == '.' && (p[1] == NUL - || (p[1] == '.' && p[2] == NUL)); - if (!ignore && checkitem != NULL) + failed = TRUE; + smsg(_(e_notopen), path); + } + else + { + while (ok) { - int r = checkitem(context, p); + int ignore; + + p = utf16_to_enc(wfb.cFileName, NULL); // p is allocated here + if (p == NULL) + break; // out of memory - if (r < 0) + ignore = p[0] == '.' && (p[1] == NUL + || (p[1] == '.' && p[2] == NUL)); + if (!ignore && checkitem != NULL) { - vim_free(p); - break; + int r = checkitem(context, p); + + if (r < 0) + { + vim_free(p); + break; + } + if (r == 0) + ignore = TRUE; } - if (r == 0) - ignore = TRUE; - } - if (!ignore) - { - if (ga_grow(gap, 1) == OK) - ((char_u**)gap->ga_data)[gap->ga_len++] = vim_strsave(p); - else + if (!ignore) { - failed = TRUE; - vim_free(p); - break; + if (ga_grow(gap, 1) == OK) + ((char_u**)gap->ga_data)[gap->ga_len++] = vim_strsave(p); + else + { + failed = TRUE; + vim_free(p); + break; + } } - } - vim_free(p); - ok = FindNextFileW(hFind, &wfb); + vim_free(p); + ok = FindNextFileW(hFind, &wfb); + } + FindClose(hFind); } - FindClose(hFind); - } - - vim_free(buf); - vim_free(wn); -# else - DIR *dirp; - struct dirent *dp; - char_u *p; - dirp = opendir((char *)path); - if (dirp == NULL) - { - failed = TRUE; - smsg(_(e_notopen), path); + vim_free(buf); + vim_free(wn); } - else +# else { - for (;;) - { - int ignore; - - dp = readdir(dirp); - if (dp == NULL) - break; - p = (char_u *)dp->d_name; + DIR *dirp; + struct dirent *dp; - ignore = p[0] == '.' && - (p[1] == NUL || - (p[1] == '.' && p[2] == NUL)); - if (!ignore && checkitem != NULL) + dirp = opendir((char *)path); + if (dirp == NULL) + { + failed = TRUE; + smsg(_(e_notopen), path); + } + else + { + for (;;) { - int r = checkitem(context, p); + int ignore; - if (r < 0) + dp = readdir(dirp); + if (dp == NULL) break; - if (r == 0) - ignore = TRUE; - } + p = (char_u *)dp->d_name; - if (!ignore) - { - if (ga_grow(gap, 1) == OK) - ((char_u**)gap->ga_data)[gap->ga_len++] = vim_strsave(p); - else + ignore = p[0] == '.' && + (p[1] == NUL || + (p[1] == '.' && p[2] == NUL)); + if (!ignore && checkitem != NULL) { - failed = TRUE; - break; + int r = checkitem(context, p); + + if (r < 0) + break; + if (r == 0) + ignore = TRUE; + } + + if (!ignore) + { + if (ga_grow(gap, 1) == OK) + ((char_u**)gap->ga_data)[gap->ga_len++] = vim_strsave(p); + else + { + failed = TRUE; + break; + } } } - } - closedir(dirp); + closedir(dirp); + } } # endif diff --git a/src/globals.h b/src/globals.h index 6f257484d3..6d3fa1670a 100644 --- a/src/globals.h +++ b/src/globals.h @@ -1524,7 +1524,7 @@ EXTERN char e_failed[] INIT(= N_("E472: Command failed")); EXTERN char e_fontset[] INIT(= N_("E234: Unknown fontset: %s")); #endif #if defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MAC) \ - || defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_MSWIN) + || defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_HAIKU) EXTERN char e_font[] INIT(= N_("E235: Unknown font: %s")); #endif #if defined(FEAT_GUI_X11) && !defined(FEAT_GUI_GTK) @@ -446,7 +446,8 @@ gui_init_check(void) gui.menu_width = 0; # endif #endif -#if defined(FEAT_TOOLBAR) && (defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA)) +#if defined(FEAT_TOOLBAR) && (defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA) \ + || defined(FEAT_GUI_HAIKU)) gui.toolbar_height = 0; #endif #if defined(FEAT_FOOTER) && defined(FEAT_GUI_MOTIF) @@ -1371,10 +1372,11 @@ gui_position_components(int total_width UNUSED) text_area_y += gui.tabline_height; #endif -#if defined(FEAT_TOOLBAR) && (defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA)) +#if defined(FEAT_TOOLBAR) && (defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA) \ + || defined(FEAT_GUI_HAIKU)) if (vim_strchr(p_go, GO_TOOLBAR) != NULL) { -# ifdef FEAT_GUI_ATHENA +# if defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_HAIKU) gui_mch_set_toolbar_pos(0, text_area_y, gui.menu_width, gui.toolbar_height); # endif @@ -1382,6 +1384,13 @@ gui_position_components(int total_width UNUSED) } #endif +# if defined(FEAT_GUI_TABLINE) && defined(FEAT_GUI_HAIKU) + gui_mch_set_tabline_pos(0, text_area_y, + gui.menu_width, gui.tabline_height); + if (gui_has_tabline()) + text_area_y += gui.tabline_height; +#endif + text_area_width = gui.num_cols * gui.char_width + gui.border_offset * 2; text_area_height = gui.num_rows * gui.char_height + gui.border_offset * 2; @@ -1453,7 +1462,7 @@ gui_get_base_height(void) # endif # endif # if defined(FEAT_GUI_TABLINE) && (defined(FEAT_GUI_MSWIN) \ - || defined(FEAT_GUI_MOTIF)) + || defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_HAIKU)) if (gui_has_tabline()) base_height += gui.tabline_height; # endif @@ -1496,6 +1505,10 @@ again: new_pixel_height = 0; busy = TRUE; +#ifdef FEAT_GUI_HAIKU + vim_lock_screen(); +#endif + // Flush pending output before redrawing out_flush(); @@ -1518,6 +1531,10 @@ again: || gui.num_rows != Rows || gui.num_cols != Columns) shell_resized(); +#ifdef FEAT_GUI_HAIKU + vim_unlock_screen(); +#endif + gui_update_scrollbars(TRUE); gui_update_cursor(FALSE, TRUE); #if defined(FEAT_XIM) && !defined(FEAT_GUI_GTK) @@ -4254,9 +4271,10 @@ gui_update_scrollbars( y += gui.menu_height; #endif -#if defined(FEAT_TOOLBAR) && (defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_ATHENA)) +#if defined(FEAT_TOOLBAR) && (defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_ATHENA) \ + || defined(FEAT_GUI_HAIKU)) if (vim_strchr(p_go, GO_TOOLBAR) != NULL) -# ifdef FEAT_GUI_ATHENA +# if defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_HAIKU) y += gui.toolbar_height; # else # ifdef FEAT_GUI_MSWIN @@ -4265,7 +4283,7 @@ gui_update_scrollbars( # endif #endif -#if defined(FEAT_GUI_TABLINE) && defined(FEAT_GUI_MSWIN) +#if defined(FEAT_GUI_TABLINE) && defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_HAIKU) if (gui_has_tabline()) y += gui.tabline_height; #endif @@ -5035,10 +5053,11 @@ ex_gui(exarg_T *eap) } #if ((defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) \ - || defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_PHOTON)) \ + || defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_PHOTON) \ + || defined(FEAT_GUI_HAIKU)) \ && defined(FEAT_TOOLBAR)) || defined(PROTO) /* - * This is shared between Athena, Motif and GTK. + * This is shared between Athena, Haiku, Motif, and GTK. */ /* @@ -29,6 +29,10 @@ # include <gtk/gtk.h> #endif +#ifdef FEAT_GUI_HAIKU +# include "gui_haiku.h" +#endif + // Needed when generating prototypes, since FEAT_GUI is always defined then. #if defined(FEAT_XCLIPBOARD) && !defined(FEAT_GUI_MOTIF) \ && !defined(FEAT_GUI_ATHENA) && !defined(FEAT_GUI_GTK) @@ -73,7 +77,8 @@ */ #if (defined(FEAT_DND) && defined(FEAT_GUI_GTK)) \ || defined(FEAT_GUI_MSWIN) \ - || defined(FEAT_GUI_MAC) + || defined(FEAT_GUI_MAC) \ + || defined(FEAT_GUI_HAIKU) # define HAVE_DROP_FILE #endif @@ -200,6 +205,10 @@ typedef struct GuiScrollbar // scroll_shift is set to the number of shifts // to reduce the count. #endif + +#if FEAT_GUI_HAIKU + VimScrollBar *id; // Pointer to real scroll bar +#endif #ifdef FEAT_GUI_MAC ControlHandle id; // A handle to the scrollbar #endif @@ -426,7 +435,7 @@ typedef struct Gui #if defined(FEAT_GUI_TABLINE) \ && (defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_MOTIF) \ - || defined(FEAT_GUI_MAC)) + || defined(FEAT_GUI_MAC) || defined(FEAT_GUI_HAIKU)) int tabline_height; #endif @@ -435,7 +444,7 @@ typedef struct Gui #endif #if defined(FEAT_TOOLBAR) \ - && (defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_MOTIF)) + && (defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_HAIKU)) int toolbar_height; // height of the toolbar #endif @@ -456,6 +465,14 @@ typedef struct Gui guicolor_T currSpColor; // Current special text color #endif +#ifdef FEAT_GUI_HAIKU + VimApp *vimApp; + VimWindow *vimWindow; + VimFormView *vimForm; |