mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 23:43:18 +02:00
Update assignment client to close on WM_CLOSE message on Windows
This commit is contained in:
parent
9546fe477c
commit
ad4956b2e2
2 changed files with 19 additions and 2 deletions
|
@ -41,7 +41,9 @@ AssignmentClient::AssignmentClient(int &argc, char **argv) :
|
|||
setOrganizationDomain("highfidelity.io");
|
||||
setApplicationName("assignment-client");
|
||||
QSettings::setDefaultFormat(QSettings::IniFormat);
|
||||
|
||||
|
||||
installNativeEventFilter(this);
|
||||
|
||||
QStringList argumentList = arguments();
|
||||
|
||||
// register meta type is required for queued invoke method on Assignment subclasses
|
||||
|
@ -113,6 +115,18 @@ AssignmentClient::AssignmentClient(int &argc, char **argv) :
|
|||
this, &AssignmentClient::handleAuthenticationRequest);
|
||||
}
|
||||
|
||||
bool AssignmentClient::nativeEventFilter(const QByteArray &eventType, void* msg, long* result) {
|
||||
if (eventType == "windows_generic_MSG") {
|
||||
MSG* message = (MSG*)msg;
|
||||
if (message->message == WM_CLOSE) {
|
||||
qDebug() << "Received WM_CLOSE message, closing";
|
||||
quit();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void AssignmentClient::sendAssignmentRequest() {
|
||||
if (!_currentAssignment) {
|
||||
NodeList::getInstance()->sendAssignment(_requestAssignment);
|
||||
|
|
|
@ -13,14 +13,17 @@
|
|||
#define hifi_AssignmentClient_h
|
||||
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QAbstractNativeEventFilter.h>
|
||||
|
||||
#include "ThreadedAssignment.h"
|
||||
|
||||
class AssignmentClient : public QCoreApplication {
|
||||
class AssignmentClient : public QCoreApplication, QAbstractNativeEventFilter {
|
||||
Q_OBJECT
|
||||
public:
|
||||
AssignmentClient(int &argc, char **argv);
|
||||
static const SharedAssignmentPointer& getCurrentAssignment() { return _currentAssignment; }
|
||||
virtual bool nativeEventFilter(const QByteArray& eventType, void* message, long* result);
|
||||
|
||||
private slots:
|
||||
void sendAssignmentRequest();
|
||||
void readPendingDatagrams();
|
||||
|
|
Loading…
Reference in a new issue