[XembedSNIProxy] Redirect and handle structure requests on the embedded window.
ClosedPublic

Authored by kmaterka on Dec 18 2019, 12:31 PM.

Details

Summary

When the window is embedded, it should not request position change. Sometimes applications are misbehaving and ignore this constrain. We need to capture all structure requests (position or size change) and ignore them. In other words, we must be a window manager for the embedded window.

BUG: 414667

Test Plan

0. You need multiples screens to test this

  1. Configure screens so that (0,0) is not on the primary screen
  2. Run any Windows app with tray icon using Wine
  3. Left click event should work correctly

Diff Detail

Repository
R120 Plasma Workspace
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 20011
Build 20029: arc lint + arc unit
kmaterka requested review of this revision.Dec 18 2019, 12:31 PM
kmaterka created this revision.

That's quite a good idea.

xembed-sni-proxy/sniproxy.cpp
154

can you explain the swapping 0 and m_containerWid here?

kmaterka added inline comments.Dec 18 2019, 12:57 PM
xembed-sni-proxy/sniproxy.cpp
154

I knew someone will ask, I wanted to add comment here but you were too quick :)

I was not following the standard - worked because most clients (including Qt) ignores parent window. Wine is using d[3] field to read parent window.

I checked other implementations on github, most (but "i3") uses data[3] to set parent window.

From specification:

An XEmbed message is an X11 client message with message type "_XEMBED". The format is 32, the first three data longs carry the toolkit's X time (l[0]), the message's major opcode (l[1]) and the message's detail code (l[2]). If no detail is required, the value passed has to be 0. The remaining two data longs (l[3] and l[4]) are reserved for data1 and data2. Unused bytes of the client message are set to 0. The event is sent to the target window with no event mask and propagation turned off.

...

data1 The embedder's window handle.

So data1 = l[3] = ev.data.data32[3]

davidedmundson accepted this revision.Dec 18 2019, 12:59 PM

Awesome stuff

xembed-sni-proxy/sniproxy.cpp
4

make sure you update this sometime

This revision is now accepted and ready to land.Dec 18 2019, 12:59 PM
kmaterka added inline comments.Dec 18 2019, 1:02 PM
xembed-sni-proxy/sniproxy.cpp
4

I have another fix ready :)

In future I will want to cleanup the code a bit (formatting, maybe some refactoring). I don't know if this welcomed because this will break git history.

154

This change is not mandatory, but should go in this change. It is related to Wine bug, when this bug is fixed it will be required to correctly set parent (if I understand Wine code correctly... :) )

This revision was automatically updated to reflect the committed changes.

In future I will want to cleanup the code a bit (formatting, maybe some refactoring). I don't know if this welcomed because this will break git history.

Refactoring, sure go for it. I don't really agree with people worrying about git history, if you have good enough git skills it isn't a big problem.

I wouldn't waste too much time on whitespace stuff as I'm (very very slowly!) trying to push for a move to clang-format everything.