2016-06-16 12:59:54 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2016-06-16 12:59:54 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2016-06-16 12:59:54 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2019-02-15 11:24:58 +00:00
|
|
|
#include "platform/win/wrapper_windows_h.h"
|
2016-06-16 12:59:54 +00:00
|
|
|
|
2019-09-04 07:19:15 +00:00
|
|
|
#include <QtCore/QAbstractNativeEventFilter>
|
|
|
|
|
2016-06-16 12:59:54 +00:00
|
|
|
namespace Platform {
|
|
|
|
|
2019-06-07 11:30:30 +00:00
|
|
|
class MainWindow;
|
|
|
|
|
2016-06-16 12:59:54 +00:00
|
|
|
class EventFilter : public QAbstractNativeEventFilter {
|
|
|
|
public:
|
|
|
|
bool nativeEventFilter(const QByteArray &eventType, void *message, long *result);
|
|
|
|
bool mainWindowEvent(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *result);
|
|
|
|
|
|
|
|
bool sessionLoggedOff() const {
|
|
|
|
return _sessionLoggedOff;
|
|
|
|
}
|
|
|
|
void setSessionLoggedOff(bool loggedOff) {
|
|
|
|
_sessionLoggedOff = loggedOff;
|
|
|
|
}
|
|
|
|
|
2019-06-07 11:30:30 +00:00
|
|
|
static EventFilter *CreateInstance(not_null<MainWindow*> window);
|
|
|
|
static EventFilter *GetInstance();
|
|
|
|
static void Destroy();
|
2016-06-16 12:59:54 +00:00
|
|
|
|
|
|
|
private:
|
2019-06-07 11:30:30 +00:00
|
|
|
explicit EventFilter(not_null<MainWindow*> window);
|
2016-06-16 12:59:54 +00:00
|
|
|
|
2019-06-07 11:30:30 +00:00
|
|
|
not_null<MainWindow*> _window;
|
2016-06-16 12:59:54 +00:00
|
|
|
bool _sessionLoggedOff = false;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Platform
|