xF: finish the frontend using liberty-xui

This has long been the missing piece in our frontend collection.

After including the termo library in a recent rewrite, we've kind of
received an option to use liberty-xui, the terminal/X11/AppKit library
spawned off from nncmpp.

The frontend for the most part resembles xP, with some missing
xC features on top.

We do not care about text layouting or X11 text selection,
seeing as that requires rather extensive changes,
and I'm not planning to use this frontend other than for testing.
General formatting support will arrive in a following commit.

It should build for macOS as well with minor changes,
but we already have xM in our collection, so this is not finished.

Bump liberty.
This commit is contained in:
2023-06-14 09:26:23 +02:00
parent bcfbd40003
commit 70fa559752
7 changed files with 3061 additions and 93 deletions
+44 -7
View File
@@ -9,7 +9,7 @@ project (xK VERSION "${project_version}"
DESCRIPTION "IRC daemon, bot, TUI client and its web frontend" LANGUAGES C)
# Options
option (WANT_XF "Build xF" OFF)
option (WANT_XF "Build the xF frontend" OFF)
# Moar warnings
set (CMAKE_C_STANDARD 99)
@@ -171,6 +171,7 @@ add_custom_command (OUTPUT xC-proto.c
add_custom_target (xC-proto DEPENDS ${PROJECT_BINARY_DIR}/xC-proto.c)
# Build
set (project_binaries xB xC xD)
foreach (name xB xC xD)
add_executable (${name} ${name}.c ${project_config})
target_link_libraries (${name} PRIVATE ${project_libraries})
@@ -183,13 +184,29 @@ target_link_libraries (xC PRIVATE ${xC_libraries})
target_include_directories (xC PRIVATE ${Termo_INCLUDE_DIRS})
if (WANT_XF)
pkg_check_modules (x11 REQUIRED x11 xrender xft fontconfig)
include_directories (${x11_INCLUDE_DIRS})
link_directories (${x11_LIBRARY_DIRS})
list (APPEND project_binaries xF)
find_package (Unistring REQUIRED)
pkg_check_modules (x11 x11 xrender xft fontconfig libpng)
option (WITH_X11 "Build xF with X11 support" "${x11_FOUND}")
if (WITH_X11 AND NOT x11_FOUND)
message (FATAL_ERROR "Some X11 libraries were not found")
endif ()
add_executable (xF xF.c ${project_config})
add_dependencies (xF xC-proto)
target_link_libraries (xF PRIVATE ${x11_LIBRARIES} ${project_libraries})
target_include_directories (xF PRIVATE
${Unistring_INCLUDE_DIRS} ${Termo_INCLUDE_DIRS})
target_link_libraries (xF PRIVATE
${Unistring_LIBRARIES} ${Termo_LIBRARIES}
${ncursesw_LIBRARIES} ${project_libraries})
if (WITH_X11)
target_compile_definitions (xF PRIVATE WITH_X11)
target_include_directories (xF PRIVATE ${x11_INCLUDE_DIRS})
target_link_directories (xF PRIVATE ${x11_LIBRARY_DIRS})
target_link_libraries (xF PRIVATE ${x11_LIBRARIES})
endif ()
add_threads (xF)
endif ()
@@ -230,13 +247,33 @@ add_custom_target (clang-tidy
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
# Installation
install (TARGETS xB xC xD DESTINATION ${CMAKE_INSTALL_BINDIR})
install (TARGETS ${project_binaries} DESTINATION ${CMAKE_INSTALL_BINDIR})
install (FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR})
install (DIRECTORY plugins/xB/
DESTINATION ${CMAKE_INSTALL_DATADIR}/xB/plugins USE_SOURCE_PERMISSIONS)
install (DIRECTORY plugins/xC/
DESTINATION ${CMAKE_INSTALL_DATADIR}/xC/plugins)
# Rasterize and install SVG icons
if (WANT_XF AND WITH_X11)
include (IconUtils)
set (icon_base ${PROJECT_BINARY_DIR}/icons)
set (icon_png_list)
foreach (icon_size 16 32 48)
icon_to_png (xF ${PROJECT_SOURCE_DIR}/xF.svg
${icon_size} ${icon_base} icon_png)
list (APPEND icon_png_list ${icon_png})
endforeach ()
add_custom_target (icons ALL DEPENDS ${icon_png_list})
install (FILES xF.svg
DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps)
install (DIRECTORY ${icon_base}
DESTINATION ${CMAKE_INSTALL_DATADIR})
endif ()
# Generate documentation from text markup
find_program (ASCIIDOCTOR_EXECUTABLE asciidoctor)
find_program (A2X_EXECUTABLE a2x)
@@ -245,7 +282,7 @@ if (NOT ASCIIDOCTOR_EXECUTABLE AND NOT A2X_EXECUTABLE)
"falling back to a substandard manual page generator")
endif ()
foreach (page xB xC xD)
foreach (page ${project_binaries})
set (page_output "${PROJECT_BINARY_DIR}/${page}.1")
list (APPEND project_MAN_PAGES "${page_output}")
if (ASCIIDOCTOR_EXECUTABLE)
+2
View File
@@ -15,6 +15,8 @@ Unreleased
* prime.lua: prevented a DoS opportunity on excessively large numbers
* Added a terminal/X11 frontend called xF
* Bumped relay protocol version
+7 -5
View File
@@ -34,9 +34,9 @@ including link:xC.adoc#_key_bindings[keyboard shortcuts].
image::xP.webp[align="center"]
xA, xT, xW, xM
--------------
Fyne, Qt Widgets, Win32, Cocoa frontends for 'xC'.
xA, xF, xT, xW, xM
------------------
Fyne, terminal/X11, Qt Widgets, Win32, Cocoa frontends for 'xC'.
Using them is not recommended.
xD
@@ -87,15 +87,17 @@ or as a https://git.janouch.name/p/nixexprs[Nix derivation].
Building
--------
Build-only dependencies: CMake, pkg-config, awk, liberty (included),
asciidoctor or asciidoc (recommended but optional) +
asciidoctor or asciidoc (recommended but optional), rsvg-convert (for 'xF') +
Common runtime dependencies: openssl +
Additionally for 'xC': curses, lua >= 5.3 (optional), termo (included) +
Additionally for 'xF': ncursesw, libunistring, termo (included),
x11 + xft + libpng (X11)
$ git clone --recursive https://git.janouch.name/p/xK.git
$ mkdir xK/build
$ cd xK/build
$ cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DWANT_READLINE=ON -DWANT_LIBEDIT=OFF -DWITH_LUA=ON
-DWITH_LUA=ON -DWITH_XF=OFF
$ make
To install the application, you can do either the usual:
+1 -1
Submodule liberty updated: fbb577f3f8...e90abbd03c
+1 -1
View File
@@ -326,4 +326,4 @@ or submit pull requests.
See also
--------
*less*(1)
*less*(1), *xF*(1)
+39
View File
@@ -0,0 +1,39 @@
xF(1)
=====
:doctype: manpage
:manmanual: xK Manual
:mansource: xK {release-version}
Name
----
xF - Terminal/X11 frontend for xC
Synopsis
--------
*xF* [_OPTION_]... RELAY-ADDRESS
Description
-----------
*xF* is an example frontend for the relay interface of the *xC* IRC client.
It normally runs in the terminal, and can also use a graphical interface
when built with support for one.
Options
-------
*-g*, *--gui*::
Use the graphical interface even when running from a terminal.
*-h*, *--help*::
Display a help message and exit.
*-V*, *--version*::
Output version information and exit.
Reporting bugs
--------------
Use https://git.janouch.name/p/xK to report bugs, request features,
or submit pull requests.
See also
--------
*xC*(1)
+2967 -79
View File
File diff suppressed because it is too large Load Diff