Cleanup: add missing braces in GHOST
This commit is contained in:
parent
7347252f0f
commit
fe63124c3e
|
@ -113,8 +113,9 @@ bool win32_chk(bool result, const char *file, int line, const char *text)
|
|||
|
||||
SetLastError(NO_ERROR);
|
||||
|
||||
if (count != 0)
|
||||
if (count != 0) {
|
||||
LocalFree(formattedMsg);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
@ -411,8 +411,9 @@ static bool nearHomePosition(GHOST_TEventNDOFMotionData *ndof, float threshold)
|
|||
|
||||
bool GHOST_NDOFManager::sendMotionEvent()
|
||||
{
|
||||
if (!m_motionEventPending)
|
||||
if (!m_motionEventPending) {
|
||||
return false;
|
||||
}
|
||||
|
||||
m_motionEventPending = false; /* Any pending motion is handled right now. */
|
||||
|
||||
|
|
|
@ -514,8 +514,9 @@ static void destroyIMCallback(XIM /*xim*/, XPointer ptr, XPointer /*data*/)
|
|||
|
||||
bool GHOST_SystemX11::openX11_IM()
|
||||
{
|
||||
if (!m_display)
|
||||
if (!m_display) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* set locale modifiers such as `@im=ibus` specified by XMODIFIERS. */
|
||||
XSetLocaleModifiers("");
|
||||
|
@ -585,7 +586,7 @@ struct init_timestamp_data {
|
|||
Time timestamp;
|
||||
};
|
||||
|
||||
static Bool init_timestamp_scanner(Display *, XEvent *event, XPointer arg)
|
||||
static Bool init_timestamp_scanner(Display * /*display*/, XEvent *event, XPointer arg)
|
||||
{
|
||||
init_timestamp_data *data = reinterpret_cast<init_timestamp_data *>(arg);
|
||||
switch (event->type) {
|
||||
|
@ -1321,10 +1322,12 @@ void GHOST_SystemX11::processEvent(XEvent *xe)
|
|||
#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING)
|
||||
XIC xic = window->getX11_XIC();
|
||||
if (xic) {
|
||||
if (xe->type == FocusIn)
|
||||
if (xe->type == FocusIn) {
|
||||
XSetICFocus(xic);
|
||||
else
|
||||
}
|
||||
else {
|
||||
XUnsetICFocus(xic);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -147,16 +147,19 @@ static XVisualInfo *x11_visualinfo_from_glx(Display *display,
|
|||
/* take a frame buffer config that has alpha cap */
|
||||
for (int i = 0; i < nbfbconfig; i++) {
|
||||
XVisualInfo *visual = (XVisualInfo *)glXGetVisualFromFBConfig(display, fbconfigs[i]);
|
||||
if (!visual)
|
||||
if (!visual) {
|
||||
continue;
|
||||
}
|
||||
/* if we don't need a alpha background, the first config will do, otherwise
|
||||
* test the alphaMask as it won't necessarily be present */
|
||||
if (needAlpha) {
|
||||
XRenderPictFormat *pict_format = XRenderFindVisualFormat(display, visual->visual);
|
||||
if (!pict_format)
|
||||
if (!pict_format) {
|
||||
continue;
|
||||
if (pict_format->direct.alphaMask <= 0)
|
||||
}
|
||||
if (pict_format->direct.alphaMask <= 0) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
*fbconfig = fbconfigs[i];
|
||||
|
@ -487,8 +490,9 @@ static Bool destroyICCallback(XIC /*xic*/, XPointer ptr, XPointer /*data*/)
|
|||
bool GHOST_WindowX11::createX11_XIC()
|
||||
{
|
||||
XIM xim = m_system->getX11_XIM();
|
||||
if (!xim)
|
||||
if (!xim) {
|
||||
return false;
|
||||
}
|
||||
|
||||
XICCallback destroy;
|
||||
destroy.callback = (XICProc)destroyICCallback;
|
||||
|
@ -536,17 +540,21 @@ void GHOST_WindowX11::refreshXInputDevices()
|
|||
XEventClass ev;
|
||||
|
||||
DeviceMotionNotify(xtablet.Device, xtablet.MotionEvent, ev);
|
||||
if (ev)
|
||||
if (ev) {
|
||||
xevents.push_back(ev);
|
||||
}
|
||||
DeviceButtonPress(xtablet.Device, xtablet.PressEvent, ev);
|
||||
if (ev)
|
||||
if (ev) {
|
||||
xevents.push_back(ev);
|
||||
}
|
||||
ProximityIn(xtablet.Device, xtablet.ProxInEvent, ev);
|
||||
if (ev)
|
||||
if (ev) {
|
||||
xevents.push_back(ev);
|
||||
}
|
||||
ProximityOut(xtablet.Device, xtablet.ProxOutEvent, ev);
|
||||
if (ev)
|
||||
if (ev) {
|
||||
xevents.push_back(ev);
|
||||
}
|
||||
}
|
||||
|
||||
XSelectExtensionEvent(m_display, m_window, xevents.data(), (int)xevents.size());
|
||||
|
|
|
@ -559,10 +559,12 @@ bool Application::processEvent(GHOST_IEvent *event)
|
|||
break;
|
||||
|
||||
case GHOST_kKeyS: // toggle mono and stereo
|
||||
if (stereo)
|
||||
if (stereo) {
|
||||
stereo = false;
|
||||
else
|
||||
}
|
||||
else {
|
||||
stereo = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case GHOST_kKeyT:
|
||||
|
@ -680,8 +682,9 @@ int main(int /*argc*/, char ** /*argv*/)
|
|||
if (lresult == ERROR_SUCCESS)
|
||||
printf("Successfully set value for key\n");
|
||||
regkey.Close();
|
||||
if (lresult == ERROR_SUCCESS)
|
||||
if (lresult == ERROR_SUCCESS) {
|
||||
printf("Successfully closed key\n");
|
||||
}
|
||||
// regkey.Write("2");
|
||||
}
|
||||
#endif // WIN32
|
||||
|
|
|
@ -179,37 +179,44 @@ static void mainwindow_do_key(MainWindow *mw, GHOST_TKey key, int press)
|
|||
{
|
||||
switch (key) {
|
||||
case GHOST_kKeyC:
|
||||
if (press)
|
||||
if (press) {
|
||||
GHOST_SetCursorShape(mw->win,
|
||||
(GHOST_TStandardCursor)(rand() % (GHOST_kStandardCursorNumCursors)));
|
||||
}
|
||||
break;
|
||||
case GHOST_kKeyLeftBracket:
|
||||
if (press)
|
||||
if (press) {
|
||||
GHOST_SetCursorVisibility(mw->win, 0);
|
||||
}
|
||||
break;
|
||||
case GHOST_kKeyRightBracket:
|
||||
if (press)
|
||||
if (press) {
|
||||
GHOST_SetCursorVisibility(mw->win, 1);
|
||||
}
|
||||
break;
|
||||
case GHOST_kKeyE:
|
||||
if (press)
|
||||
if (press) {
|
||||
multitestapp_toggle_extra_window(mw->app);
|
||||
}
|
||||
break;
|
||||
case GHOST_kKeyQ:
|
||||
if (press)
|
||||
if (press) {
|
||||
multitestapp_exit(mw->app);
|
||||
}
|
||||
break;
|
||||
case GHOST_kKeyT:
|
||||
if (press)
|
||||
if (press) {
|
||||
mainwindow_log(mw, "TextTest~|`hello`\"world\",<>/");
|
||||
}
|
||||
break;
|
||||
case GHOST_kKeyR:
|
||||
if (press) {
|
||||
int i;
|
||||
|
||||
mainwindow_log(mw, "Invalidating window 10 times");
|
||||
for (i = 0; i < 10; i++)
|
||||
for (i = 0; i < 10; i++) {
|
||||
GHOST_InvalidateWindow(mw->win);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GHOST_kKeyF11:
|
||||
|
@ -328,9 +335,7 @@ MainWindow *mainwindow_new(MultiTestApp *app)
|
|||
|
||||
return mw;
|
||||
}
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void mainwindow_free(MainWindow *mw)
|
||||
|
|
Loading…
Reference in New Issue