[X2Go-Commits] x2godesktopsharing.git - build-main (branch) updated: 3.0.1.2-23-g0d49dfd
X2Go dev team
git-admin at x2go.org
Sat Jun 8 01:13:23 CEST 2013
The branch, build-main has been updated
via 0d49dfdde6ee62e21c709de027a6f80576d88727 (commit)
from ae952c3ad02ebd5231b425cfcc13c8a6515c01d8 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
-----------------------------------------------------------------------
Summary of changes:
main.cpp | 9 ++++++++-
sharetray.cpp | 24 ++++++++++++++++++++++++
sharetray.h | 4 ++++
3 files changed, 36 insertions(+), 1 deletion(-)
The diff of changes is:
diff --git a/main.cpp b/main.cpp
index b435d48..be7bb9b 100644
--- a/main.cpp
+++ b/main.cpp
@@ -83,7 +83,7 @@ void client ( const QStringList & cmd )
static int setup_unix_signal_handlers()
{
- struct sigaction keybint, term, abort;
+ struct sigaction keybint, term, abort, hup;
keybint.sa_handler = ShareTray::keybintSignalHandler;
sigemptyset(&keybint.sa_mask);
@@ -107,6 +107,13 @@ static int setup_unix_signal_handlers()
if (sigaction(SIGABRT, &abort, 0) > 0)
return 3;
+ hup.sa_handler = ShareTray::hupSignalHandler;
+ sigemptyset(&hup.sa_mask);
+ hup.sa_flags |= SA_RESTART;
+
+ if (sigaction(SIGHUP, &hup, 0) > 0)
+ return 4;
+
return 0;
}
diff --git a/sharetray.cpp b/sharetray.cpp
index 7c00b1e..2bf7dee 100644
--- a/sharetray.cpp
+++ b/sharetray.cpp
@@ -41,6 +41,7 @@
int ShareTray::sigkeybintFd[2];
int ShareTray::sigtermFd[2];
int ShareTray::sigabortFd[2];
+int ShareTray::sighupFd[2];
ShareTray::ShareTray()
: QMainWindow()
@@ -181,12 +182,17 @@ ShareTray::ShareTray()
if (::socketpair(AF_UNIX, SOCK_STREAM, 0, sigabortFd))
qFatal("Couldn't create ABRT socketpair");
+ if (::socketpair(AF_UNIX, SOCK_STREAM, 0, sighupFd))
+ qFatal("Couldn't create HANGUP socketpair");
+
snKeybInt = new QSocketNotifier(sigkeybintFd[1], QSocketNotifier::Read, this);
connect(snKeybInt, SIGNAL(activated(int)), this, SLOT(handleSigKeybInt()));
snTerm = new QSocketNotifier(sigtermFd[1], QSocketNotifier::Read, this);
connect(snTerm, SIGNAL(activated(int)), this, SLOT(handleSigTerm()));
snAbort = new QSocketNotifier(sigabortFd[1], QSocketNotifier::Read, this);
connect(snAbort, SIGNAL(activated(int)), this, SLOT(handleSigAbort()));
+ snHup = new QSocketNotifier(sighupFd[1], QSocketNotifier::Read, this);
+ connect(snHup, SIGNAL(activated(int)), this, SLOT(handleSigHup()));
QTimer *timer = new QTimer ( this );
connect ( timer, SIGNAL ( timeout() ), this, SLOT ( slotTimer() ) );
@@ -244,6 +250,18 @@ void ShareTray::handleSigAbort()
snAbort->setEnabled(true);
}
+void ShareTray::handleSigHup()
+{
+ snHup->setEnabled(false);
+ char tmp;
+ ::read(sighupFd[1], &tmp, sizeof(tmp));
+
+ // do Qt stuff here
+ slotMenuClose();
+
+ snHup->setEnabled(true);
+}
+
void ShareTray::keybintSignalHandler(int)
{
char a = 1;
@@ -262,6 +280,12 @@ void ShareTray::abortSignalHandler(int)
::write(sigabortFd[0], &a, sizeof(a));
}
+void ShareTray::hupSignalHandler(int)
+{
+ char a = 1;
+ ::write(sighupFd[0], &a, sizeof(a));
+}
+
void ShareTray::slotStopSharing()
{
if ( serverSocket )
diff --git a/sharetray.h b/sharetray.h
index c7fe8eb..0441359 100644
--- a/sharetray.h
+++ b/sharetray.h
@@ -37,6 +37,7 @@ public:
static void keybintSignalHandler(int unused);
static void termSignalHandler(int unused);
static void abortSignalHandler(int unused);
+ static void hupSignalHandler(int unused);
// desktop sharing socket
QString getSocketAnswer(QString message);
void closeSocket(SimpleLocalSocket* sock);
@@ -67,6 +68,7 @@ public slots:
void handleSigKeybInt();
void handleSigTerm();
void handleSigAbort();
+ void handleSigHup();
private slots:
void slotStopSharing();
void slotStartSharing();
@@ -94,9 +96,11 @@ private:
static int sigkeybintFd[2];
static int sigtermFd[2];
static int sigabortFd[2];
+ static int sighupFd[2];
QSocketNotifier *snKeybInt;
QSocketNotifier *snTerm;
QSocketNotifier *snAbort;
+ QSocketNotifier *snHup;
};
#endif
hooks/post-receive
--
x2godesktopsharing.git (Desktop Sharing for X2Go)
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "x2godesktopsharing.git" (Desktop Sharing for X2Go).
More information about the x2go-commits
mailing list