Remove SalDisplay::GetKeyboardName

This method seems to be useless. The return value (keyboard name) isn't
used at any point. And I don't see any point in this method where some
implicit call is done to refresh mappings...
This commit is contained in:
Thomas Arnhold 2012-01-27 16:51:04 +01:00
parent 2b507836fc
commit 04b9c2f633
4 changed files with 3 additions and 104 deletions

View file

@ -323,7 +323,6 @@ protected:
KeySym nShiftKeySym_; // first shift modifier
KeySym nCtrlKeySym_; // first control modifier
KeySym nMod1KeySym_; // first mod1 modifier
rtl::OString m_aKeyboardName;
vcl_sal::WMAdaptor* m_pWMAdaptor;
@ -427,7 +426,6 @@ public:
{ mpInputMethod = pInputMethod; }
void SetKbdExtension(SalI18N_KeyboardExtension *pKbdExtension)
{ mpKbdExtension = pKbdExtension; }
const char* GetKeyboardName( bool bRefresh = false );
::vcl_sal::WMAdaptor* getWMAdaptor() const { return m_pWMAdaptor; }
bool IsXinerama() const { return m_bXinerama; }
const std::vector< Rectangle >& GetXineramaScreens() const { return m_aXineramaScreens; }

View file

@ -215,94 +215,4 @@ static const keyboard_layout type6_layout[] =
#include <stdio.h>
#endif
const char* SalDisplay::GetKeyboardName( bool bRefresh )
{
if (bRefresh || m_aKeyboardName.isEmpty())
{
#if defined(SOLARIS)
if( IsLocal() )
{
int kbd = open( "/dev/kbd", O_RDONLY );
if( kbd >= 0 )
{
int kbd_type = 0;
if( ! ioctl( kbd, KIOCTYPE, &kbd_type ) )
{
int kbd_layout = 0;
if( ! ioctl( kbd, KIOCLAYOUT, &kbd_layout ) )
{
const keyboard_layout *p_layout = NULL;
switch( kbd_type )
{
case KB_KLUNK: p_layout = type0_layout; break;
case KB_SUN3: p_layout = type3_layout; break;
case KB_SUN4: p_layout = type4_layout; break;
case KB_USB: p_layout = type6_layout; break;
case KB_PC: p_layout = type101_layout; break;
}
if( p_layout )
{
while( p_layout->n_layout != -1 )
{
if ( p_layout->n_layout == kbd_layout )
{
m_aKeyboardName = p_layout->p_description;
break;
}
p_layout++;
}
}
}
}
close(kbd);
}
}
#elif !defined(AIX)
int opcode, event, error;
int major = XkbMajorVersion, minor = XkbMinorVersion;
if( XkbQueryExtension( GetDisplay(), &opcode, &event,&error, &major, &minor ) )
{
XkbDescPtr pXkbDesc = NULL;
// try X keyboard extension
if( (pXkbDesc = XkbGetKeyboard( GetDisplay(), XkbAllComponentsMask, XkbUseCoreKbd )) )
{
const char* pAtom = NULL;
if( pXkbDesc->names->groups[0] )
{
pAtom = XGetAtomName( GetDisplay(), pXkbDesc->names->groups[0] );
m_aKeyboardName = pAtom;
XFree( (void*)pAtom );
}
else
m_aKeyboardName = "<unknown keyboard>";
#if OSL_DEBUG_LEVEL > 1
#define PRINT_ATOM( x ) { if( pXkbDesc->names->x ) { pAtom = XGetAtomName( GetDisplay(), pXkbDesc->names->x ); fprintf( stderr, "%s: %s\n", #x, pAtom ); XFree( (void*)pAtom ); } else fprintf( stderr, "%s: <nil>\n", #x ); }
PRINT_ATOM( keycodes );
PRINT_ATOM( geometry );
PRINT_ATOM( symbols );
PRINT_ATOM( types );
PRINT_ATOM( compat );
PRINT_ATOM( phys_symbols );
#define PRINT_ATOM_2( x ) { if( pXkbDesc->names->x[i] ) { pAtom = XGetAtomName( GetDisplay(), pXkbDesc->names->x[i] ); fprintf( stderr, "%s[%d]: %s\n", #x, i, pAtom ); XFree( (void*)pAtom ); } else fprintf( stderr, "%s[%d]: <nil>\n", #x, i ); }
int i;
for( i = 0; i < XkbNumVirtualMods; i++ )
PRINT_ATOM_2( vmods );
for( i = 0; i < XkbNumIndicators; i++ )
PRINT_ATOM_2( indicators );
for( i = 0; i < XkbNumKbdGroups; i++ )
PRINT_ATOM_2( groups );
#endif
XkbFreeKeyboard( pXkbDesc, XkbAllComponentsMask, True );
}
}
#endif
if (m_aKeyboardName.isEmpty())
m_aKeyboardName = "<unknown keyboard>";
}
return m_aKeyboardName.getStr();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -2170,14 +2170,10 @@ long SalX11Display::Dispatch( XEvent *pEvent )
}
break;
case MappingNotify:
if( MappingKeyboard == pEvent->xmapping.request ||
MappingModifier == pEvent->xmapping.request )
if( MappingModifier == pEvent->xmapping.request )
{
XRefreshKeyboardMapping( &pEvent->xmapping );
if( MappingModifier == pEvent->xmapping.request )
ModifierMapping();
if( MappingKeyboard == pEvent->xmapping.request ) // refresh mapping
GetKeyboardName( true );
ModifierMapping();
}
break;
case ButtonPress:

View file

@ -129,12 +129,7 @@ extern "C" {
void signalKeysChanged( GdkKeymap*, gpointer data )
{
GtkSalDisplay* pDisp = (GtkSalDisplay*)data;
#if !GTK_CHECK_VERSION(3,0,0)
pDisp->GetKeyboardName(true);
#else
(void)pDisp;
#warning FIXME: impl. / check signalKeysChanged ...
#endif
#warning signalKeysChanged called
}
void signalScreenSizeChanged( GdkScreen* pScreen, gpointer data )