Bug 309955

Summary: Oxygen transparent - all windows open on first monitor
Product: [Plasma] Oxygen Reporter: Zach <zachleigh>
Component: styleAssignee: Hugo Pereira Da Costa <hugo.pereira.da.costa>
Status: RESOLVED FIXED    
Severity: normal CC: hugo.pereira.da.costa, yyc1992
Priority: NOR    
Version: Git   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Zach 2012-11-12 11:37:19 UTC
When Oxygen Transparent is selected as the style, all windows open in position 0,0 on the primary monitor.  Applying any other style fixes the problem.

Kubuntu 12.10
KDE 4.9.3
Oxygen Transparent git script downloaded Nov. 10 2012 from KDE-Look here: http://kde-look.org/content/show.php/oxygen-transparent?content=127752
Nvidia GeForce 550 ti, Nvidia driver version 304.51

Reproducible: Always

Steps to Reproduce:
1. Install and apply Oxygen Transparent style on a multi monitor system
2. Open windows on second monitor
3.
Actual Results:  
Windows open on first monitor
Comment 1 Hugo Pereira Da Costa 2012-11-20 13:43:03 UTC
I fear there is not much we can do about it (and it is a known issue).
It comes from the fact that when enabling transparency, a new window is created (replacing the original non transparent one), and we (well QT) looses the screen number in the process
In fact, it looses the position also and all windows would show at 0,0, except that we use a trick for working around this issue. Since I don't have a dual display, I cant look for a workaround for the screen number ...
Question: could you
- install bespin widget style,
- enable transparency
- see if you have the same issue
If not I could look around this code and try implement the possible differences ...

Hugo
Comment 2 Zach 2012-11-25 04:09:01 UTC
Thanks for getting back Hugo.  I installed Bespin style and enabled transparency.  The transparancy was inconsistant and broke some things, but windows opened on the correct screen.
Comment 3 Hugo Pereira Da Costa 2012-11-28 10:29:30 UTC
Git commit 9bcf0665d20fb95174ed922f7bbea42d4daba5f7 by Hugo Pereira Da Costa.
Committed on 28/11/2012 at 11:24.
Pushed by hpereiradacosta into branch 'stable'.

Moved widget to (1000,1000) instead of (-10000, 10000)

M  +1    -1    style/oxygenargbhelper.cpp

http://commits.kde.org/oxygen-transparent/9bcf0665d20fb95174ed922f7bbea42d4daba5f7
Comment 4 Hugo Pereira Da Costa 2012-11-28 10:29:30 UTC
Git commit 83a46b6c18b35916efc34818406ca3484121543b by Hugo Pereira Da Costa.
Committed on 28/11/2012 at 11:27.
Pushed by hpereiradacosta into branch 'master'.

Moved widget to (1000,1000) instead of (-10000, 10000)

M  +1    -1    style/oxygenargbhelper.cpp

http://commits.kde.org/oxygen-transparent/83a46b6c18b35916efc34818406ca3484121543b
Comment 5 Hugo Pereira Da Costa 2012-11-28 10:30:26 UTC
@Zach
Can you test again with latest code ? 
(and notably that not all windows always open on second screen ;) )
Comment 6 Zach 2012-12-09 01:32:38 UTC
Sorry about the late reply...havent had much time to test anything the past few weeks.

Upgraded to KDE 4.9.4 and installed via latest git script --branch KDE/4.9  
Now all windows open on the second monitor, even if they are opened from the first.  Its the same problem as before but reveresed.
Comment 7 Christoph Feck 2012-12-09 15:42:33 UTC
Thanks for the update.

Hugo, is there a way to avoid using a temporary widget moved to a specific place?
Comment 8 Hugo Pereira Da Costa 2012-12-11 06:30:00 UTC
Git commit 5966f86e286b01ef1af5a45f0f5325d78f7a4e57 by Hugo Pereira Da Costa.
Committed on 11/12/2012 at 07:27.
Pushed by hpereiradacosta into branch 'master'.

