Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/faerot/far2l
Browse files Browse the repository at this point in the history
  • Loading branch information
faerot committed Sep 20, 2024
2 parents 1aa1428 + 182ef26 commit e2e8fa7
Show file tree
Hide file tree
Showing 60 changed files with 1,173 additions and 571 deletions.
5 changes: 1 addition & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,6 @@ if (NOT DEFINED UNRAR)
set(UNRAR "bundled")
endif()

if (NOT DEFINED USESPDLOG)
set(USESPDLOG "NO")
endif()

# EACP disabled by default for now as FAR's GetCodePageInfo rejects all multibyte charsets due to BUGBUG.
# Uncomment EACP-stuff here when that will be fixed. See https://github.com/elfmz/far2l/issues/1179
#if (NOT DEFINED EACP)
Expand Down Expand Up @@ -536,6 +532,7 @@ endif()
add_subdirectory (packaging)

add_subdirectory(man)
add_subdirectory(bash-completion)

if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(FIXUP_SCRIPT packaging/osx/FixupBundle.cmake)
Expand Down
24 changes: 21 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,24 @@ emulators](#terminals), which provide clipboard access and has their advanced ke

| Mode<br>(UI Backends) | TTY<br>(plain far2l) | TTY\|X | TTY\|Xi | GUI |
| ---: | --- | --- | --- | --- |
| **Works:** | in terminal | in terminal | in terminal | in Desktop<br>environment<br><sub>(X11<br>or Wayland<br>or macOS)</sub> |
| **Works:** | in terminal | in terminal | in terminal | in Desktop<br>environment<br><sub>(X11<br>or Wayland<br>or macOS)<br>via wxWidgets</sub> |
| **Binaries:** | far2l | far2l<br>far2l_ttyx.broker | far2l<br>far2l_ttyx.broker | far2l<br>far2l_gui.so |
| **[Dependencies](#required-dependencies):** | minimal | + libx11 | + libx11, libxi | + wxWidgets, GTK |
| **Keyboard:** | <sub>_Typical terminals_:<br>**only essential<br>key combinations**<br><br>_KiTTY_ (putty fork),<br>_kitty_ (*nix one),<br>_iTerm2_,<br>_Windows Terminal_,<br>far2l’s VT: **full support**</sub> | <sub>_Typical terminals_:<br>**only essential<br>key combinations**<br><br>_KiTTY_ (putty fork),<br>_kitty_ (*nix one),<br>_iTerm2_,<br>_Windows Terminal_,<br>far2l’s VT: **full support**</sub> | <sub>_Typical terminals_:<br>**most of key<br>combinations under x11**;<br>**only essential key<br>combinations<br>under Wayland**<br><br>_KiTTY_ (putty fork),<br>_kitty_ (*nix one),<br>_iTerm2_,<br>_Windows Terminal_,<br>far2l’s VT: **full support**</sub> | **All key<br>combinations** |
| **Clipboard<br>access:** | <sub>_Typical terminals_:<br>via command line<br>tools like xclip<br><br>_kitty_ (*nix one),<br>_iTerm2_:<br>via **OSC52**<br><br>_Windows Terminal_:<br>via **OSC52**<br>or via **command line<br>tools under WSL**<br><br>_KiTTY_ (putty fork),<br>far2l’s VT:<br>via **far2l extensions**</sub> | <sub>_Typical terminals_,<br>_kitty_ (*nix one):<br>via **x11 interaction**<br><br>_iTerm2_:<br>via **OSC52**<br><br>_Windows Terminal_:<br>via **OSC52**<br>or via **command line<br>tools under WSL**<br><br>_KiTTY_ (putty fork),<br>far2l’s VT:<br>via **far2l extensions**</sub> | <sub>_Typical terminals_,<br>_kitty_ (*nix one):<br>via **x11 interaction**<br><br>_iTerm2_:<br>via **OSC52**<br><br>_Windows Terminal_:<br>via **OSC52**<br>or via **command line<br>tools under WSL**<br><br>_KiTTY_ (putty fork),<br>far2l’s VT:<br>via **far2l extensions**</sub> | via<br>**wxWidgets API**<br><br><sub>via command line<br>tools under WSL</sub> |
| **Typical<br>use case:** | **Servers**,<br>embedded | <sub>Run far2l in<br>favorite terminal<br>but with<br>**better UX**</sub> | <sub>Run far2l in<br>favorite terminal<br>but with<br>**best UX**</sub> | **Desktop** |
| **Mandatory:** | yes | no | no | no |

<sub>_Note_: When running far2l automatically downgrade
if its components are not installed (or system libs are not available):
**GUI****TTY|Xi****TTY|X****TTY**.
To force run only specific backend use in command line:
for **GUI**: `far2l --notty`;
for **TTY|Xi** use in command line: `far2l --tty`;
for **TTY|X**: `far2l --tty --nodetect=xi`;
for plain **TTY**: `far2l --tty --nodetect=x`
(see details via `far2l --help`).</sub>

<sub>_Note about use OSC 52 in TTY/TTY|X_:
to interact with the system clipboard you must **not forget to enable OSC 52**
in both the **FAR2L settings** (`Options`->`Interface settings`->`Use OSC52 to set clipboard data`,
Expand Down Expand Up @@ -111,8 +121,11 @@ See also [Community packages & binaries](#community_bins)
* `libnfs-dev` (_optional_ - needed for **NetRocks/NFS**)
* `libneon27-dev` (or later, _optional_ - needed for **NetRocks/WebDAV**)
* `libarchive-dev` (_optional_ - needed for better archives support in **multiarc**)
* `libunrar-dev` (_optional_ - needed for RAR archives support in **multiarc**, see UNRAR command line option)
* `libunrar-dev` (_optional_ - needed for RAR archives support in **multiarc**, see `UNRAR` command line option)
* `libpcre3-dev` (or `libpcre2-dev` in older distributions, _optional_ - needed for advanced custom archive formats support in **multiarc**)
* `libpython3-dev` (_optional_ - needed for **python plugins** support, see `-DPYTHON` command line option)
* `libffi-dev` (_optional_ - needed for **python plugins** support, see `-DPYTHON` command line option)
* `python3-venv` (_optional_ - needed for **python plugins** support, see `-DPYTHON` command line option)
* `cmake` ( >= 3.2.2 )
* `pkg-config`
* `g++`
Expand Down Expand Up @@ -173,6 +186,11 @@ To force-disable TTY|X and TTY|Xi backends: add argument `-DTTYX=no`; to disable
To eliminate libuchardet requirement to reduce far2l dependencies by cost of losing automatic charset detection functionality: add `-DUSEUCD=no`

To build with Python plugin: add argument `-DPYTHON=yes`
but you must have installed additional packages within yours system:
`libpython3-dev`,
`libffi-dev`,
`python3-venv`.


To control how RAR archives will be handled in multiarc:
`-DUNRAR=bundled` (default) use bundled sources found in multiarc/src/formats/rar/unrar
Expand Down Expand Up @@ -214,7 +232,7 @@ cd far2l
```
* Install needed dependencies with MacPorts:
``` sh
sudo port install cmake pkgconfig wxWidgets-3.2 libssh openssl libxml2 libfmt uchardet neon
sudo port install cmake pkgconfig wxWidgets-3.2 libssh openssl libxml2 uchardet neon
export PKG_CONFIG_PATH=/opt/local/lib/pkgconfig
```
* OR if you prefer to use brew packages, then:
Expand Down
148 changes: 145 additions & 3 deletions WinPort/src/Backend/WX/wxMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1109,12 +1109,147 @@ static bool IsForcedCharTranslation(int code)
|| code==WXK_NUMPAD_MULTIPLY || code==WXK_NUMPAD_SUBTRACT || code==WXK_NUMPAD_DIVIDE);
}

// helper function that returns textual description of wx virtual keycode
const char* GetWxVirtualKeyCodeName(int keycode)
{
switch ( keycode )
{
#define WXK_(x) \
case WXK_##x: return #x;

WXK_(BACK)
WXK_(TAB)
WXK_(RETURN)
WXK_(ESCAPE)
WXK_(SPACE)
WXK_(DELETE)
WXK_(START)
WXK_(LBUTTON)
WXK_(RBUTTON)
WXK_(CANCEL)
WXK_(MBUTTON)
// WXK_(NUMPAD_CENTER)
WXK_(SHIFT)
WXK_(ALT)
WXK_(CONTROL)
WXK_(MENU)
WXK_(PAUSE)
WXK_(CAPITAL)
WXK_(END)
WXK_(HOME)
WXK_(LEFT)
WXK_(UP)
WXK_(RIGHT)
WXK_(DOWN)
WXK_(SELECT)
WXK_(PRINT)
WXK_(EXECUTE)
WXK_(SNAPSHOT)
WXK_(INSERT)
WXK_(HELP)
WXK_(NUMPAD0)
WXK_(NUMPAD1)
WXK_(NUMPAD2)
WXK_(NUMPAD3)
WXK_(NUMPAD4)
WXK_(NUMPAD5)
WXK_(NUMPAD6)
WXK_(NUMPAD7)
WXK_(NUMPAD8)
WXK_(NUMPAD9)
WXK_(MULTIPLY)
WXK_(ADD)
WXK_(SEPARATOR)
WXK_(SUBTRACT)
WXK_(DECIMAL)
WXK_(DIVIDE)
WXK_(F1)
WXK_(F2)
WXK_(F3)
WXK_(F4)
WXK_(F5)
WXK_(F6)
WXK_(F7)
WXK_(F8)
WXK_(F9)
WXK_(F10)
WXK_(F11)
WXK_(F12)
WXK_(F13)
WXK_(F14)
WXK_(F15)
WXK_(F16)
WXK_(F17)
WXK_(F18)
WXK_(F19)
WXK_(F20)
WXK_(F21)
WXK_(F22)
WXK_(F23)
WXK_(F24)
WXK_(NUMLOCK)
WXK_(SCROLL)
WXK_(PAGEUP)
WXK_(PAGEDOWN)
WXK_(NUMPAD_SPACE)
WXK_(NUMPAD_TAB)
WXK_(NUMPAD_ENTER)
WXK_(NUMPAD_F1)
WXK_(NUMPAD_F2)
WXK_(NUMPAD_F3)
WXK_(NUMPAD_F4)
WXK_(NUMPAD_HOME)
WXK_(NUMPAD_LEFT)
WXK_(NUMPAD_UP)
WXK_(NUMPAD_RIGHT)
WXK_(NUMPAD_DOWN)
WXK_(NUMPAD_PAGEUP)
WXK_(NUMPAD_PAGEDOWN)
WXK_(NUMPAD_END)
WXK_(NUMPAD_INSERT)
WXK_(NUMPAD_DELETE)
WXK_(NUMPAD_EQUAL)
WXK_(NUMPAD_MULTIPLY)
WXK_(NUMPAD_ADD)
WXK_(NUMPAD_SEPARATOR)
WXK_(NUMPAD_SUBTRACT)
WXK_(NUMPAD_DECIMAL)
WXK_(NUMPAD_DIVIDE)

WXK_(WINDOWS_LEFT)
WXK_(WINDOWS_RIGHT)
#ifdef __WXOSX__
WXK_(RAW_CONTROL)
#endif
#undef WXK_

default:
return "ERR";
}
}

char* FormatWxKeyState(uint16_t state) {

static char buffer[5];

buffer[0] = state & wxMOD_ALT ? 'A' : 'a';
buffer[1] = state & wxMOD_CONTROL ? 'C' : 'c';
buffer[2] = state & wxMOD_SHIFT ? 'S' : 's';
buffer[3] = state & wxMOD_META ? 'M' : 'm';

buffer[4] = '\0';

return buffer;
}

void WinPortPanel::OnKeyDown( wxKeyEvent& event )
{
ResetTimerIdling();
DWORD now = WINPORT(GetTickCount)();
const auto uni = event.GetUnicodeKey();
fprintf(stderr, "OnKeyDown: raw=%x code=%x uni=%x (%lc) ts=%lu [now=%u]",
fprintf(stderr, "\nOnKeyDown: %s %s raw=%x code=%x uni=%x (%lc) ts=%lu [now=%u]",
FormatWxKeyState(event.GetModifiers()),
GetWxVirtualKeyCodeName(event.GetKeyCode()),
event.GetRawKeyCode(), event.GetKeyCode(),
uni, (uni > 0x1f) ? uni : L' ', event.GetTimestamp(), now);

Expand Down Expand Up @@ -1233,7 +1368,9 @@ void WinPortPanel::OnKeyUp( wxKeyEvent& event )
{
ResetTimerIdling();
const auto uni = event.GetUnicodeKey();
fprintf(stderr, "OnKeyUp: raw=%x code=%x uni=%x (%lc) ts=%lu",
fprintf(stderr, "\nOnKeyUp: %s %s raw=%x code=%x uni=%x (%lc) ts=%lu",
FormatWxKeyState(event.GetModifiers()),
GetWxVirtualKeyCodeName(event.GetKeyCode()),
event.GetRawKeyCode(), event.GetKeyCode(),
uni, (uni > 0x1f) ? uni : L' ', event.GetTimestamp());

Expand Down Expand Up @@ -1311,7 +1448,12 @@ void WinPortPanel::OnChar( wxKeyEvent& event )
{
ResetTimerIdling();
const auto uni = event.GetUnicodeKey();
fprintf(stderr, "OnChar: raw=%x code=%x uni=%x (%lc) ts=%lu lke=%u",
if (_key_tracker.LastKeydown().GetTimestamp() != event.GetTimestamp()) {
fprintf(stderr, "\n");
}
fprintf(stderr, "OnChar: %s %s raw=%x code=%x uni=%x (%lc) ts=%lu lke=%u",
FormatWxKeyState(event.GetModifiers()),
GetWxVirtualKeyCodeName(event.GetKeyCode()),
event.GetRawKeyCode(), event.GetKeyCode(),
uni, (uni > 0x1f) ? uni : L' ', event.GetTimestamp(), _last_keydown_enqueued);
_exclusive_hotkeys.OnKeyUp(event);
Expand Down
Loading

0 comments on commit e2e8fa7

Please sign in to comment.