X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fthird_party%2Fangle%2Futil%2Fwin32%2FWin32Window.cpp;h=7802f2587e8fda3f31e8f6697592b1a61f967b74;hb=1afa4dd80ef85af7c90efaea6959db1d92330844;hp=ec5a0c0cac68125b99f7a54bb88441e7d034ce12;hpb=90762837333c13ccf56f2ad88e4481fc71e8d281;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/third_party/angle/util/win32/Win32Window.cpp b/src/third_party/angle/util/win32/Win32Window.cpp index ec5a0c0..7802f25 100644 --- a/src/third_party/angle/util/win32/Win32Window.cpp +++ b/src/third_party/angle/util/win32/Win32Window.cpp @@ -6,6 +6,8 @@ #include "win32/Win32Window.h" +#include + Key VirtualKeyCodeToKey(WPARAM key, LPARAM flags) { switch (key) @@ -377,8 +379,17 @@ bool Win32Window::initialize(const std::string &name, size_t width, size_t heigh { destroy(); - mParentClassName = name; - mChildClassName = name + "Child"; + // Use a new window class name for ever window to ensure that a new window can be created + // even if the last one was not properly destroyed + static size_t windowIdx = 0; + std::ostringstream nameStream; + nameStream << name << "_" << windowIdx++; + + mParentClassName = nameStream.str(); + mChildClassName = mParentClassName + "_Child"; + + // Work around compile error from not defining "UNICODE" while Chromium does + const LPSTR idcArrow = MAKEINTRESOURCEA(32512); WNDCLASSEXA parentWindowClass = { 0 }; parentWindowClass.cbSize = sizeof(WNDCLASSEXA); @@ -388,7 +399,7 @@ bool Win32Window::initialize(const std::string &name, size_t width, size_t heigh parentWindowClass.cbWndExtra = 0; parentWindowClass.hInstance = GetModuleHandle(NULL); parentWindowClass.hIcon = NULL; - parentWindowClass.hCursor = LoadCursorA(NULL, IDC_ARROW); + parentWindowClass.hCursor = LoadCursorA(NULL, idcArrow); parentWindowClass.hbrBackground = 0; parentWindowClass.lpszMenuName = NULL; parentWindowClass.lpszClassName = mParentClassName.c_str(); @@ -405,7 +416,7 @@ bool Win32Window::initialize(const std::string &name, size_t width, size_t heigh childWindowClass.cbWndExtra = 0; childWindowClass.hInstance = GetModuleHandle(NULL); childWindowClass.hIcon = NULL; - childWindowClass.hCursor = LoadCursorA(NULL, IDC_ARROW); + childWindowClass.hCursor = LoadCursorA(NULL, idcArrow); childWindowClass.hbrBackground = 0; childWindowClass.lpszMenuName = NULL; childWindowClass.lpszClassName = mChildClassName.c_str(); @@ -414,7 +425,7 @@ bool Win32Window::initialize(const std::string &name, size_t width, size_t heigh return false; } - DWORD parentStyle = WS_VISIBLE | WS_CAPTION | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_SYSMENU; + DWORD parentStyle = WS_CAPTION | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_SYSMENU; DWORD parentExtendedStyle = WS_EX_APPWINDOW; RECT sizeRect = { 0, 0, width, height }; @@ -424,7 +435,7 @@ bool Win32Window::initialize(const std::string &name, size_t width, size_t heigh sizeRect.right - sizeRect.left, sizeRect.bottom - sizeRect.top, NULL, NULL, GetModuleHandle(NULL), this); - mNativeWindow = CreateWindowExA(0, mChildClassName.c_str(), name.c_str(), WS_VISIBLE | WS_CHILD, 0, 0, width, height, + mNativeWindow = CreateWindowExA(0, mChildClassName.c_str(), name.c_str(), WS_CHILD, 0, 0, width, height, mParentWindow, NULL, GetModuleHandle(NULL), this); mNativeDisplay = GetDC(mNativeWindow); @@ -533,12 +544,12 @@ bool Win32Window::resize(int width, int height) return true; } -bool Win32Window::setVisible(bool isVisible) +void Win32Window::setVisible(bool isVisible) { int flag = (isVisible ? SW_SHOW : SW_HIDE); - return (ShowWindow(mNativeWindow, flag) == TRUE) && - (ShowWindow(mParentWindow, flag) == TRUE); + ShowWindow(mParentWindow, flag); + ShowWindow(mNativeWindow, flag); } void Win32Window::pushEvent(Event event)