Restore and fix old fullscreen code

This commit is contained in:
Phillip Stephens 2015-11-04 20:31:30 -08:00
parent aac3d2b7cd
commit 327a9dad58
2 changed files with 11 additions and 67 deletions

View File

@ -30,6 +30,7 @@ static const int ContextAttribs[] =
{
GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
GLX_CONTEXT_MINOR_VERSION_ARB, 3,
GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
//GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_DEBUG_BIT_ARB,
//GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,
None
@ -570,13 +571,8 @@ public:
return m_pixelFactor;
}
bool m_inFs = false;
int m_origFrame[4];
uint32_t m_decoBits;
bool isFullscreen() const
{
#if 0
unsigned long nitems;
Atom actualType;
int actualFormat;
@ -598,80 +594,20 @@ public:
return fullscreen;
}
return false;
#endif
return m_inFs;
}
struct FSHints
{
uint32_t flags;
uint32_t functions;
uint32_t decorations;
int32_t inputMode;
uint32_t status;
};
void setFullscreen(bool fs)
{
#if 0
XEvent fsEvent;
fsEvent.type = ClientMessage;
fsEvent.xclient.type = ClientMessage;
fsEvent.xclient.window = m_windowId;
fsEvent.xclient.message_type = XInternAtom(m_xDisp, "_NET_WM_STATE", False);
fsEvent.xclient.format = 32;
fsEvent.xclient.data.l[0] = fs;
fsEvent.xclient.data.l[1] = XInternAtom(m_xDisp, "_NET_WM_STATE_FULLSCREEN", False);
fsEvent.xclient.data.l[2] = 0;
XSendEvent(m_xDisp, m_windowId, False,
XSendEvent(m_xDisp, DefaultRootWindow(m_xDisp), False,
StructureNotifyMask | SubstructureRedirectMask, (XEvent*)&fsEvent);
#endif
if (!m_inFs)
{
if (!fs)
return;
XSetWindowAttributes attrs = {};
attrs.override_redirect = True;
//XChangeWindowAttributes(m_xDisp, m_windowId, CWOverrideRedirect, &attrs);
FSHints hints = {};
hints.flags = 2;
hints.decorations = 1;
XChangeProperty(m_xDisp, m_windowId, S_ATOMS->m_motifWmHints, S_ATOMS->m_motifWmHints, 32,
PropModeReplace, (unsigned char*)&hints, 5);
getWindowFrame(m_origFrame[0], m_origFrame[1], m_origFrame[2], m_origFrame[3]);
Screen* screen = DefaultScreenOfDisplay(m_xDisp);
if (m_origFrame[2] < 1 || m_origFrame[3] < 1)
genFrameDefault(screen, m_origFrame[0], m_origFrame[1], m_origFrame[2], m_origFrame[3]);
fprintf(stderr, "= %d %d %d %d\n", m_origFrame[0], m_origFrame[1], m_origFrame[2], m_origFrame[3]);
fprintf(stderr, "%d %d %d %d\n", 0, 0, screen->width, screen->height);
setWindowFrame(0, 0, screen->width, screen->height);
m_inFs = true;
fprintf(stderr, "FULLSCREEN\n");
}
else
{
if (fs)
return;
fprintf(stderr, "%d %d %d %d\n", m_origFrame[0], m_origFrame[1], m_origFrame[2], m_origFrame[3]);
setWindowFrame(m_origFrame[0], m_origFrame[1], m_origFrame[2], m_origFrame[3]);
XSetWindowAttributes attrs = {};
attrs.override_redirect = False;
//XChangeWindowAttributes(m_xDisp, m_windowId, CWOverrideRedirect, &attrs);
FSHints hints = {};
hints.flags = 2;
hints.decorations = 1;
XChangeProperty(m_xDisp, m_windowId, S_ATOMS->m_motifWmHints, S_ATOMS->m_motifWmHints, 32,
PropModeReplace, (unsigned char*)&hints, 5);
m_inFs = false;
fprintf(stderr, "WINDOWED\n");
}
}
void waitForRetrace()
@ -1072,6 +1008,13 @@ public:
return m_gfxCtx.getLoadContextDataFactory();
}
bool _isWindowMapped()
{
XWindowAttributes attr;
XGetWindowAttributes(m_xDisp, m_windowId, &attr);
return attr.map_state != IsUnmapped;
}
};
IWindow* _WindowXlibNew(const std::string& title,

View File

@ -25,6 +25,7 @@ class DolphinSmashAdapterCallback : public IDolphinSmashAdapterCallback
{
printf("CONTROLLER %u UPDATE %d %d\n", idx, state.m_leftStick[0], state.m_leftStick[1]);
printf(" %d %d\n", state.m_rightStick[0], state.m_rightStick[1]);
printf(" %d %d\n", state.m_analogTriggers[0], state.m_analogTriggers[1]);
}
};