mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 23:34:06 +00:00
2be1c2b375
For now, the modifier key is hardcoded to be Ctrl.
22 lines
628 B
C++
22 lines
628 B
C++
/* This file is (c) 2008-2009 Konstantin Isakov <ikm@users.sf.net>
|
|
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
|
|
|
|
#include "keyboardstate.hh"
|
|
#include <QX11Info>
|
|
#include <X11/X.h>
|
|
#include <X11/XKBlib.h>
|
|
|
|
bool KeyboardState::checkModifiersPressed( int mask )
|
|
{
|
|
XkbStateRec state;
|
|
|
|
XkbGetState( QX11Info::display(), XkbUseCoreKbd, &state );
|
|
|
|
return !(
|
|
( mask & Alt && !( state.base_mods & Mod1Mask ) ) ||
|
|
( mask & Ctrl && !( state.base_mods & ControlMask ) ) ||
|
|
( mask & Shift && !( state.base_mods & ShiftMask ) ) ||
|
|
( mask & Win && !( state.base_mods & Mod4Mask ) ) );
|
|
}
|
|
|