-
Notifications
You must be signed in to change notification settings - Fork 90
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
Let the user disable main window stealing focus when searching. #387
Conversation
mainwindow.cc
Outdated
if ( !isActiveWindow() ) | ||
{ | ||
qApp->setActiveWindow( this ); | ||
raise(); | ||
activateWindow(); | ||
if (cfg.preferences.raiseMainWindow) { | ||
raise(); | ||
activateWindow(); | ||
} | ||
shown = true; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when a search action is triggered, does the mainwindow can be inactive at the same time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be visible but inactive, which I assume is what the isActiveWindow()
call for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there may be case when gd windows has invisible .at this case ,raise()
should be called but without activateWindow()
does raise()
need to put outside of the if condition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at this case ,raise() should be called but without activateWindow()
I'm going to test this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, apparently you have to disable raise()
as well to prevent the main window from focusing itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think when mainwindow is invisible ,the application has choosen this branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does popup dialog need to change accordingly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does popup dialog need to change accordingly?
I think so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the window is actually invisible, it is fine to raise it.
please add some more informations about this PR |
For example, when I watch a video in MPV with Mpvacious, I have it automatically send the subtitles to GoldenDict. Every time a new subtitle appears on the screen, GoldenDict focuses itself, which is not always desirable. I only want to focus it myself when I need to. Without this PR I can only do it by having GoldenDict and MPV open in separate workspaces. A screencast: https://invidious.baczek.me/watch?v=bvl-dtB0wLs |
With the last commit popups work as intended. |
I think The reason is : after upgrade, users mainwindow will lost focus(as the checked box has been unchecked(I think) in the configuration file. |
@@ -580,7 +580,7 @@ void ScanPopup::engagePopup( bool forcePopup, bool giveFocus ) | |||
//QApplication::processEvents(); // Make window appear immediately no matter what | |||
} | |||
else | |||
if ( ui.pinButton->isChecked() ) | |||
if ( ui.pinButton->isChecked() && cfg.preferences.raiseMainWindow) | |||
{ | |||
// Pinned-down window isn't always on top, so we need to raise it | |||
show(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
show()
should this method be called at all conditions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
show() should this method be called at all conditions?
I think so. I will change that.
I think if the setting is on by default, which is the current behavior, then after updating the app the users won't notice any change unless they uncheck the setting. Correct me if I'm wrong. We could call the setting |
ok,Let's use your way last thing: |
…ed when search is triggered
If I run clang-format on the 6 files I've changed, the diff is going to be huge, but I'll try. |
only on the changed lines. after set the clang format ,you can select the changes lines and use menu If you have difficult doing this ,Let's just pass the step , your current code format is also good enough. |
Alright. |
7f9edee this commit should be revert or reset . too much unrelated line format changes will make future bug tracking difficult. |
config.cc
Outdated
newTabsOpenAfterCurrentOne( false ), | ||
newTabsOpenInBackground( true ), | ||
hideSingleTab( false ), | ||
mruTabOrder( false ), | ||
hideMenubar( false ), | ||
enableTrayIcon( true ), | ||
startToTray( false ), | ||
closeToTray( true ), | ||
autoStart( false ), | ||
doubleClickTranslates( true ), | ||
selectWordBySingleClick( false ), | ||
autoScrollToTargetArticle( true ), | ||
escKeyHidesMainWindow( false ), | ||
darkMode( false ), | ||
darkReaderMode( false ), | ||
alwaysOnTop( false ), | ||
searchInDock( false ), | ||
|
||
enableMainWindowHotkey( true ), | ||
mainWindowHotkey( QKeySequence( "Ctrl+F11,F11" ) ), | ||
enableClipboardHotkey( true ), | ||
clipboardHotkey( QKeySequence( "Ctrl+C,C" ) ), | ||
|
||
startWithScanPopupOn( false ), | ||
enableScanPopupModifiers( false ), | ||
scanPopupModifiers( 0 ), | ||
ignoreOwnClipboardChanges( false ), | ||
scanToMainWindow( false ), | ||
ignoreDiacritics( false ), | ||
ignorePunctuation( false ), | ||
#ifdef HAVE_X11 | ||
// Enable both Clipboard and Selection by default so that X users can enjoy full | ||
// power and disable optionally. | ||
trackClipboardScan ( true ), | ||
trackSelectionScan ( true ), | ||
showScanFlag( false ), | ||
// Enable both Clipboard and Selection by default so that X users can enjoy full | ||
// power and disable optionally. | ||
trackClipboardScan( true ), | ||
trackSelectionScan( true ), | ||
showScanFlag( false ), | ||
#endif | ||
pronounceOnLoadMain( false ), | ||
pronounceOnLoadPopup( false ), | ||
useInternalPlayer( InternalPlayerBackend::anyAvailable() ), | ||
internalPlayerBackend( InternalPlayerBackend::defaultBackend() ), | ||
checkForNewReleases( true ), | ||
disallowContentFromOtherSites( false ), | ||
enableWebPlugins( false ), | ||
hideGoldenDictHeader( false ), | ||
maxNetworkCacheSize( 50 ), | ||
clearNetworkCacheOnExit( true ), | ||
zoomFactor( 1 ), | ||
helpZoomFactor( 1 ), | ||
wordsZoomLevel( 0 ), | ||
maxStringsInHistory( 500 ), | ||
storeHistory( 1 ), | ||
alwaysExpandOptionalParts( false ) | ||
, historyStoreInterval( 0 ) | ||
, favoritesStoreInterval( 0 ) | ||
, confirmFavoritesDeletion( true ) | ||
, collapseBigArticles( false ) | ||
, articleSizeLimit( 2000 ) | ||
, limitInputPhraseLength( false ) | ||
, inputPhraseLengthLimit( 1000 ) | ||
, maxDictionaryRefsInContextMenu ( 20 ) | ||
, synonymSearchEnabled( true ), | ||
stripClipboard( false ), | ||
raiseWindowOnSearch(true) | ||
pronounceOnLoadMain( false ), | ||
pronounceOnLoadPopup( false ), | ||
useInternalPlayer( InternalPlayerBackend::anyAvailable() ), | ||
internalPlayerBackend( InternalPlayerBackend::defaultBackend() ), | ||
checkForNewReleases( true ), | ||
disallowContentFromOtherSites( false ), | ||
enableWebPlugins( false ), | ||
hideGoldenDictHeader( false ), | ||
maxNetworkCacheSize( 50 ), | ||
clearNetworkCacheOnExit( true ), | ||
zoomFactor( 1 ), | ||
helpZoomFactor( 1 ), | ||
wordsZoomLevel( 0 ), | ||
maxStringsInHistory( 500 ), | ||
storeHistory( 1 ), | ||
alwaysExpandOptionalParts( false ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do not change these lines, seems the .clang-format settings has improper configuration .I'll check this file.
the original code is usually indent two spaces
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay
76fa9a8 |
SonarCloud Quality Gate failed. |
When a search is triggered, the main window focuses itself even if it's already visible, which may be undesirable for some users. Let the user disable this behavior.