Revert "Moved widget to (1000,1000) instead of (-10000, 10000)"
-> does not work

This reverts commit 83a46b6c18b35916efc34818406ca3484121543b.

M  +1    -1    style/oxygenargbhelper.cpp

http://commits.kde.org/oxygen-transparent/5966f86e286b01ef1af5a45f0f5325d78f7a4e57
Comment 9 Hugo Pereira Da Costa 2012-12-11 06:30:00 UTC
Git commit 5b9609075abec3c8983f81e636fb371a5aad3d9d by Hugo Pereira Da Costa.
Committed on 11/12/2012 at 07:27.
Pushed by hpereiradacosta into branch 'KDE/4.9'.

Revert "attempt at fixing positionning of windows"
-> does not work.

This reverts commit dc6634cfa129ebdd0ec11d7695aa4c3cfaa8b93b.

M  +1    -1    style/oxygenargbhelper.cpp

http://commits.kde.org/oxygen-transparent/5b9609075abec3c8983f81e636fb371a5aad3d9d
Comment 10 Hugo Pereira Da Costa 2012-12-11 06:34:33 UTC
@Christoph
not that I know. The only way, I think, is to set the WA_Translucent attribute in the widget's constructor, before it is first mapped into an X window. When the widget style does that (in the polish() method), it seems it is too late already.
Now, I must say I'm still confused why this does not happen with bespin. I'll investigate further. One possibility is that the move is done somewhat earlier in bespin than oxygen, but I'm unclear about that (looking at the code). 
I'll see if I can grab a second screen to test with the NVIDIA box I have at home.

Hugo
Comment 11 Hugo Pereira Da Costa 2012-12-11 06:35:01 UTC
In the meanwhile, I reverted the commit.
Comment 12 Yichao Yu 2013-10-15 15:08:04 UTC
NOTE:
In Qt5, the xcb backend does not support recreating the window (yet) which cause it impossible to make the main window translucent anymore.

Upstream bug report:
https://bugreports.qt-project.org/browse/QTBUG-34064
Comment 13 Yichao Yu 2013-10-16 08:20:58 UTC
@Hugo Pereira Da Costa

Real reason and upstream bug report here[1]. A better workaround here[2].

[1] https://bugreports.qt-project.org/browse/QTBUG-34108
[2] https://github.com/QtCurve/qtcurve/commit/bf795a7aab396a06377c3a8060cbdaf2ad99f3b0
Comment 14 Yichao Yu 2013-10-25 15:39:26 UTC
@Christoph
Are you sure it is fine for Bespin with translucency enabled? It has the same problem here.

I am using kscreen to setup a second VGA monitor (1280x1024) on the left of the original screen for my laptop (1920x1200) and tested by opening a kate window using krunner.

For Oxygen, all windows opens on the first monitor (VGA on the left).
For Bespin, all windows opens on the second monitor (LVDS on the right).
I also confirmed that my patch fixes the problem in QtCurve so the window always opens in the current screen. =D
Comment 15 Yichao Yu 2013-10-25 15:56:27 UTC
@Zach

Sorry that was a wrong @ ....
Comment 16 Hugo Pereira Da Costa 2013-10-29 15:42:14 UTC
Git commit 01ff65157d8d5006d2d39d08323384f5d455c0d5 by Hugo Pereira Da Costa.
Committed on 29/10/2013 at 15:40.
Pushed by hpereiradacosta into branch 'master'.

Fixed window positionning issues when setting translucent background.
Patch is based on QtCurve code.
Many thanks to Yichao Yu

M  +15   -12   style/oxygenargbhelper.cpp

http://commits.kde.org/oxygen-transparent/01ff65157d8d5006d2d39d08323384f5d455c0d5
Comment 17 Hugo Pereira Da Costa 2013-10-29 15:43:03 UTC
Tested the patch: seems to work as expected.
So I pushed the code.
Closing

Many thanks, Yichao