From d3c7e96763a631b2bc84d0341551ae6706a18fe2 Mon Sep 17 00:00:00 2001 From: Adeel Kazmi Date: Fri, 15 Nov 2019 22:34:25 +0000 Subject: [PATCH] Updates to ensure compilation with Visual Studio Change-Id: I4c84321639880b09b977b61eeffaca9e3f55b25c --- dali/devel-api/adaptor-framework/file-stream.cpp | 4 +- dali/devel-api/adaptor-framework/file-stream.h | 2 +- .../imaging/windows/curl-environment-win.cpp | 5 - .../internal/imaging/windows/file-download-win.cpp | 2 +- .../windows/native-image-source-impl-win.cpp | 2 +- .../input/common/input-method-context-impl.h | 4 +- dali/internal/system/windows/file-closer-win.cpp | 119 ------------ dali/internal/system/windows/trigger-event.cpp | 6 +- dali/internal/system/windows/trigger-event.h | 3 +- .../windows/platform-implement-win.cpp | 203 +++++++++++---------- .../window-system/windows/platform-implement-win.h | 130 +++++++------ .../window-system/windows/window-base-win.cpp | 19 +- .../window-system/windows/window-base-win.h | 2 + 13 files changed, 206 insertions(+), 295 deletions(-) delete mode 100755 dali/internal/system/windows/file-closer-win.cpp diff --git a/dali/devel-api/adaptor-framework/file-stream.cpp b/dali/devel-api/adaptor-framework/file-stream.cpp index f6528e4..83dc907 100644 --- a/dali/devel-api/adaptor-framework/file-stream.cpp +++ b/dali/devel-api/adaptor-framework/file-stream.cpp @@ -40,10 +40,12 @@ FileStream::FileStream(Dali::Vector& buffer, size_t dataSize, uint8_t m mImpl.reset( new Impl( buffer, dataSize, mode ) ); } -FileStream::~FileStream() = default; +FileStream::FileStream(FileStream&&) = default; FileStream& FileStream::operator=(FileStream&&) = default; +FileStream::~FileStream() = default; + std::iostream& FileStream::GetStream() { return mImpl->GetStream(); diff --git a/dali/devel-api/adaptor-framework/file-stream.h b/dali/devel-api/adaptor-framework/file-stream.h index de69f06..32f373e 100644 --- a/dali/devel-api/adaptor-framework/file-stream.h +++ b/dali/devel-api/adaptor-framework/file-stream.h @@ -76,7 +76,7 @@ public: /** * Default move constructor */ - FileStream(FileStream&&) = default; + FileStream(FileStream&&); /** * Non copyable diff --git a/dali/internal/imaging/windows/curl-environment-win.cpp b/dali/internal/imaging/windows/curl-environment-win.cpp index d727848..7c377e5 100755 --- a/dali/internal/imaging/windows/curl-environment-win.cpp +++ b/dali/internal/imaging/windows/curl-environment-win.cpp @@ -42,11 +42,6 @@ const long EXCLUDE_BODY = 1L; namespace Network { -void CurlEnvironment::GetThreadId( CRYPTO_THREADID* tid ) -{ - // If dali uses c++ thread, we may replace pthread_self() to this_thread::get_id() - tid->val = Internal::Adaptor::WindowsPlatformImplementation::GetCurrentThreadId(); -} } } } diff --git a/dali/internal/imaging/windows/file-download-win.cpp b/dali/internal/imaging/windows/file-download-win.cpp index 198e828..2a137af 100755 --- a/dali/internal/imaging/windows/file-download-win.cpp +++ b/dali/internal/imaging/windows/file-download-win.cpp @@ -85,7 +85,7 @@ size_t __cdecl ChunkLoader(char *ptr, size_t size, size_t nmemb, void *userdata) static size_t __cdecl WriteFunction( void *input, size_t uSize, size_t uCount, void *avg ) { - fwrite( input, uSize, uCount, (FILE*)avg ); + fwrite( (const char*)input, uSize, uCount, (FILE*)avg ); return uSize * uCount; } diff --git a/dali/internal/imaging/windows/native-image-source-impl-win.cpp b/dali/internal/imaging/windows/native-image-source-impl-win.cpp index eb96bb2..b0e78fb 100755 --- a/dali/internal/imaging/windows/native-image-source-impl-win.cpp +++ b/dali/internal/imaging/windows/native-image-source-impl-win.cpp @@ -192,7 +192,7 @@ int NativeImageSourceWin::GetPixelDepth(Dali::NativeImageSource::ColorDepth dept { case Dali::NativeImageSource::COLOR_DEPTH_DEFAULT: { - return WindowsPlatformImplementation::GetColorDepth(); + return 32; } case Dali::NativeImageSource::COLOR_DEPTH_8: { diff --git a/dali/internal/input/common/input-method-context-impl.h b/dali/internal/input/common/input-method-context-impl.h index dd1db18..35e1765 100755 --- a/dali/internal/input/common/input-method-context-impl.h +++ b/dali/internal/input/common/input-method-context-impl.h @@ -19,6 +19,8 @@ */ // EXTERNAL INCLUDES +#include +#include #include #include #include @@ -27,8 +29,6 @@ // INTERNAL INCLUDES #include -#include - namespace Dali { diff --git a/dali/internal/system/windows/file-closer-win.cpp b/dali/internal/system/windows/file-closer-win.cpp deleted file mode 100755 index 7cadd88..0000000 --- a/dali/internal/system/windows/file-closer-win.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// Internal -#include -#include -#include - -// External -#include -#include - -namespace Dali -{ - -namespace Internal -{ - -namespace Platform -{ - -namespace InternalFile -{ - -std::string GetRealName( const char *name ) -{ - if( NULL != name && '*' == name[0] ) - { - std::string envName; - - const char *p = name + 1; - - while( 0 != *p && '*' != *p ) - { - envName.push_back( *p ); - p++; - } - - p++; - - char *envValue = std::getenv( envName.c_str() ); - - std::string realName = envValue; - realName += p; - - return realName; - } - else - { - return ""; - } -} - -FILE *FOpen( const char *name, const char *mode ) -{ - if( NULL != name && '*' == name[0] ) - { - std::string realName = GetRealName( name ); - return (FILE*)CustomFile::FOpen( realName.c_str(), mode ); - } - else - { - return (FILE*)CustomFile::FOpen( name, mode ); - } -} - -FILE *FMemopen( void *__s, size_t __len, const char *__modes ) -{ - FILE *ret = (FILE*)CustomFile::FMemopen( __s, __len, __modes ); - return ret; -} - -size_t FRead( void* _Buffer, size_t _ElementSize, size_t _ElementCount, FILE* _Stream ) -{ - return CustomFile::FRead( _Buffer, _ElementSize, _ElementCount, _Stream ); -} - -int FClose( FILE *__stream ) -{ - return CustomFile::FClose( __stream ); -} - -void FWrite( void *buf, int size, int count, FILE *fp ) -{ - CustomFile::FWrite( buf, size * count, fp ); -} - -int FSeek( FILE *fp, int offset, int origin ) -{ - return CustomFile::FSeek( fp, offset, origin ); -} - -int FTell( FILE *fp ) -{ - return CustomFile::FTell( fp ); -} - -bool FEof( FILE *fp ) -{ - return CustomFile::FEof( fp ); -} -} //InternalFile -} //Platform -} //Internal -} //Dali diff --git a/dali/internal/system/windows/trigger-event.cpp b/dali/internal/system/windows/trigger-event.cpp index cbd5b33..af42ad6 100755 --- a/dali/internal/system/windows/trigger-event.cpp +++ b/dali/internal/system/windows/trigger-event.cpp @@ -48,11 +48,14 @@ TriggerEvent::TriggerEvent( CallbackBase* callback, TriggerEventInterface::Optio { DALI_LOG_ERROR("Unable to create TriggerEvent File descriptor\n"); } + + mSelfCallback = MakeCallback( this, &TriggerEvent::Triggered ); } TriggerEvent::~TriggerEvent() { delete mCallback; + delete mSelfCallback; if ( mThreadID >= 0) { @@ -67,8 +70,7 @@ void TriggerEvent::Trigger() // Increment event counter by 1. // Writing to the file descriptor triggers the Dispatch() method in the other thread // (if in multi-threaded environment). - CallbackBase *callback = MakeCallback( this, &TriggerEvent::Triggered ); - WindowsPlatformImplementation::PostWinThreadMessage( WIN_CALLBACK_EVENT, reinterpret_cast( callback ), 0, mThreadID ); + WindowsPlatformImplementation::PostWinThreadMessage( WIN_CALLBACK_EVENT, reinterpret_cast( mSelfCallback ), 0, mThreadID ); } else { diff --git a/dali/internal/system/windows/trigger-event.h b/dali/internal/system/windows/trigger-event.h index 4c86810..6bf2264 100755 --- a/dali/internal/system/windows/trigger-event.h +++ b/dali/internal/system/windows/trigger-event.h @@ -74,6 +74,7 @@ private: private: CallbackBase* mCallback; + CallbackBase* mSelfCallback; int32_t mThreadID; TriggerEventInterface::Options mOptions; }; @@ -84,4 +85,4 @@ private: } // namespace Dali -#endif // DALI_INTERNAL_TRIGGER_EVENT_IMPL_H +#endif // DALI_INTERNAL_TRIGGER_EVENT_IMPL_H \ No newline at end of file diff --git a/dali/internal/window-system/windows/platform-implement-win.cpp b/dali/internal/window-system/windows/platform-implement-win.cpp index 1d79ce8..1816ae1 100755 --- a/dali/internal/window-system/windows/platform-implement-win.cpp +++ b/dali/internal/window-system/windows/platform-implement-win.cpp @@ -19,6 +19,7 @@ #include // EXTERNAL INCLUDES +#include #include // INTERNAL INCLUDES @@ -62,107 +63,73 @@ void RunLoop() } } -void GetDPI( uint64_t hWnd, float &xDpi, float &yDpi ) +LRESULT CALLBACK WinProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { - HDC hdcScreen = GetDC( reinterpret_cast( hWnd ) ); - - int32_t iX = GetDeviceCaps( hdcScreen, HORZRES ); // pixel - int32_t iY = GetDeviceCaps( hdcScreen, VERTRES ); // pixel - int32_t iPhsX = GetDeviceCaps( hdcScreen, HORZSIZE ); // mm - int32_t iPhsY = GetDeviceCaps( hdcScreen, VERTSIZE ); // mm - - xDpi = static_cast( iX ) / static_cast( iPhsX ) * INCH; - yDpi = static_cast( iY ) / static_cast( iPhsY ) * INCH; -} - -CallbackBase *listener = NULL; - -LRESULT CALLBACK WinProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - if( NULL != listener ) - { - TWinEventInfo eventInfo( reinterpret_cast( hWnd ), uMsg, wParam, lParam); - CallbackBase::Execute( *listener, &eventInfo ); - } + WindowImpl::ProcWinMessge( reinterpret_cast( hWnd ), uMsg, wParam, lParam ); LRESULT ret = DefWindowProc( hWnd, uMsg, wParam, lParam ); return ret; } -DWORD windowStyle = WS_OVERLAPPED; +std::map mHWndToListener; -int32_t GetEdgeWidth() +WindowImpl::WindowImpl() { - switch( windowStyle ) - { - case WS_OVERLAPPED: - { - return 8; - } - default: - { - return 0; - } - } + colorDepth = -1; + mHWnd = 0; + mHdc = 0; + listener = NULL; + windowStyle = WS_OVERLAPPED; } -int32_t GetEdgeHeight() +WindowImpl::~WindowImpl() { - switch( windowStyle ) - { - case WS_OVERLAPPED: - { - return 18; - } - default: - { - return 0; - } - } + mHWndToListener.erase( mHWnd ); } -class WindowsDisplayInfo +void WindowImpl::ProcWinMessge( uint64_t hWnd, uint32_t uMsg, uint64_t wParam, uint64_t lParam ) { -public: - static int GetColorDepth() - { - DALI_ASSERT_DEBUG(colorDepth >= 0 && "HWND hasn't been created, no color depth"); - return colorDepth; - } + std::map::iterator x = mHWndToListener.find( hWnd ); - static void SetHWND( HWND inHWnd ) + if( mHWndToListener.end() != x ) { - if( hWnd != inHWnd ) + CallbackBase* listener = x->second->listener; + + if( NULL != listener ) { - hWnd = inHWnd; - hdc = GetDC( hWnd ); - colorDepth = GetDeviceCaps( WindowsDisplayInfo::hdc, BITSPIXEL ) * GetDeviceCaps( WindowsDisplayInfo::hdc, PLANES ); + TWinEventInfo eventInfo( hWnd, uMsg, wParam, lParam ); + CallbackBase::Execute( *listener, &eventInfo ); } } +} -private: - static int colorDepth; - static HWND hWnd; - static HDC hdc; -}; +void WindowImpl::GetDPI( float &xDpi, float &yDpi ) +{ + HDC hdcScreen = GetDC( reinterpret_cast( mHWnd ) ); -int WindowsDisplayInfo::colorDepth = -1; -HWND WindowsDisplayInfo::hWnd = NULL; -HDC WindowsDisplayInfo::hdc = NULL; + int32_t iX = GetDeviceCaps( hdcScreen, HORZRES ); // pixel + int32_t iY = GetDeviceCaps( hdcScreen, VERTRES ); // pixel + int32_t iPhsX = GetDeviceCaps( hdcScreen, HORZSIZE ); // mm + int32_t iPhsY = GetDeviceCaps( hdcScreen, VERTSIZE ); // mm + + xDpi = static_cast( iX ) / static_cast( iPhsX ) * INCH; + yDpi = static_cast( iY ) / static_cast( iPhsY ) * INCH; +} -int GetColorDepth() +int WindowImpl::GetColorDepth() { - return WindowsDisplayInfo::GetColorDepth(); + DALI_ASSERT_DEBUG( colorDepth >= 0 && "HWND hasn't been created, no color depth" ); + return colorDepth; } -uint64_t CreateHwnd( - _In_opt_ const char *lpClassName, - _In_opt_ const char *lpWindowName, - _In_ int X, - _In_ int Y, - _In_ int nWidth, - _In_ int nHeight, - _In_opt_ uint64_t parent) +uint64_t WindowImpl::CreateHwnd( + _In_opt_ const char *lpClassName, + _In_opt_ const char *lpWindowName, + _In_ int X, + _In_ int Y, + _In_ int nWidth, + _In_ int nHeight, + _In_opt_ uint64_t parent ) { WNDCLASS cs = { 0 }; cs.cbClsExtra = 0; @@ -178,49 +145,89 @@ uint64_t CreateHwnd( RegisterClass( &cs ); HWND hWnd = CreateWindow( lpClassName, lpWindowName, windowStyle, X, Y, nWidth + 2 * GetEdgeWidth(), nHeight + 2 * GetEdgeHeight(), NULL, NULL, cs.hInstance, NULL ); - ShowWindow( hWnd, SW_SHOW ); + ::ShowWindow( hWnd, SW_SHOW ); - WindowsDisplayInfo::SetHWND( hWnd ); + SetHWND( reinterpret_cast(hWnd) ); - return reinterpret_cast( hWnd ); + return mHWnd; } -void SetListener( CallbackBase *callback ) +void WindowImpl::SetListener( CallbackBase *callback ) { listener = callback; } -bool PostWinMessage( - _In_ uint32_t Msg, - _In_ uint32_t wParam, - _In_ uint64_t lParam, - _In_ uint64_t hWnd) +bool WindowImpl::PostWinMessage( + _In_ uint32_t Msg, + _In_ uint32_t wParam, + _In_ uint64_t lParam ) { - return (bool)PostMessage( reinterpret_cast( hWnd ), Msg, wParam, lParam ); + return (bool)PostMessage( reinterpret_cast( mHWnd ), Msg, wParam, lParam ); } -bool PostWinThreadMessage( - _In_ uint32_t Msg, - _In_ uint32_t wParam, - _In_ uint64_t lParam, - _In_ uint64_t threadID/* = -1*/ ) +int32_t WindowImpl::GetEdgeWidth() { - if( -1 == threadID ) + switch( windowStyle ) { - threadID = GetCurrentThreadId(); + case WS_OVERLAPPED: + { + return 8; } + default: + { + return 0; + } + } +} - return (bool)PostThreadMessage( threadID, Msg, wParam, lParam ); +int32_t WindowImpl::GetEdgeHeight() +{ + switch( windowStyle ) + { + case WS_OVERLAPPED: + { + return 18; + } + default: + { + return 0; + } + } } -void ShowWindow( uint64_t hWnd) +void WindowImpl::SetHWND( uint64_t inHWnd ) { - ::ShowWindow( reinterpret_cast( hWnd ), SW_SHOW); + if( mHWnd != inHWnd ) + { + mHWnd = inHWnd; + mHdc = reinterpret_cast( GetDC( reinterpret_cast( mHWnd ) ) ); + colorDepth = GetDeviceCaps( reinterpret_cast( mHdc ), BITSPIXEL ) * GetDeviceCaps( reinterpret_cast( mHdc ), PLANES ); + + std::map::iterator x = mHWndToListener.find( mHWnd ); + + if( mHWndToListener.end() == x ) + { + mHWndToListener.insert( std::make_pair( mHWnd, this ) ); + } + else + { + x->second = this; + } + } } -void HideWindow( uint64_t hWnd) +bool PostWinThreadMessage( + _In_ uint32_t Msg, + _In_ uint32_t wParam, + _In_ uint64_t lParam, + _In_ uint64_t threadID/* = -1*/ ) { - ::ShowWindow( reinterpret_cast( hWnd ), SW_HIDE); + if( -1 == threadID ) + { + threadID = GetCurrentThreadId(); + } + + return (bool)PostThreadMessage( threadID, Msg, wParam, lParam ); } struct TTimerCallbackInfo diff --git a/dali/internal/window-system/windows/platform-implement-win.h b/dali/internal/window-system/windows/platform-implement-win.h index 18b33c1..4ba8799 100755 --- a/dali/internal/window-system/windows/platform-implement-win.h +++ b/dali/internal/window-system/windows/platform-implement-win.h @@ -1,21 +1,21 @@ #ifndef PLATFORM_IMPLEMENT_WIN_INCLUDE #define PLATFORM_IMPLEMENT_WIN_INCLUDE -/* -* Copyright (c) 2018 Samsung Electronics Co., Ltd. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* +/* +* Copyright (c) 2018 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* */ // EXTERNAL_HEADERS @@ -25,72 +25,94 @@ typedef uint64_t WinWindowHandle; typedef uint64_t WinPixmap; -namespace Dali -{ - -namespace Internal -{ - -namespace Adaptor -{ +namespace Dali +{ + +namespace Internal +{ + +namespace Adaptor +{ namespace WindowsPlatformImplementation { void RunLoop(); -int GetEdgeHeight(); +bool PostWinThreadMessage( + _In_ uint32_t Msg, + _In_ uint32_t wParam, + _In_ uint64_t lParam, + _In_ uint64_t threadID = -1 ); + +using timerCallback = bool(*)(void *data); + +int SetTimer(int interval, timerCallback callback, void *data); + +void KillTimer(int id); + +const char* GetKeyName( int keyCode ); + +uint64_t GetCurrentThreadId(); + +void GetNanoseconds( uint64_t& timeInNanoseconds ); + +unsigned int GetCurrentMilliSeconds( void ); + +class WindowImpl +{ +public: + WindowImpl(); + + virtual ~WindowImpl(); + + static void ProcWinMessge( uint64_t hWnd, uint32_t uMsg, uint64_t wParam, uint64_t lParam ); -int GetColorDepth(); + void GetDPI( float &xDpi, float &yDpi ); -uint64_t CreateHwnd( + int GetColorDepth(); + + uint64_t CreateHwnd( _In_opt_ const char *lpClassName, _In_opt_ const char *lpWindowName, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, - _In_opt_ uint64_t parent); + _In_opt_ uint64_t parent ); -void SetListener( CallbackBase *callback ); + void SetListener( CallbackBase *callback ); -bool PostWinMessage( + bool PostWinMessage( _In_ uint32_t Msg, _In_ uint32_t wParam, - _In_ uint64_t lParam, - _In_ uint64_t hWnd); + _In_ uint64_t lParam ); -bool PostWinThreadMessage( - _In_ uint32_t Msg, - _In_ uint32_t wParam, - _In_ uint64_t lParam, - _In_ uint64_t threadID = -1 ); + int32_t GetEdgeWidth(); -void ShowWindow( uint64_t hWnd ); -void HideWindow( uint64_t hWnd ); + int32_t GetEdgeHeight(); -using timerCallback = bool(*)(void *data); +protected: -int SetTimer(int interval, timerCallback callback, void *data); +private: -void KillTimer(int id); + void SetHWND( uint64_t inHWnd ); -void GetDPI( uint64_t hWnd, float &xDpi, float &yDpi ); + unsigned long windowStyle; -const char* GetKeyName( int keyCode ); + int colorDepth; + uint64_t mHWnd; + uint64_t mHdc; -uint64_t GetCurrentThreadId(); + CallbackBase *listener; +}; -void GetNanoseconds( uint64_t& timeInNanoseconds ); +} // namespace WindowsPlatformImplement -unsigned int GetCurrentMilliSeconds( void ); +} // namespace Adaptor + +} // namespace internal + +} // namespace Dali -} // namespace WindowsPlatformImplement - -} // namespace Adaptor - -} // namespace internal - -} // namespace Dali - #endif // WIN32_WINDOWS_SYSTEM_INCLUDE diff --git a/dali/internal/window-system/windows/window-base-win.cpp b/dali/internal/window-system/windows/window-base-win.cpp index ef1c28d..e1526ff 100755 --- a/dali/internal/window-system/windows/window-base-win.cpp +++ b/dali/internal/window-system/windows/window-base-win.cpp @@ -61,7 +61,7 @@ WindowBaseWin::WindowBaseWin( Dali::PositionSize positionSize, Any surface, bool WindowBaseWin::~WindowBaseWin() { - WindowsPlatformImplementation::PostWinMessage( WM_CLOSE, 0, 0, mWin32Window ); + mWindowImpl.PostWinMessage( WM_CLOSE, 0, 0 ); } void WindowBaseWin::Initialize( PositionSize positionSize, Any surface, bool isTransparent ) @@ -82,7 +82,7 @@ void WindowBaseWin::Initialize( PositionSize positionSize, Any surface, bool isT mWin32Window = static_cast< WinWindowHandle >( surfaceId ); } - WindowsPlatformImplementation::SetListener( MakeCallback( this, &WindowBaseWin::EventEntry ) ); + mWindowImpl.SetListener( MakeCallback( this, &WindowBaseWin::EventEntry ) ); } void WindowBaseWin::OnDeleteRequest() @@ -128,7 +128,7 @@ void WindowBaseWin::OnMouseButtonDown( int type, TWinEventInfo *event ) Integration::Point point; point.SetDeviceId( touchEvent.multi.device ); point.SetState( state ); - point.SetScreenPosition( Vector2( touchEvent.x, touchEvent.y + WindowsPlatformImplementation::GetEdgeHeight() ) ); + point.SetScreenPosition( Vector2( touchEvent.x, touchEvent.y + mWindowImpl.GetEdgeHeight() ) ); point.SetRadius( touchEvent.multi.radius, Vector2( touchEvent.multi.radius_x, touchEvent.multi.radius_y ) ); point.SetPressure( touchEvent.multi.pressure ); point.SetAngle( Degree( touchEvent.multi.angle ) ); @@ -152,7 +152,7 @@ void WindowBaseWin::OnMouseButtonUp( int type, TWinEventInfo *event ) Integration::Point point; point.SetDeviceId( touchEvent.multi.device ); point.SetState( state ); - point.SetScreenPosition( Vector2( touchEvent.x, touchEvent.y + WindowsPlatformImplementation::GetEdgeHeight() ) ); + point.SetScreenPosition( Vector2( touchEvent.x, touchEvent.y + mWindowImpl.GetEdgeHeight() ) ); point.SetRadius( touchEvent.multi.radius, Vector2( touchEvent.multi.radius_x, touchEvent.multi.radius_y ) ); point.SetPressure( touchEvent.multi.pressure ); point.SetAngle( Degree( touchEvent.multi.angle ) ); @@ -176,7 +176,7 @@ void WindowBaseWin::OnMouseButtonMove( int type, TWinEventInfo *event ) Integration::Point point; point.SetDeviceId( touchEvent.multi.device ); point.SetState( state ); - point.SetScreenPosition( Vector2( touchEvent.x, touchEvent.y + WindowsPlatformImplementation::GetEdgeHeight() ) ); + point.SetScreenPosition( Vector2( touchEvent.x, touchEvent.y + mWindowImpl.GetEdgeHeight() ) ); point.SetRadius( touchEvent.multi.radius, Vector2( touchEvent.multi.radius_x, touchEvent.multi.radius_y ) ); point.SetPressure( touchEvent.multi.pressure ); point.SetAngle( Degree( touchEvent.multi.angle ) ); @@ -239,7 +239,7 @@ void WindowBaseWin::OnKeyUp( int type, TWinEventInfo *event ) // Ensure key event string is not NULL as keys like SHIFT have a null string. keyString.push_back( event->wParam ); - Integration::KeyEvent keyEvent( keyName, emptyString, keyString, keyCode, modifier, time, Integration::KeyEvent::Down, emptyString, emptyString, DEFAULT_DEVICE_CLASS, DEFAULT_DEVICE_SUBCLASS ); + Integration::KeyEvent keyEvent( keyName, emptyString, keyString, keyCode, modifier, time, Integration::KeyEvent::Up, emptyString, emptyString, DEFAULT_DEVICE_CLASS, DEFAULT_DEVICE_SUBCLASS ); mKeyEventSignal.Emit( keyEvent ); } @@ -291,6 +291,7 @@ void WindowBaseWin::Move( PositionSize positionSize ) void WindowBaseWin::Resize( PositionSize positionSize ) { + ::SetWindowPos( (HWND)mWin32Window, NULL, positionSize.x, positionSize.y, positionSize.width, positionSize.height, SWP_SHOWWINDOW ); } void WindowBaseWin::MoveResize( PositionSize positionSize ) @@ -436,7 +437,7 @@ void WindowBaseWin::GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertic float xres, yres; //// 1 inch = 25.4 millimeters - WindowsPlatformImplementation::GetDPI( mWin32Window, xres, yres ); + mWindowImpl.GetDPI( xres, yres ); xres *= 1.5f; yres *= 1.5f; @@ -479,9 +480,7 @@ unsigned int WindowBaseWin::GetSurfaceId( Any surface ) const void WindowBaseWin::CreateWinWindow( PositionSize positionSize, bool isTransparent ) { - long hWnd = WindowsPlatformImplementation::CreateHwnd( "Demo", "Demo", positionSize.x, positionSize.y, positionSize.width, positionSize.height, NULL ); - - WindowsPlatformImplementation::ShowWindow( hWnd ); + long hWnd = mWindowImpl.CreateHwnd( "Demo", "Demo", positionSize.x, positionSize.y, positionSize.width, positionSize.height, NULL ); mWin32Window = (WinWindowHandle)hWnd; DALI_ASSERT_ALWAYS( mWin32Window != 0 && "There is no Windows window" ); diff --git a/dali/internal/window-system/windows/window-base-win.h b/dali/internal/window-system/windows/window-base-win.h index 5e99156..f1af92f 100755 --- a/dali/internal/window-system/windows/window-base-win.h +++ b/dali/internal/window-system/windows/window-base-win.h @@ -376,6 +376,8 @@ private: bool mOwnSurface:1; ///< Whether we own the surface (responsible for deleting it) bool mIsTransparent:1; ///< Whether the window is transparent (32 bit or 24 bit) bool mRotationAppSet:1; + + WindowsPlatformImplementation::WindowImpl mWindowImpl; }; } // namespace Adaptor -- 2.7.4