GHOST: fix WITH_GHOST_DEBUG option
Changing the order of include changes broke GHOST_DEBUG, however it was using defines in a fragile way. Fix by removing 'GHOST_DEBUG' and use 'WITH_GHOST_DEBUG' which was already defined by CMake.
This commit is contained in:
parent
52186a39af
commit
070bf01d37
|
@ -33,15 +33,11 @@
|
|||
#endif
|
||||
|
||||
#ifdef WITH_GHOST_DEBUG
|
||||
# define GHOST_DEBUG // spit ghost events to stdout
|
||||
#endif // WITH_GHOST_DEBUG
|
||||
|
||||
#ifdef GHOST_DEBUG
|
||||
# include <iostream>
|
||||
# include <stdio.h> //for printf()
|
||||
#endif // GHOST_DEBUG
|
||||
#endif // WITH_GHOST_DEBUG
|
||||
|
||||
#ifdef GHOST_DEBUG
|
||||
#ifdef WITH_GHOST_DEBUG
|
||||
# define GHOST_PRINT(x) \
|
||||
{ \
|
||||
std::cout << x; \
|
||||
|
@ -52,10 +48,10 @@
|
|||
printf(x, __VA_ARGS__); \
|
||||
} \
|
||||
(void)0
|
||||
#else // GHOST_DEBUG
|
||||
#else // WITH_GHOST_DEBUG
|
||||
# define GHOST_PRINT(x)
|
||||
# define GHOST_PRINTF(x, ...)
|
||||
#endif // GHOST_DEBUG
|
||||
#endif // WITH_GHOST_DEBUG
|
||||
|
||||
#ifdef WITH_ASSERT_ABORT
|
||||
# include <stdio.h> //for fprintf()
|
||||
|
@ -70,7 +66,7 @@
|
|||
} \
|
||||
} \
|
||||
(void)0
|
||||
#elif defined(GHOST_DEBUG)
|
||||
#elif defined(WITH_GHOST_DEBUG)
|
||||
# define GHOST_ASSERT(x, info) \
|
||||
{ \
|
||||
if (!(x)) { \
|
||||
|
@ -80,8 +76,8 @@
|
|||
} \
|
||||
} \
|
||||
(void)0
|
||||
#else // GHOST_DEBUG
|
||||
#else // WITH_GHOST_DEBUG
|
||||
# define GHOST_ASSERT(x, info) ((void)0)
|
||||
#endif // GHOST_DEBUG
|
||||
#endif // WITH_GHOST_DEBUG
|
||||
|
||||
#endif // __GHOST_DEBUG_H__
|
||||
|
|
|
@ -80,13 +80,13 @@ GHOST_TSuccess GHOST_DisplayManagerWin32::getDisplaySetting(GHOST_TUns8 display,
|
|||
GHOST_TSuccess success;
|
||||
DEVMODE dm;
|
||||
if (::EnumDisplaySettings(display_device.DeviceName, index, &dm)) {
|
||||
#ifdef GHOST_DEBUG
|
||||
#ifdef WITH_GHOST_DEBUG
|
||||
printf("display mode: width=%d, height=%d, bpp=%d, frequency=%d\n",
|
||||
dm.dmPelsWidth,
|
||||
dm.dmPelsHeight,
|
||||
dm.dmBitsPerPel,
|
||||
dm.dmDisplayFrequency);
|
||||
#endif // GHOST_DEBUG
|
||||
#endif // WITH_GHOST_DEBUG
|
||||
setting.xPixels = dm.dmPelsWidth;
|
||||
setting.yPixels = dm.dmPelsHeight;
|
||||
setting.bpp = dm.dmBitsPerPel;
|
||||
|
@ -142,16 +142,16 @@ GHOST_TSuccess GHOST_DisplayManagerWin32::setCurrentDisplaySetting(
|
|||
* dm.dmSize = sizeof(DEVMODE);
|
||||
* dm.dmDriverExtra = 0;
|
||||
*/
|
||||
#ifdef GHOST_DEBUG
|
||||
#ifdef WITH_GHOST_DEBUG
|
||||
printf("display change: Requested settings:\n");
|
||||
printf(" dmBitsPerPel=%d\n", dm.dmBitsPerPel);
|
||||
printf(" dmPelsWidth=%d\n", dm.dmPelsWidth);
|
||||
printf(" dmPelsHeight=%d\n", dm.dmPelsHeight);
|
||||
printf(" dmDisplayFrequency=%d\n", dm.dmDisplayFrequency);
|
||||
#endif // GHOST_DEBUG
|
||||
#endif // WITH_GHOST_DEBUG
|
||||
|
||||
LONG status = ::ChangeDisplaySettings(&dm, CDS_FULLSCREEN);
|
||||
#ifdef GHOST_DEBUG
|
||||
#ifdef WITH_GHOST_DEBUG
|
||||
switch (status) {
|
||||
case DISP_CHANGE_SUCCESSFUL:
|
||||
printf("display change: The settings change was successful.\n");
|
||||
|
@ -182,6 +182,6 @@ GHOST_TSuccess GHOST_DisplayManagerWin32::setCurrentDisplaySetting(
|
|||
printf("display change: Return value invalid\n");
|
||||
break;
|
||||
}
|
||||
#endif // GHOST_DEBUG
|
||||
#endif // WITH_GHOST_DEBUG
|
||||
return status == DISP_CHANGE_SUCCESSFUL ? GHOST_kSuccess : GHOST_kFailure;
|
||||
}
|
||||
|
|
|
@ -28,10 +28,10 @@
|
|||
#include "utf_winfunc.h"
|
||||
#include "utfconv.h"
|
||||
|
||||
#ifdef GHOST_DEBUG
|
||||
#ifdef WITH_GHOST_DEBUG
|
||||
// utility
|
||||
void printLastError(void);
|
||||
#endif // GHOST_DEBUG
|
||||
#endif // WITH_GHOST_DEBUG
|
||||
|
||||
GHOST_DropTargetWin32::GHOST_DropTargetWin32(GHOST_WindowWin32 *window, GHOST_SystemWin32 *system)
|
||||
: m_window(window), m_system(system)
|
||||
|
@ -209,9 +209,9 @@ void *GHOST_DropTargetWin32::getGhostData(IDataObject *pDataObject)
|
|||
// return getDropDataAsBitmap(pDataObject);
|
||||
break;
|
||||
default:
|
||||
#ifdef GHOST_DEBUG
|
||||
#ifdef WITH_GHOST_DEBUG
|
||||
::printf("\nGHOST_kDragnDropTypeUnknown");
|
||||
#endif // GHOST_DEBUG
|
||||
#endif // WITH_GHOST_DEBUG
|
||||
return NULL;
|
||||
break;
|
||||
}
|
||||
|
@ -284,10 +284,10 @@ void *GHOST_DropTargetWin32::getDropDataAsString(IDataObject *pDataObject)
|
|||
// Free memory
|
||||
::GlobalUnlock(stgmed.hGlobal);
|
||||
::ReleaseStgMedium(&stgmed);
|
||||
#ifdef GHOST_DEBUG
|
||||
#ifdef WITH_GHOST_DEBUG
|
||||
::printf("\n<converted droped unicode string>\n%s\n</droped converted unicode string>\n",
|
||||
tmp_string);
|
||||
#endif // GHOST_DEBUG
|
||||
#endif // WITH_GHOST_DEBUG
|
||||
return tmp_string;
|
||||
}
|
||||
}
|
||||
|
@ -336,9 +336,9 @@ int GHOST_DropTargetWin32::WideCharToANSI(LPCWSTR in, char *&out)
|
|||
NULL);
|
||||
|
||||
if (!size) {
|
||||
#ifdef GHOST_DEBUG
|
||||
#ifdef WITH_GHOST_DEBUG
|
||||
::printLastError();
|
||||
#endif // GHOST_DEBUG
|
||||
#endif // WITH_GHOST_DEBUG
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -351,16 +351,16 @@ int GHOST_DropTargetWin32::WideCharToANSI(LPCWSTR in, char *&out)
|
|||
size = ::WideCharToMultiByte(CP_ACP, 0x00000400, in, -1, (LPSTR)out, size, NULL, NULL);
|
||||
|
||||
if (!size) {
|
||||
#ifdef GHOST_DEBUG
|
||||
#ifdef WITH_GHOST_DEBUG
|
||||
::printLastError();
|
||||
#endif // GHOST_DEBUG
|
||||
#endif // WITH_GHOST_DEBUG
|
||||
::free(out);
|
||||
out = NULL;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
#ifdef GHOST_DEBUG
|
||||
#ifdef WITH_GHOST_DEBUG
|
||||
void printLastError(void)
|
||||
{
|
||||
LPTSTR s;
|
||||
|
@ -378,4 +378,4 @@ void printLastError(void)
|
|||
LocalFree(s);
|
||||
}
|
||||
}
|
||||
#endif // GHOST_DEBUG
|
||||
#endif // WITH_GHOST_DEBUG
|
||||
|
|
|
@ -309,12 +309,12 @@ GHOST_TSuccess GHOST_System::init()
|
|||
m_windowManager = new GHOST_WindowManager();
|
||||
m_eventManager = new GHOST_EventManager();
|
||||
|
||||
#ifdef GHOST_DEBUG
|
||||
#ifdef WITH_GHOST_DEBUG
|
||||
if (m_eventManager) {
|
||||
m_eventPrinter = new GHOST_EventPrinter();
|
||||
m_eventManager->addConsumer(m_eventPrinter);
|
||||
}
|
||||
#endif // GHOST_DEBUG
|
||||
#endif // WITH_GHOST_DEBUG
|
||||
|
||||
if (m_timerManager && m_windowManager && m_eventManager) {
|
||||
return GHOST_kSuccess;
|
||||
|
|
|
@ -31,9 +31,9 @@
|
|||
#include "GHOST_Debug.h"
|
||||
#include "GHOST_EventManager.h"
|
||||
#include "GHOST_ModifierKeys.h"
|
||||
#ifdef GHOST_DEBUG
|
||||
#ifdef WITH_GHOST_DEBUG
|
||||
# include "GHOST_EventPrinter.h"
|
||||
#endif // GHOST_DEBUG
|
||||
#endif // WITH_GHOST_DEBUG
|
||||
|
||||
class GHOST_DisplayManager;
|
||||
class GHOST_Event;
|
||||
|
@ -390,9 +390,9 @@ class GHOST_System : public GHOST_ISystem {
|
|||
#endif
|
||||
|
||||
/** Prints all the events. */
|
||||
#ifdef GHOST_DEBUG
|
||||
#ifdef WITH_GHOST_DEBUG
|
||||
GHOST_EventPrinter *m_eventPrinter;
|
||||
#endif // GHOST_DEBUG
|
||||
#endif // WITH_GHOST_DEBUG
|
||||
|
||||
/** Settings of the display before the display went fullscreen. */
|
||||
GHOST_DisplaySetting m_preFullScreenSetting;
|
||||
|
|
|
@ -1881,7 +1881,7 @@ static GHOST_TKey ghost_key_from_keysym(const KeySym key)
|
|||
# endif
|
||||
#endif
|
||||
default:
|
||||
#ifdef GHOST_DEBUG
|
||||
#ifdef WITH_GHOST_DEBUG
|
||||
printf("%s: unknown key: %lu / 0x%lx\n", __func__, key, key);
|
||||
#endif
|
||||
type = GHOST_kKeyUnknown;
|
||||
|
@ -1905,7 +1905,7 @@ static GHOST_TKey ghost_key_from_keycode(const XkbDescPtr xkb_descr, const KeyCo
|
|||
switch (id) {
|
||||
case MAKE_ID('T', 'L', 'D', 'E'):
|
||||
return GHOST_kKeyAccentGrave;
|
||||
#ifdef GHOST_DEBUG
|
||||
#ifdef WITH_GHOST_DEBUG
|
||||
default:
|
||||
printf("%s unhandled keycode: %.*s\n", __func__, XkbKeyNameLength, id_str);
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue