-
Notifications
You must be signed in to change notification settings - Fork 720
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show Main Window hotkey opens File menu #781
Comments
Confirmed. Tested with hotkey "Ctrl+alt+c+c". The main window will open with the File menu opened too. GoldenDict 1.5.0-RC2 |
Confirmed, in another Arch (Fluxbox) with GoldenDict 1.5.0RC2 and Qt 5.7.1. |
Confirmed, Arch KDE. |
This is specific to Arch, may be. |
Anyway to get this to work on Windows7? There should be an option to open the main window with a highlight + hot-key search. Alternatively, is there an option to include the "Found in Dictionaries" sidebar to the popup window? One or the other would be a great option! |
@MichailBachtin Why on Earth would you post this here especially if you've already made a #802 ticket for this? This achieves nothing but confusion. |
A workaround for this issue is to uncheck the menu bar under the View menu. |
@usermjs |
That is a great contribution compared to sarcasm that is 2 months late. |
I have this issue on one of my computers, both running latest Ubuntu 18.10. Same preferences at both of them, one is working well, the other is showing file menu when it opens for translate-results. the workaround from usermjs is fine to solve this until it is fixed. |
These X11 workarounds opened the Goldendict File menu each time the main window was shown not through system tray icon, e.g. via a hotkey or when trying to start another goldendict instance. I managed to reproduce this issue only in KDE Plasma 5 and only if $QT_QPA_PLATFORMTHEME environment variable is empty (not "qt5ct"). Couldn't reproduce this bug in Xfce with either empty or "qt5ct" $QT_QPA_PLATFORMTHEME value. Fixes goldendict#781. An alternative user workaround for this bug is described in a comment to goldendict#781: hide the Goldendict main menu (Ctrl+M). Unfortunately these X11 workarounds are not entirely useless even with Qt5. When they are disabled, activating an already running goldendict instance by launching another one without command line arguments no longer gives focus to the running instance. This regression manifests itself only in KDE Plasma 5 and not in Xfce, independently from the $QT_QPA_PLATFORMTHEME value or the main menu visibility. This commit affects only Qt5 Linux builds. For these builds the behavior becomes equivalent to reverting 3 commits: d1a4db2 d992c81 402b481 and then restoring the reverted "qApp->setActiveWindow( this );" line in the "if ( !isVisible() )" branch of MainWindow::toggleMainWindow(). Note: I haven't removed "qApp->setActiveWindow( this );" because this was the only not Linux-specific line of code introduced by the 3 disabled commits. Behavior on Linux or other platforms may have come to rely on it, especially in view of very similar code below in the "if ( !isActiveWindow() )" branch.
I disabled the workaround responsible for this bug in this branch. I haven't created a pull request based on this branch because it causes a regression. I suspect that the bug and the regression caused by my fix could depend on window manager focus settings, but I haven't tested this. If you find such dependencies, please describe them in comments. Note: my system is the Xfce edition of Manjaro (stable branch with latest updates, which is not far behind Arch Linux). |
The disabled X11 workaround makes the system believe that the user manually clicked on the top-left pixel of the main Goldendict window. This hack steals focus from other applications reliably, but it also performs this click at the position belonging to the File menu in the default KDE Plasma style. Without the X11 workaround, when KDE's Focus stealing prevention level is set to As an alternative to the X11 hack, I tried to find a proper way to activate and focus the first instance of Goldendict when the second instance is launched. Freedesktop.org's window manager specification suggests that the secondary instance should activate the primary one instead of sending a message to it (as Goldendict does now):
This seems to be a proper cross-platform approach. Microsoft recommends the same here:
Unfortunately I couldn't find such activation mechanism in Qt API. The KDE wayI tested KDE's systemsettings5 unique/single application: launching a second instance of it activates and focuses the primary instance with any focus stealing prevention level. KDBusAddons documentation states:
Any ideas? |
KWin requires applications that want to get focus properly to depend on KIO (a tier 3 KDE framework with complex dependencies) or to implement X11 startup notifications support, which is not particularly easy. See comments to my KWin bug report. So most apps do neither and don't get focus in Plasma unless focus stealing prevention level is set to |
I also have this problem on KDE Plasma 5.183, Qt 5.13.2 (Slackware -current). I'm running the latest version of goldendict from git |
Confirmed, Manjaro, Plasma 5.19 goldendict 1.5.0RC2-9 |
Unfortunately I don't understand much of the above, but I have the same issue on debian buster, but the workaround with disabling the menu bar works for me. |
Several:
Regarding your post:
|
Comments on the ideas:
No, I don't compile binaries. If you build GoldenDict from source, you can merge the referenced branch and compile with it. |
I fixed this problem. Simplily click view -> MenuBar, uncheck it. |
I am on KDE. I found another solution to this issue was to switch to the Fusion application style. |
I think this is a regression from #235 |
The fix for #235 actually limited the workaround that causes this issue, so it is not responsible for this regression. Apparently window styles that placed the main menu at position (1, 1) weren't popular 9 years ago, so no one noticed the issue back then. I think that requiring users to apply the workaround of hiding the menu bar is preferable to not giving the activated GoldenDict window focus. So until someone implements proper startup notification support, this bug will remain open. |
Unfortunately the X11 focus workaround that opens the File menu cannot be simply removed. Without this workaround, when KDE Plasma's Focus stealing prevention level is set to Low (which is the default) or higher, launching a second GoldenDict instance doesn't give focus to the already running instance unless that instance's main window is currently hidden into system tray or minimized. A workaround of hiding then showing the main window makes the window flicker. Suggesting GoldenDict users to set the focus stealing prevention level to None is not right, because this setting is global and affects all applications. Emulate a left mouse button click at position (0, 0) instead of (1, 1) in order to waste 1 rather than 2 pixels to the left of the menu bar. Introduce a new macro X11_MAIN_WINDOW_FOCUS_WORKAROUNDS to link the X11 focus workaround to the File menu workaround introduced in this commit. This simplifies disabling all related workarounds at once. When the focus workaround is replaced with a proper solution, the developer won't forget to remove all obsolete workarounds if they are linked together. Fixes goldendict#781.
This makes looking up words with it less convenient.
GoldenDict 1.5.0RC2
Arch Linux w/ Xfce
The text was updated successfully, but these errors were encountered: