Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Molenkamp <github@lazydodo.com>2016-07-18 16:48:16 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2016-07-18 16:48:51 +0300
commit404f41d22de46119ee8afb409011eb1ba1840092 (patch)
tree7efb1ee2598457fd0f8a47724212068d89547703
parenta76e69f5f75c06dda6d35113d80b6b65dcc94ea0 (diff)
[bf_intern_ghost/Windows] Cleanup
This patch addresses the following issues in bf_intern_ghost ``` Warning C4312 'type cast': conversion from 'GHOST_TEmbedderWindowID' to 'HWND' of greater size bf_intern_ghost K:\BlenderGit\blender\intern\ghost\intern\GHOST_WindowWin32.cpp 179 Warning C4312 'type cast': conversion from 'GHOST_TEmbedderWindowID' to 'HWND' of greater size bf_intern_ghost K:\BlenderGit\blender\intern\ghost\intern\GHOST_WindowWin32.cpp 198 ``` GHOST_TEmbedderWindowID is defined as long, handles are however of pointer size, so this should have been an issue when we moved to 64 bits, guess we got lucky. fixed by turning GHOST_TEmbedderWindowID from long into void* ``` Warning C4302 'reinterpret_cast': truncation from 'HKL' to 'LANGID' bf_intern_ghost K:\BlenderGit\blender\intern\ghost\intern\GHOST_ImeWin32.cpp 67 ``` reinterpret_cast emits warnings on truncation, LOWORD does the job just as well with no warnings. ``` Warning C4838 conversion from 'int' to 'DWORD' requires a narrowing conversion bf_intern_ghost K:\BlenderGit\blender\intern\ghost\intern\GHOST_ContextWGL.cpp 734 Warning C4838 conversion from 'int' to 'BYTE' requires a narrowing conversion bf_intern_ghost K:\BlenderGit\blender\intern\ghost\intern\GHOST_ContextWGL.cpp 734 ``` Weird warning, it does a really bad job at telling you what parameter is causing the warning , tuns out there's a bunch of parameters that cause it but it still only yields a single warning, the problem is that every (somevar ? a : b) construct results in an integer type. which needs to be properly cast to get rid of the warning. ``` Warning C4996 'GetVersionExA': was declared deprecated bf_intern_ghost K:\BlenderGit\blender\intern\ghost\intern\GHOST_WindowWin32.cpp 105 Warning C4996 'GetVersionExA': was declared deprecated bf_intern_ghost K:\BlenderGit\blender\intern\ghost\intern\GHOST_WindowWin32.cpp 107 ``` The warning was clear, the code not as much. The version check in place here is quite convoluted and could be replaced by including VersionHelpers.h and calling IsWindows7OrGreater, However, CreateInstance will just return NULL in m_Bar if the interface is not supported, so the whole check is useless. This however did require that the CreateInstance call actually asked for ITaskbarList3 and not ITaskBarlist . (You're not really allowed to assign different interface types to each-other, a roundtrip through QueryInterface is required there, we were violating spec here by asking for ITaskBarlist and storing it in ITaskbarList3* ) Reviewers: sergey Reviewed By: sergey Subscribers: sergey Differential Revision: https://developer.blender.org/D2094
-rw-r--r--intern/ghost/GHOST_Types.h2
-rw-r--r--intern/ghost/intern/GHOST_ContextWGL.cpp9
-rw-r--r--intern/ghost/intern/GHOST_ImeWin32.cpp2
-rw-r--r--intern/ghost/intern/GHOST_WindowWin32.cpp31
4 files changed, 8 insertions, 36 deletions
diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h
index 7e77ba3a41f..0dd5d15b011 100644
--- a/intern/ghost/GHOST_Types.h
+++ b/intern/ghost/GHOST_Types.h
@@ -530,7 +530,7 @@ typedef struct {
#ifdef _WIN32
-typedef long GHOST_TEmbedderWindowID;
+typedef void* GHOST_TEmbedderWindowID;
#endif // _WIN32
#ifndef _WIN32
diff --git a/intern/ghost/intern/GHOST_ContextWGL.cpp b/intern/ghost/intern/GHOST_ContextWGL.cpp
index eeb6a2469ee..abce3ea6588 100644
--- a/intern/ghost/intern/GHOST_ContextWGL.cpp
+++ b/intern/ghost/intern/GHOST_ContextWGL.cpp
@@ -707,6 +707,7 @@ int GHOST_ContextWGL::choose_pixel_format(
PIXELFORMATDESCRIPTOR preferredPFD = {
sizeof(PIXELFORMATDESCRIPTOR), /* size */
1, /* version */
+ (DWORD) (
PFD_SUPPORT_OPENGL |
PFD_DRAW_TO_WINDOW |
PFD_SWAP_COPY | /* support swap copy */
@@ -717,16 +718,16 @@ int GHOST_ContextWGL::choose_pixel_format(
needAlpha ? PFD_SUPPORT_COMPOSITION : /* support composition for transparent background */
#endif
0
- ),
+ )),
PFD_TYPE_RGBA, /* color type */
- (needAlpha ? 32 : 24), /* preferred color depth */
+ (BYTE) (needAlpha ? 32 : 24), /* preferred color depth */
0, 0, 0, 0, 0, 0, /* color bits (ignored) */
- needAlpha ? 8 : 0, /* alpha buffer */
+ (BYTE) (needAlpha ? 8 : 0), /* alpha buffer */
0, /* alpha shift (ignored) */
0, /* no accumulation buffer */
0, 0, 0, 0, /* accum bits (ignored) */
24, /* depth buffer */
- needStencil ? 8 : 0, /* stencil buffer */
+ (BYTE) (needStencil ? 8 : 0), /* stencil buffer */
0, /* no auxiliary buffers */
PFD_MAIN_PLANE, /* main layer */
0, /* reserved */
diff --git a/intern/ghost/intern/GHOST_ImeWin32.cpp b/intern/ghost/intern/GHOST_ImeWin32.cpp
index af5a2ed7097..96bd12faef8 100644
--- a/intern/ghost/intern/GHOST_ImeWin32.cpp
+++ b/intern/ghost/intern/GHOST_ImeWin32.cpp
@@ -64,7 +64,7 @@ bool GHOST_ImeWin32::SetInputLanguage()
* while composing a text.
*/
HKL keyboard_layout = ::GetKeyboardLayout(0);
- input_language_id_ = reinterpret_cast<LANGID>(keyboard_layout);
+ input_language_id_ = LOWORD(keyboard_layout);
ime_status_ = ::ImmIsIME(keyboard_layout);
return ime_status_;
}
diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp
index c9bcb38ab68..6a27d7aadf9 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.cpp
+++ b/intern/ghost/intern/GHOST_WindowWin32.cpp
@@ -95,31 +95,6 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system,
m_parentWindowHwnd(parentwindowhwnd),
m_debug_context(is_debug)
{
- OSVERSIONINFOEX versionInfo;
- bool hasMinVersionForTaskbar = false;
-
- ZeroMemory(&versionInfo, sizeof(OSVERSIONINFOEX));
-
- versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
-
- if (!GetVersionEx((OSVERSIONINFO *)&versionInfo)) {
- versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- if (GetVersionEx((OSVERSIONINFO *)&versionInfo)) {
- if ((versionInfo.dwMajorVersion == 6 && versionInfo.dwMinorVersion >= 1) ||
- (versionInfo.dwMajorVersion >= 7))
- {
- hasMinVersionForTaskbar = true;
- }
- }
- }
- else {
- if ((versionInfo.dwMajorVersion == 6 && versionInfo.dwMinorVersion >= 1) ||
- (versionInfo.dwMajorVersion >= 7))
- {
- hasMinVersionForTaskbar = true;
- }
- }
-
if (state != GHOST_kWindowStateFullScreen) {
RECT rect;
MONITORINFO monitor;
@@ -341,11 +316,7 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system,
}
}
}
-
- if (hasMinVersionForTaskbar)
- CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_ITaskbarList, (LPVOID *)&m_Bar);
- else
- m_Bar = NULL;
+ CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_ITaskbarList3, (LPVOID *)&m_Bar);
}