Use XCB and SelectSelectionInput instead of GTK+

As it happens, there is no real need to constantly poll for changes,
since XFixes can inform us of updates as they happen.

With GTK+ gone we've got dependencies and error handling under control.
XCB is a truly awful thing to learn, though.

Our method will never work on Wayland or Windows, so we don't miss out
on anything by abandoning the huge toolkit.
This commit is contained in:
2018-09-22 14:09:42 +02:00
parent b0d3b2dcb5
commit 942bda7db4
5 changed files with 255 additions and 118 deletions

View File

@@ -74,19 +74,18 @@ else (USE_SYSTEM_TERMO)
set (Termo_LIBRARIES termo-static)
endif (USE_SYSTEM_TERMO)
# We actually don't care about the specific version
pkg_search_module (gtk gtk+-3.0 gtk+-2.0)
option (WITH_GTK "Compile with GTK+ support" ${gtk_FOUND})
pkg_check_modules (xcb xcb xcb-xfixes)
option (WITH_X11 "Compile with X11 selection support using XCB" ${xcb_FOUND})
if (WITH_GTK)
if (NOT gtk_FOUND)
message (FATAL_ERROR "GTK+ library not found")
endif (NOT gtk_FOUND)
if (WITH_X11)
if (NOT xcb_FOUND)
message (FATAL_ERROR "XCB not found")
endif (NOT xcb_FOUND)
list (APPEND dependencies_INCLUDE_DIRS ${gtk_INCLUDE_DIRS})
list (APPEND dependencies_LIBRARY_DIRS ${gtk_LIBRARY_DIRS})
list (APPEND dependencies_LIBRARIES ${gtk_LIBRARIES})
endif (WITH_GTK)
list (APPEND dependencies_INCLUDE_DIRS ${xcb_INCLUDE_DIRS})
list (APPEND dependencies_LIBRARY_DIRS ${xcb_LIBRARY_DIRS})
list (APPEND dependencies_LIBRARIES ${xcb_LIBRARIES})
endif (WITH_X11)
link_directories (${dependencies_LIBRARY_DIRS})
include_directories (${ZLIB_INCLUDE_DIRS} ${icu_INCLUDE_DIRS}