2 * Copyright 2012 Ruediger Gad
4 * This file is part of QZeeControl.
6 * QZeeControl is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * QZeeControl is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with QZeeControl. If not, see <http://www.gnu.org/licenses/>.
20 #include "xtstadapter.h"
22 void XtstAdapter::sendKeyPress(QString key){
23 int keyCode = XKeysymToKeycode(display, XStringToKeysym(key.toUtf8().constData()));
25 // "Shift_L" on N9 equals keycode 50.
26 // qDebug("Shift_L is: %d", XKeysymToKeycode(display, XStringToKeysym("Shift_L")));
29 * In case we want to send a single upper case character we press and release shift
30 * prior respectively after sending our actual key press.
32 bool isUpperCaseChar = (key.length() == 1 && key.at(0).isUpper());
34 XTestFakeKeyEvent(display, 50, true, 0);
37 XTestFakeKeyEvent(display, keyCode, true, 0);
38 XTestFakeKeyEvent(display, keyCode, false, 0);
41 * In case we want to send a single upper case character we press and release shift
42 * prior respectively after sending our actual key press.
45 XTestFakeKeyEvent(display, 50, false, 0);