mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-09-04 08:35:21 +00:00
Try setting current window as foreground on activate.
This commit is contained in:
@@ -20,6 +20,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||||||
#include "mainwidget.h"
|
#include "mainwidget.h"
|
||||||
#include "history/history_location_manager.h"
|
#include "history/history_location_manager.h"
|
||||||
#include "storage/localstorage.h"
|
#include "storage/localstorage.h"
|
||||||
|
#include "core/application.h"
|
||||||
|
#include "window/window_controller.h"
|
||||||
#include "core/crash_reports.h"
|
#include "core/crash_reports.h"
|
||||||
|
|
||||||
#include <QtCore/QOperatingSystemVersion>
|
#include <QtCore/QOperatingSystemVersion>
|
||||||
@@ -144,6 +146,14 @@ void DeleteMyModules() {
|
|||||||
void psActivateProcess(uint64 pid) {
|
void psActivateProcess(uint64 pid) {
|
||||||
if (pid) {
|
if (pid) {
|
||||||
::EnumWindows((WNDENUMPROC)_ActivateProcess, (LPARAM)&pid);
|
::EnumWindows((WNDENUMPROC)_ActivateProcess, (LPARAM)&pid);
|
||||||
|
} else if (Core::IsAppLaunched()) {
|
||||||
|
if (const auto window = Core::App().activeWindow()) {
|
||||||
|
if (const auto handle = window->widget()->windowHandle()) {
|
||||||
|
if (const auto id = handle->winId()) {
|
||||||
|
SetForegroundWindow(HWND(id));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user