KKeyServer

KDE 4.7 PyKDE API Reference

- KDE's Python API

# KKeyServer Namespace Reference

`from PyKDE4.kdeui.KKeyServer import *`

## 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.

## Functions
long | accelModMaskX ()
bool | initializeMods ()
bool, int keyCode | keyQtToCodeX (int keyQt)
bool, long mod | keyQtToModX (int keyQt)
bool, int sym | keyQtToSymX (int keyQt)
bool | keyboardHasMetaKey ()
QString | modToStringUser (long mod)
long | modXAlt ()
long | modXCtrl ()
long | modXLock ()
long | modXMeta ()
long | modXModeSwitch ()
long | modXNumLock ()
long | modXScrollLock ()
long | modXShift ()
bool, int modQt | modXToQt (long modX)
long | stringUserToMod (QString mod)
bool, int keyQt | symXToKeyQt (long sym)
bool | xEventToQt (XEvent e, int keyModQt)

## Function Documentation

long accelModMaskX | ( |  | ) |

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

See also:
  modXShift()

See also:
  modXLock()

See also:
  modXCtrl()

See also:
  modXAlt()

See also:
  modXNumLock()

See also:
  modXWin()

See also:
  modXScrollLock()

bool initializeMods | ( |  | ) |

Initialises the values to return for the mod*() functions below. Called automatically by those functions if not already initialized.

bool, int keyCode keyQtToCodeX | ( | int | keyQt
| ) |  |  |

Extracts the code from the given Qt key.

Parameters:

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

Returns:
  true if successful, false otherwise

bool, long mod keyQtToModX | ( | int | keyQt
| ) |  |  |

Extracts the modifiers from the given Qt key and converts them in a mask of X11 modifiers.

Parameters:

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

Returns:
  true if successful, false otherwise

bool, int sym keyQtToSymX | ( | int | keyQt
| ) |  |  |

Extracts the symbol from the given Qt key and converts it to an X11 symbol + modifiers.

Parameters:

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

Returns:
  true if successful, false otherwise

bool keyboardHasMetaKey | ( |  | ) |

Returns true if the current keyboard layout supports the Meta key. Specifically, whether the Super or Meta keys are assigned to an X modifier.

Returns:
  true if the keyboard has a Meta key

See also:
  modXMeta()

QString modToStringUser | ( | long | 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

long modXAlt | ( |  | ) |

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

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

See also:
  accelModMaskX()

long modXCtrl | ( |  | ) |

Returns the X11 Ctrl modifier mask/flag.

Returns:
  the X11 Ctrl modifier mask/flag.

See also:
  accelModMaskX()

long modXLock | ( |  | ) |

Returns the X11 Lock modifier mask/flag.

Returns:
  the X11 Lock modifier mask/flag.

See also:
  accelModMaskX()

long modXMeta | ( |  | ) |

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

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

See also:
  keyboardHasWinKey()

See also:
  accelModMaskX()

long modXModeSwitch | ( |  | ) |

Returns the X11 Mode_switch modifier mask/flag.

Returns:
  the X11 Mode_switch modifier mask/flag.

See also:
  accelModMaskX()

long modXNumLock | ( |  | ) |

Returns the X11 NumLock modifier mask/flag.

Returns:
  the X11 NumLock modifier mask/flag.

See also:
  accelModMaskX()

long modXScrollLock | ( |  | ) |

Returns the X11 ScrollLock modifier mask/flag.

Returns:
  the X11 ScrollLock modifier mask/flag.

See also:
  accelModMaskX()

long modXShift | ( |  | ) |

Returns the X11 Shift modifier mask/flag.

Returns:
  the X11 Shift modifier mask/flag.

See also:
  accelModMaskX()

bool, int modQt modXToQt | ( | long | modX
| ) |  |  |

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

long stringUserToMod | ( | QString | mod
| ) |  |  |

Converts the modifier given as user-readable string to KKey.ModFlag modifier, or 0.

Internal:

bool, int keyQt symXToKeyQt | ( | long | sym
| ) |  |  |

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

bool xEventToQt | ( | XEvent | e,
|  | int | keyModQt
| ) |  |  |

Converts an X keypress event into a Qt key + modifier code

Parameters:

  | e | the X11 keypress event
  | keyModQt | the Qt keycode and mask of Qt key code modifiers will be written here if successful

Returns:
  true if successful, false otherwise