Mark event loop nesting more carefully.

Fixes #5506. I hope fixes #5508.
This commit is contained in:
John Preston 2018-12-23 16:08:48 +04:00
parent 4e692e2c1e
commit de4a477686
5 changed files with 30 additions and 4 deletions

View File

@ -430,7 +430,8 @@ bool Application::nativeEventFilter(
const QByteArray &eventType,
void *message,
long *result) {
if (_eventNestingLevel > _loopNestingLevel) {
if (_eventNestingLevel > _loopNestingLevel
&& Platform::NativeEventNestsLoop(message)) {
_previousLoopNestingLevels.push_back(_loopNestingLevel);
_loopNestingLevel = _eventNestingLevel;
}

View File

@ -477,15 +477,19 @@ void RegisterCustomScheme() {
#endif // !TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME
}
PermissionStatus GetPermissionStatus(PermissionType type){
PermissionStatus GetPermissionStatus(PermissionType type) {
return PermissionStatus::Granted;
}
void RequestPermission(PermissionType type, Fn<void(PermissionStatus)> resultCallback){
void RequestPermission(PermissionType type, Fn<void(PermissionStatus)> resultCallback) {
resultCallback(PermissionStatus::Granted);
}
void OpenSystemSettingsForPermission(PermissionType type){
void OpenSystemSettingsForPermission(PermissionType type) {
}
bool NativeEventNestsLoop(void *message) {
return true;
}
namespace ThirdParty {

View File

@ -332,6 +332,10 @@ void OpenSystemSettingsForPermission(PermissionType type) {
#endif // OS_MAC_OLD
}
bool NativeEventNestsLoop(void *message) {
return true;
}
} // namespace Platform
void psNewVersion() {

View File

@ -35,6 +35,8 @@ PermissionStatus GetPermissionStatus(PermissionType type);
void RequestPermission(PermissionType type, Fn<void(PermissionStatus)> resultCallback);
void OpenSystemSettingsForPermission(PermissionType type);
bool NativeEventNestsLoop(void *message);
QString SystemLanguage();
QString SystemCountry();

View File

@ -657,6 +657,21 @@ void OpenSystemSettingsForPermission(PermissionType type) {
}
}
bool NativeEventNestsLoop(void *message) {
const auto code = static_cast<const MSG*>(message)->message;
if (code > WM_NULL && code <= WM_GETMINMAXINFO) {
return true;
} else if (code >= WM_NCCREATE && code <= WM_NCXBUTTONDBLCLK) {
return true;
} else if (code == WM_WINDOWPOSCHANGING
|| code == WM_WINDOWPOSCHANGED
|| code == WM_STYLECHANGING
|| code == WM_STYLECHANGED) {
return true;
}
return false;
}
} // namespace Platform
void psNewVersion() {