Skip to content

Commit

Permalink
Fixup mod-external usage, automatic trigger panel open
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <falktx@falktx.com>
  • Loading branch information
falkTX committed Dec 3, 2023
1 parent 68e15bc commit e08abac
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/mod-app-asio
Submodule mod-app-asio updated 3 files
+12 −16 asio.c
+2 −2 main.c
+3 −3 regsvr.c
2 changes: 1 addition & 1 deletion src/mod-ui
24 changes: 24 additions & 0 deletions src/systray/mod-app.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ class AppWindow : public QMainWindow
bool successfullyStarted = false;
int timerId = 0;

#ifdef Q_OS_WIN
HANDLE openEvent = nullptr;
#endif

struct DeviceInfo {
QString uid;
bool canInput = false;
Expand Down Expand Up @@ -216,12 +220,21 @@ class AppWindow : public QMainWindow
connect(&processUI, qOverload<int, QProcess::ExitStatus>(&QProcess::finished), this, &AppWindow::uiFinished);

timerId = startTimer(500);

#ifdef Q_OS_WIN
openEvent = ::CreateEventA(nullptr, false, false, "Global\\mod-app-open");
#endif
}

~AppWindow()
{
printf("----------- %s %d\n", __FUNCTION__, __LINE__);

#ifdef Q_OS_WIN
if (openEvent != nullptr)
CloseHandle(openEvent);
#endif

close();
}

Expand Down Expand Up @@ -588,6 +601,17 @@ class AppWindow : public QMainWindow
{
if (timerId != 0 && event->timerId() == timerId)
{
#ifdef Q_OS_WIN
if (openEvent != nullptr)
{
if (WaitForSingleObject(openEvent, 0) == WAIT_OBJECT_0)
{
show();
activateWindow();
}
}
#endif

if (startingHost || stoppingHost || processHost.state() != QProcess::NotRunning)
readHostLog();

Expand Down

0 comments on commit e08abac

Please sign in to comment.