Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New platform: xcb (simplified X11) #303

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

agordon
Copy link

@agordon agordon commented Apr 23, 2021

Hello Igalia devs,

Thanks for all your hard-work on WPE/COG - it's fantastic.

I'd like to offer a new platform plugin (temporary name: xcb).
It is conceptually similar to the current X11 platform, but works on minimal X11 servers without any extensions (e.g. GL/XKB).
It also supports some command-line options to enable easy startup in various kiosk modes.

Comments very welcomed.

Adds ability to directly pass parameters to the platform plugins.

Example:
  cog --platform FOO --platform-options "bar=1,baz" https://example.com
  cog -P FOO -O "bar=1,baz" https://example.com

The option syntax is platform-plugin dependant.
Current platform plugins (drm,x11,fdo,headless) do not support any
options.
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
@philn philn added the enhancement New feature or request label Apr 23, 2021
@aperezdc aperezdc self-requested a review April 28, 2021 09:49
@aperezdc
Copy link
Member

@agordon: Thanks for the PR, much appreciated! This new XCB platform plug-in has quite some overlap with the existing X11 one. I think it would make sense to merge both, for example:

  • We could make XKB optional (it can be a build option) and use your key input handling from this PR if XKB is disabled and/or unavailable.
  • When EGL fails to initialize in the existing X11 code, we could use your code from this PR to use SHM buffer exports.
  • The existing X11 plug-in does not support fullscreening, we could import the related code from this PR for that.

Having only one platform plug-in for X11 would make the code easier to maintain and everybody using X11 would be running the same code, so bugs will be caught and fixed earlier.

How does that sound? Would you be willing to help merge both, with some guidance from our side? 🔧

@agordon
Copy link
Author

agordon commented May 19, 2021

Yes, happy to work with you to consolidate it

aperezdc added a commit that referenced this pull request Nov 30, 2023
Massage the parts from #303 which deal with input using xcb-keysyms to
be included in the x11 platform plug-in. This provides a fallback that
can be used when XKB initialization fails, typically in cases where the
X server does not support XKB or has the support disabled. XKB is a X11
protocol extension after all, and it is wrong to assume that it will be
always available.
@aperezdc
Copy link
Member

There is some nice code in this PR, so I have picked e.g. the xcb-keysyms code from here to add it into the existing X11 platform plug-in in #679 😺

aperezdc added a commit that referenced this pull request Nov 30, 2023
Massage the parts from #303 which deal with input using xcb-keysyms to
be included in the x11 platform plug-in. This provides a fallback that
can be used when XKB initialization fails, typically in cases where the
X server does not support XKB or has the support disabled. XKB is a X11
protocol extension after all, and it is wrong to assume that it will be
always available. While at it, allow running without keyboard support,
producing a warning in this case.
aperezdc added a commit that referenced this pull request Nov 30, 2023
Massage the parts from #303 which deal with input using xcb-keysyms to
be included in the x11 platform plug-in. This provides a fallback that
can be used when XKB initialization fails, typically in cases where the
X server does not support XKB or has the support disabled. XKB is a X11
protocol extension after all, and it is wrong to assume that it will be
always available. While at it, allow running without keyboard support,
producing a warning in this case.
bykov34 pushed a commit to bykov34/cog that referenced this pull request Mar 14, 2024
Massage the parts from Igalia#303 which deal with input using xcb-keysyms to
be included in the x11 platform plug-in. This provides a fallback that
can be used when XKB initialization fails, typically in cases where the
X server does not support XKB or has the support disabled. XKB is a X11
protocol extension after all, and it is wrong to assume that it will be
always available. While at it, allow running without keyboard support,
producing a warning in this case.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants