mirror of https://github.com/AxioDL/boo.git
Add True and False tests for bitwise enums
This commit is contained in:
parent
af4b1a4521
commit
c1d3d040bf
|
@ -45,6 +45,14 @@ static inline ComPtr<T>* ReferenceComPtr(ComPtr<T>& ptr) {
|
||||||
constexpr type operator~(type key) { \
|
constexpr type operator~(type key) { \
|
||||||
using T = std::underlying_type_t<type>; \
|
using T = std::underlying_type_t<type>; \
|
||||||
return type(~static_cast<T>(key)); \
|
return type(~static_cast<T>(key)); \
|
||||||
|
} \
|
||||||
|
constexpr bool True(type key) { \
|
||||||
|
using T = std::underlying_type_t<type>; \
|
||||||
|
return static_cast<T>(key) != 0; \
|
||||||
|
} \
|
||||||
|
constexpr bool False(type key) { \
|
||||||
|
using T = std::underlying_type_t<type>; \
|
||||||
|
return static_cast<T>(key) == 0; \
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -124,11 +124,11 @@ public:
|
||||||
|
|
||||||
void startRumble(EDualshockMotor motor, uint8_t duration = 254, uint8_t intensity = 255) {
|
void startRumble(EDualshockMotor motor, uint8_t duration = 254, uint8_t intensity = 255) {
|
||||||
m_rumbleRequest |= motor;
|
m_rumbleRequest |= motor;
|
||||||
if ((EDualshockMotor(motor) & EDualshockMotor::Left) != EDualshockMotor::None) {
|
if (True(EDualshockMotor(motor) & EDualshockMotor::Left)) {
|
||||||
m_rumbleDuration[0] = duration;
|
m_rumbleDuration[0] = duration;
|
||||||
m_rumbleIntensity[0] = intensity;
|
m_rumbleIntensity[0] = intensity;
|
||||||
}
|
}
|
||||||
if ((EDualshockMotor(motor) & EDualshockMotor::Right) != EDualshockMotor::None) {
|
if (True(EDualshockMotor(motor) & EDualshockMotor::Right)) {
|
||||||
m_rumbleDuration[1] = duration;
|
m_rumbleDuration[1] = duration;
|
||||||
m_rumbleIntensity[1] = intensity;
|
m_rumbleIntensity[1] = intensity;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,15 +42,15 @@ public:
|
||||||
m_callback->controllerDisconnected();
|
m_callback->controllerDisconnected();
|
||||||
}
|
}
|
||||||
void startRumble(EXInputMotor motors, uint16_t intensity) {
|
void startRumble(EXInputMotor motors, uint16_t intensity) {
|
||||||
if ((motors & EXInputMotor::Left) != EXInputMotor::None)
|
if (True(motors & EXInputMotor::Left))
|
||||||
m_rumbleRequest[0] = intensity;
|
m_rumbleRequest[0] = intensity;
|
||||||
if ((motors & EXInputMotor::Right) != EXInputMotor::None)
|
if (True(motors & EXInputMotor::Right))
|
||||||
m_rumbleRequest[1] = intensity;
|
m_rumbleRequest[1] = intensity;
|
||||||
}
|
}
|
||||||
void stopRumble(EXInputMotor motors) {
|
void stopRumble(EXInputMotor motors) {
|
||||||
if ((motors & EXInputMotor::Left) != EXInputMotor::None)
|
if (True(motors & EXInputMotor::Left))
|
||||||
m_rumbleRequest[0] = 0;
|
m_rumbleRequest[0] = 0;
|
||||||
if ((motors & EXInputMotor::Right) != EXInputMotor::None)
|
if (True(motors & EXInputMotor::Right))
|
||||||
m_rumbleRequest[1] = 0;
|
m_rumbleRequest[1] = 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1123,7 +1123,7 @@ struct GLCommandQueue : IGraphicsCommandQueue {
|
||||||
auto pipeline = fmt->m_pipeline.cast<GLShaderPipeline>();
|
auto pipeline = fmt->m_pipeline.cast<GLShaderPipeline>();
|
||||||
for (size_t i = 0; i < pipeline->m_elements.size(); ++i) {
|
for (size_t i = 0; i < pipeline->m_elements.size(); ++i) {
|
||||||
const VertexElementDescriptor& desc = pipeline->m_elements[i];
|
const VertexElementDescriptor& desc = pipeline->m_elements[i];
|
||||||
if ((desc.semantic & VertexSemantic::Instanced) != VertexSemantic::None)
|
if (True(desc.semantic & VertexSemantic::Instanced))
|
||||||
instStride += SEMANTIC_SIZE_TABLE[int(desc.semantic & VertexSemantic::SemanticMask)];
|
instStride += SEMANTIC_SIZE_TABLE[int(desc.semantic & VertexSemantic::SemanticMask)];
|
||||||
else
|
else
|
||||||
stride += SEMANTIC_SIZE_TABLE[int(desc.semantic & VertexSemantic::SemanticMask)];
|
stride += SEMANTIC_SIZE_TABLE[int(desc.semantic & VertexSemantic::SemanticMask)];
|
||||||
|
@ -1137,7 +1137,7 @@ struct GLCommandQueue : IGraphicsCommandQueue {
|
||||||
IGraphicsBuffer* lastEBO = nullptr;
|
IGraphicsBuffer* lastEBO = nullptr;
|
||||||
for (size_t i = 0; i < pipeline->m_elements.size(); ++i) {
|
for (size_t i = 0; i < pipeline->m_elements.size(); ++i) {
|
||||||
const VertexElementDescriptor& desc = pipeline->m_elements[i];
|
const VertexElementDescriptor& desc = pipeline->m_elements[i];
|
||||||
IGraphicsBuffer* vbo = (desc.semantic & VertexSemantic::Instanced) != VertexSemantic::None
|
IGraphicsBuffer* vbo = True(desc.semantic & VertexSemantic::Instanced)
|
||||||
? fmt->m_instVbo.get()
|
? fmt->m_instVbo.get()
|
||||||
: fmt->m_vbo.get();
|
: fmt->m_vbo.get();
|
||||||
IGraphicsBuffer* ebo = fmt->m_ibo.get();
|
IGraphicsBuffer* ebo = fmt->m_ibo.get();
|
||||||
|
@ -1157,7 +1157,7 @@ struct GLCommandQueue : IGraphicsCommandQueue {
|
||||||
}
|
}
|
||||||
glEnableVertexAttribArray(i);
|
glEnableVertexAttribArray(i);
|
||||||
int maskedSem = int(desc.semantic & VertexSemantic::SemanticMask);
|
int maskedSem = int(desc.semantic & VertexSemantic::SemanticMask);
|
||||||
if ((desc.semantic & VertexSemantic::Instanced) != VertexSemantic::None) {
|
if (True(desc.semantic & VertexSemantic::Instanced)) {
|
||||||
glVertexAttribPointer(i, SEMANTIC_COUNT_TABLE[maskedSem], SEMANTIC_TYPE_TABLE[maskedSem], GL_TRUE, instStride,
|
glVertexAttribPointer(i, SEMANTIC_COUNT_TABLE[maskedSem], SEMANTIC_TYPE_TABLE[maskedSem], GL_TRUE, instStride,
|
||||||
(void*)instOffset);
|
(void*)instOffset);
|
||||||
glVertexAttribDivisor(i, 1);
|
glVertexAttribDivisor(i, 1);
|
||||||
|
|
|
@ -1944,7 +1944,7 @@ struct VulkanVertexFormat {
|
||||||
int semantic = int(elemin->semantic & boo::VertexSemantic::SemanticMask);
|
int semantic = int(elemin->semantic & boo::VertexSemantic::SemanticMask);
|
||||||
attribute.location = i;
|
attribute.location = i;
|
||||||
attribute.format = SEMANTIC_TYPE_TABLE[semantic];
|
attribute.format = SEMANTIC_TYPE_TABLE[semantic];
|
||||||
if ((elemin->semantic & boo::VertexSemantic::Instanced) != boo::VertexSemantic::None) {
|
if (True(elemin->semantic & boo::VertexSemantic::Instanced)) {
|
||||||
attribute.binding = 1;
|
attribute.binding = 1;
|
||||||
attribute.offset = m_instStride;
|
attribute.offset = m_instStride;
|
||||||
m_instStride += SEMANTIC_SIZE_TABLE[semantic];
|
m_instStride += SEMANTIC_SIZE_TABLE[semantic];
|
||||||
|
|
|
@ -68,7 +68,7 @@ void DolphinSmashAdapter::transferCycle() {
|
||||||
DolphinControllerState state;
|
DolphinControllerState state;
|
||||||
bool rumble = false;
|
bool rumble = false;
|
||||||
EDolphinControllerType type = parseState(&state, controller, rumble);
|
EDolphinControllerType type = parseState(&state, controller, rumble);
|
||||||
if (type != EDolphinControllerType::None && !(m_knownControllers & 1 << i)) {
|
if (True(type) && !(m_knownControllers & 1 << i)) {
|
||||||
m_leftStickCal[0] = state.m_leftStick[0];
|
m_leftStickCal[0] = state.m_leftStick[0];
|
||||||
m_leftStickCal[1] = state.m_leftStick[1];
|
m_leftStickCal[1] = state.m_leftStick[1];
|
||||||
m_rightStickCal[0] = state.m_rightStick[0];
|
m_rightStickCal[0] = state.m_rightStick[0];
|
||||||
|
@ -77,7 +77,7 @@ void DolphinSmashAdapter::transferCycle() {
|
||||||
m_triggersCal[1] = state.m_analogTriggers[1];
|
m_triggersCal[1] = state.m_analogTriggers[1];
|
||||||
m_knownControllers |= 1 << i;
|
m_knownControllers |= 1 << i;
|
||||||
m_callback->controllerConnected(i, type);
|
m_callback->controllerConnected(i, type);
|
||||||
} else if (type == EDolphinControllerType::None && (m_knownControllers & 1 << i)) {
|
} else if (False(type) && (m_knownControllers & 1 << i)) {
|
||||||
m_knownControllers &= ~(1 << i);
|
m_knownControllers &= ~(1 << i);
|
||||||
m_callback->controllerDisconnected(i);
|
m_callback->controllerDisconnected(i);
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ void DualshockPad::receivedHIDReport(const uint8_t* data, size_t length, HIDRepo
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_rumbleRequest != m_rumbleState) {
|
if (m_rumbleRequest != m_rumbleState) {
|
||||||
if ((m_rumbleRequest & EDualshockMotor::Left) != EDualshockMotor::None) {
|
if (True(m_rumbleRequest & EDualshockMotor::Left)) {
|
||||||
m_report.rumble.leftDuration = m_rumbleDuration[0];
|
m_report.rumble.leftDuration = m_rumbleDuration[0];
|
||||||
m_report.rumble.leftForce = m_rumbleIntensity[0];
|
m_report.rumble.leftForce = m_rumbleIntensity[0];
|
||||||
} else {
|
} else {
|
||||||
|
@ -97,7 +97,7 @@ void DualshockPad::receivedHIDReport(const uint8_t* data, size_t length, HIDRepo
|
||||||
m_report.rumble.leftForce = 0;
|
m_report.rumble.leftForce = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((m_rumbleRequest & EDualshockMotor::Right) != EDualshockMotor::None) {
|
if (True(m_rumbleRequest & EDualshockMotor::Right)) {
|
||||||
m_report.rumble.rightDuration = m_rumbleDuration[1];
|
m_report.rumble.rightDuration = m_rumbleDuration[1];
|
||||||
m_report.rumble.rightOn = m_rumbleIntensity[1] > 0;
|
m_report.rumble.rightOn = m_rumbleIntensity[1] > 0;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -55,6 +55,8 @@
|
||||||
#define MWM_FUNC_CLOSE (1L << 5)
|
#define MWM_FUNC_CLOSE (1L << 5)
|
||||||
|
|
||||||
#undef None
|
#undef None
|
||||||
|
#undef False
|
||||||
|
#undef True
|
||||||
|
|
||||||
typedef GLXContext (*glXCreateContextAttribsARBProc)(Display*, GLXFBConfig, GLXContext, Bool, const int*);
|
typedef GLXContext (*glXCreateContextAttribsARBProc)(Display*, GLXFBConfig, GLXContext, Bool, const int*);
|
||||||
static glXCreateContextAttribsARBProc glXCreateContextAttribsARB = 0;
|
static glXCreateContextAttribsARBProc glXCreateContextAttribsARB = 0;
|
||||||
|
@ -205,23 +207,23 @@ struct XlibAtoms {
|
||||||
Atom m_utf8String = 0;
|
Atom m_utf8String = 0;
|
||||||
Atom m_imagePng = 0;
|
Atom m_imagePng = 0;
|
||||||
XlibAtoms(Display* disp) {
|
XlibAtoms(Display* disp) {
|
||||||
m_wmProtocols = XInternAtom(disp, "WM_PROTOCOLS", True);
|
m_wmProtocols = XInternAtom(disp, "WM_PROTOCOLS", true);
|
||||||
m_wmDeleteWindow = XInternAtom(disp, "WM_DELETE_WINDOW", True);
|
m_wmDeleteWindow = XInternAtom(disp, "WM_DELETE_WINDOW", true);
|
||||||
m_netSupported = XInternAtom(disp, "_NET_SUPPORTED", True);
|
m_netSupported = XInternAtom(disp, "_NET_SUPPORTED", true);
|
||||||
m_netwmName = XInternAtom(disp, "_NET_WM_NAME", False);
|
m_netwmName = XInternAtom(disp, "_NET_WM_NAME", false);
|
||||||
m_netwmPid = XInternAtom(disp, "_NET_WM_PID", False);
|
m_netwmPid = XInternAtom(disp, "_NET_WM_PID", false);
|
||||||
m_netwmIcon = XInternAtom(disp, "_NET_WM_ICON", False);
|
m_netwmIcon = XInternAtom(disp, "_NET_WM_ICON", false);
|
||||||
m_netwmIconName = XInternAtom(disp, "_NET_WM_ICON_NAME", False);
|
m_netwmIconName = XInternAtom(disp, "_NET_WM_ICON_NAME", false);
|
||||||
m_netwmState = XInternAtom(disp, "_NET_WM_STATE", False);
|
m_netwmState = XInternAtom(disp, "_NET_WM_STATE", false);
|
||||||
m_netwmStateFullscreen = XInternAtom(disp, "_NET_WM_STATE_FULLSCREEN", False);
|
m_netwmStateFullscreen = XInternAtom(disp, "_NET_WM_STATE_FULLSCREEN", false);
|
||||||
m_netwmStateAdd = XInternAtom(disp, "_NET_WM_STATE_ADD", False);
|
m_netwmStateAdd = XInternAtom(disp, "_NET_WM_STATE_ADD", false);
|
||||||
m_netwmStateRemove = XInternAtom(disp, "_NET_WM_STATE_REMOVE", False);
|
m_netwmStateRemove = XInternAtom(disp, "_NET_WM_STATE_REMOVE", false);
|
||||||
m_motifWmHints = XInternAtom(disp, "_MOTIF_WM_HINTS", True);
|
m_motifWmHints = XInternAtom(disp, "_MOTIF_WM_HINTS", true);
|
||||||
m_targets = XInternAtom(disp, "TARGETS", False);
|
m_targets = XInternAtom(disp, "TARGETS", false);
|
||||||
m_clipboard = XInternAtom(disp, "CLIPBOARD", False);
|
m_clipboard = XInternAtom(disp, "CLIPBOARD", false);
|
||||||
m_clipdata = XInternAtom(disp, "CLIPDATA", False);
|
m_clipdata = XInternAtom(disp, "CLIPDATA", false);
|
||||||
m_utf8String = XInternAtom(disp, "UTF8_STRING", False);
|
m_utf8String = XInternAtom(disp, "UTF8_STRING", false);
|
||||||
m_imagePng = XInternAtom(disp, "image/png", False);
|
m_imagePng = XInternAtom(disp, "image/png", false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static XlibAtoms* S_ATOMS = NULL;
|
static XlibAtoms* S_ATOMS = NULL;
|
||||||
|
@ -395,7 +397,7 @@ public:
|
||||||
s_glxError = false;
|
s_glxError = false;
|
||||||
XErrorHandler oldHandler = XSetErrorHandler(ctxErrorHandler);
|
XErrorHandler oldHandler = XSetErrorHandler(ctxErrorHandler);
|
||||||
for (m_attribIdx = 0; m_attribIdx < std::extent<decltype(ContextAttribList)>::value; ++m_attribIdx) {
|
for (m_attribIdx = 0; m_attribIdx < std::extent<decltype(ContextAttribList)>::value; ++m_attribIdx) {
|
||||||
m_glxCtx = glXCreateContextAttribsARB(m_xDisp, m_fbconfig, m_lastCtx, True, ContextAttribList[m_attribIdx]);
|
m_glxCtx = glXCreateContextAttribsARB(m_xDisp, m_fbconfig, m_lastCtx, true, ContextAttribList[m_attribIdx]);
|
||||||
if (m_glxCtx)
|
if (m_glxCtx)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -444,7 +446,7 @@ public:
|
||||||
if (!m_mainCtx) {
|
if (!m_mainCtx) {
|
||||||
s_glxError = false;
|
s_glxError = false;
|
||||||
XErrorHandler oldHandler = XSetErrorHandler(ctxErrorHandler);
|
XErrorHandler oldHandler = XSetErrorHandler(ctxErrorHandler);
|
||||||
m_mainCtx = glXCreateContextAttribsARB(m_xDisp, m_fbconfig, m_glxCtx, True, ContextAttribList[m_attribIdx]);
|
m_mainCtx = glXCreateContextAttribsARB(m_xDisp, m_fbconfig, m_glxCtx, true, ContextAttribList[m_attribIdx]);
|
||||||
XSetErrorHandler(oldHandler);
|
XSetErrorHandler(oldHandler);
|
||||||
if (!m_mainCtx)
|
if (!m_mainCtx)
|
||||||
Log.report(logvisor::Fatal, "unable to make main GLX context");
|
Log.report(logvisor::Fatal, "unable to make main GLX context");
|
||||||
|
@ -460,7 +462,7 @@ public:
|
||||||
if (!m_loadCtx) {
|
if (!m_loadCtx) {
|
||||||
s_glxError = false;
|
s_glxError = false;
|
||||||
XErrorHandler oldHandler = XSetErrorHandler(ctxErrorHandler);
|
XErrorHandler oldHandler = XSetErrorHandler(ctxErrorHandler);
|
||||||
m_loadCtx = glXCreateContextAttribsARB(m_xDisp, m_fbconfig, m_glxCtx, True, ContextAttribList[m_attribIdx]);
|
m_loadCtx = glXCreateContextAttribsARB(m_xDisp, m_fbconfig, m_glxCtx, true, ContextAttribList[m_attribIdx]);
|
||||||
XSetErrorHandler(oldHandler);
|
XSetErrorHandler(oldHandler);
|
||||||
if (!m_loadCtx)
|
if (!m_loadCtx)
|
||||||
Log.report(logvisor::Fatal, "unable to make load GLX context");
|
Log.report(logvisor::Fatal, "unable to make load GLX context");
|
||||||
|
@ -881,7 +883,7 @@ public:
|
||||||
unsigned long bytes;
|
unsigned long bytes;
|
||||||
unsigned char* string = nullptr;
|
unsigned char* string = nullptr;
|
||||||
XLockDisplay(m_xDisp);
|
XLockDisplay(m_xDisp);
|
||||||
int ret = XGetWindowProperty(m_xDisp, m_windowId, XA_WM_NAME, 0, ~0l, False, XA_STRING, &actualType, &actualFormat,
|
int ret = XGetWindowProperty(m_xDisp, m_windowId, XA_WM_NAME, 0, ~0l, false, XA_STRING, &actualType, &actualFormat,
|
||||||
&nitems, &bytes, &string);
|
&nitems, &bytes, &string);
|
||||||
XUnlockDisplay(m_xDisp);
|
XUnlockDisplay(m_xDisp);
|
||||||
if (ret == Success) {
|
if (ret == Success) {
|
||||||
|
@ -1023,7 +1025,7 @@ public:
|
||||||
Atom* vals = nullptr;
|
Atom* vals = nullptr;
|
||||||
bool fullscreen = false;
|
bool fullscreen = false;
|
||||||
XLockDisplay(m_xDisp);
|
XLockDisplay(m_xDisp);
|
||||||
int ret = XGetWindowProperty(m_xDisp, m_windowId, S_ATOMS->m_netwmState, 0, ~0l, False, XA_ATOM, &actualType,
|
int ret = XGetWindowProperty(m_xDisp, m_windowId, S_ATOMS->m_netwmState, 0, ~0l, false, XA_ATOM, &actualType,
|
||||||
&actualFormat, &nitems, &bytes, (unsigned char**)&vals);
|
&actualFormat, &nitems, &bytes, (unsigned char**)&vals);
|
||||||
XUnlockDisplay(m_xDisp);
|
XUnlockDisplay(m_xDisp);
|
||||||
if (ret == Success) {
|
if (ret == Success) {
|
||||||
|
@ -1051,16 +1053,16 @@ public:
|
||||||
|
|
||||||
if (S_ATOMS->m_motifWmHints) {
|
if (S_ATOMS->m_motifWmHints) {
|
||||||
wmHints.flags = MWM_HINTS_DECORATIONS | MWM_HINTS_FUNCTIONS;
|
wmHints.flags = MWM_HINTS_DECORATIONS | MWM_HINTS_FUNCTIONS;
|
||||||
if ((style & EWindowStyle::Titlebar) != EWindowStyle::None) {
|
if (True(style & EWindowStyle::Titlebar)) {
|
||||||
wmHints.decorations |= MWM_DECOR_BORDER | MWM_DECOR_TITLE | MWM_DECOR_MINIMIZE | MWM_DECOR_MENU;
|
wmHints.decorations |= MWM_DECOR_BORDER | MWM_DECOR_TITLE | MWM_DECOR_MINIMIZE | MWM_DECOR_MENU;
|
||||||
wmHints.functions |= MWM_FUNC_MOVE | MWM_FUNC_MINIMIZE;
|
wmHints.functions |= MWM_FUNC_MOVE | MWM_FUNC_MINIMIZE;
|
||||||
}
|
}
|
||||||
if ((style & EWindowStyle::Resize) != EWindowStyle::None) {
|
if (True(style & EWindowStyle::Resize)) {
|
||||||
wmHints.decorations |= MWM_DECOR_MAXIMIZE | MWM_DECOR_RESIZEH;
|
wmHints.decorations |= MWM_DECOR_MAXIMIZE | MWM_DECOR_RESIZEH;
|
||||||
wmHints.functions |= MWM_FUNC_RESIZE | MWM_FUNC_MAXIMIZE;
|
wmHints.functions |= MWM_FUNC_RESIZE | MWM_FUNC_MAXIMIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((style & EWindowStyle::Close) != EWindowStyle::None)
|
if (True(style & EWindowStyle::Close))
|
||||||
wmHints.functions |= MWM_FUNC_CLOSE;
|
wmHints.functions |= MWM_FUNC_CLOSE;
|
||||||
|
|
||||||
XLockDisplay(m_xDisp);
|
XLockDisplay(m_xDisp);
|
||||||
|
@ -1081,7 +1083,7 @@ public:
|
||||||
XEvent fsEvent = {0};
|
XEvent fsEvent = {0};
|
||||||
fsEvent.xclient.type = ClientMessage;
|
fsEvent.xclient.type = ClientMessage;
|
||||||
fsEvent.xclient.serial = 0;
|
fsEvent.xclient.serial = 0;
|
||||||
fsEvent.xclient.send_event = True;
|
fsEvent.xclient.send_event = true;
|
||||||
fsEvent.xclient.window = m_windowId;
|
fsEvent.xclient.window = m_windowId;
|
||||||
fsEvent.xclient.message_type = S_ATOMS->m_netwmState;
|
fsEvent.xclient.message_type = S_ATOMS->m_netwmState;
|
||||||
fsEvent.xclient.format = 32;
|
fsEvent.xclient.format = 32;
|
||||||
|
@ -1089,7 +1091,7 @@ public:
|
||||||
fsEvent.xclient.data.l[1] = S_ATOMS->m_netwmStateFullscreen;
|
fsEvent.xclient.data.l[1] = S_ATOMS->m_netwmStateFullscreen;
|
||||||
fsEvent.xclient.data.l[2] = 0;
|
fsEvent.xclient.data.l[2] = 0;
|
||||||
XLockDisplay(m_xDisp);
|
XLockDisplay(m_xDisp);
|
||||||
XSendEvent(m_xDisp, DefaultRootWindow(m_xDisp), False, StructureNotifyMask | SubstructureRedirectMask,
|
XSendEvent(m_xDisp, DefaultRootWindow(m_xDisp), false, StructureNotifyMask | SubstructureRedirectMask,
|
||||||
(XEvent*)&fsEvent);
|
(XEvent*)&fsEvent);
|
||||||
XUnlockDisplay(m_xDisp);
|
XUnlockDisplay(m_xDisp);
|
||||||
|
|
||||||
|
@ -1163,7 +1165,7 @@ public:
|
||||||
// Atom t1 = S_ATOMS->m_clipboard;
|
// Atom t1 = S_ATOMS->m_clipboard;
|
||||||
// Atom t2 = S_ATOMS->m_clipdata;
|
// Atom t2 = S_ATOMS->m_clipdata;
|
||||||
|
|
||||||
if (XGetWindowProperty(m_xDisp, m_windowId, S_ATOMS->m_clipdata, 0, 32, False, AnyPropertyType, &type,
|
if (XGetWindowProperty(m_xDisp, m_windowId, S_ATOMS->m_clipdata, 0, 32, false, AnyPropertyType, &type,
|
||||||
&format, &nitems, &rem, &data)) {
|
&format, &nitems, &rem, &data)) {
|
||||||
Log.report(logvisor::Fatal, "Clipboard allocation failed");
|
Log.report(logvisor::Fatal, "Clipboard allocation failed");
|
||||||
XUnlockDisplay(m_xDisp);
|
XUnlockDisplay(m_xDisp);
|
||||||
|
@ -1218,7 +1220,7 @@ public:
|
||||||
} else
|
} else
|
||||||
reply.xselection.property = 0;
|
reply.xselection.property = 0;
|
||||||
}
|
}
|
||||||
XSendEvent(m_xDisp, se->requestor, False, 0, &reply);
|
XSendEvent(m_xDisp, se->requestor, false, 0, &reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define NSEC_PER_SEC 1000000000
|
#define NSEC_PER_SEC 1000000000
|
||||||
|
@ -1472,7 +1474,7 @@ public:
|
||||||
char charCode = translateKeysym(&event->xkey, specialKey, modifierKey);
|
char charCode = translateKeysym(&event->xkey, specialKey, modifierKey);
|
||||||
EModifierKey modifierMask = translateModifiers(state);
|
EModifierKey modifierMask = translateModifiers(state);
|
||||||
if (charCode) {
|
if (charCode) {
|
||||||
if (inputCb && (modifierMask & (EModifierKey::Ctrl | EModifierKey::Command)) == EModifierKey::None)
|
if (inputCb && False(modifierMask & (EModifierKey::Ctrl | EModifierKey::Command)))
|
||||||
inputCb->insertText(std::string(1, charCode));
|
inputCb->insertText(std::string(1, charCode));
|
||||||
|
|
||||||
bool isRepeat = m_charKeys.find(charCode) != m_charKeys.cend();
|
bool isRepeat = m_charKeys.find(charCode) != m_charKeys.cend();
|
||||||
|
@ -1484,7 +1486,7 @@ public:
|
||||||
m_callback->specialKeyDown(specialKey, modifierMask, isRepeat);
|
m_callback->specialKeyDown(specialKey, modifierMask, isRepeat);
|
||||||
if (!isRepeat)
|
if (!isRepeat)
|
||||||
m_specialKeys.insert((unsigned long)specialKey);
|
m_specialKeys.insert((unsigned long)specialKey);
|
||||||
} else if (modifierKey != EModifierKey::None) {
|
} else if (True(modifierKey)) {
|
||||||
bool isRepeat = m_modKeys.find((unsigned long)modifierKey) != m_modKeys.cend();
|
bool isRepeat = m_modKeys.find((unsigned long)modifierKey) != m_modKeys.cend();
|
||||||
m_callback->modKeyDown(modifierKey, isRepeat);
|
m_callback->modKeyDown(modifierKey, isRepeat);
|
||||||
if (!isRepeat)
|
if (!isRepeat)
|
||||||
|
@ -1507,7 +1509,7 @@ public:
|
||||||
} else if (specialKey != ESpecialKey::None) {
|
} else if (specialKey != ESpecialKey::None) {
|
||||||
m_specialKeys.erase((unsigned long)specialKey);
|
m_specialKeys.erase((unsigned long)specialKey);
|
||||||
m_callback->specialKeyUp(specialKey, modifierMask);
|
m_callback->specialKeyUp(specialKey, modifierMask);
|
||||||
} else if (modifierKey != EModifierKey::None) {
|
} else if (True(modifierKey)) {
|
||||||
m_modKeys.erase((unsigned long)modifierKey);
|
m_modKeys.erase((unsigned long)modifierKey);
|
||||||
m_callback->modKeyUp(modifierKey);
|
m_callback->modKeyUp(modifierKey);
|
||||||
}
|
}
|
||||||
|
|
|
@ -180,7 +180,7 @@ struct CTestWindowCallback : IWindowCallback {
|
||||||
void charKeyDown(unsigned long charCode, EModifierKey mods, bool isRepeat) {}
|
void charKeyDown(unsigned long charCode, EModifierKey mods, bool isRepeat) {}
|
||||||
void charKeyUp(unsigned long charCode, EModifierKey mods) {}
|
void charKeyUp(unsigned long charCode, EModifierKey mods) {}
|
||||||
void specialKeyDown(ESpecialKey key, EModifierKey mods, bool isRepeat) {
|
void specialKeyDown(ESpecialKey key, EModifierKey mods, bool isRepeat) {
|
||||||
if (key == ESpecialKey::Enter && (mods & EModifierKey::Alt) != EModifierKey::None)
|
if (key == ESpecialKey::Enter && True(mods & EModifierKey::Alt))
|
||||||
m_fullscreenToggleRequested = true;
|
m_fullscreenToggleRequested = true;
|
||||||
}
|
}
|
||||||
void specialKeyUp(ESpecialKey key, EModifierKey mods) {}
|
void specialKeyUp(ESpecialKey key, EModifierKey mods) {}
|
||||||
|
|
Loading…
Reference in New Issue