x11rb: cairo example does not work

Hi, the cairo example for me does not draw anything, it crates the transparent window but doesn’t draw anything Console output

MapNotify(MapNotifyEvent { response_type: 19, sequence: 26, event: 96468992, window: 96468992, override_redirect: false }))
Got an unknown event
Expose(ExposeEvent { response_type: 12, sequence: 26, window: 96468992, x: 0, y: 0, width: 100, height: 100, count: 0 }))
ConfigureNotify(ConfigureNotifyEvent { response_type: 150, sequence: 26, event: 96468992, window: 96468992, above_sibling: 0, x: 910, y: 479, width: 100, height: 100, border_width: 0, override_redirect: false }))
UnmapNotify(UnmapNotifyEvent { response_type: 18, sequence: 52, event: 96468992, window: 96468992, from_configure: false }))
Got an unknown event
MapNotify(MapNotifyEvent { response_type: 19, sequence: 52, event: 96468992, window: 96468992, override_redirect: false }))
Got an unknown event
Expose(ExposeEvent { response_type: 12, sequence: 52, window: 96468992, x: 0, y: 0, width: 100, height: 100, count: 0 }))

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (7 by maintainers)

Most upvoted comments

Ok now almost everything works, except clicking on the overlay brings the window inside it to focus, instead of keeping the overlay on top, is there any way to set the window “topmost”, similar to windows?

You can add the _NET_WM_STATE_ABOVE value to the _NET_WM_STATE property (see https://specifications.freedesktop.org/wm-spec/1.3/ar01s05.html). You will need the intern_atom and change_property requests for that.

You need to enable the shape feature of x11rb.

The example here does that: https://github.com/psychon/x11rb/issues/26

The important part is this:

    // Make the window click-through by setting an empty input shape
    conn.shape_rectangles(
        shape::SO::SET,
        shape::SK::INPUT,
        xproto::ClipOrdering::YX_BANDED,
        window,
        0,
        0,
        &[],
    )?;

Argh. Thanks for that! From the docs for FreeColormap: https://www.x.org/releases/X11R7.6/doc/xproto/x11protocol.html#requests:FreeColormap

f the colormap is defined as the colormap for a window […] the colormap for the window is changed to None,

Now, I do not really know why this makes a difference (the colormap is not used for anything). But whatever, if it works like that, it works like that…

I think I figured it out

xwininfo: Window id: 0x6000000 "Simple Window"

  Absolute upper-left X:  0
  Absolute upper-left Y:  0
  Relative upper-left X:  0
  Relative upper-left Y:  0
  Width: 100
  Height: 100
  Depth: 32
  Visual: 0x7f
  Visual Class: TrueColor
  Border width: 0
  Class: InputOutput
  Colormap: 0x0 (not installed)
  Bit Gravity State: ForgetGravity
  Window Gravity State: NorthWestGravity
  Backing Store State: NotUseful
  Save Under State: no
  Map State: IsViewable
  Override Redirect State: no
  Corners:  +0+0  -3740+0  -3740-980  +0-980
  -geometry 100x100+0+0

Check that Colormap: 0x0. After commenting conn.free_colormap(colormap) the example works. It looks like colormaps are not reference counted.