# kdecore Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# KKeyServer Namespace Reference

A collection of functions for the conversion of key presses and their modifiers from the window system specific format to the generic format and vice-versa. More...

## Classes

struct | Sym
| Represents a key symbol. More...
struct | Key
| Represents a key press. More...
struct | Variations
| TODO: please document this class. More...

## Enumerations

enum | ExtraModFlag { MODE_SWITCH = 0x2000 }

## Functions

bool | initializeMods ()
static void | initializeVariations ()
static void | intializeKKeyLabels ()
uint | modX (KKey::ModFlag mod)
bool | keyboardHasWinKey ()
uint | modXShift ()
uint | modXLock ()
uint | modXCtrl ()
uint | modXAlt ()
uint | modXNumLock ()
uint | modXWin ()
uint | modXScrollLock ()
uint | modXModeSwitch ()
uint | accelModMaskX ()
bool | keyQtToSym (int keyQt, uint &keySym)
bool | keyQtToMod (int keyQt, uint &mod)
bool | symToKeyQt (uint keySym, int &keyQt)
bool | modToModQt (uint mod, int &modQt)
bool | modToModX (uint mod, uint &modX)
bool | modXToModQt (uint modX, int &modQt)
bool | modXToMod (uint modX, uint &mod)
bool | codeXToSym (uchar codeX, uint modX, uint &sym)
static QString | modToString (uint mod, bool bUserSpace)
QString | modToStringInternal (uint mod)
QString | modToStringUser (uint mod)
KDECORE_EXPORT int | qtButtonStateToMod (Qt::ButtonState s)
KDECORE_EXPORT bool | stringToSymMod (const QString &, uint &sym, uint &mod)
KDECORE_EXPORT void | keyQtToKeyX (uint keyCombQt, unsigned char *pKeyCodeX, uint *pKeySymX, uint *pKeyModX)

## Variables

static ModInfo | g_rgModInfo [KKey::MOD_FLAG_COUNT]
static const SymName | g_rgSymNames []
static SymVariation | g_rgSymVariation []
static const TransKey | g_rgQtToSymX []
static bool | g_bInitializedMods
static bool | g_bInitializedVariations
static bool | g_bInitializedKKeyLabels
static bool | g_bMacLabels
static uint | g_modXNumLock
static uint | g_modXScrollLock
static uint | g_modXModeSwitch

## Detailed Description

A collection of functions for the conversion of key presses and their modifiers from the window system specific format to the generic format and vice-versa.

## Enumeration Type Documentation

enum KKeyServer::ExtraModFlag

Supplement enum KKey::ModFlag

Since:
  3.1.

Definition at line 40 of file kkeyserver_x11.h.

## Function Documentation

KDECORE_EXPORT bool KKeyServer::initializeMods | ( |  | ) |

| TODO: please document. Definition at line 329 of file kkeyserver_x11.cpp. References endl(), modX(), and QString::number(). Referenced by accelModMaskX(), keyboardHasWinKey(), modToModX(), modX(), modXModeSwitch(), modXNumLock(), modXScrollLock(), modXToMod(), modXToModQt(), and modXWin().

KDECORE_EXPORT uint KKeyServer::modX | ( | KKey::ModFlag | modFlag | ) |

Returns the equivalent X modifier mask of the given modifier flag.

Parameters:

  | modFlag | the generic flags to check

Returns:
  the window system specific flags

Definition at line 593 of file kkeyserver_x11.cpp.

References initializeMods().

Referenced by codeXToSym(), initializeMods(), modToModX(), KKeyNative::modX(), modXToMod(), and modXToModQt().

KDECORE_EXPORT bool KKeyServer::keyboardHasWinKey | ( |  | ) |

Returns true if the current keyboard layout supports the Win key.

Specifically, whether the Super or Meta keys are assigned to an X modifier.

Returns:
  true if the keyboard has a Win key

See also:
  modXWin()

Definition at line 605 of file kkeyserver_x11.cpp.

References initializeMods().

Referenced by KKeyNative::keyboardHasWinKey().

KDECORE_EXPORT uint KKeyServer::modXShift | ( |  | ) |

Returns the X11 Shift modifier mask/flag.

Returns:
  the X11 Shift modifier mask/flag.

See also:
  accelModMaskX()

Definition at line 606 of file kkeyserver_x11.cpp.

KDECORE_EXPORT uint KKeyServer::modXLock | ( |  | ) |

Returns the X11 Lock modifier mask/flag.

Returns:
  the X11 Lock modifier mask/flag.

See also:
  accelModMaskX()

Definition at line 607 of file kkeyserver_x11.cpp.

Referenced by KKeyNative::modXLock().

KDECORE_EXPORT uint KKeyServer::modXCtrl | ( |  | ) |

Returns the X11 Ctrl modifier mask/flag.

Returns:
  the X11 Ctrl modifier mask/flag.

