Skip to content

Commit

Permalink
XCB: new platform (simplified X11)
Browse files Browse the repository at this point in the history
Similar to the X11 platform plugin, but should work on bare-bone X11
server, without any special extensions or hardware requirements (e.g.
GL/DRI/XKB). Works over SSH X11Forwarding tunnel and inside VNC servers.
Downside: much higher CPU load than other platforms.

Compilation requires the libxcb-keysyms and libxcb-image libraries
Debian/Ubuntu: apt-get install libxcb-keysyms1-dev libxcb-image0-dev

Usage:

  cog -P xcb https://example.com
  cog -P xcb -O "[options]" https://example.com

[Options] is comma separated string with one or more of:

  fullscreen  -   start in fullscreen mode (not multi-monitor aware,
                  default: not full screen).
  x=N,y=N     -   open window in position X,Y on screen
  width=N     -   set window width
  height=N    -   set window height
                  (default for x,y,width,height: window manager decides)
  fps=N       -   screen update frequency (default: 10).
                  higher values result in higher CPU load.
  scroll-delta=N        - amount of pixels to scrool with mouse-wheel
                          (default: 20).
  rev-scroll-direction  - reverse mouse-whell scroll direction.
  ignore-keys           - do not send keys to WebKit.
  ignore-mouse-movement - do not send mouse movement events to WebKit.
  ignore-mouse-buttons  - do not send mouse button clicks and scroll
                          wheel to WebKit.

Example:

  cog -P xcb -O "fullscreen,fps=20,scroll-delta=100" https://example.com
  • Loading branch information
agordon committed Apr 23, 2021
1 parent b1e877c commit 6cb6ecd
Show file tree
Hide file tree
Showing 3 changed files with 1,150 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ option(COG_PLATFORM_FDO "Build the FDO platform module" ON)
option(COG_PLATFORM_DRM "Build the DRM platform module" ON)
option(COG_PLATFORM_X11 "Build the X11 platform module" OFF)
option(COG_PLATFORM_GTK4 "Build the GTK4 platform module" OFF)
option(COG_PLATFORM_XCB "Build the XCB (Simplified X11) platform module" OFF)

option(COG_BUILD_PROGRAMS "Build and install programs as well" ON)
option(INSTALL_MAN_PAGES "Install the man(1) pages if COG_BUILD_PROGRAMS is enabled" ON)
Expand Down Expand Up @@ -209,3 +210,6 @@ endif ()
if (COG_PLATFORM_GTK4)
add_subdirectory(platform/gtk4)
endif ()
if (COG_PLATFORM_XCB)
add_subdirectory(platform/xcb)
endif ()
22 changes: 22 additions & 0 deletions platform/xcb/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# libcogplaform-xcb

# libxcb-keysyms1-dev libxcb-image0-dev

pkg_check_modules(COGPLATFORM_XCB_DEPS IMPORTED_TARGET
REQUIRED wpebackend-fdo-1.0>=1.6.0 xcb xcb-image xcb-keysyms)

add_library(cogplatform-xcb MODULE cog-platform-xcb.c)
set_target_properties(cogplatform-xcb PROPERTIES
C_STANDARD 99
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
)
target_compile_definitions(cogplatform-xcb PRIVATE G_LOG_DOMAIN=\"Cog-XCB\")
target_link_libraries(cogplatform-xcb PRIVATE cogcore
PkgConfig::COGPLATFORM_XCB_DEPS
PkgConfig::WebKit
)

install(TARGETS cogplatform-xcb
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT "runtime"
)

0 comments on commit 6cb6ecd

Please sign in to comment.