mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-08-30 17:58:37 +08:00
UI: Cancel session end request on commitDataRequest() signal
This commit is contained in:
@@ -1428,6 +1428,9 @@ OBSApp::OBSApp(int &argc, char **argv, profiler_name_store_t *store)
|
||||
snInt = new QSocketNotifier(sigintFd[1], QSocketNotifier::Read, this);
|
||||
connect(snInt, &QSocketNotifier::activated, this,
|
||||
&OBSApp::ProcessSigInt);
|
||||
#else
|
||||
connect(qApp, &QGuiApplication::commitDataRequest, this,
|
||||
&OBSApp::commitData);
|
||||
#endif
|
||||
|
||||
sleepInhibitor = os_inhibit_sleep_create("OBS Video/audio");
|
||||
@@ -3270,6 +3273,16 @@ void OBSApp::ProcessSigInt(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
void OBSApp::commitData(QSessionManager &manager)
|
||||
{
|
||||
if (auto main = App()->GetMainWindow()) {
|
||||
QMetaObject::invokeMethod(main, "close", Qt::QueuedConnection);
|
||||
manager.cancel();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#ifndef _WIN32
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
#include <QPointer>
|
||||
#ifndef _WIN32
|
||||
#include <QSocketNotifier>
|
||||
#else
|
||||
#include <QSessionManager>
|
||||
#endif
|
||||
#include <obs.hpp>
|
||||
#include <util/lexer.h>
|
||||
@@ -132,6 +134,9 @@ private:
|
||||
#ifndef _WIN32
|
||||
static int sigintFd[2];
|
||||
QSocketNotifier *snInt = nullptr;
|
||||
#else
|
||||
private slots:
|
||||
void commitData(QSessionManager &manager);
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user