Before: Construst Scanpopup only when both enableClipboardHotkey and enableScanPopup are true
Now: Always construct ScanPopup so that users can freely enable Copy->ScanPopup through navbar or tray
* There is no difference between those two on Windows and MacOS which only support clipboard (Ctrl+C) scanning
* Q_WS_X11 was defined on Qt4, and it causes the super weird trackClipboardChanges to occur on Windows
Accepting changes in Preferences dialog no longer disables two options
"Ignore words order" and "Ignore diacritics", which are configurable in
Full-text search dialog.
When Search Pane is hidden, Words Zoom level is large and GoldenDict
main window's width is small, translateBoxWidget does not fit into the
toolbar and is hidden behind the toolbar extension button » on the right
side. Reducing Words Zoom level does not automatically make
translateBoxWidget visible until the user presses the toolbar extension
button or types text to be translated.
I haven't noticed any effect of the existing line of code that activates
groupList parent widget's layout whether Search Pane is visible or
hidden. This line was introduced in the commit that implemented
TranslateBox - da13998518. In this initial
implementation navToolbar was the parent of groupList, and
translateBoxWidget did not yet exist. I think that the introduction of
translateBoxWidget in 404a16442b obsoleted
this line of code, and so remove it here.
I have verified that this fix works as intended in the Qt 4 and the Qt 5
version both under KDE Plasma and Xfce.
When the last tab is closed while the article view in it has focus,
Results Navigation Pane acquires focus in the Qt 4 version. This is OK,
because typed text is sent to the translate line and all shortcuts work.
In the Qt 5 version, depending on the value of the "Hide single tab"
option, either no widget has focus or the tab bar acquires focus in this
situation. This leads to issues described in the added comment.
Focus is already transferred to GoldenDict in toggleMainWindow() only
the first time the main window is shown. At all subsequent requests to
show the main window, focus has to be forced with the workaround.
Checking focus asynchronously allows to resort to the workaround less
often.
Under Xfce: the timeout of 0 ms is almost always sufficient in the Qt 5
version, but is never enough in the Qt 4 version. The timeout of 4 ms is
always sufficient in both versions.
Under KDE Plasma: the timeout of 0 ms is rarely sufficient in the Qt 5
version. Unfortunately, with any timeout other than 0 ms, the Qt 5
version does not always get focus, which would be a serious regression,
so no other timeout can be used. The Qt 4 version does not always get
focus both with and without the timeout.
translateLine->internalWinId() always equals 0. When the show/hide main
window hotkey is triggered right after GoldenDict starts to system tray,
`wh` equals MainWindow::internalWinId(). A few more experiments confirm
that XGetInputFocus()'s output parameter `focus_return` is an ID of a
top-level window, not of an embedded widget child.
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 #781.