From eabfe24d3de708e79bf8325b38b6caa0ed2b1df7 Mon Sep 17 00:00:00 2001 From: Chris Mayo Date: Thu, 23 Oct 2025 19:34:57 +0100 Subject: [PATCH 1/2] Use libxkbcommon instead of libX11 --- .github/workflows/build_gnulinux.yml | 1 + .github/workflows/build_macosx.yml | 2 +- Makefile.in | 2 +- README.md | 1 + src/ui.cc | 10 +++++----- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build_gnulinux.yml b/.github/workflows/build_gnulinux.yml index 6dd7174..32c5b49 100644 --- a/.github/workflows/build_gnulinux.yml +++ b/.github/workflows/build_gnulinux.yml @@ -57,6 +57,7 @@ jobs: [[ "${QT_MAJOR_VERSION}" == 6 ]] # i.e. assert sudo apt-get install qt6-base-dev fi + sudo apt-get install libxkbcommon-dev - name: install dependency Clang 19 if: "${{ matrix.cc == 'clang-19' }}" diff --git a/.github/workflows/build_macosx.yml b/.github/workflows/build_macosx.yml index 09ada95..b54317c 100644 --- a/.github/workflows/build_macosx.yml +++ b/.github/workflows/build_macosx.yml @@ -19,7 +19,7 @@ jobs: - name: install dependencies run: | - brew install xquartz libx11 qt@5 pkg-config + brew install xquartz libxkbcommon qt@5 pkg-config brew link qt@5 --force git clone --depth 1 https://github.com/FreeSpacenav/libspnav cd libspnav diff --git a/Makefile.in b/Makefile.in index 5009eb3..577e05b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -19,7 +19,7 @@ libpath = -L$(PREFIX)/lib CFLAGS = $(warn) $(dbg) $(opt) $(incpath) -fPIC $(add_cflags) -MMD CXXFLAGS = $(warn) $(dbg) $(opt) $(incpath) -fPIC $(cflags_qt) \ $(add_cflags) -MMD -LDFLAGS = $(libpath) $(libs_qt) -lspnav -lX11 $(add_ldflags) +LDFLAGS = $(libpath) $(libs_qt) -lspnav -lxkbcommon $(add_ldflags) $(bin): $(obj) $(CXX) -o $@ $(obj) $(LDFLAGS) diff --git a/README.md b/README.md index 5b03a44..c34ac75 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ Installation ------------ First make sure you have the dependencies installed: - libspnav v1.0 or higher + - libxkbcommon - Qt 5 or Qt 6 (core, gui, and widgets) To build just run `./configure`, `make`, and `make install` as usual. diff --git a/src/ui.cc b/src/ui.cc index b627b5a..2e2d98e 100644 --- a/src/ui.cc +++ b/src/ui.cc @@ -26,7 +26,7 @@ along with this program. If not, see . #include "ui_about.h" #include -#include +#include static QSlider *slider_sens_axis[6]; static QCheckBox *chk_inv[6]; @@ -290,8 +290,8 @@ void MainWin::updateui() bnrow[i].rad_action->setChecked(true); } - char *str; - if(cfg.kbmap[i] > 0 && (str = XKeysymToString(cfg.kbmap[i]))) { + char str[64]; + if(cfg.kbmap[i] > 0 && xkb_keysym_get_name(cfg.kbmap[i], str, sizeof str)) { bnrow[i].rad_mapkey->setChecked(true); bnrow[i].cmb_mapkey->setCurrentText(str); } @@ -640,8 +640,8 @@ void MainWin::combo_str_changed(const QString &qstr) if(!str || !*str) return; QLineEdit *ed = bnrow[i].cmb_mapkey->lineEdit(); - KeySym sym = XStringToKeysym(str); - if(sym == NoSymbol) { + xkb_keysym_t sym = xkb_keysym_from_name(str, XKB_KEYSYM_NO_FLAGS); + if(sym == XKB_KEY_NoSymbol) { QPalette cmap = def_cmb_cmap; cmap.setColor(QPalette::Text, Qt::red); ed->setPalette(cmap); From 7e54b273b91c5e74229a5a8457fb95f8054444a1 Mon Sep 17 00:00:00 2001 From: Chris Mayo Date: Fri, 24 Oct 2025 19:16:04 +0100 Subject: [PATCH 2/2] Update macOS workflow paths for libxkbcommon --- .github/workflows/build_macosx.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_macosx.yml b/.github/workflows/build_macosx.yml index b54317c..4beb786 100644 --- a/.github/workflows/build_macosx.yml +++ b/.github/workflows/build_macosx.yml @@ -28,7 +28,7 @@ jobs: sudo make install - name: configure - run: CFLAGS=-I/usr/X11R6/include LDFLAGS=-L/usr/X11R6/lib ./configure + run: CFLAGS=-I/opt/homebrew/include LDFLAGS=-L/opt/homebrew/lib ./configure - name: build run: make