Qt 4.8
Classes | Functions
qwaylandinputdevice.cpp File Reference
#include "qwaylandinputdevice.h"
#include "qwaylandintegration.h"
#include "qwaylandwindow.h"
#include "qwaylandbuffer.h"
#include <QWindowSystemInterface>
#include <QtGui/private/qpixmap_raster_p.h>
#include <QtGui/QPlatformWindow>
#include <unistd.h>
#include <fcntl.h>
#include <X11/extensions/XKBcommon.h>
#include <X11/keysym.h>

Go to the source code of this file.

Classes

class  QWaylandInputDevice
 

Functions

static uint32_t translateKey (uint32_t sym, char *string, size_t size)
 
static Qt::KeyboardModifiers translateModifiers (int s)
 

Function Documentation

◆ translateKey()

static uint32_t translateKey ( uint32_t  sym,
char *  string,
size_t  size 
)
static

Definition at line 181 of file qwaylandinputdevice.cpp.

Referenced by QWaylandInputDevice::inputHandleKey().

182 {
183  Q_UNUSED(size);
184  string[0] = '\0';
185 
186  switch (sym) {
187  case XK_Escape: return Qt::Key_Escape;
188  case XK_Tab: return Qt::Key_Tab;
189  case XK_ISO_Left_Tab: return Qt::Key_Backtab;
190  case XK_BackSpace: return Qt::Key_Backspace;
191  case XK_Return: return Qt::Key_Return;
192  case XK_Insert: return Qt::Key_Insert;
193  case XK_Delete: return Qt::Key_Delete;
194  case XK_Clear: return Qt::Key_Delete;
195  case XK_Pause: return Qt::Key_Pause;
196  case XK_Print: return Qt::Key_Print;
197 
198  case XK_Home: return Qt::Key_Home;
199  case XK_End: return Qt::Key_End;
200  case XK_Left: return Qt::Key_Left;
201  case XK_Up: return Qt::Key_Up;
202  case XK_Right: return Qt::Key_Right;
203  case XK_Down: return Qt::Key_Down;
204  case XK_Prior: return Qt::Key_PageUp;
205  case XK_Next: return Qt::Key_PageDown;
206 
207  case XK_Shift_L: return Qt::Key_Shift;
208  case XK_Shift_R: return Qt::Key_Shift;
209  case XK_Shift_Lock: return Qt::Key_Shift;
210  case XK_Control_L: return Qt::Key_Control;
211  case XK_Control_R: return Qt::Key_Control;
212  case XK_Meta_L: return Qt::Key_Meta;
213  case XK_Meta_R: return Qt::Key_Meta;
214  case XK_Alt_L: return Qt::Key_Alt;
215  case XK_Alt_R: return Qt::Key_Alt;
216  case XK_Caps_Lock: return Qt::Key_CapsLock;
217  case XK_Num_Lock: return Qt::Key_NumLock;
218  case XK_Scroll_Lock: return Qt::Key_ScrollLock;
219  case XK_Super_L: return Qt::Key_Super_L;
220  case XK_Super_R: return Qt::Key_Super_R;
221  case XK_Menu: return Qt::Key_Menu;
222 
223  default:
224  string[0] = sym;
225  string[1] = '\0';
226  return toupper(sym);
227  }
228 }
#define XK_ISO_Left_Tab
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ translateModifiers()

static Qt::KeyboardModifiers translateModifiers ( int  s)
static

Definition at line 163 of file qwaylandinputdevice.cpp.

Referenced by QWaylandInputDevice::inputHandleKey(), and QWaylandInputDevice::inputHandleKeyboardFocus().

164 {
165  const uchar qt_alt_mask = XKB_COMMON_MOD1_MASK;
166  const uchar qt_meta_mask = XKB_COMMON_MOD4_MASK;
167 
168  Qt::KeyboardModifiers ret = 0;
169  if (s & XKB_COMMON_SHIFT_MASK)
170  ret |= Qt::ShiftModifier;
171  if (s & XKB_COMMON_CONTROL_MASK)
172  ret |= Qt::ControlModifier;
173  if (s & qt_alt_mask)
174  ret |= Qt::AltModifier;
175  if (s & qt_meta_mask)
176  ret |= Qt::MetaModifier;
177 
178  return ret;
179 }
uchar qt_alt_mask
unsigned char uchar
Definition: qglobal.h:994
uchar qt_meta_mask