mirror of https://github.com/AxioDL/boo.git
Fullscreen fix
This commit is contained in:
parent
9160423fe8
commit
5fe40276a0
|
@ -519,10 +519,13 @@ public:
|
||||||
bool isFullscreen() const
|
bool isFullscreen() const
|
||||||
{
|
{
|
||||||
unsigned long nitems;
|
unsigned long nitems;
|
||||||
|
Atom actualType;
|
||||||
|
int actualFormat;
|
||||||
|
unsigned long bytes;
|
||||||
Atom* vals = nullptr;
|
Atom* vals = nullptr;
|
||||||
bool fullscreen = false;
|
bool fullscreen = false;
|
||||||
if (XGetWindowProperty(m_xDisp, m_windowId, S_ATOMS->m_netwmState, 0, 65536, False,
|
if (XGetWindowProperty(m_xDisp, m_windowId, XInternAtom(m_xDisp, "_NET_WM_STATE", True), 0, ~0l, False,
|
||||||
XA_ATOM, nullptr, nullptr, &nitems, nullptr, (unsigned char**)&vals))
|
XA_ATOM, &actualType, &actualFormat, &nitems, &bytes, (unsigned char**)&vals) == Success)
|
||||||
{
|
{
|
||||||
for (int i=0 ; i<nitems ; ++i)
|
for (int i=0 ; i<nitems ; ++i)
|
||||||
{
|
{
|
||||||
|
@ -540,18 +543,14 @@ public:
|
||||||
|
|
||||||
void setFullscreen(bool fs)
|
void setFullscreen(bool fs)
|
||||||
{
|
{
|
||||||
XClientMessageEvent fsEvent =
|
XEvent fsEvent;
|
||||||
{
|
fsEvent.type = ClientMessage;
|
||||||
ClientMessage,
|
fsEvent.xclient.window = m_windowId;
|
||||||
0,
|
fsEvent.xclient.message_type = XInternAtom(m_xDisp, "_NET_WM_STATE", False);
|
||||||
True,
|
fsEvent.xclient.format = 32;
|
||||||
m_xDisp,
|
fsEvent.xclient.data.l[0] = fs;
|
||||||
m_windowId,
|
fsEvent.xclient.data.l[1] = XInternAtom(m_xDisp, "_NET_WM_STATE_FULLSCREEN", False);
|
||||||
S_ATOMS->m_netwmState,
|
fsEvent.xclient.data.l[2] = 0;
|
||||||
32
|
|
||||||
};
|
|
||||||
fsEvent.data.l[0] = fs ? S_ATOMS->m_netwmStateAdd : S_ATOMS->m_netwmStateRemove;
|
|
||||||
fsEvent.data.l[1] = S_ATOMS->m_netwmStateFullscreen;
|
|
||||||
XSendEvent(m_xDisp, m_windowId, False,
|
XSendEvent(m_xDisp, m_windowId, False,
|
||||||
StructureNotifyMask | SubstructureRedirectMask, (XEvent*)&fsEvent);
|
StructureNotifyMask | SubstructureRedirectMask, (XEvent*)&fsEvent);
|
||||||
}
|
}
|
||||||
|
|
|
@ -278,12 +278,14 @@ struct TestApplicationCallback : IApplicationCallback
|
||||||
mainWindow = app->newWindow(_S("YAY!"));
|
mainWindow = app->newWindow(_S("YAY!"));
|
||||||
mainWindow->setCallback(&windowCallback);
|
mainWindow->setCallback(&windowCallback);
|
||||||
mainWindow->showWindow();
|
mainWindow->showWindow();
|
||||||
|
mainWindow->setFullscreen(true);
|
||||||
devFinder.startScanning();
|
devFinder.startScanning();
|
||||||
|
|
||||||
IGraphicsCommandQueue* gfxQ = mainWindow->getCommandQueue();
|
IGraphicsCommandQueue* gfxQ = mainWindow->getCommandQueue();
|
||||||
std::thread loaderThread(LoaderProc, this);
|
std::thread loaderThread(LoaderProc, this);
|
||||||
|
|
||||||
size_t frameIdx = 0;
|
size_t frameIdx = 0;
|
||||||
|
size_t lastCheck = 0;
|
||||||
while (running)
|
while (running)
|
||||||
{
|
{
|
||||||
mainWindow->waitForRetrace();
|
mainWindow->waitForRetrace();
|
||||||
|
@ -300,6 +302,12 @@ struct TestApplicationCallback : IApplicationCallback
|
||||||
gfxQ->execute();
|
gfxQ->execute();
|
||||||
|
|
||||||
fprintf(stderr, "%zu\n", frameIdx++);
|
fprintf(stderr, "%zu\n", frameIdx++);
|
||||||
|
|
||||||
|
if ((frameIdx - lastCheck) > 100)
|
||||||
|
{
|
||||||
|
lastCheck = frameIdx;
|
||||||
|
mainWindow->setFullscreen(!mainWindow->isFullscreen());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_cv.notify_one();
|
m_cv.notify_one();
|
||||||
|
|
Loading…
Reference in New Issue