Skip to content

Latest commit

 

History

History
151 lines (115 loc) · 7.28 KB

dev-notes.md

File metadata and controls

151 lines (115 loc) · 7.28 KB

Developer notes

A collection of references and notes while developing this project.

Reference

Spec:

Guides and blog posts:

Other window manager articles:

Other articles:

Compositing manager examples:

Other window manager examples:

Relevant tools

  • Xvfb: X virtual framebuffer
    • Also xvfb-run to run a command in a virtual framebuffer (this will start and stop xvfb for you)
    • xvfb-run --server-num 99 --server-args "-ac -screen 0 1920x1080x24" firefox: Run Firefox in a virtual framebuffer with a 1920x1080 display with 24-bit color depth.
  • Xephyr: Nested X server that runs as an X application. It's basically a way to create a new X11 screen that appears as a window on your desktop.
    • Xephyr :99 -screen 1920x1080x24: Creates a new 1920x1080 display with 24-bit color depth. Then you can run DISPLAY=:99 firefox to run Firefox on that display.
    • Xephyr :99 +extension COMPOSITE -screen 300x300x24 Create a new display with the composite extension enabled.

Using Xephyr

(run these commands in separate terminals or put them in the background with &)

# Create a new display with Xephyr
Xephyr :99 -screen 1920x1080x24

# Start an application in the new display
DISPLAY=:99 firefox

The Xephyr source code (git repo) is in the xserver repository in the hw/kdrive/xephyr directory.

Cursor is not visible in Xephyr window

All of the relevant flags you would think would do something don't work to get a cursor showing up by default.

Examples of flags that do not work:

Xephyr :99 -screen 1920x1080x24 -sw-cursor -softCursor
Xephyr :99 -screen 1920x1080x24 -host-cursor

The only flag that seems to make the cursor always visible is -retro. This makes the background tile (party_like_its_1989) and makes the cursor visible by default. As far as I can tell and skimming the code, it doesn't have any other side-effects so it definately seems worth using instead of worrying about creating your own cursors.

Xephyr :99 -screen 1920x1080x24 -retro

The default cursor is a small "x" from the cursor font at glyph index 0 and 1. You can see how this is created for Xephyr in the CreateRootCursor(...) function. X11 requests: OpenFont -> CreateGlyphCursor. I first came across the "x" cursor from a ffmpeg recording using x11grab.

Xephyr running with the -retro flag. The "x" in the middle is the default cursor

Relevant links:

As far as I can tell, normally, your window manager would set a default cursor on the root window during a CreateWindow or ChangeWindowAttributes request. Then any child application windows just specify cursor: None to inherit their parents cursor. Any other cursors that an application uses would be created with CreateCursor.

For example, with the galculator application (just a small example program for illustration), the only cursor it creates is a text I-beam cursor for selecting the output number. You can trace this using x11trace galculator. At least on Manjaro Linux, you need to install the xtrace package to get the x11trace command. Confusingly, you might already have a xtrace command but that's not the same thing. And if you run galculator in Xephyr (DISPLAY=:99 galculator), your cursor is invisible (can only see the button hover highlights) until you move it over the area where the text I-beam cursor displays and move it out where it finally falls back to the default "x" cursor everywhere.

I have no idea how cursor themes work or how various applications make cursors consistent across your system. I'm guessing there is some freedesktop.org standard for this but I haven't looked into it yet.