mirror of
https://github.com/debauchee/barrier.git
synced 2026-02-09 13:15:33 +08:00
checkpoint. adding screen saver support. only on X so far
and untested. also some known problems: not detecting an xscreensaver started after us and not detecting built-in screen saver activation (not sure if we can without using ugly extensions).
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "CXWindowsPrimaryScreen.h"
|
||||
#include "CServer.h"
|
||||
#include "CXWindowsClipboard.h"
|
||||
#include "CXWindowsScreenSaver.h"
|
||||
#include "CXWindowsUtil.h"
|
||||
#include "CThread.h"
|
||||
#include "CLog.h"
|
||||
@@ -60,6 +61,14 @@ CXWindowsPrimaryScreen::run()
|
||||
}
|
||||
break;
|
||||
|
||||
case ClientMessage:
|
||||
if (xevent.xclient.message_type == m_atomScreenSaver ||
|
||||
xevent.xclient.format == 32) {
|
||||
// screen saver activation/deactivation event
|
||||
m_server->onScreenSaver(xevent.xclient.data.l[0] != 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case KeyPress:
|
||||
{
|
||||
log((CLOG_DEBUG1 "event: KeyPress code=%d, state=0x%04x", xevent.xkey.keycode, xevent.xkey.state));
|
||||
@@ -267,6 +276,10 @@ CXWindowsPrimaryScreen::open(CServer* server)
|
||||
{
|
||||
CDisplayLock display(this);
|
||||
|
||||
// get notified of screen saver activation/deactivation
|
||||
m_atomScreenSaver = XInternAtom(display, "SCREENSAVER", False);
|
||||
getScreenSaver()->setNotify(m_window);
|
||||
|
||||
// update key state
|
||||
updateModifierMap(display);
|
||||
|
||||
@@ -298,6 +311,10 @@ CXWindowsPrimaryScreen::close()
|
||||
{
|
||||
assert(m_server != NULL);
|
||||
|
||||
// stop being notified of screen saver activation/deactivation
|
||||
getScreenSaver()->setNotify(None);
|
||||
m_atomScreenSaver = None;
|
||||
|
||||
// close the display
|
||||
closeDisplay();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user