DolphinQt2: FocusEventFilter -> WindowActivationEventFilter

This commit is contained in:
Michael Maltese
2017-06-14 18:49:56 -07:00
parent 220ce425cd
commit 5b3b6b7f3d
6 changed files with 33 additions and 31 deletions

View File

@ -1,19 +0,0 @@
// Copyright 2017 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include <QEvent>
#include <QObject>
#include "DolphinQt2/QtUtils/FocusEventFilter.h"
bool FocusEventFilter::eventFilter(QObject* object, QEvent* event)
{
if (event->type() == QEvent::FocusOut)
emit focusOutEvent();
if (event->type() == QEvent::FocusIn)
emit focusInEvent();
return false;
}

View File

@ -0,0 +1,19 @@
// Copyright 2017 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include <QEvent>
#include <QObject>
#include "DolphinQt2/QtUtils/WindowActivationEventFilter.h"
bool WindowActivationEventFilter::eventFilter(QObject* object, QEvent* event)
{
if (event->type() == QEvent::WindowDeactivate)
emit windowDeactivated();
if (event->type() == QEvent::WindowActivate)
emit windowActivated();
return false;
}

View File

@ -6,12 +6,12 @@
#include <QObject>
class FocusEventFilter : public QObject
class WindowActivationEventFilter : public QObject
{
Q_OBJECT
signals:
void focusInEvent();
void focusOutEvent();
void windowActivated();
void windowDeactivated();
private:
bool eventFilter(QObject* object, QEvent* event) override;