[Bf-blender-cvs] [648ee66] master: Style cleanup GHOST/Win32
Campbell Barton
noreply at git.blender.org
Sun Jul 27 05:51:36 CEST 2014
Commit: 648ee669b7758a607701a4fe8c0bd4e965ccf3f1
Author: Campbell Barton
Date: Sun Jul 27 13:40:39 2014 +1000
Branches: master
https://developer.blender.org/rB648ee669b7758a607701a4fe8c0bd4e965ccf3f1
Style cleanup GHOST/Win32
===================================================================
M intern/ghost/intern/GHOST_DisplayManagerWin32.cpp
M intern/ghost/intern/GHOST_DropTargetWin32.cpp
M intern/ghost/intern/GHOST_SystemWin32.cpp
M intern/ghost/intern/GHOST_TaskbarWin32.h
M intern/ghost/intern/GHOST_WindowWin32.cpp
===================================================================
diff --git a/intern/ghost/intern/GHOST_DisplayManagerWin32.cpp b/intern/ghost/intern/GHOST_DisplayManagerWin32.cpp
index 0bfc67a..65d5e65 100644
--- a/intern/ghost/intern/GHOST_DisplayManagerWin32.cpp
+++ b/intern/ghost/intern/GHOST_DisplayManagerWin32.cpp
@@ -56,7 +56,7 @@ GHOST_TSuccess GHOST_DisplayManagerWin32::getNumDisplays(GHOST_TUns8& numDisplay
return numDisplays > 0 ? GHOST_kSuccess : GHOST_kFailure;
}
-static BOOL get_dd(DWORD d, DISPLAY_DEVICE* dd)
+static BOOL get_dd(DWORD d, DISPLAY_DEVICE *dd)
{
dd->cb = sizeof(DISPLAY_DEVICE);
return ::EnumDisplayDevices(NULL, d, dd, 0);
@@ -161,8 +161,7 @@ GHOST_TSuccess GHOST_DisplayManagerWin32::setCurrentDisplaySetting(GHOST_TUns8 d
LONG status = ::ChangeDisplaySettings(&dm, CDS_FULLSCREEN);
#ifdef GHOST_DEBUG
- switch (status)
- {
+ switch (status) {
case DISP_CHANGE_SUCCESSFUL:
printf("display change: The settings change was successful.\n");
break;
@@ -173,7 +172,8 @@ GHOST_TSuccess GHOST_DisplayManagerWin32::setCurrentDisplaySetting(GHOST_TUns8 d
printf("display change: An invalid set of flags was passed in.\n");
break;
case DISP_CHANGE_BADPARAM:
- printf("display change: An invalid parameter was passed in. This can include an invalid flag or combination of flags.\n");
+ printf("display change: An invalid parameter was passed in. "
+ "This can include an invalid flag or combination of flags.\n");
break;
case DISP_CHANGE_FAILED:
printf("display change: The display driver failed the specified graphics mode.\n");
diff --git a/intern/ghost/intern/GHOST_DropTargetWin32.cpp b/intern/ghost/intern/GHOST_DropTargetWin32.cpp
index 5288b77..1aaf939 100644
--- a/intern/ghost/intern/GHOST_DropTargetWin32.cpp
+++ b/intern/ghost/intern/GHOST_DropTargetWin32.cpp
@@ -43,10 +43,11 @@ void printLastError(void);
#endif // GHOST_DEBUG
-GHOST_DropTargetWin32::GHOST_DropTargetWin32(GHOST_WindowWin32 *window, GHOST_SystemWin32 *system)
- :
- m_window(window),
- m_system(system)
+GHOST_DropTargetWin32::GHOST_DropTargetWin32(
+ GHOST_WindowWin32 *window,
+ GHOST_SystemWin32 *system)
+ : m_window(window),
+ m_system(system)
{
m_cRef = 1;
m_hWnd = window->getHWND();
@@ -68,8 +69,7 @@ HRESULT __stdcall GHOST_DropTargetWin32::QueryInterface(REFIID riid, void **ppvO
return E_INVALIDARG;
*ppvObj = NULL;
- if (riid == IID_IUnknown || riid == IID_IDropTarget)
- {
+ if (riid == IID_IUnknown || riid == IID_IDropTarget) {
AddRef();
*ppvObj = (void *)this;
return S_OK;
@@ -208,8 +208,7 @@ GHOST_TDragnDropTypes GHOST_DropTargetWin32::getGhostType(IDataObject *pDataObje
void *GHOST_DropTargetWin32::getGhostData(IDataObject *pDataObject)
{
GHOST_TDragnDropTypes type = getGhostType(pDataObject);
- switch (type)
- {
+ switch (type) {
case GHOST_kDragnDropTypeFilenames:
return getDropDataAsFilenames(pDataObject);
break;
@@ -241,15 +240,12 @@ void *GHOST_DropTargetWin32::getDropDataAsFilenames(IDataObject *pDataObject)
// Check if dataobject supplies the format we want.
// Double checking here, first in getGhostType.
- if (pDataObject->QueryGetData(&fmtetc) == S_OK)
- {
- if (pDataObject->GetData(&fmtetc, &stgmed) == S_OK)
- {
+ if (pDataObject->QueryGetData(&fmtetc) == S_OK) {
+ if (pDataObject->GetData(&fmtetc, &stgmed) == S_OK) {
hdrop = (HDROP) ::GlobalLock(stgmed.hGlobal);
totfiles = ::DragQueryFileW(hdrop, -1, NULL, 0);
- if (!totfiles)
- {
+ if (!totfiles) {
::GlobalUnlock(stgmed.hGlobal);
return NULL;
}
@@ -258,14 +254,11 @@ void *GHOST_DropTargetWin32::getDropDataAsFilenames(IDataObject *pDataObject)
strArray->count = 0;
strArray->strings = (GHOST_TUns8 **) ::malloc(totfiles * sizeof(GHOST_TUns8 *));
- for (UINT nfile = 0; nfile < totfiles; nfile++)
- {
- if (::DragQueryFileW(hdrop, nfile, fpath, MAX_PATH) > 0)
- {
- if (!(temp_path = alloc_utf_8_from_16(fpath, 0)) )
- {
+ for (UINT nfile = 0; nfile < totfiles; nfile++) {
+ if (::DragQueryFileW(hdrop, nfile, fpath, MAX_PATH) > 0) {
+ if (!(temp_path = alloc_utf_8_from_16(fpath, 0)) ) {
continue;
- }
+ }
// Just ignore paths that could not be converted verbatim.
strArray->strings[nvalid] = (GHOST_TUns8 *) temp_path;
@@ -291,13 +284,10 @@ void *GHOST_DropTargetWin32::getDropDataAsString(IDataObject *pDataObject)
// Try unicode first.
// Check if dataobject supplies the format we want.
- if (pDataObject->QueryGetData(&fmtetc) == S_OK)
- {
- if (pDataObject->GetData(&fmtetc, &stgmed) == S_OK)
- {
+ if (pDataObject->QueryGetData(&fmtetc) == S_OK) {
+ if (pDataObject->GetData(&fmtetc, &stgmed) == S_OK) {
LPCWSTR wstr = (LPCWSTR) ::GlobalLock(stgmed.hGlobal);
- if (!(tmp_string = alloc_utf_8_from_16((wchar_t *)wstr, 0)) )
- {
+ if (!(tmp_string = alloc_utf_8_from_16((wchar_t *)wstr, 0)) ) {
::GlobalUnlock(stgmed.hGlobal);
return NULL;
}
@@ -313,21 +303,17 @@ void *GHOST_DropTargetWin32::getDropDataAsString(IDataObject *pDataObject)
fmtetc.cfFormat = CF_TEXT;
- if (pDataObject->QueryGetData(&fmtetc) == S_OK)
- {
- if (pDataObject->GetData(&fmtetc, &stgmed) == S_OK)
- {
+ if (pDataObject->QueryGetData(&fmtetc) == S_OK) {
+ if (pDataObject->GetData(&fmtetc, &stgmed) == S_OK) {
char *str = (char *)::GlobalLock(stgmed.hGlobal);
tmp_string = (char *)::malloc(::strlen(str) + 1);
- if (!tmp_string)
- {
+ if (!tmp_string) {
::GlobalUnlock(stgmed.hGlobal);
return NULL;
}
- if (!::strcpy(tmp_string, str) )
- {
+ if (!::strcpy(tmp_string, str) ) {
::free(tmp_string);
::GlobalUnlock(stgmed.hGlobal);
return NULL;
@@ -358,8 +344,7 @@ int GHOST_DropTargetWin32::WideCharToANSI(LPCWSTR in, char * &out)
NULL, NULL
);
- if (!size)
- {
+ if (!size) {
#ifdef GHOST_DEBUG
::printLastError();
#endif // GHOST_DEBUG
@@ -367,8 +352,7 @@ int GHOST_DropTargetWin32::WideCharToANSI(LPCWSTR in, char * &out)
}
out = (char *)::malloc(size);
- if (!out)
- {
+ if (!out) {
::printf("\nmalloc failed!!!");
return 0;
}
@@ -382,8 +366,7 @@ int GHOST_DropTargetWin32::WideCharToANSI(LPCWSTR in, char * &out)
NULL, NULL
);
- if (!size)
- {
+ if (!size) {
#ifdef GHOST_DEBUG
::printLastError();
#endif //GHOST_DEBUG
@@ -407,8 +390,7 @@ void printLastError(void)
0,
(LPTSTR)&s,
0,
- NULL)
- )
+ NULL))
{
printf("\nLastError: (%d) %s\n", (int)err, s);
LocalFree(s);
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index 2a3e27c..91ac854 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -201,23 +201,27 @@ GHOST_TUns8 GHOST_SystemWin32::getNumDisplays() const
}
-void GHOST_SystemWin32::getMainDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const
+void GHOST_SystemWin32::getMainDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const
{
width = ::GetSystemMetrics(SM_CXSCREEN);
height = ::GetSystemMetrics(SM_CYSCREEN);
}
-void GHOST_SystemWin32::getAllDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const
+void GHOST_SystemWin32::getAllDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const
{
width = ::GetSystemMetrics(SM_CXVIRTUALSCREEN);
height = ::GetSystemMetrics(SM_CYVIRTUALSCREEN);
}
GHOST_IWindow *GHOST_SystemWin32::createWindow(
- const STR_String& title,
- GHOST_TInt32 left, GHOST_TInt32 top, GHOST_TUns32 width, GHOST_TUns32 height,
- GHOST_TWindowState state, GHOST_TDrawingContextType type,
- bool stereoVisual, const bool exclusive, const GHOST_TUns16 numOfAASamples, const GHOST_TEmbedderWindowID parentWindow)
+ const STR_String &title,
+ GHOST_TInt32 left, GHOST_TInt32 top,
+ GHOST_TUns32 width, GHOST_TUns32 height,
+ GHOST_TWindowState state, GHOST_TDrawingContextType type,
+ bool stereoVisual,
+ const bool exclusive,
+ const GHOST_TUns16 numOfAASamples,
+ const GHOST_TEmbedderWindowID parentWindow)
{
GHOST_Window *window = 0;
window = new GHOST_WindowWin32(this, title, left, top, width, height, state, type, stereoVisual, numOfAASamples, parentWindow);
@@ -300,7 +304,7 @@ bool GHOST_SystemWin32::processEvents(bool waitForEvent)
}
-GHOST_TSuccess GHOST_SystemWin32::getCursorPosition(GHOST_TInt32& x, GHOST_TInt32& y) const
+GHOST_TSuccess GHOST_SystemWin32::getCursorPosition(GHOST_TInt32 &x, GHOST_TInt32 &y) const
{
POINT point;
if (::GetCursorPos(&point)) {
@@ -314,13 +318,13 @@ GHOST_TSuccess GHOST_SystemWin32::getCursorPosition(GHOST_TInt32& x, GHOST_TInt3
GHOST_TSuccess GHOST_SystemWin32::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y)
{
- if (!GetActiveWindow())
+ if (!::GetActiveWindow())
return GHOST_kFailure;
return ::SetCursorPos(x, y) == TRUE ? GHOST_kSuccess : GHOST_kFailure;
}
-GHOST_TSuccess GHOST_SystemWin32::getModifierKeys(GHOST_ModifierKeys& keys) const
+GHOST_TSuccess GHOST_SystemWin32::getModifierKeys(GHOST_ModifierKeys &keys) const
{
bool down = HIBYTE(::GetKeyState(VK_LSHIFT)) != 0;
keys.set(GHOST_kModifierKeyLeftShift, down);
@@ -347,7 +351,7 @@ GHOST_TSuccess GHOST_SystemWin32::getModifierKeys(GHOST_ModifierKeys& keys) cons
}
-GHOST_TSuccess GHOST_SystemWin32::getButtons(GHOST_Buttons& buttons) const
+GHOST_TSuccess GHOST_SystemWin32::getButtons(GHOST_Buttons &buttons) const
{
/* Check for swapped buttons (left-handed mouse buttons)
* GetAsyncKeyState() will give back the state of the physical mouse buttons.
@@ -423,7 +427,7 @@ GHOST_TSuccess GHOST_SystemWin32::exit()
return GHOST_System::exit();
}
-GHOST_TKey GHOST_SystemWin32::hardKey(GHOST_IWindow *window, RAWINPUT const& raw, int *keyDown, char *vk)
+GHOST_TKey GHOST_SystemWin32::hardKey(GHOST_IWindow *window, RAWINPUT const &raw, int *keyDown, char *vk)
{
GHOST_SystemWin32 *system = (GHOST_SystemWin32 *)getSystem();
GHOST_TKey key = GHOST_kKeyUnknown;
@@ -438,8 +442,7 @@ GHOST_TKey GHOST_
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list