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){
25 // int keyCode = XKeysymToKeycode(display, XStringToKeysym(key.toUtf8().constData()));
27 //// "Shift_L" on N9 equals keycode 50.
28 //// qDebug("Shift_L is: %d", XKeysymToKeycode(display, XStringToKeysym("Shift_L")));
31 // * In case we want to send a single upper case character we press and release shift
32 // * prior respectively after sending our actual key press.
34 // bool isUpperCaseChar = (key.length() == 1 && key.at(0).isUpper());
35 // if(isUpperCaseChar){
36 // XTestFakeKeyEvent(display, 50, true, 0);
39 // XTestFakeKeyEvent(display, keyCode, true, 0);
40 // XTestFakeKeyEvent(display, keyCode, false, 0);
43 // * In case we want to send a single upper case character we press and release shift
44 // * prior respectively after sending our actual key press.
46 // if(isUpperCaseChar){
47 // XTestFakeKeyEvent(display, 50, false, 0);
53 void XtstAdapter::sendKey(QString key, bool down){
54 int keyCode = XKeysymToKeycode(display, XStringToKeysym(key.toUtf8().constData()));
56 // "Shift_L" on N9 equals keycode 50.
57 // qDebug("Shift_L is: %d", XKeysymToKeycode(display, XStringToKeysym("Shift_L")));
60 * In case we want to send a single upper case character we press and release shift
61 * prior respectively after sending our actual key press.
63 bool isUpperCaseChar = (key.length() == 1 && key.at(0).isUpper());
65 XTestFakeKeyEvent(display, 50, true, 0);
68 XTestFakeKeyEvent(display, keyCode, down, 0);
71 * In case we want to send a single upper case character we press and release shift
72 * prior respectively after sending our actual key press.
75 XTestFakeKeyEvent(display, 50, false, 0);