summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorStephan Schäfer <ssa@openoffice.org>2002-11-26 15:38:44 +0000
committerStephan Schäfer <ssa@openoffice.org>2002-11-26 15:38:44 +0000
commit7a356470bf7f530c72e1b52e5e003e70bd339f6a (patch)
treeb519a5bb716d78b32b75cebc3ec98da031aed04f /vcl
parent5cac64330940c570dd9739076084cef33562fec0 (diff)
#105224# send modkey events only if no hotkey was pressed
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/window/winproc.cxx12
-rw-r--r--vcl/win/source/window/salframe.cxx40
2 files changed, 39 insertions, 13 deletions
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index ecbfb21e3c19..119e8214ca62 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: winproc.cxx,v $
*
- * $Revision: 1.72 $
+ * $Revision: 1.73 $
*
- * last change: $Author: ssa $ $Date: 2002-11-25 17:09:08 $
+ * last change: $Author: ssa $ $Date: 2002-11-26 16:38:44 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -1973,8 +1973,12 @@ static void ImplHandleSalKeyMod( Window* pWindow, SalKeyModEvent* pEvent )
if ( !pChild )
return;
- CommandModKeyData data( pEvent->mnModKeyCode );
- ImplCallCommand( pChild, COMMAND_MODKEYCHANGE, &data );
+ // send modkey events only if useful data is available
+ if( pEvent->mnModKeyCode != 0 )
+ {
+ CommandModKeyData data( pEvent->mnModKeyCode );
+ ImplCallCommand( pChild, COMMAND_MODKEYCHANGE, &data );
+ }
}
// -----------------------------------------------------------------------
diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx
index 23ebfc3d6b61..5e5a9b03b158 100644
--- a/vcl/win/source/window/salframe.cxx
+++ b/vcl/win/source/window/salframe.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: salframe.cxx,v $
*
- * $Revision: 1.84 $
+ * $Revision: 1.85 $
*
- * last change: $Author: ssa $ $Date: 2002-11-25 17:09:58 $
+ * last change: $Author: ssa $ $Date: 2002-11-26 16:37:42 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -3269,6 +3269,8 @@ static long ImplHandleKeyMsg( HWND hWnd, UINT nMsg,
static WPARAM nDeadChar = 0;
static WPARAM nLastVKChar = 0;
static USHORT nLastChar = 0;
+ static USHORT nLastModKeyCode = 0;
+ static bool bWaitForModKeyRelease = false;
USHORT nRepeat = LOWORD( lParam )-1;
USHORT nModCode = 0;
@@ -3365,19 +3367,36 @@ static long ImplHandleKeyMsg( HWND hWnd, UINT nMsg,
SalKeyModEvent aModEvt;
aModEvt.mnTime = GetMessageTime();
aModEvt.mnCode = nModCode;
- aModEvt.mnModKeyCode = 0;
+ aModEvt.mnModKeyCode = 0; // no command events will be sent if this member is 0
+
+ USHORT tmpCode = 0;
if( GetKeyState( VK_LSHIFT ) & 0x8000 )
- aModEvt.mnModKeyCode |= MODKEY_LSHIFT;
+ tmpCode |= MODKEY_LSHIFT;
if( GetKeyState( VK_RSHIFT ) & 0x8000 )
- aModEvt.mnModKeyCode |= MODKEY_RSHIFT;
+ tmpCode |= MODKEY_RSHIFT;
if( GetKeyState( VK_LCONTROL ) & 0x8000 )
- aModEvt.mnModKeyCode |= MODKEY_LMOD1;
+ tmpCode |= MODKEY_LMOD1;
if( GetKeyState( VK_RCONTROL ) & 0x8000 )
- aModEvt.mnModKeyCode |= MODKEY_RMOD1;
+ tmpCode |= MODKEY_RMOD1;
if( GetKeyState( VK_LMENU ) & 0x8000 )
- aModEvt.mnModKeyCode |= MODKEY_LMOD2;
+ tmpCode |= MODKEY_LMOD2;
if( GetKeyState( VK_RMENU ) & 0x8000 )
- aModEvt.mnModKeyCode |= MODKEY_RMOD2;
+ tmpCode |= MODKEY_RMOD2;
+
+ if( tmpCode < nLastModKeyCode )
+ {
+ aModEvt.mnModKeyCode = nLastModKeyCode;
+ nLastModKeyCode = 0;
+ bWaitForModKeyRelease = true;
+ }
+ else
+ {
+ if( !bWaitForModKeyRelease )
+ nLastModKeyCode = tmpCode;
+ }
+
+ if( !tmpCode )
+ bWaitForModKeyRelease = false;
return pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
SALEVENT_KEYMODCHANGE, &aModEvt );
@@ -3391,6 +3410,9 @@ static long ImplHandleKeyMsg( HWND hWnd, UINT nMsg,
UINT nCharMsg = WM_CHAR;
BOOL bKeyUp = (nMsg == WM_KEYUP) || (nMsg == WM_SYSKEYUP);
+ nLastModKeyCode = 0; // make sure no modkey messages are sent if they belong to a hotkey (see above)
+ bWaitForModKeyRelease = true;
+
aKeyEvt.mnCode = ImplSalGetKeyCode( wParam );
if ( !bKeyUp )
{