alamminsalo / orion

Cross platform Twitch.tv client
GNU General Public License v3.0
314 stars 60 forks source link

Context menus appear on the wrong monitor at first #74

Open rakslice opened 7 years ago

rakslice commented 7 years ago

When the mouse cursor is on a different monitor than the one the Orion window opens on at the time it opens, Orion's right-click context menus come up that other monitor, until I move the Orion window even just a small amount, after which the context menu comes up at the correct position (approximately where I right-clicked). If I exit and re-run Orion with the cursor on a different monitor, the problem comes back.

(Testing under Windows 10.0.14393 64-bit)

rakslice commented 7 years ago

Built w/ Qt 5.8.0 (MSVC 2015, 32 bit)

rakslice commented 7 years ago

I wonder if this is caused by an error positioning the window on a display in the first place. In the debug output I see a warning about geometry:


Starting window...
Reopening socket
'orion.exe' (Win32): Loaded 'C:\Windows\System32\mscms.dll'. Symbols loaded.
QSGThreadedRenderLoop: expose event received for window ApplicationWindow_QMLTYPE_94_QML_103(0x2c0c147cc50) with invalid geometry: QRect(676,216 1208x1007) on QScreen(0x2c0b8db9690, name=\\.\DISPLAY2)
qml: Connected to chat```
ahjolinna commented 7 years ago

I have tested all your latest (3) patch pull request on linux (openSUSE) and for now nothing has broken yet on linux, so that is good...

anyway...about this patch (75), it didn't fix anything yet on the linux side...but I doubt that will happen as xorg is horrible with this stuff (KDE has this problem also)...I haven't tested yet how this works on wayland...

here is trace log (gdb didn't say anything): orion-trace-log.txt

rakslice commented 7 years ago

Found an upstream bug report for this issue: https://bugreports.qt.io/browse/QTBUG-46977

rakslice commented 7 years ago

I'm going to change the workaround window move to happen on launch rather than before a context menu is opened. QT's behaviour is generally consistent with initially using the metrics of the screen the mouse cursor is on in place of the screen the application window is on, and this leads to incorrect text sizing when running with QT_AUTO_SCREEN_SCALE_FACTOR enabled.

ahjolinna commented 7 years ago

I hope this and other things are fixed in Qt 5.9, it's still planning to release by the end of May and this tool-kit update adds many new features including fully leveraging C++11, a new graphics architecture, Wayland support improvements, Qt 3D enhancements, and much more. Other changes as outlined earlier include:

Among the documented features so far for Qt 5.9 include an OpenVG back-end for Qt Quick, Qt Quick now caches QtGui / Qt Quick OpenGL shader program binaries on-disk to improve application start-up times, the QPainter OpenGL engine is now functional with OpenGL core profile contexts, window-screen associations can now be created via QML for multi-screen aware applications, Qt WebEngine is updated, and various other changes. The feature list though isn't comprehensive yet with the documentation still in need of many updates. We'll cover more on Qt 5.9 toolkit features in the weeks ahead. beta release announcement: http://blog.qt.io/blog/2017/04/07/qt-5-9-beta-released/

(quoted from phoronix.com)

rakslice commented 7 years ago

Unfortunately, while testing that change I've found that even the workaround already in the pull request doesn't work consistently.