See also:
  accelModMaskX()

Definition at line 608 of file kkeyserver_x11.cpp.

KDECORE_EXPORT uint KKeyServer::modXAlt | ( |  | ) |

Returns the X11 Alt (Mod1) modifier mask/flag.

Returns:
  the X11 Alt (Mod1) modifier mask/flag.

See also:
  accelModMaskX()

Definition at line 609 of file kkeyserver_x11.cpp.

KDECORE_EXPORT uint KKeyServer::modXNumLock | ( |  | ) |

Returns the X11 NumLock modifier mask/flag.

Returns:
  the X11 NumLock modifier mask/flag.

See also:
  accelModMaskX()

Definition at line 610 of file kkeyserver_x11.cpp.

References initializeMods().

Referenced by KKeyNative::modXNumLock().

KDECORE_EXPORT uint KKeyServer::modXWin | ( |  | ) |

Returns the X11 Win (Mod3) modifier mask/flag.

Returns:
  the X11 Win (Mod3) modifier mask/flag.

See also:
  keyboardHasWinKey()

  accelModMaskX()

Definition at line 611 of file kkeyserver_x11.cpp.

References initializeMods().

KDECORE_EXPORT uint KKeyServer::modXScrollLock | ( |  | ) |

Returns the X11 ScrollLock modifier mask/flag.

Returns:
  the X11 ScrollLock modifier mask/flag.

See also:
  accelModMaskX()

Definition at line 612 of file kkeyserver_x11.cpp.

References initializeMods().

Referenced by KKeyNative::modXScrollLock().

KDECORE_EXPORT uint KKeyServer::modXModeSwitch | ( |  | ) |

Returns the X11 Mode_switch modifier mask/flag.

Returns:
  the X11 Mode_switch modifier mask/flag.

See also:
  accelModMaskX()

Since:
  3.5

Definition at line 613 of file kkeyserver_x11.cpp.

References initializeMods().

Referenced by KKeyNative::modXModeSwitch().

KDECORE_EXPORT uint KKeyServer::accelModMaskX | ( |  | ) |

Returns bitwise OR'ed mask containing Shift, Ctrl, Alt, and Win (if available).

See also:
  modXShift()

  modXLock()

  modXCtrl()

  modXAlt()

  modXNumLock()

  modXWin()

  modXScrollLock()

Definition at line 615 of file kkeyserver_x11.cpp.

References initializeMods().

Referenced by KKeyNative::accelModMaskX().

KDECORE_EXPORT bool KKeyServer::keyQtToSym | ( | int | keyQt,
|  | uint & | sym
| ) |

Extracts the symbol from the given Qt key and converts it to a symbol.

Parameters:

  | keyQt | the qt key code
  | sym | if successful, the symbol will be written here

Returns:
  true if successful, false otherwise

See also:
  Qt::Key

  Sym

Definition at line 623 of file kkeyserver_x11.cpp.

References KKeyServer::Sym::initQt(), and KKeyServer::Sym::m_sym.

Referenced by KKey::init().

KDECORE_EXPORT bool KKeyServer::keyQtToMod | ( | int | keyQt,
|  | uint & | mod
| ) |

Extracts the modifiers from the given Qt key and converts them in a mask of ORed KKey::ModFlag modifiers.

Parameters:

  | keyQt | the qt key code
  | mod | if successful, the modifiers will be written here

Returns:
  true if successful, false otherwise

See also:
  Qt::Key

Definition at line 633 of file kkeyserver_x11.cpp.

Referenced by KKey::init().

KDECORE_EXPORT bool KKeyServer::symToKeyQt | ( | uint | sym,
|  | int & | keyQt
| ) |

Converts the given symbol to a Qt key code.

Parameters:

  | sym | the symbol
  | keyQt | if successful, the qt key code will be written here

Returns:
  true if successful, false otherwise

See also:
  Qt::Key

  Sym

Definition at line 645 of file kkeyserver_x11.cpp.

References KKeyServer::Sym::qt().

KDECORE_EXPORT bool KKeyServer::modToModQt | ( | uint | mod,
|  | int & | modQt
| ) |

Converts the mask of ORed KKey::ModFlag modifiers to a mask of ORed Qt key code modifiers.

Parameters:

  | mod | the mask of KKey::ModFlag modifiers
  | modQt | the mask of Qt key code modifiers will be written here, if successful

Returns:
  true if successful, false otherwise

See also:
  Qt::Key

  KKey

Definition at line 652 of file kkeyserver_x11.cpp.

KDECORE_EXPORT bool KKeyServer::modToModX | ( | uint | mod,
|  | uint & | modX
| ) |

Converts the mask of ORed KKey::ModFlag modifiers to a mask of ORed X11 modifiers.

Parameters:

  | mod | the mask of KKey::ModFlag modifiers
  | modX | the mask of X11 modifiers will be written here, if successful

