Add a Win32 frontend for xC
This has been more of an exercise. The performance of Msftedit.dll is rather abysmal, and its interface isn't the most accomodating. That said, the frontend is quite usable, at least on Windows 10+.
This commit is contained in:
parent
1da4699a7a
commit
0219dbd026
2
NEWS
2
NEWS
@ -31,6 +31,8 @@
|
||||
|
||||
* Added a web frontend for xC called xP
|
||||
|
||||
* Added a Win32 frontend for xC called xW
|
||||
|
||||
* Added a Go port of xD called xS
|
||||
|
||||
|
||||
|
12
README.adoc
12
README.adoc
@ -2,7 +2,7 @@ xK
|
||||
==
|
||||
|
||||
'xK' (chat kit) is an IRC software suite consisting of a daemon, bot, terminal
|
||||
client, and a web frontend for the client. It's all you're ever going to
|
||||
client, and web + Win32 frontends for the client. It's all you're ever going to
|
||||
need for chatting, so long as you can make do with slightly minimalist software.
|
||||
|
||||
They're all lean on dependencies, and offer a maximally permissive licence.
|
||||
@ -137,6 +137,16 @@ For remote use, it's recommended to put 'xP' behind a reverse proxy, with TLS,
|
||||
and some form of HTTP authentication. Pass the external URL of the WebSocket
|
||||
endpoint as the third command line argument in this case.
|
||||
|
||||
xW
|
||||
~~
|
||||
The Win32 frontend is a separate CMake subproject that should be compiled
|
||||
using MinGW-w64. In order to run it, make a shortcut for the executable and
|
||||
include the relay address in its _Target_ field:
|
||||
|
||||
C:\...\xW.exe 127.0.0.1 9000
|
||||
|
||||
It works reasonably well starting with Windows 7.
|
||||
|
||||
Client Certificates
|
||||
-------------------
|
||||
'xC' will use the SASL EXTERNAL method to authenticate using the TLS client
|
||||
|
2
liberty
2
liberty
@ -1 +1 @@
|
||||
Subproject commit 0f3ed1457571ff8c42fc99e77ea18854afa877b0
|
||||
Subproject commit 62166f9679f583f1ea6028bfe54a4487ccc57df0
|
11
xW/.clang-format
Normal file
11
xW/.clang-format
Normal file
@ -0,0 +1,11 @@
|
||||
BasedOnStyle: LLVM
|
||||
ColumnLimit: 80
|
||||
IndentWidth: 4
|
||||
TabWidth: 4
|
||||
UseTab: ForContinuationAndIndentation
|
||||
AlwaysBreakAfterReturnType: AllDefinitions
|
||||
BreakBeforeBraces: Linux
|
||||
SpaceAfterCStyleCast: true
|
||||
AlignAfterOpenBracket: DontAlign
|
||||
AlignOperands: DontAlign
|
||||
SpacesBeforeTrailingComments: 2
|
97
xW/CMakeLists.txt
Normal file
97
xW/CMakeLists.txt
Normal file
@ -0,0 +1,97 @@
|
||||
# The last version with Windows XP support is 3.13, we want to keep that
|
||||
cmake_minimum_required (VERSION 3.10)
|
||||
|
||||
file (READ ../xK-version project_version)
|
||||
configure_file (../xK-version xK-version.tag COPYONLY)
|
||||
string (STRIP "${project_version}" project_version)
|
||||
|
||||
# This is an entirely separate CMake project--the main executables only build
|
||||
# on Windows within Cygwin, and this Windows executable only builds on Linux
|
||||
# cross-compiled, so you'd want to build them independently anyway.
|
||||
project (xW VERSION "${project_version}"
|
||||
DESCRIPTION "Win32 frontend for xC" LANGUAGES CXX)
|
||||
|
||||
set (CMAKE_CXX_STANDARD 17)
|
||||
|
||||
add_definitions (-DUNICODE -D_UNICODE)
|
||||
add_compile_options ("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
|
||||
add_compile_options ("$<$<CXX_COMPILER_ID:GNU>:-Wall;-Wextra>")
|
||||
add_compile_options ("$<$<CXX_COMPILER_ID:Clang>:-Wall;-Wextra>")
|
||||
add_link_options ("$<$<CXX_COMPILER_ID:GNU>:-static;-municode>")
|
||||
|
||||
set (project_config ${PROJECT_BINARY_DIR}/config.h)
|
||||
configure_file (${PROJECT_SOURCE_DIR}/config.h.in ${project_config})
|
||||
include_directories (${PROJECT_SOURCE_DIR} ${PROJECT_BINARY_DIR})
|
||||
|
||||
# Icon generation utilities
|
||||
# TODO: Shove this into liberty as a CMake module, similar to AddThreads,
|
||||
# and remove the copies in the parent CMakeLists.txt as well as in tdv.
|
||||
if (NOT ${CMAKE_VERSION} VERSION_LESS 3.18.0)
|
||||
set (find_program_REQUIRE REQUIRED)
|
||||
endif ()
|
||||
|
||||
function (icon_to_png name svg size output_dir output)
|
||||
set (_dimensions ${size}x${size})
|
||||
set (_png_path ${output_dir}/hicolor/${_dimensions}/apps)
|
||||
set (_png ${_png_path}/${name}.png)
|
||||
set (${output} ${_png} PARENT_SCOPE)
|
||||
|
||||
find_program (rsvg_convert_EXECUTABLE rsvg-convert ${find_program_REQUIRE})
|
||||
add_custom_command (OUTPUT ${_png}
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${_png_path}
|
||||
COMMAND ${rsvg_convert_EXECUTABLE} --output=${_png}
|
||||
--width=${size} --height=${size} ${svg}
|
||||
DEPENDS ${svg}
|
||||
COMMENT "Generating ${name} ${_dimensions} application icon" VERBATIM)
|
||||
endfunction ()
|
||||
|
||||
function (icon_for_win32 pngs ico)
|
||||
find_program (icotool_EXECUTABLE icotool ${find_program_REQUIRE})
|
||||
add_custom_command (OUTPUT ${ico}
|
||||
COMMAND ${icotool_EXECUTABLE} -c -o ${ico} ${pngs}
|
||||
DEPENDS ${pngs}
|
||||
COMMENT "Generating Windows program icon" VERBATIM)
|
||||
endfunction ()
|
||||
|
||||
# Rasterize SVG icons
|
||||
set (icon_ico_list)
|
||||
foreach (icon xW xW-highlighted)
|
||||
set (icon_png_list)
|
||||
foreach (icon_size 16 32 48 256)
|
||||
icon_to_png (${icon} ${PROJECT_SOURCE_DIR}/${icon}.svg
|
||||
${icon_size} ${PROJECT_BINARY_DIR}/icons icon_png)
|
||||
list (APPEND icon_png_list ${icon_png})
|
||||
endforeach ()
|
||||
set (icon_ico ${PROJECT_BINARY_DIR}/${icon}.ico)
|
||||
icon_for_win32 ("${icon_png_list}" ${icon_ico})
|
||||
list (APPEND icon_ico_list ${icon_ico})
|
||||
endforeach ()
|
||||
|
||||
set_property (SOURCE xW.rc APPEND PROPERTY OBJECT_DEPENDS ${icon_ico_list})
|
||||
|
||||
# Build the main executable and link it
|
||||
set (root "${PROJECT_SOURCE_DIR}/..")
|
||||
|
||||
find_program (awk_EXECUTABLE awk ${find_program_REQUIRE})
|
||||
add_custom_command (OUTPUT xC-proto.cpp
|
||||
COMMAND ${CMAKE_COMMAND} -E env LC_ALL=C ${awk_EXECUTABLE}
|
||||
-f ${root}/liberty/tools/lxdrgen.awk
|
||||
-f ${root}/liberty/tools/lxdrgen-cpp.awk
|
||||
-v PrefixCamel=Relay
|
||||
${root}/xC.lxdr > xC-proto.cpp
|
||||
DEPENDS
|
||||
${root}/liberty/tools/lxdrgen.awk
|
||||
${root}/liberty/tools/lxdrgen-cpp.awk
|
||||
${root}/xC.lxdr
|
||||
COMMENT "Generating xC relay protocol code" VERBATIM)
|
||||
add_custom_target (xC-proto DEPENDS ${PROJECT_BINARY_DIR}/xC-proto.cpp)
|
||||
|
||||
add_executable (xW WIN32 xW.cpp xW.rc xW.manifest ${project_config}
|
||||
${root}/liberty/tools/lxdrgen-cpp-win32.cpp)
|
||||
target_link_libraries (xW comctl32 ws2_32)
|
||||
add_dependencies (xW xC-proto)
|
||||
|
||||
# At least with MinGW, this is a fully independent portable executable
|
||||
install (TARGETS xW DESTINATION .)
|
||||
set (CPACK_GENERATOR ZIP)
|
||||
include (CPack)
|
6
xW/config.h.in
Normal file
6
xW/config.h.in
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
#define PROGRAM_VERSION "${project_version}"
|
||||
|
||||
#endif // ! CONFIG_H
|
24
xW/xW-highlighted.svg
Normal file
24
xW/xW-highlighted.svg
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg version="1.1" width="48" height="48" viewBox="0 0 48 48"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
|
||||
<defs>
|
||||
<clipPath id="outer">
|
||||
<rect x="-1" y="-0.15" width="5" height="3.30" />
|
||||
</clipPath>
|
||||
<clipPath id="inner">
|
||||
<rect x="-1" y="0" width="5" height="3" />
|
||||
</clipPath>
|
||||
</defs>
|
||||
|
||||
<g transform="translate(6, 6) scale(12)" stroke-linecap="square">
|
||||
<g clip-path="url(#outer)">
|
||||
<path stroke="#ffffff" stroke-width="1.5" d="M 0.5,0 2.5,3" />
|
||||
<path stroke="#ffffff" stroke-width="1.5" d="M 0.5,3 2.5,0" />
|
||||
</g>
|
||||
<g clip-path="url(#inner)">
|
||||
<path stroke="#ff0000" stroke-width="0.9" d="M 0.5,0 2.5,3" />
|
||||
<path stroke="#ff0000" stroke-width="0.9" d="M 0.5,3 2.5,0" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 806 B |
12
xW/xW-resources.h
Normal file
12
xW/xW-resources.h
Normal file
@ -0,0 +1,12 @@
|
||||
#define IDI_ICON 1
|
||||
#define IDI_HIGHLIGHTED 2
|
||||
#define IDA_ACCELERATORS 10
|
||||
|
||||
// Named after input_add_functions() in xC.
|
||||
#define ID_PREVIOUS_BUFFER 11
|
||||
#define ID_NEXT_BUFFER 12
|
||||
#define ID_SWITCH_BUFFER 13
|
||||
#define ID_GOTO_HIGHLIGHT 14
|
||||
#define ID_GOTO_ACTIVITY 15
|
||||
#define ID_TOGGLE_UNIMPORTANT 16
|
||||
#define ID_DISPLAY_FULL_LOG 17
|
11
xW/xW.manifest
Normal file
11
xW/xW.manifest
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<assemblyIdentity name="xW" version="1.0.0.0" type="win32" />
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0" type="win32" processorArchitecture="*"
|
||||
publicKeyToken="6595b64144ccf1df" language="*" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
</assembly>
|
23
xW/xW.rc
Normal file
23
xW/xW.rc
Normal file
@ -0,0 +1,23 @@
|
||||
#include <windows.h>
|
||||
#include "xW-resources.h"
|
||||
|
||||
// Beware of this madness https://gitlab.kitware.com/cmake/cmake/-/issues/23066
|
||||
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "xW.manifest"
|
||||
|
||||
IDI_ICON ICON "xW.ico"
|
||||
IDI_HIGHLIGHTED ICON "xW-highlighted.ico"
|
||||
|
||||
IDA_ACCELERATORS ACCELERATORS
|
||||
BEGIN
|
||||
"^p", ID_PREVIOUS_BUFFER
|
||||
"^n", ID_NEXT_BUFFER
|
||||
VK_F5, ID_PREVIOUS_BUFFER, VIRTKEY
|
||||
VK_F6, ID_NEXT_BUFFER, VIRTKEY
|
||||
VK_PRIOR, ID_PREVIOUS_BUFFER, CONTROL, VIRTKEY
|
||||
VK_NEXT, ID_NEXT_BUFFER, CONTROL, VIRTKEY
|
||||
VK_TAB, ID_SWITCH_BUFFER, CONTROL, VIRTKEY
|
||||
"!", ID_GOTO_HIGHLIGHT, ALT
|
||||
"a", ID_GOTO_ACTIVITY, ALT
|
||||
"H", ID_TOGGLE_UNIMPORTANT, ALT
|
||||
"h", ID_DISPLAY_FULL_LOG, ALT
|
||||
END
|
24
xW/xW.svg
Normal file
24
xW/xW.svg
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg version="1.1" width="48" height="48" viewBox="0 0 48 48"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
|
||||
<defs>
|
||||
<clipPath id="outer">
|
||||
<rect x="-1" y="-0.15" width="5" height="3.30" />
|
||||
</clipPath>
|
||||
<clipPath id="inner">
|
||||
<rect x="-1" y="0" width="5" height="3" />
|
||||
</clipPath>
|
||||
</defs>
|
||||
|
||||
<g transform="translate(6, 6) scale(12)" stroke-linecap="square">
|
||||
<g clip-path="url(#outer)">
|
||||
<path stroke="#ffffff" stroke-width="1.5" d="M 0.5,0 2.5,3" />
|
||||
<path stroke="#ffffff" stroke-width="1.5" d="M 0.5,3 2.5,0" />
|
||||
</g>
|
||||
<g clip-path="url(#inner)">
|
||||
<path stroke="#000000" stroke-width="0.2" d="M 0,0 2,3 M 1,0 3,3" />
|
||||
<path stroke="#ff6600" stroke-width="0.3" d="M 0,3 2,0 M 1,3 3,0" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 818 B |
Loading…
Reference in New Issue
Block a user