diff options
author | Oliver Bolte <obo@openoffice.org> | 2005-04-12 11:20:08 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2005-04-12 11:20:08 +0000 |
commit | bf0079da83cd658995172f8b44d220360467c42c (patch) | |
tree | c9f72691aef47f2ca8a9d08b4b5dc1b29ba74ebd /vcl/unx/gtk/window/gtkframe.cxx | |
parent | 466ee652dc33a74cde84be6093bc5b0ad693deb5 (diff) |
INTEGRATION: CWS vclfinal01 (1.27.2); FILE MERGED
2005/04/07 09:40:02 pl 1.27.2.1: #i46889# copy AlternateKeyCode handling from generic plugin
Diffstat (limited to 'vcl/unx/gtk/window/gtkframe.cxx')
-rw-r--r-- | vcl/unx/gtk/window/gtkframe.cxx | 45 |
1 files changed, 41 insertions, 4 deletions
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx index 9e33d4c0ae29..8b82a7c63c69 100644 --- a/vcl/unx/gtk/window/gtkframe.cxx +++ b/vcl/unx/gtk/window/gtkframe.cxx @@ -2,9 +2,9 @@ * * $RCSfile: gtkframe.cxx,v $ * - * $Revision: 1.27 $ + * $Revision: 1.28 $ * - * last change: $Author: rt $ $Date: 2005-04-01 16:10:11 $ + * last change: $Author: obo $ $Date: 2005-04-12 12:20:08 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -183,6 +183,30 @@ static USHORT GetKeyCode( guint keyval ) return nCode; } +// F10 means either KEY_F10 or KEY_MENU, which has to be decided +// in the independent part. +struct KeyAlternate +{ + USHORT nKeyCode; + sal_Unicode nCharCode; + KeyAlternate() : nKeyCode( 0 ), nCharCode( 0 ) {} + KeyAlternate( USHORT nKey, sal_Unicode nChar = 0 ) : nKeyCode( nKey ), nCharCode( nChar ) {} +}; + +inline KeyAlternate +GetAlternateKeyCode( const USHORT nKeyCode ) +{ + KeyAlternate aAlternate; + + switch( nKeyCode ) + { + case KEY_F10: aAlternate = KeyAlternate( KEY_MENU );break; + case KEY_F24: aAlternate = KeyAlternate( KEY_SUBTRACT, '-' );break; + } + + return aAlternate; +} + void GtkSalFrame::doKeyCallback( guint state, guint keyval, guint16 hardware_keycode, @@ -207,8 +231,9 @@ void GtkSalFrame::doKeyCallback( guint state, * else shortcuts (e.g. Ctrl-o) will not work but be inserted by * the application */ + bool bHandled = false; if( (aEvent.mnCode & (KEY_MOD1|KEY_MOD2)) == 0 || group == 0 ) - CallCallback( SALEVENT_KEYINPUT, &aEvent ); + bHandled = CallCallback( SALEVENT_KEYINPUT, &aEvent ); else { // check other mapping @@ -226,7 +251,19 @@ void GtkSalFrame::doKeyCallback( guint state, { aEvent.mnCode = GetKeyCode( updated_keyval ) | GetModCode( state ); aEvent.mnCharCode = (USHORT)gdk_keyval_to_unicode( updated_keyval ); - CallCallback( SALEVENT_KEYINPUT, &aEvent ); + bHandled = CallCallback( SALEVENT_KEYINPUT, &aEvent ); + } + } + // #i46889# copy AlternatKeyCode handling from generic plugin + if( ! bHandled ) + { + KeyAlternate aAlternate = GetAlternateKeyCode( aEvent.mnCode ); + if( aAlternate.nKeyCode ) + { + aEvent.mnCode = aAlternate.nKeyCode; + if( aAlternate.nCharCode ) + aEvent.mnCharCode = aAlternate.nCharCode; + bHandled = CallCallback( SALEVENT_KEYINPUT, &aEvent ); } } if( bSendRelease && ! aDel.isDeleted() ) |