[vlc-commits] skins2: fix mouse cursor shape change and mouse cursor position on OS/2
KO Myung-Hun
git at videolan.org
Thu May 23 17:19:26 CEST 2013
vlc | branch: master | KO Myung-Hun <komh at chollian.net> | Sun May 12 17:33:29 2013 +0900| [beaf0baf22f659c18459abd4a413cc6ea8a0d4eb] | committer: Rafaël Carré
skins2: fix mouse cursor shape change and mouse cursor position on OS/2
Signed-off-by: Rafaël Carré <funman at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=beaf0baf22f659c18459abd4a413cc6ea8a0d4eb
---
modules/gui/skins2/os2/os2_factory.cpp | 7 ++++++-
modules/gui/skins2/os2/os2_factory.hpp | 10 ++++++++--
modules/gui/skins2/os2/os2_loop.cpp | 11 +++++++----
3 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/modules/gui/skins2/os2/os2_factory.cpp b/modules/gui/skins2/os2/os2_factory.cpp
index d741196..61170eb 100644
--- a/modules/gui/skins2/os2/os2_factory.cpp
+++ b/modules/gui/skins2/os2/os2_factory.cpp
@@ -154,7 +154,7 @@ MRESULT EXPENTRY OS2Factory::OS2Proc( HWND hwnd, ULONG msg,
OS2Factory::OS2Factory( intf_thread_t *pIntf ):
OSFactory( pIntf ), m_hParentWindow( 0 ),
- m_dirSep( "\\" ), m_pfnwpOldFrameProc( 0 )
+ m_pfnwpOldFrameProc( 0 ), m_dirSep( "\\" )
{
// see init()
}
@@ -204,6 +204,9 @@ bool OS2Factory::init()
SWP_ACTIVATE | SWP_ZORDER | SWP_MOVE | SWP_SIZE |
SWP_SHOW );
+ // Set the mouse pointer to a default arrow
+ changeCursor( kDefaultArrow );
+
// Initialize the resource path
char *datadir = config_GetUserDir( VLC_DATA_DIR );
m_resourcePath.push_back( (string)datadir + "\\skins" );
@@ -407,6 +410,8 @@ void OS2Factory::changeCursor( CursorType_t type ) const
HPOINTER hptr = WinQuerySysPointer( HWND_DESKTOP, id, FALSE );
WinSetPointer( HWND_DESKTOP, hptr );
+
+ m_cursorType = type;
}
diff --git a/modules/gui/skins2/os2/os2_factory.hpp b/modules/gui/skins2/os2/os2_factory.hpp
index cfe3fe4..e125504 100644
--- a/modules/gui/skins2/os2/os2_factory.hpp
+++ b/modules/gui/skins2/os2/os2_factory.hpp
@@ -121,8 +121,12 @@ public:
/// Map to find the GenericWindow associated with a OS2Window
map<HWND, GenericWindow*> m_windowMap;
+ /// Get the parent window handle
HWND getParentWindow() { return m_hParentClientWindow; }
+ /// Get the m_cursorType
+ CursorType_t getCursorType() const { return m_cursorType; }
+
/// Callback function (Windows Procedure)
static MRESULT EXPENTRY OS2FrameProc( HWND hwnd, ULONG msg,
MPARAM mp1, MPARAM Mp2 );
@@ -136,12 +140,14 @@ private:
HAB m_hab;
/// Handle of message queue
HMQ m_hmq;
- /// Window procedure of the old frame window
- PFNWP m_pfnwpOldFrameProc;
/// Handle of the parent window
HWND m_hParentWindow;
/// Handle of the client window of the parent window
HWND m_hParentClientWindow;
+ /// Window procedure of the old frame window
+ PFNWP m_pfnwpOldFrameProc;
+ /// Cursor type
+ mutable CursorType_t m_cursorType;
/// Directory separator
const string m_dirSep;
/// Resource path
diff --git a/modules/gui/skins2/os2/os2_loop.cpp b/modules/gui/skins2/os2/os2_loop.cpp
index 5a23b5a..57ba6a2 100644
--- a/modules/gui/skins2/os2/os2_loop.cpp
+++ b/modules/gui/skins2/os2/os2_loop.cpp
@@ -147,14 +147,17 @@ MRESULT EXPENTRY OS2Loop::processEvent( HWND hwnd, ULONG msg,
}
case WM_MOUSEMOVE:
{
+ pFactory->changeCursor( pFactory->getCursorType());
+
// Compute the absolute position of the mouse
- int x = GET_X_MP( mp1 ) + win.getLeft();
- int y = GET_Y_MP( mp1 ) + win.getTop();
+ POINTL ptl;
+ WinQueryPointerPos( HWND_DESKTOP, &ptl );
+ int x = ptl.x;
+ int y = ( pFactory->getScreenHeight() - 1 ) - ptl.y;
EvtMotion evt( getIntf(), x, y );
win.processEvent( evt );
- // fall though to WinDefWindowProc()
- break;
+ return MRFROMLONG( TRUE );
}
case WM_MOUSELEAVE:
{
More information about the vlc-commits
mailing list