summaryrefslogtreecommitdiff
path: root/toolkit/source
diff options
context:
space:
mode:
authorFrank Schönheit <fs@openoffice.org>2002-08-16 08:12:34 +0000
committerFrank Schönheit <fs@openoffice.org>2002-08-16 08:12:34 +0000
commit06461b92c1a8ee97d36fa0e02343cd9b72d7e9a7 (patch)
treeb212644f7ee135944cb866fe7e4538da51cfede7 /toolkit/source
parent2979ed06a9fd595de39e0748a97fbe081bc6dd02 (diff)
#102205# allow context menu requests triggered by keyboard, too
Diffstat (limited to 'toolkit/source')
-rw-r--r--toolkit/source/awt/vclxwindow.cxx18
1 files changed, 14 insertions, 4 deletions
diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx
index b9fa4f5ccc72..f607376b9957 100644
--- a/toolkit/source/awt/vclxwindow.cxx
+++ b/toolkit/source/awt/vclxwindow.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: vclxwindow.cxx,v $
*
- * $Revision: 1.26 $
+ * $Revision: 1.27 $
*
- * last change: $Author: fs $ $Date: 2002-06-12 13:15:27 $
+ * last change: $Author: fs $ $Date: 2002-08-16 09:12:34 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -423,10 +423,20 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
case VCLEVENT_WINDOW_COMMAND:
{
CommandEvent* pCmdEvt = (CommandEvent*)rVclWindowEvent.GetData();
- if ( GetMouseListeners().getLength() && pCmdEvt->IsMouseEvent() && ( pCmdEvt->GetCommand() == COMMAND_CONTEXTMENU ) )
+ if ( GetMouseListeners().getLength() && ( pCmdEvt->GetCommand() == COMMAND_CONTEXTMENU ) )
{
// COMMAND_CONTEXTMENU als mousePressed mit PopupTrigger = sal_True versenden...
- MouseEvent aMEvt( ((CommandEvent*)rVclWindowEvent.GetData())->GetMousePosPixel(), 1, MOUSE_SIMPLECLICK, MOUSE_LEFT, 0 );
+ Point aWhere = static_cast< CommandEvent* >( rVclWindowEvent.GetData() )->GetMousePosPixel();
+ if ( !pCmdEvt->IsMouseEvent() )
+ { // for keyboard events, we set the coordinates to -1,-1. This is a slight HACK, but the current API
+ // handles a context menu command as special case of a mouse event, which is simply wrong.
+ // Without extending the API, we would not have another chance to notify listeners of a
+ // keyboard-triggered context menu request
+ // 102205 - 16.08.2002 - fs@openoffice.org
+ aWhere = Point( -1, -1 );
+ }
+
+ MouseEvent aMEvt( aWhere, 1, MOUSE_SIMPLECLICK, MOUSE_LEFT, 0 );
::com::sun::star::awt::MouseEvent aEvent;
aEvent.Source = (::cppu::OWeakObject*)this;
ImplInitMouseEvent( aEvent, aMEvt );