xpra icon
Bug tracker and wiki

Opened 4 years ago

Closed 2 years ago

Last modified 12 months ago

#501 closed enhancement (fixed)

Support SHAPE extension

Reported by: Norman Rasmussen Owned by: alas
Priority: minor Milestone: 0.16
Component: core Version:
Keywords: Cc:

Description (last modified by Antoine Martin)

xeyes and xclock use this extension to have non-rectangular windows, low priority feature request to support it.

Attachments (5)

shape-v1.patch (7.6 KB) - added by Antoine Martin 2 years ago.
work in progress patch: send shape as metadata to X11 clients
XP-seamless-Linux.png (99.0 KB) - added by Antoine Martin 2 years ago.
shows off VirtualBox?'s seamless mode running within Xpra: IE8 and control panel directly on the Linux desktop
xshape.c (3.3 KB) - added by Antoine Martin 2 years ago.
example xshape code
cairo-xshape-example.c (3.4 KB) - added by Antoine Martin 2 years ago.
cairo xshape example
shapedwindow.py (2.9 KB) - added by Antoine Martin 2 years ago.
python gtk example

Download all attachments as: .zip

Change History (14)

comment:1 Changed 4 years ago by Antoine Martin

Description: modified (diff)
Milestone: 1.0
Owner: changed from Antoine Martin to Antoine Martin
Status: newassigned

See:

Looks like we should select for shape events with XShapeSelectInput and call XShapeGetRectangles to get the list of rectangles for a window, then we can pass that to the client...

Then the client can use gdk.Window.shape_combine_mask
Here is an example: shapedwindow.py

Last edited 4 years ago by Antoine Martin (previous) (diff)

Changed 2 years ago by Antoine Martin

Attachment: shape-v1.patch added

work in progress patch: send shape as metadata to X11 clients

comment:2 Changed 2 years ago by Antoine Martin

The patch above does most of what we need, except:

  • always reading the initial value of shape
  • structuring the data for the different kinds of shapes (bounding and clip)
  • actually using it client side: do we want to call the X11 layer directly? (easier since we don't cook the data as per gtk's mask interface - but maybe this works on win32 and osx via gtk?)

We probably want this in a reasonable shape (pun intended) before closing #885.

comment:3 Changed 2 years ago by Antoine Martin

Mostly done in r9657, this will do for now. xeyes works!

Remaining items (which may well get re-scheduled):

  • we're using the metadata packet, which is fine unless an application creates a storm of updates (why would they?) - we could convert the rectangles to a 1-bit image and compress it, sending it from the encode thread to prevent this bottleneck (meh). we may need to bump the max packet size limit, or whitelist the metadata packet (a fullscreen xeyes is enough to trigger the packet size warning), or even use a dedicated packet? (also meh)
  • not sure where we're supposed to get the offset passed in to XShapeCombineRectangles, maybe from the "extents" values? (until an app uses it, I'm not sure)
  • osx support: no idea (see Setting a Window’s Appearance?)
  • win32: UpdateLayeredWindow requires a layered window, and A layered window is created by specifying WS_EX_LAYERED when creating the window with the CreateWindowEx? function. - so I'm not sure this can be made to work with GTK...

And this shows off what is now possible with virtualbox seamless and remoted via Xpra:
shows off VirtualBox's seamless mode running within Xpra: IE8 and control panel directly on the Linux desktop

Last edited 2 years ago by Antoine Martin (previous) (diff)

Changed 2 years ago by Antoine Martin

Attachment: XP-seamless-Linux.png added

shows off VirtualBox?'s seamless mode running within Xpra: IE8 and control panel directly on the Linux desktop

Changed 2 years ago by Antoine Martin

Attachment: xshape.c added

example xshape code

Changed 2 years ago by Antoine Martin

Attachment: cairo-xshape-example.c added

cairo xshape example

comment:4 Changed 2 years ago by Antoine Martin

Found some examples to use for testing (beyond xeyes and virtualbox):

The source is now attached to this ticket in case googlecode loses yet more code.

The first one shows that the implementation is missing something: the window ends up not being transparent...
The second one works fine.

I have moved the osx and win32 items to #893.

Changed 2 years ago by Antoine Martin

Attachment: shapedwindow.py added

python gtk example

comment:5 Changed 2 years ago by Antoine Martin

Owner: changed from Antoine Martin to alas
Status: assignednew

Well, well. Turns out this is a bit of a monster of a bug, and not in the xshape code at all: r9671 fixes xshape for OR windows in trunk, as well as a long list of other properties we were failing to propagate for OR windows: "title", "size-hints", "fullscreen", "fullscreen-monitors", "bypass-compositor", "maximized", "opacity", "workspace", "strut", "shape".

This should be backported to all supported branches, but I think I'll just wait for the next point release to make sure this does not have undesirable side effects.

Apart from that, this is ready for testing, just connect with a Linux client and fire up one of the test applications:

  • xeyes
  • virtualbox in seamless mode
  • python shapedwindow.py
  • compile then run the C examples, ie:
    gcc $(pkg-config xext x11 cairo-xlib-xrender --cflags --libs) cairo-xshape-example.c -o cairo-xshape-example
    ./cairo-xshape-example
    
    gcc $(pkg-config xext x11 --cflags --libs) xshape.c -o xshape
    ./xshape 
    

@afarr: mostly a FYI, feel free to close as an acknowledgement.

comment:6 Changed 2 years ago by J. Max Mena

Resolution: fixed
Status: newclosed

Started a r9688 Fedora 21 Trunk Server:

  • shapedwindow.py works as expected when connecting from Fedora 20 Trunk r9688
  • Windows has a nice border

Consulted with Alex, and this has been acknowledged. Closing!

comment:7 Changed 2 years ago by Antoine Martin

Milestone: 1.00.16

(fix milestone)

comment:8 Changed 16 months ago by Antoine Martin

Problem is that the scaling code added in r10652 is too slow, so r12781 defaults to the lazy direct scaling of rectangles - will backport.
This fixes latest versions of google-chrome which seem to reset the xshape values far too often, causing multi-second stalls.

comment:9 Changed 12 months ago by Antoine Martin

r14363 makes it possible to disable the xshape code with the XPRA_SHAPE=0 env var.

Note: See TracTickets for help on using tickets.