Returns:
  true if successful, false otherwise

See also:
  KKey

Definition at line 706 of file kkeyserver_x11.cpp.

References endl(), initializeMods(), and modX().

Referenced by KKeyNative::init().

KDECORE_EXPORT bool KKeyServer::modXToModQt | ( | uint | modX,
|  | int & | modQt
| ) |

Converts the mask of ORed X11 modifiers to a mask of ORed Qt key code modifiers.

Parameters:

  | modX | the mask of X11 modifiers
  | modQt | the mask of Qt key code modifiers will be written here if successful

Returns:
  true if successful, false otherwise

See also:
  Qt::Key

Definition at line 728 of file kkeyserver_x11.cpp.

References initializeMods(), and modX().

Referenced by KKeyNative::keyCodeQt().

KDECORE_EXPORT bool KKeyServer::modXToMod | ( | uint | modX,
|  | uint & | mod
| ) |

Converts the mask of ORed X11 modifiers to a mask of ORed KKey::ModFlag modifiers.

Parameters:

  | modX | the mask of X11 modifiers
  | mod | the mask of KKey::ModFlag modifiers will be written here, if successful

Returns:
  true if successful, false otherwise

See also:
  KKey

Definition at line 746 of file kkeyserver_x11.cpp.

References initializeMods(), and modX().

Referenced by KKeyServer::Key::key(), and KKeyNative::key().

KDECORE_EXPORT bool KKeyServer::codeXToSym | ( | uchar | codeX,
|  | uint | modX,
|  | uint & | symX
| ) |

Converts a X11 key code and a mask of ORed X11 modifiers into a X11 symbol.

converts it to a symbol.

Parameters:

  | codeX | the X11 key code
  | modX | the mask of ORed X11 modifiers
  | symX | if successful, the X11 symbol will be written here

Returns:
  true if successful, false otherwise

See also:
  Qt::Key

  Sym

Definition at line 759 of file kkeyserver_x11.cpp.

References modX().

Referenced by KKeyNative::init().

static QString modToString | ( | uint | mod,
|  | bool | bUserSpace
| ) | `[static]`

| Q_WS_WIN. Definition at line 775 of file kkeyserver_x11.cpp. References QString::isEmpty(). Referenced by modToStringUser().

KDECORE_EXPORT QString KKeyServer::modToStringUser | ( | uint | mod | ) |

Converts the mask of ORed KKey::ModFlag modifiers to a user-readable string.

Parameters:

  | mod | the mask of ORed KKey::ModFlag modifiers

Returns:
  the user-readable string

Definition at line 794 of file kkeyserver_x11.cpp.

References modToString().

Referenced by KKey::modFlagLabel(), and KKey::toString().

KDECORE_EXPORT int qtButtonStateToMod | ( | Qt::ButtonState | s | ) |

| Converts the Qt-compatible button state to x11 modifier.

## Variable Documentation

ModInfo KKeyServer::g_rgModInfo[KKey::MOD_FLAG_COUNT]`[static]`

Initial value:

    {
        { KKey::SHIFT, Qt::SHIFT,   X11_ONLY(ShiftMask)   I18N_NOOP("Shift"), QString() },
        { KKey::CTRL,  Qt::CTRL,    X11_ONLY(ControlMask) I18N_NOOP("Ctrl"), QString() },
        { KKey::ALT,   Qt::ALT,     X11_ONLY(Mod1Mask)    I18N_NOOP("Alt"), QString() },
        { KKey::WIN,   KKey::QtWIN, X11_ONLY(Mod4Mask)    I18N_NOOP("Win"), QString() }
    }

Definition at line 108 of file kkeyserver_x11.cpp.

const SymName KKeyServer::g_rgSymNames[]`[static]`

Initial value:

     {
        { XK_ISO_Left_Tab, "Backtab" },
        { XK_BackSpace,    I18N_NOOP("Backspace") },
        { XK_Sys_Req,      I18N_NOOP("SysReq") },
        { XK_Caps_Lock,    I18N_NOOP("CapsLock") },
        { XK_Num_Lock,     I18N_NOOP("NumLock") },
        { XK_Scroll_Lock,  I18N_NOOP("ScrollLock") },
        { XK_Prior,        I18N_NOOP("PageUp") },
        { XK_Next,         I18N_NOOP("PageDown") },

        { 0, 0 }
    }

Definition at line 117 of file kkeyserver_x11.cpp.

SymVariation KKeyServer::g_rgSymVariation[]`[static]`

Initial value:

    {
        { '/', XK_KP_Divide, false },
        { '*', XK_KP_Multiply, false },
        { '-', XK_KP_Subtract, false },
        { '+', XK_KP_Add, false },
        { XK_Return, XK_KP_Enter, false },
        { 0, 0, false }
    }

Definition at line 143 of file kkeyserver_x11.cpp.

This file is part of the documentation for kdecore Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:19:14 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003