├── README.txt ├── ThreatDragonModels └── qt-rfb-threat-model │ └── qt-rfb-threat-model.json ├── main.cpp ├── rfbclientcls.cpp ├── rfbclientcls.h ├── rfbclientwidgetcls.cpp ├── rfbclientwidgetcls.h ├── vncclient.pro ├── vncclientwidget2cls.cpp └── vncclientwidget2cls.h /README.txt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Azril Azam 3 | * 4 | * 5 | * Desc 6 | * 7 | * This file is a part of the 100% Qt5 VNC RFB-CLIENT implementation without 8 | * using any 3rd party rfb library 9 | * 10 | * 11 | * ReadMe.txt 12 | * Qt5 RFB-CLIENT is free software: you can redistribute it and/or 13 | * modify it under the terms of the GNU Lesser General Public License as 14 | * published by the Free Software Foundation, either version 3 of the License, 15 | * or (at your option) any later version. 16 | * 17 | * Qt5 RFB-CLIENT is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU Lesser General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public License 23 | * along with Qt HTML platform plugin. If not, see 24 | * . 25 | */ 26 | 27 | This is a Qt5 framework project file. This project was created using QtCreator. 28 | Open the vncclient.pro via QtCreator and all source files should configured 29 | by the IDE. 30 | 31 | Regards 32 | Azril 33 | -MALAYSIA- -------------------------------------------------------------------------------- /ThreatDragonModels/qt-rfb-threat-model/qt-rfb-threat-model.json: -------------------------------------------------------------------------------- 1 | { 2 | "summary": { 3 | "title": "qt-rfb-threat-model", 4 | "owner": "azril", 5 | "description": "High level threat model of qt-rfb" 6 | }, 7 | "detail": { 8 | "contributors": [], 9 | "diagrams": [], 10 | "reviewer": "azril" 11 | } 12 | } -------------------------------------------------------------------------------- /main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Azril Azam 3 | * 4 | * 5 | * Desc 6 | * 7 | * This file is a part of the 100% Qt5 VNC RFB-CLIENT implementation without 8 | * using any 3rd party rfb library 9 | * 10 | * main.cpp 11 | * 12 | * 13 | * Qt5 RFB-CLIENT is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU Lesser General Public License as 15 | * published by the Free Software Foundation, either version 3 of the License, 16 | * or (at your option) any later version. 17 | * 18 | * Qt5 RFB-CLIENT is distributed in the hope that it will be useful, 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | * GNU Lesser General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU Lesser General Public License 24 | * along with Qt HTML platform plugin. If not, see 25 | * . 26 | */ 27 | 28 | #include 29 | #include "vncclientwidgetcls.h" 30 | #include "rfbclientwidgetcls.h" 31 | #include "vncclientwidget2cls.h" 32 | 33 | int main(int argc, char *argv[]) 34 | { 35 | QApplication a(argc, argv); 36 | 37 | vncclientwidget2cls vnc; 38 | vnc.connectVNCTCP("localhost",5901); // connect via TCP 39 | //vnc.connectVNCIPC("/var/nemd3/nemd3vnc"); connect via UNIX socket 40 | vnc.show(); 41 | return a.exec(); 42 | } 43 | -------------------------------------------------------------------------------- /rfbclientcls.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Azril Azam 3 | * 4 | * 5 | * Desc 6 | * 7 | * This file is a part of the 100% Qt5 VNC RFB-CLIENT implementation without 8 | * using any 3rd party rfb library 9 | * 10 | * rfbclientcls.cpp 11 | * 12 | * 13 | * Qt5 RFB-CLIENT is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU Lesser General Public License as 15 | * published by the Free Software Foundation, either version 3 of the License, 16 | * or (at your option) any later version. 17 | * 18 | * Qt5 RFB-CLIENT is distributed in the hope that it will be useful, 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | * GNU Lesser General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU Lesser General Public License 24 | * along with Qt HTML platform plugin. If not, see 25 | * . 26 | */ 27 | 28 | #include "rfbclientcls.h" 29 | 30 | rfbclientcls::rfbclientcls(QObject *parent) : 31 | QObject(parent) 32 | { 33 | pixelFormatStruct pixel_format; 34 | 35 | 36 | this->vncClientTCP.setParent(this); 37 | this->vncClientIPC.setParent(this); 38 | this->opsThreadTimer.setParent(this); 39 | 40 | this->serverConnected = false; 41 | this->socketMode = 10; //default TCP 42 | this->pauseMode = false; 43 | xEmitDisconnecSignal = false; 44 | 45 | //set default client pixel information 46 | pixel_format.bpp = 32; 47 | pixel_format.depth = 24; 48 | pixel_format.true_color_flag = 1; 49 | pixel_format.big_endian_flag = 0; 50 | pixel_format.red_max = 0xFF; 51 | pixel_format.green_max = 0xFF; 52 | pixel_format.blue_max = 0xFF; 53 | pixel_format.red_shift = 0x10; 54 | pixel_format.green_shift = 0x08; 55 | pixel_format.blue_shift = 0x00; 56 | 57 | qDebug("Setting client pixel"); 58 | this->clientPixelF = pixel_format; 59 | 60 | qDebug("Setting client color format"); 61 | this->clientColorFormat = this->getColorFormat(&this->clientPixelF); 62 | 63 | qDebug("load default image"); 64 | this->VNCIMAGE = QImage(":/new/prefix1/creditimg.png"); 65 | } 66 | 67 | 68 | rfbclientcls::~rfbclientcls() 69 | { 70 | qDebug() << "rfbclientcls is going to be deleted"; 71 | 72 | this->disconnectFromHost(); 73 | /*this->opsThreadTimer.stop(); 74 | disconnect(&this->opsThreadTimer,SIGNAL(timeout()),this,SLOT(opsThreadTimerTimeOutSlot())); 75 | 76 | this->vncClientTCP.abort(); 77 | this->vncClientIPC.abort(); 78 | this->opsThreadTimer.stop(); 79 | disconnect(&this->opsThreadTimer,SIGNAL(timeout()),this,SLOT(opsThreadTimerTimeOutSlot()));*/ 80 | /*if (this->opsThreadTimer != NULL) 81 | { 82 | 83 | disconnect(this->opsThreadTimer,SIGNAL(timeout()),this,SLOT(opsThreadTimerTimeOutSlot())); 84 | delete this->opsThreadTimer; 85 | this->opsThreadTimer = NULL; 86 | } 87 | 88 | if (this->vncClientTCP != NULL) 89 | { 90 | //disconnect(this->vncClientTCP,SIGNAL(disconnected()),this,SLOT(vncSockDisconnectedSlot())); 91 | this->vncClientTCP->abort(); 92 | delete this->vncClientTCP; 93 | this->vncClientTCP = NULL; 94 | } 95 | 96 | if (this->vncClientIPC != NULL) 97 | { 98 | //disconnect(this->vncClientIPC,SIGNAL(disconnected()),this,SLOT(vncSockDisconnectedSlot())); 99 | this->vncClientIPC->abort(); 100 | delete this->vncClientIPC; 101 | this->vncClientIPC = NULL; 102 | }*/ 103 | 104 | qDebug("rfbclientcls deleted"); 105 | } 106 | 107 | void rfbclientcls::opsThreadTimerTimeOutSlot() 108 | { 109 | this->processRFBOperationProtocol(); 110 | } 111 | 112 | void rfbclientcls::processRFBOperationProtocol() 113 | { 114 | 115 | switch (this->socketMode){ 116 | case 0: 117 | if (this->vncClientTCP.state() != QTcpSocket::ConnectedState) 118 | { 119 | this->disconnectFromHost(); 120 | return; 121 | } 122 | break; 123 | 124 | case 1: 125 | if (this->vncClientIPC.state() != QLocalSocket::ConnectedState) 126 | { 127 | this->disconnectFromHost(); 128 | return; 129 | } 130 | break; 131 | } 132 | 133 | this->getRFBOpsType(); 134 | this->opsThreadTimer.start(1); 135 | 136 | } 137 | 138 | void rfbclientcls::newUpdateRFBFB() 139 | { 140 | unsigned char padding; 141 | quint16 totalRects; 142 | quint16 currentRect; 143 | rfbRectHeader rfbRH; 144 | qint64 bppSize; 145 | quint64 totalPixelSize; 146 | quint32 cursorSize; 147 | 148 | unsigned char *pixelData; 149 | unsigned char *cursorData; 150 | 151 | unsigned char *px; 152 | unsigned char *p; 153 | QImage srcImg; 154 | 155 | 156 | //get the padding 157 | if (this->readFromRFBServer(&padding,1) != 1) 158 | return; 159 | 160 | //get number of rectangle 161 | if (this->readFromRFBServer((unsigned char*)&totalRects,2) != 2) 162 | return; 163 | totalRects = this->swap16(totalRects); 164 | 165 | //process each rect 166 | for (currentRect = 0; currentRect < totalRects; currentRect++) 167 | { 168 | //process all events; 169 | qApp->processEvents(); 170 | 171 | switch (this->socketMode) 172 | { 173 | case 0: 174 | if (this->vncClientTCP.state() != QTcpSocket::ConnectedState) 175 | return; 176 | break; 177 | 178 | case 1: 179 | if (this->vncClientIPC.state() != QLocalSocket::ConnectedState) 180 | return; 181 | } 182 | 183 | //get rect information 184 | if (this->readFromRFBServer((unsigned char*)&rfbRH,sizeof(rfbRH)) == sizeof(rfbRH)) 185 | { 186 | 187 | //swap the value 188 | rfbRH.x = swap16(rfbRH.x); 189 | rfbRH.y = swap16(rfbRH.y); 190 | rfbRH.width = swap16(rfbRH.width); 191 | rfbRH.height = swap16(rfbRH.height); 192 | rfbRH.encoding = swap32(rfbRH.encoding); 193 | 194 | if (rfbRH.width * rfbRH.height > 0) 195 | { 196 | 197 | switch (rfbRH.encoding) 198 | { 199 | case 0: //Get Raw Data 200 | //Get Pixel Size 201 | bppSize = (this->serverPixelF.bpp >> 3); 202 | totalPixelSize = rfbRH.width * rfbRH.height * bppSize; 203 | 204 | //create pixel buffer 205 | pixelData = (unsigned char*)malloc(totalPixelSize); 206 | if (this->readFromRFBServer(pixelData,totalPixelSize) == totalPixelSize) 207 | { 208 | //create new image 209 | px = 0; 210 | p = 0; 211 | srcImg = QImage(rfbRH.width,rfbRH.height,QImage::Format_RGB888); 212 | 213 | px = pixelData; 214 | p = (unsigned char*)srcImg.bits(); 215 | for (int cy = 0; cy < rfbRH.height; cy++) 216 | { 217 | qApp->processEvents(); 218 | for (int cx = 0; cx < rfbRH.width; cx++) 219 | { 220 | p[0] = px[2]; 221 | p[1] = px[1]; 222 | p[2] = px[0]; 223 | px+=4; 224 | p+=3; 225 | } 226 | } 227 | 228 | //update image raster 229 | QPainter painter(&this->VNCIMAGE); 230 | painter.drawImage(rfbRH.x,rfbRH.y,srcImg); 231 | painter.end(); 232 | } 233 | //clear pixel data 234 | free (pixelData); 235 | break; 236 | 237 | 238 | case -223: //this->updateFBGetDesktopSizePseudo(); 239 | this->VNCIMAGE = QImage(rfbRH.width,rfbRH.height,QImage::Format_RGB888); 240 | this->serverFBHeight = rfbRH.height; 241 | this->serverFBWidth = rfbRH.width; 242 | emit this->rfbResizeSignal(rfbRH.width,rfbRH.height,this->serverVNCName); 243 | break; 244 | 245 | 246 | case -239://this->updateFBGetCursorPseudo(); 247 | 248 | cursorSize = rfbRH.width * rfbRH.height; 249 | if (cursorSize > 0) 250 | { 251 | cursorData = (unsigned char *)malloc(cursorSize); 252 | if (this->readFromRFBServer(cursorData,cursorSize) == cursorSize) 253 | //emit this->rfbCursorPositionSignal(rfbRH.x,rfbRH.y); 254 | free(cursorData); 255 | } 256 | break; 257 | } 258 | } 259 | } 260 | //process next rectangle 261 | } 262 | 263 | //if all good then display the image 264 | if ((currentRect >= totalRects) && (!this->pauseMode)) 265 | emit this->rfbFrameBufferUpdateSignal(); 266 | 267 | } 268 | 269 | void rfbclientcls::getRFBOpsType() 270 | { 271 | unsigned char msgType; 272 | 273 | 274 | if (this->readFromRFBServer((unsigned char*)&msgType,1) != 1) 275 | return; 276 | 277 | switch (msgType) 278 | { 279 | case 0: this->newUpdateRFBFB();break; 280 | //case 0: this->RFBOpsStage = 1;break; //framebufferupdate 281 | // case 1: this->RFBOpsStage = 2;break; //setcolormapentries 282 | // case 2: this->RFBOpsStage = 3; break; //ServerBell 283 | // case 3: this->RFBOpsStage = 4; break; //server cut text 284 | } 285 | return; 286 | } 287 | 288 | 289 | /*void rfbclientcls::updateFBGetDesktopSizePseudo(quint16 w, quint16 h) 290 | { 291 | 292 | 293 | this->VNCIMAGE = QImage(w,h,QImage::Format_RGB888); 294 | this->serverFBHeight = w; 295 | this->serverFBWidth = h; 296 | emit this->rfbResizeSignal(w,h,this->serverVNCName); 297 | 298 | } 299 | 300 | void rfbclientcls::updateFBGetCursorPseudo() 301 | { 302 | 303 | unsigned char *cursorData; 304 | quint32 size = this->gRFBRH.width * this->gRFBRH.height; 305 | 306 | if ((size) <=0) 307 | { 308 | this->RFBOpsStage = 13; 309 | return; 310 | } 311 | 312 | cursorData = (unsigned char*)malloc(size); 313 | if (this->readFromRFBServer(cursorData,size) != size) 314 | { 315 | free (cursorData); 316 | return; //read until equal to size; 317 | } 318 | 319 | //emit this->rfbCursorPositionSignal(this->gRFBRH.x,this->gRFBRH.y); 320 | 321 | free (cursorData); 322 | 323 | }*/ 324 | 325 | quint64 rfbclientcls::readFromRFBServer(unsigned char *data, quint64 size) 326 | { 327 | //qint64 bSize; 328 | while(1) 329 | { 330 | qApp->processEvents(); 331 | switch (this->socketMode) 332 | { 333 | case 0: 334 | if (this->vncClientTCP.state() != QTcpSocket::ConnectedState) 335 | return 0; 336 | 337 | if ((quint64)this->vncClientTCP.bytesAvailable() >= size) 338 | { 339 | this->vncClientTCP.read((char*)data,(qint64)size); 340 | return size; 341 | } 342 | break; 343 | 344 | 345 | case 1: 346 | if (this->vncClientIPC.state() != QLocalSocket::ConnectedState) 347 | return 0; 348 | 349 | if ((quint64)this->vncClientIPC.bytesAvailable() >= size) 350 | { 351 | this->vncClientIPC.read((char*)data,(qint64)size); 352 | return size; 353 | } 354 | break; 355 | } 356 | } 357 | 358 | return 0; 359 | } 360 | 361 | 362 | QImage rfbclientcls::getVNCImage() 363 | { 364 | return this->VNCIMAGE; 365 | } 366 | 367 | bool rfbclientcls::pauseRFB() 368 | { 369 | this->pauseMode = true; 370 | //make image black in white 371 | 372 | this->pauseResumeImg = this->VNCIMAGE; 373 | this->VNCIMAGE = this->VNCIMAGE.convertToFormat(QImage::Format_Mono); 374 | this->disconnectFromHost(); 375 | 376 | emit this->rfbPauseSignal(); 377 | return true; 378 | } 379 | 380 | bool rfbclientcls::resumeRFB() 381 | { 382 | this->VNCIMAGE = this->pauseResumeImg;//this->VNCIMAGE.convertToFormat(QImage::Format_RGB888); 383 | this->pauseMode = false; 384 | return true; 385 | switch(socketMode) 386 | { 387 | case 0: 388 | if (this->connectToHostTCP(this->serverName,this->serverPort)) 389 | { 390 | this->pauseMode = false; 391 | return true; 392 | } 393 | break; 394 | 395 | case 1: 396 | if (this->connectToHostIPC(this->serverName)) 397 | { 398 | this->pauseMode = false; 399 | return true; 400 | } 401 | break; 402 | 403 | } 404 | return false; 405 | 406 | /*if (this->serverConnected) 407 | { 408 | this->sendClientFrameBufferRequestUpdate(0,0,this->VNCIMAGE.width(),this->VNCIMAGE.height(),0); 409 | this->pauseMode = false; 410 | return true; 411 | } 412 | return false;*/ 413 | 414 | } 415 | 416 | qint32 rfbclientcls::getColorFormat(pixelFormatStruct *pixel) 417 | { 418 | // qDebug() << " check color format for following parameter:"; 419 | // qDebug() << " ... - BPP = " << pixel->bpp << ", Depth = " << pixel->depth << ", True color = " << pixel->true_color_flag; 420 | // qDebug() << " ... - Red max = " << pixel->red_max << ", Green max = " << pixel->green_max << ", Blue max = " << pixel->blue_max; 421 | // qDebug() << " ... - Red shift = " << pixel->red_shift << ", Green shift = " << pixel->green_shift << ", Blue shift = " << pixel->blue_shift; 422 | 423 | if (pixel->bpp == 32 && pixel->depth == 24 && pixel->true_color_flag == 1 && 424 | pixel->red_max == 0xFF && pixel->green_max == 0xFF && pixel->blue_max == 0xFF && 425 | pixel->red_shift == 0x10 && pixel->green_shift == 0x08 && pixel->blue_shift == 0x00) { 426 | // qDebug() << " color format identified as RGB888"; 427 | return PIXEL_FORMAT_RGB_888; 428 | } 429 | 430 | if (pixel->bpp == 16 && pixel->depth == 16 && pixel->true_color_flag == 1 && 431 | pixel->red_max == 0x1F && pixel->green_max == 0x3F && pixel->blue_max == 0x1F && 432 | pixel->red_shift == 0x0B && pixel->green_shift == 0x05 && pixel->blue_shift == 0x00) { 433 | // qDebug() << " color format identified as RGB565"; 434 | return PIXEL_FORMAT_RGB_565; 435 | } 436 | 437 | if (pixel->bpp == 16 && pixel->depth == 15 && pixel->true_color_flag == 1 && 438 | pixel->red_max == 0x1F && pixel->green_max == 0x1F && pixel->blue_max == 0x1F && 439 | pixel->red_shift == 0x0A && pixel->green_shift == 0x05 && pixel->blue_shift == 0x00) { 440 | // qDebug()<< " color format identified as RGB555"; 441 | return PIXEL_FORMAT_RGB_555; 442 | } 443 | 444 | qDebug() << " ERROR - unknown Color format"; 445 | 446 | return PIXEL_FORMAT_NONE; 447 | } 448 | 449 | void rfbclientcls::vncSockDisconnectedSlot() 450 | { 451 | this->disconnectFromHost(); 452 | return; 453 | 454 | } 455 | 456 | bool rfbclientcls::connectToHostTCP(QString server, qint16 port) 457 | { 458 | this->socketMode = 0; 459 | return this->connectToHost(server,port); 460 | 461 | } 462 | 463 | bool rfbclientcls::connectToHostIPC(QString server) 464 | { 465 | this->socketMode = 1; 466 | return this->connectToHost(server,0); 467 | } 468 | 469 | bool rfbclientcls::connectToHost(QString server, qint16 port) 470 | { 471 | this->serverName = server; 472 | this->serverPort = port; 473 | QFile sf; 474 | 475 | this->opsThreadTimer.stop(); 476 | disconnect(&this->opsThreadTimer,SIGNAL(timeout()),this,SLOT(opsThreadTimerTimeOutSlot())); 477 | 478 | disconnect(&this->vncClientTCP,SIGNAL(disconnected()),this,SLOT(vncSockDisconnectedSlot())); 479 | this->vncClientTCP.abort(); 480 | 481 | disconnect(&this->vncClientIPC,SIGNAL(disconnected()),this,SLOT(vncSockDisconnectedSlot())); 482 | this->vncClientIPC.abort(); 483 | 484 | //restart fresh 485 | switch (this->socketMode){ 486 | 487 | case 0: 488 | connect(&this->vncClientTCP,SIGNAL(disconnected()),this,SLOT(vncSockDisconnectedSlot())); 489 | this->vncClientTCP.connectToHost(server,port); 490 | if (!this->vncClientTCP.waitForConnected(3000)) 491 | { 492 | qDebug() << "rfbclientcls: fail to connect to host." << this->vncClientTCP.errorString(); 493 | this->disconnectFromHost(); 494 | return false; 495 | } 496 | break; 497 | 498 | case 1: 499 | 500 | //check if local server IPC file exists 501 | sf.setFileName(server); 502 | if (!sf.exists()) 503 | { 504 | qDebug() << "VNC Connect: IPC Server not exists! Exiting"; 505 | return false; 506 | } 507 | connect(&this->vncClientIPC,SIGNAL(disconnected()),this,SLOT(vncSockDisconnectedSlot())); 508 | this->vncClientIPC.connectToServer(server); 509 | if (!this->vncClientIPC.waitForConnected(3000)) 510 | { 511 | qDebug() << "rfbclientcls: fail to connect to host." << this->vncClientTCP.errorString(); 512 | this->disconnectFromHost(); 513 | return false; 514 | } 515 | } 516 | 517 | qDebug("vnc sock connected"); 518 | this->serverConnected = true; 519 | this->pauseMode = false; 520 | 521 | emit this->rfbHostConnectedSignal(); 522 | if (!this->performHandshakingProtocol()) 523 | { 524 | this->disconnectFromHost(); 525 | return false; 526 | } 527 | 528 | qDebug() << "Timer start"; 529 | this->opsThreadTimer.setSingleShot(true); 530 | connect(&this->opsThreadTimer,SIGNAL(timeout()),this,SLOT(opsThreadTimerTimeOutSlot()),Qt::DirectConnection); 531 | this->opsThreadTimer.start(1); 532 | return true; 533 | 534 | } 535 | 536 | void rfbclientcls::disconnectFromHost() 537 | { 538 | qint16 w,h; 539 | 540 | this->opsThreadTimer.stop(); 541 | disconnect(&this->opsThreadTimer,SIGNAL(timeout()),this,SLOT(opsThreadTimerTimeOutSlot())); 542 | 543 | 544 | disconnect(&this->vncClientTCP,SIGNAL(disconnected()),this,SLOT(vncSockDisconnectedSlot())); 545 | this->vncClientTCP.abort(); 546 | 547 | disconnect(&this->vncClientIPC,SIGNAL(disconnected()),this,SLOT(vncSockDisconnectedSlot())); 548 | this->vncClientIPC.abort(); 549 | 550 | qDebug("sock disconnected"); 551 | this->serverConnected = false; 552 | 553 | if (!this->pauseMode) 554 | { 555 | //if disconnection request is not from pause 556 | this->VNCIMAGE = QImage(":/new/prefix1/creditimg.png"); 557 | w = this->VNCIMAGE.width(); 558 | h = this->VNCIMAGE.height(); 559 | emit this->rfbResizeSignal(w,h,""); 560 | } 561 | 562 | //if disconnect request from pause. 563 | //then reset the pause 564 | this->pauseMode = false; 565 | 566 | emit this->rfbHostDisconnectedSignal(); 567 | } 568 | 569 | 570 | bool rfbclientcls::performHandshakingProtocol() 571 | { 572 | if (!this->handleVersionProtocol()) 573 | return false; 574 | if (!this->handleSecurityProtocol()) 575 | return false; 576 | if (!this->handleClientInitProtocol()) 577 | return false; 578 | if (!this->handleServerInitProtocol()) 579 | return false; 580 | 581 | return true; 582 | } 583 | 584 | bool rfbclientcls::handleVersionProtocol() 585 | { 586 | unsigned char vncServerData[12]; 587 | QString enc; 588 | 589 | 590 | 591 | qDebug("Handling version protocol"); 592 | //step 1. Get the version protocol from server 593 | 594 | if (this->readFromHost((unsigned char*)vncServerData,12) != 12) 595 | return false; 596 | 597 | enc.clear(); 598 | this->serverMajorVersion = enc.append((QChar)vncServerData[6]).toInt(); 599 | 600 | enc.clear(); 601 | this->serverMinorVersion = enc.append((QChar)vncServerData[10]).toInt(); 602 | 603 | qDebug(" server version %d.%d",serverMajorVersion,serverMinorVersion); 604 | 605 | //client to server 606 | enc.clear(); 607 | this->clientMinorVersion = 0; 608 | if (this->serverMajorVersion >= 3) 609 | { 610 | this->clientMajorVersion = 3; 611 | switch (this->serverMinorVersion) 612 | { 613 | case 3: this->clientMinorVersion = 3; enc.append("RFB 003.003\n");break; 614 | case 7: this->clientMinorVersion = 7; enc.append("RFB 003.007\n");break; 615 | case 8: this->clientMinorVersion = 8; enc.append("RFB 003.008\n");break; 616 | } 617 | } 618 | 619 | if (this->clientMinorVersion == 0) 620 | return false; 621 | 622 | //test 623 | //enc.clear(); 624 | //enc.append("RFB 004.000\n"); 625 | //send data to server 626 | qint32 writers = this->writeToHost((unsigned char*)enc.toStdString().c_str(),12); 627 | 628 | if (writers == 12) 629 | return true; 630 | 631 | return false; 632 | } 633 | 634 | bool rfbclientcls::handleSecurityProtocol() 635 | { 636 | unsigned char vncServerData[20]; 637 | unsigned char vncClientData[10]; 638 | QString enc; 639 | 640 | qDebug("Handling security protocol"); 641 | 642 | //step 1. Get the version protocol from server 643 | 644 | if (this->readFromHost(vncServerData,2) != 2) 645 | return false; 646 | 647 | 648 | qint8 numberOfSecurity = 0; 649 | qint8 securityID = vncServerData[1]; 650 | 651 | numberOfSecurity = vncServerData[0]; 652 | numberOfSecurity = numberOfSecurity; 653 | //get security info 654 | //qDebug() << " number of security " << numberOfSecurity; 655 | //qDebug() << " security id" << securityID; 656 | 657 | switch (securityID) 658 | { 659 | //no security 660 | case 0x01:vncClientData[0] = 0x01;qDebug(" Server requires no security");break; 661 | case 0x02:qDebug(" Requires VNC authentication");break; 662 | default:qDebug(" unknown security id (%d)",vncServerData[1]); 663 | } 664 | 665 | //send to server for security cleareance 666 | qDebug(" requesting no security option"); 667 | if (this->writeToHost((unsigned char*)vncClientData,1) != 1) 668 | return false; 669 | 670 | qDebug(" waiting for security clearence"); 671 | //wait for server acknowledgement 672 | 673 | if (this->readFromHost((unsigned char*)vncServerData,4) != 4) 674 | return false; 675 | 676 | if (enc.fromLocal8Bit((char *)vncServerData,4).toInt() == 0) 677 | { 678 | qDebug(" security pass"); 679 | return true; 680 | } 681 | 682 | qDebug(" Security fail"); 683 | return false; 684 | } 685 | 686 | bool rfbclientcls::handleClientInitProtocol() 687 | { 688 | QString vncClientData; 689 | 690 | 691 | qDebug("Handling Client Init Protocol"); 692 | 693 | 694 | vncClientData.clear(); 695 | vncClientData.append("\x01"); 696 | qDebug(" writing server a share flag"); 697 | if (this->writeToHost((unsigned char*)vncClientData.toStdString().c_str(),1) != 1) 698 | return false; 699 | 700 | return true; 701 | } 702 | 703 | bool rfbclientcls::handleServerInitProtocol() 704 | { 705 | rfbServerInitStruct rfbSID; 706 | unsigned char *serverName = 0; 707 | //unsigned char vncServerData[26]; 708 | 709 | 710 | qDebug("Handling Server Init Protocol"); 711 | 712 | 713 | if (this->readFromHost((unsigned char*)&rfbSID,sizeof(rfbSID)) != sizeof(rfbSID)) 714 | return false; 715 | 716 | rfbSID.fbWidth = swap16(rfbSID.fbWidth); 717 | rfbSID.fbHeight = swap16(rfbSID.fbHeight); 718 | rfbSID.fbPixel.red_max = swap16(rfbSID.fbPixel.red_max); 719 | rfbSID.fbPixel.green_max = swap16(rfbSID.fbPixel.green_max); 720 | rfbSID.fbPixel.blue_max = swap16(rfbSID.fbPixel.blue_max); 721 | rfbSID.fbNameLength = swap32(rfbSID.fbNameLength); 722 | 723 | 724 | //set server frame buffer information 725 | qDebug(" setting server frame buffer information"); 726 | qDebug() << "Height" << rfbSID.fbHeight; 727 | qDebug() << "Width" << rfbSID.fbWidth; 728 | //qDebug() << "pixel" << rfbSID.fbPixel.; 729 | 730 | this->serverFBHeight = rfbSID.fbHeight; 731 | this->serverFBWidth = rfbSID.fbWidth; 732 | this->serverPixelF = rfbSID.fbPixel; 733 | this->serverColorFormat = this->getColorFormat(&this->serverPixelF); 734 | 735 | 736 | //read server name 737 | serverName = (unsigned char*)malloc(rfbSID.fbNameLength+1); 738 | qDebug() << " reading server name for" << rfbSID.fbNameLength; 739 | if (this->readFromHost(serverName,rfbSID.fbNameLength) != rfbSID.fbNameLength) 740 | return false; 741 | serverName[rfbSID.fbNameLength] = 0x00; 742 | this->serverVNCName = QString((char*)serverName).trimmed(); 743 | 744 | //create a new VNC Image; 745 | this->VNCIMAGE = QImage(rfbSID.fbWidth,rfbSID.fbHeight,QImage::Format_RGB888); 746 | this->serverFBHeight = rfbSID.fbHeight; 747 | this->serverFBWidth = rfbSID.fbWidth; 748 | emit this->rfbResizeSignal(rfbSID.fbWidth,rfbSID.fbHeight,this->serverVNCName); 749 | 750 | //this->updateFBGetDesktopSizePseudo(rfbSID.fbWidth,rfbSID.fbHeight); 751 | 752 | qDebug("SERVER NAME IS %s", this->serverVNCName.toStdString().c_str()); 753 | 754 | free (serverName); 755 | 756 | //create vncImage 757 | //qDebug(" Creating new RFB Image QImage RGB888"); 758 | //this->VNCIMAGE = QImage(this->serverFBWidth,this->serverFBHeight,QImage::Format_RGB888); 759 | 760 | //check if serverColorFormat == clientColorFormat 761 | if (this->serverColorFormat != this->clientColorFormat) 762 | { 763 | //set server color format 764 | qDebug(" Resetting server pixel format"); 765 | if(!this->sendClientSetPixelFormat(this->clientPixelF)) 766 | return false; 767 | } 768 | 769 | //encodings 770 | if (!this->sendClientSetEncodings(0)) //raw 771 | return false; 772 | 773 | if (!this->sendClientSetEncodings(-239)) //cursor pseudo 774 | return false; 775 | 776 | if (!this->sendClientSetEncodings(-223)) //desktopsize pseudo 777 | return false; 778 | 779 | 780 | 781 | //qDebug(" emiting resize at %d x %d",rfbSID.fbWidth,rfbSID.fbHeight); 782 | //qDebug("name length is %d",rfbSID.fbNameLength); 783 | //qDebug("server name is %s",QString(vncServerData.mid(24,rfbSID.fbNameLength)).toStdString().c_str()); 784 | 785 | return this->sendClientFrameBufferRequestUpdate(0,0,rfbSID.fbWidth,rfbSID.fbHeight,0); 786 | 787 | return true; 788 | } 789 | 790 | 791 | bool rfbclientcls::sendClientFrameBufferRequestUpdate(int x, int y, int width, int height, int incremental) 792 | { 793 | 794 | unsigned char vncClientData[10]; 795 | char inc = 0x01; 796 | if (incremental == 0) 797 | { 798 | //qDebug("frame request is not incremental"); 799 | inc = 0x00; 800 | } 801 | 802 | vncClientData[0] = 3; 803 | vncClientData[1] = inc; //(incremental) ? 1 : 0; 804 | vncClientData[2] = (x >> 8) & 0xFF; 805 | vncClientData[3] = (x >> 0) & 0xFF; 806 | vncClientData[4] = (y >> 8) & 0xFF; 807 | vncClientData[5] = (y >> 0) & 0xFF; 808 | vncClientData[6] = (width >> 8) & 0xFF; 809 | vncClientData[7] = (width >> 0) & 0xFF; 810 | vncClientData[8] = (height >> 8) & 0xFF; 811 | vncClientData[9] = (height >> 0) & 0xFF; 812 | 813 | 814 | if (this->writeToHost(vncClientData,10) != 10) 815 | { 816 | qDebug(" fail to write request update"); 817 | return false; 818 | } 819 | 820 | qDebug(" success request update"); 821 | return true; 822 | } 823 | 824 | bool rfbclientcls::sendClientSetEncodings(qint32 encID) 825 | { 826 | 827 | SET_ENCODING_STRUCT enc; 828 | qint32 encType; 829 | 830 | 831 | enc.msgType = 2; 832 | enc.padding = 2; 833 | enc.numOfEncodings = 1; //numofencoding in LE 834 | enc.numOfEncodings = swap16(enc.numOfEncodings); //numofencoding in BE 835 | enc.encoding = swap32(encID); 836 | 837 | 838 | 839 | 840 | if (this->writeToHost((unsigned char*)&enc,8) != 8) 841 | { 842 | qDebug(" fail to set encoding"); 843 | return false; 844 | } 845 | 846 | return true; 847 | 848 | //send raw encoding 849 | encType = 0; 850 | encType = swap32(encType); 851 | if (this->writeToHost((unsigned char*)&encType,4) != 4) 852 | { 853 | qDebug(" fail to set encoding"); 854 | return false; 855 | } 856 | 857 | //send desktop resize 858 | encType = -223; 859 | encType = swap32(encType); 860 | if (this->writeToHost((unsigned char*)&encType,4) != 4) 861 | { 862 | qDebug(" fail to set encoding"); 863 | return false; 864 | } 865 | 866 | return true; 867 | 868 | 869 | } 870 | 871 | bool rfbclientcls::sendClientSetPixelFormat(pixelFormatStruct pixel) 872 | { 873 | unsigned char vncClientData[20]; 874 | 875 | vncClientData[0] = 0; //message type 876 | vncClientData[1] = 0x00; 877 | vncClientData[2] = 0x00; 878 | vncClientData[3] = 0x00; 879 | vncClientData[4] = pixel.bpp; 880 | vncClientData[5] = pixel.depth; 881 | vncClientData[6] = pixel.big_endian_flag; 882 | vncClientData[7] = pixel.true_color_flag; 883 | vncClientData[8] = (pixel.red_max >> 8) & 0xFF; 884 | vncClientData[9] = (pixel.red_max >> 0) & 0xFF; 885 | vncClientData[10] = (pixel.green_max >> 8) & 0xFF; 886 | vncClientData[11] = (pixel.green_max >> 0) & 0xFF; 887 | vncClientData[12] = (pixel.blue_max >> 8) & 0xFF; 888 | vncClientData[13] = (pixel.blue_max >> 0) & 0xFF; 889 | vncClientData[14] = pixel.red_shift; 890 | vncClientData[15] = pixel.green_shift; 891 | vncClientData[16] = pixel.blue_shift; 892 | vncClientData[17] = 0x00; 893 | vncClientData[18] = 0x00; 894 | vncClientData[19] = 0x00; 895 | 896 | if (this->writeToHost(vncClientData,20) != 20) 897 | { 898 | qDebug(" fail to set pixel format"); 899 | return false; 900 | } 901 | 902 | return true; 903 | } 904 | 905 | QPixmap rfbclientcls::getVNCPixmap() 906 | { 907 | return QPixmap::fromImage(this->VNCIMAGE); 908 | } 909 | 910 | 911 | quint16 rfbclientcls::swap16(quint16 src) 912 | { 913 | quint16 tgt; 914 | char *tgtX = (char *)&tgt; 915 | char *srcX = (char *)&src; 916 | tgtX[0] = srcX[1]; 917 | tgtX[1] = srcX[0]; 918 | 919 | return tgt; 920 | } 921 | 922 | qint16 rfbclientcls::swap16(qint16 src) 923 | { 924 | qint16 tgt; 925 | char *tgtX = (char *)&tgt; 926 | char *srcX = (char *)&src; 927 | tgtX[0] = srcX[1]; 928 | tgtX[1] = srcX[0]; 929 | 930 | return tgt; 931 | } 932 | 933 | quint32 rfbclientcls::swap32(quint32 src) 934 | { 935 | quint32 tgt; 936 | char *tgtX = (char *)&tgt; 937 | char *srcX = (char *)&src; 938 | 939 | tgtX[0] = srcX[3]; 940 | tgtX[1] = srcX[2]; 941 | tgtX[2] = srcX[1]; 942 | tgtX[3] = srcX[0]; 943 | 944 | return tgt; 945 | } 946 | 947 | qint32 rfbclientcls::swap32(qint32 src) 948 | { 949 | qint32 tgt; 950 | char *tgtX = (char *)&tgt; 951 | char *srcX = (char *)&src; 952 | 953 | tgtX[0] = srcX[3]; 954 | tgtX[1] = srcX[2]; 955 | tgtX[2] = srcX[1]; 956 | tgtX[3] = srcX[0]; 957 | 958 | return tgt; 959 | } 960 | 961 | qint64 rfbclientcls::writeToHost(unsigned char *src, qint64 size) 962 | { 963 | qint64 rs = 0; 964 | 965 | switch (this->socketMode) 966 | { 967 | case 0: 968 | rs = this->vncClientTCP.write((char*)src,size); 969 | if (!this->vncClientTCP.waitForBytesWritten()) 970 | return 0; 971 | break; 972 | 973 | case 1: 974 | rs = this->vncClientIPC.write((char*)src,size); 975 | if (!this->vncClientIPC.waitForBytesWritten()) 976 | return 0; 977 | break; 978 | } 979 | 980 | return rs; 981 | } 982 | 983 | qint64 rfbclientcls::writeToHostNonBlock(unsigned char *src, qint64 size) 984 | { 985 | 986 | qint64 rs = 0; 987 | 988 | switch (this->socketMode) 989 | { 990 | case 0: 991 | if (this->vncClientTCP.state() == QTcpSocket::ConnectedState) 992 | rs = this->vncClientTCP.write((char*)src,size); 993 | break; 994 | 995 | case 1: 996 | if (this->vncClientIPC.state() == QLocalSocket::ConnectedState) 997 | rs = this->vncClientIPC.write((char*)src,size); 998 | break; 999 | } 1000 | 1001 | return rs; 1002 | 1003 | } 1004 | 1005 | qint64 rfbclientcls::readFromHost(unsigned char *tgt, qint64 size) 1006 | { 1007 | 1008 | switch (this->socketMode){ 1009 | 1010 | case 0: 1011 | if (this->vncClientTCP.state() == QTcpSocket::ConnectedState) 1012 | { 1013 | while(1){ 1014 | 1015 | QCoreApplication::processEvents(); 1016 | if (this->vncClientTCP.bytesAvailable() == 0) 1017 | this->vncClientTCP.waitForReadyRead(); // wait for data to arrive 1018 | 1019 | if (this->vncClientTCP.bytesAvailable() >= size){ 1020 | return this->vncClientTCP.read((char*)tgt,size); 1021 | } 1022 | } 1023 | } 1024 | break; 1025 | 1026 | case 1: 1027 | if (this->vncClientIPC.state() == QLocalSocket::ConnectedState) 1028 | { 1029 | while(1){ 1030 | 1031 | QCoreApplication::processEvents(); 1032 | if (this->vncClientIPC.bytesAvailable() == 0) 1033 | this->vncClientIPC.waitForReadyRead(); // wait for data to arrive 1034 | 1035 | if (this->vncClientIPC.bytesAvailable() >= size){ 1036 | return this->vncClientIPC.read((char*)tgt,size); 1037 | } 1038 | } 1039 | } 1040 | break; 1041 | } 1042 | 1043 | return 0; // disconnected state 1044 | 1045 | 1046 | 1047 | /*switch (this->socketMode) 1048 | { 1049 | case 0: 1050 | if (this->vncClientTCP.state() == QTcpSocket::ConnectedState) 1051 | { 1052 | bSize = this->vncClientTCP.bytesAvailable(); 1053 | } 1054 | else 1055 | bSize = 0; 1056 | break; 1057 | 1058 | case 1: 1059 | if (this->vncClientIPC.state() == QLocalSocket::ConnectedState) 1060 | bSize = this->vncClientIPC.bytesAvailable(); 1061 | else 1062 | bSize = 0; 1063 | break; 1064 | } 1065 | 1066 | if (!wait) 1067 | { 1068 | if ((bSize == 0) || size > bSize) 1069 | { 1070 | return 0; //no data 1071 | } 1072 | 1073 | } 1074 | 1075 | //socket will wait until data arrived; 1076 | //if there is data 1077 | while(1) 1078 | { 1079 | QCoreApplication::processEvents(); 1080 | switch (this->socketMode) 1081 | { 1082 | case 0: 1083 | if (this->vncClientTCP.state() == QTcpSocket::ConnectedState) 1084 | bSize = this->vncClientTCP.bytesAvailable(); 1085 | else 1086 | bSize = 0; 1087 | break; 1088 | 1089 | case 1: 1090 | if (this->vncClientIPC.state() == QLocalSocket::ConnectedState) 1091 | bSize = this->vncClientIPC.bytesAvailable(); 1092 | else 1093 | bSize = 0; 1094 | break; 1095 | } 1096 | if (bSize >=size) 1097 | break; 1098 | } 1099 | 1100 | switch (this->socketMode) 1101 | { 1102 | case 0: 1103 | if (this->vncClientIPC.state() == QLocalSocket::ConnectedState) 1104 | this->vncClientTCP.read((char*)tgt,size); 1105 | else 1106 | bSize = 0; 1107 | break; 1108 | 1109 | case 1: 1110 | if (this->vncClientIPC.state() == QLocalSocket::ConnectedState) 1111 | this->vncClientIPC.read((char*)tgt,size); 1112 | else 1113 | bSize = 0; 1114 | break; 1115 | } 1116 | 1117 | return size;*/ 1118 | 1119 | } 1120 | 1121 | 1122 | void rfbclientcls::sendServerPointerEvent(quint16 x, quint16 y, quint8 buttonMask) 1123 | { 1124 | this->sendClientPointerEvent(x,y,buttonMask); 1125 | } 1126 | 1127 | void rfbclientcls::sendClientPointerEvent(quint16 x, quint16 y, quint8 buttonMask) 1128 | { 1129 | SENT_POINTER_EVENT pointer; 1130 | 1131 | if (!this->serverConnected) 1132 | return; 1133 | 1134 | pointer.msgType = 0x05; 1135 | pointer.x = swap16(x); 1136 | pointer.y = swap16(y); 1137 | pointer.buttonMask = buttonMask; 1138 | 1139 | this->writeToHostNonBlock((unsigned char*)&pointer,6); 1140 | //this->writeToHost((unsigned char*)&pointer,6); 1141 | 1142 | } 1143 | 1144 | void rfbclientcls::sendServerKeyEvent(quint32 pKey, quint8 press, bool modifier) 1145 | { 1146 | this->sendClientKeyEvent(pKey,press,modifier); 1147 | } 1148 | 1149 | void rfbclientcls::sendClientKeyEvent(quint32 pKey, quint8 press, bool modifier) 1150 | { 1151 | SENT_KEY_EVENT clientKey; 1152 | 1153 | if (!this->serverConnected) 1154 | return; 1155 | 1156 | clientKey.msgType = 0x04; 1157 | clientKey.padding = 0; 1158 | clientKey.press = press; 1159 | 1160 | clientKey.keyValue = this->translateRfbKey(pKey,modifier); 1161 | clientKey.keyValue = swap32(clientKey.keyValue); 1162 | 1163 | this->writeToHostNonBlock((unsigned char*)&clientKey,8); 1164 | } 1165 | 1166 | quint32 rfbclientcls::translateRfbKey(quint32 inkey,bool modifier) 1167 | { 1168 | quint32 k = 5000; 1169 | 1170 | switch (inkey) 1171 | { 1172 | 1173 | case Qt::Key_Backspace: k = XK_BackSpace; break; 1174 | case Qt::Key_Tab: k = XK_Tab;break; 1175 | case Qt::Key_Clear: k = XK_Clear; break; 1176 | case Qt::Key_Return: k = XK_Return; break; 1177 | case Qt::Key_Pause: k = XK_Pause; break; 1178 | case Qt::Key_Escape: k = XK_Escape; break; 1179 | case Qt::Key_Space: k = XK_space; break; 1180 | case Qt::Key_Delete: k = XK_Delete; break; 1181 | case Qt::Key_Period: k = XK_period; break; 1182 | 1183 | //special keyboard char 1184 | case Qt::Key_Exclam: k = XK_exclam;break; //! 1185 | case Qt::Key_QuoteDbl: k = XK_quotedbl;break; //? 1186 | case Qt::Key_NumberSign: k = XK_numbersign;break; //# 1187 | case Qt::Key_Percent: k = XK_percent;break; //% 1188 | case Qt::Key_Dollar: k = XK_dollar;break; //$ 1189 | case Qt::Key_Ampersand: k = XK_ampersand;break; //& 1190 | case Qt::Key_Apostrophe: k = XK_apostrophe;break;//! 1191 | case Qt::Key_ParenLeft: k = XK_parenleft;break; 1192 | case Qt::Key_ParenRight: k = XK_parenright;break; 1193 | 1194 | case Qt::Key_Slash: k = XK_slash; break; /// 1195 | case Qt::Key_Asterisk: k = XK_asterisk; break; //* 1196 | case Qt::Key_Minus: k = XK_minus; break; //- 1197 | case Qt::Key_Plus: k = XK_plus; break; //+ 1198 | case Qt::Key_Enter: k = XK_Return; break; // 1199 | case Qt::Key_Equal: k = XK_equal; break; //= 1200 | 1201 | case Qt::Key_Colon: k = XK_colon;break; 1202 | case Qt::Key_Semicolon: k = XK_semicolon; break; 1203 | case Qt::Key_Greater: k = XK_greater; break; 1204 | case Qt::Key_Question: k = XK_question; break; 1205 | case Qt::Key_At: k = XK_at; break; 1206 | 1207 | case Qt::Key_BracketLeft: k = XK_bracketleft; break; 1208 | case Qt::Key_Backslash: k = XK_backslash;break; 1209 | case Qt::Key_BracketRight: k = XK_bracketright;break; 1210 | case Qt::Key_AsciiCircum: k = XK_asciicircum;break; 1211 | case Qt::Key_Underscore: k = XK_underscore;break; 1212 | case Qt::Key_QuoteLeft: k = XK_quoteleft;break; 1213 | case Qt::Key_BraceLeft: k = XK_braceleft;break; 1214 | case Qt::Key_Bar: k = XK_bar; break; 1215 | case Qt::Key_BraceRight: k = XK_braceright;break; 1216 | case Qt::Key_AsciiTilde: k = XK_asciitilde;break; 1217 | case Qt::Key_nobreakspace: k = XK_nobreakspace;break; 1218 | case Qt::Key_exclamdown: k = XK_exclamdown;break; 1219 | case Qt::Key_cent: k = XK_cent;break; 1220 | case Qt::Key_sterling: k = XK_sterling;break; 1221 | case Qt::Key_currency: k = XK_currency;break; 1222 | case Qt::Key_yen: k = XK_yen;break; 1223 | case Qt::Key_brokenbar: k = XK_brokenbar;break; 1224 | case Qt::Key_section: k = XK_section;break; 1225 | case Qt::Key_diaeresis: k = XK_diaeresis;break; 1226 | case Qt::Key_copyright: k = XK_copyright; break; 1227 | case Qt::Key_ordfeminine: k = XK_ordfeminine; break; 1228 | case Qt::Key_guillemotleft: k = XK_guillemotleft; break; 1229 | case Qt::Key_guillemotright: k = XK_guillemotright; break; 1230 | case Qt::Key_notsign: k = XK_notsign; break; 1231 | case Qt::Key_hyphen: k = XK_hyphen; break; 1232 | case Qt::Key_registered: k = XK_registered; break; 1233 | 1234 | case Qt::Key_Up: k = XK_Up; break; 1235 | case Qt::Key_Down: k = XK_Down; break; 1236 | case Qt::Key_Right: k = XK_Right; break; 1237 | case Qt::Key_Left: k = XK_Left; break; 1238 | case Qt::Key_Insert: k = XK_Insert; break; 1239 | case Qt::Key_Home: k = XK_Home; break; 1240 | case Qt::Key_End: k = XK_End; break; 1241 | case Qt::Key_PageUp: k = XK_Page_Up; break; 1242 | case Qt::Key_PageDown: k = XK_Page_Down; break; 1243 | case Qt::Key_F1: k = XK_F1; break; 1244 | case Qt::Key_F2: k = XK_F2; break; 1245 | case Qt::Key_F3: k = XK_F3; break; 1246 | case Qt::Key_F4: k = XK_F4; break; 1247 | case Qt::Key_F5: k = XK_F5; break; 1248 | case Qt::Key_F6: k = XK_F6; break; 1249 | case Qt::Key_F7: k = XK_F7; break; 1250 | case Qt::Key_F8: k = XK_F8; break; 1251 | case Qt::Key_F9: k = XK_F9; break; 1252 | case Qt::Key_F10: k = XK_F10; break; 1253 | case Qt::Key_F11: k = XK_F11; break; 1254 | case Qt::Key_F12: k = XK_F12; break; 1255 | case Qt::Key_F13: k = XK_F13; break; 1256 | case Qt::Key_F14: k = XK_F14; break; 1257 | case Qt::Key_F15: k = XK_F15; break; 1258 | case Qt::Key_F16: k = XK_F16; break; 1259 | case Qt::Key_F17: k = XK_F17; break; 1260 | case Qt::Key_F18: k = XK_F18; break; 1261 | case Qt::Key_F19: k = XK_F19; break; 1262 | case Qt::Key_F20: k = XK_F20; break; 1263 | case Qt::Key_F21: k = XK_F21; break; 1264 | case Qt::Key_F22: k = XK_F22; break; 1265 | case Qt::Key_F23: k = XK_F23; break; 1266 | case Qt::Key_F24: k = XK_F24; break; 1267 | case Qt::Key_F25: k = XK_F25; break; 1268 | case Qt::Key_F26: k = XK_F26; break; 1269 | case Qt::Key_F27: k = XK_F27; break; 1270 | case Qt::Key_F28: k = XK_F28; break; 1271 | case Qt::Key_F29: k = XK_F29; break; 1272 | case Qt::Key_F30: k = XK_F30; break; 1273 | case Qt::Key_F31: k = XK_F31; break; 1274 | case Qt::Key_F32: k = XK_F32; break; 1275 | case Qt::Key_F33: k = XK_F33; break; 1276 | case Qt::Key_F34: k = XK_F34; break; 1277 | case Qt::Key_F35: k = XK_F35; break; 1278 | case Qt::Key_NumLock: k = XK_Num_Lock; break; 1279 | case Qt::Key_CapsLock: k = XK_Caps_Lock; break; 1280 | case Qt::Key_ScrollLock: k = XK_Scroll_Lock; break; 1281 | case Qt::Key_Shift: k = XK_Shift_R; break; //k = XK_Shift_L; break; 1282 | case Qt::Key_Control: k = XK_Control_R; break;// k = XK_Control_L; break; 1283 | case Qt::Key_Alt: k = XK_Alt_R; break;//k = XK_Alt_L; break; 1284 | case Qt::Key_Meta: k = XK_Meta_R; break;//k = XK_Meta_L; break;*/ 1285 | 1286 | case Qt::Key_Super_L: k = XK_Super_L; break; /* left "windows" key */ 1287 | case Qt::Key_Super_R: k = XK_Super_R; break; /* right "windows" key */ 1288 | 1289 | case Qt::Key_Mode_switch: k = XK_Mode_switch; break; 1290 | case Qt::Key_Help: k = XK_Help; break; 1291 | case Qt::Key_Print: k = XK_Print; break; 1292 | case Qt::Key_SysReq: k = XK_Sys_Req; break; 1293 | case Qt::Key_0: k = XK_0;break; 1294 | case Qt::Key_1: k = XK_1;break; 1295 | case Qt::Key_2: k = XK_2;break; 1296 | case Qt::Key_3: k = XK_3;break; 1297 | case Qt::Key_4: k = XK_4;break; 1298 | case Qt::Key_5: k = XK_5;break; 1299 | case Qt::Key_6: k = XK_6;break; 1300 | case Qt::Key_7: k = XK_7;break; 1301 | case Qt::Key_8: k = XK_8;break; 1302 | case Qt::Key_9: k = XK_9;break; 1303 | } 1304 | 1305 | if (k == 5000) 1306 | { 1307 | 1308 | if (!modifier) 1309 | { 1310 | switch (inkey) 1311 | { 1312 | case Qt::Key_A: k = XK_a;break; 1313 | case Qt::Key_B: k = XK_b;break; 1314 | case Qt::Key_C: k = XK_c;break; 1315 | case Qt::Key_D: k = XK_d;break; 1316 | case Qt::Key_E: k = XK_e;break; 1317 | case Qt::Key_F: k = XK_f;break; 1318 | case Qt::Key_G: k = XK_g;break; 1319 | case Qt::Key_H: k = XK_h;break; 1320 | case Qt::Key_I: k = XK_i;break; 1321 | case Qt::Key_J: k = XK_j;break; 1322 | case Qt::Key_K: k = XK_k;break; 1323 | case Qt::Key_L: k = XK_l;break; 1324 | case Qt::Key_M: k = XK_m;break; 1325 | case Qt::Key_N: k = XK_n;break; 1326 | case Qt::Key_O: k = XK_o;break; 1327 | case Qt::Key_P: k = XK_p;break; 1328 | case Qt::Key_Q: k = XK_q;break; 1329 | case Qt::Key_R: k = XK_r;break; 1330 | case Qt::Key_S: k = XK_s;break; 1331 | case Qt::Key_T: k = XK_t;break; 1332 | case Qt::Key_U: k = XK_u;break; 1333 | case Qt::Key_V: k = XK_v;break; 1334 | case Qt::Key_W: k = XK_w;break; 1335 | case Qt::Key_X: k = XK_x;break; 1336 | case Qt::Key_Y: k = XK_y;break; 1337 | case Qt::Key_Z: k = XK_z;break; 1338 | } 1339 | } 1340 | else 1341 | { 1342 | switch (inkey) 1343 | { 1344 | case Qt::Key_A: k = XK_A;break; 1345 | case Qt::Key_B: k = XK_B;break; 1346 | case Qt::Key_C: k = XK_C;break; 1347 | case Qt::Key_D: k = XK_D;break; 1348 | case Qt::Key_E: k = XK_E;break; 1349 | case Qt::Key_F: k = XK_F;break; 1350 | case Qt::Key_G: k = XK_G;break; 1351 | case Qt::Key_H: k = XK_H;break; 1352 | case Qt::Key_I: k = XK_I;break; 1353 | case Qt::Key_J: k = XK_J;break; 1354 | case Qt::Key_K: k = XK_K;break; 1355 | case Qt::Key_L: k = XK_L;break; 1356 | case Qt::Key_M: k = XK_M;break; 1357 | case Qt::Key_N: k = XK_N;break; 1358 | case Qt::Key_O: k = XK_O;break; 1359 | case Qt::Key_P: k = XK_P;break; 1360 | case Qt::Key_Q: k = XK_Q;break; 1361 | case Qt::Key_R: k = XK_R;break; 1362 | case Qt::Key_S: k = XK_S;break; 1363 | case Qt::Key_T: k = XK_T;break; 1364 | case Qt::Key_U: k = XK_U;break; 1365 | case Qt::Key_V: k = XK_V;break; 1366 | case Qt::Key_W: k = XK_W;break; 1367 | case Qt::Key_X: k = XK_X;break; 1368 | case Qt::Key_Y: k = XK_Y;break; 1369 | case Qt::Key_Z: k = XK_Z;break; 1370 | } 1371 | } 1372 | } 1373 | 1374 | return k; 1375 | 1376 | } 1377 | 1378 | void rfbclientcls::vncIPCSockErrorSlot(QLocalSocket::LocalSocketError) 1379 | { 1380 | 1381 | //QMessageBox::critical(0,"RFB Error",this->vncClientIPC->errorString()); 1382 | this->vncClientIPC.abort(); 1383 | } 1384 | 1385 | void rfbclientcls::vncTCPSockErrorSlot(QAbstractSocket::SocketError) 1386 | { 1387 | //QMessageBox::critical(0,"RFB Error",this->vncClientTCP->errorString()); 1388 | this->vncClientTCP.abort(); 1389 | } 1390 | 1391 | -------------------------------------------------------------------------------- /rfbclientcls.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Azril Azam 3 | * 4 | * 5 | * Desc 6 | * 7 | * This file is a part of the 100% Qt5 VNC RFB-CLIENT implementation without 8 | * using any 3rd party rfb library 9 | * 10 | * rfbclientcls.h defines all constant and operations that are required to communicate 11 | * with RFB protocol server 12 | * 13 | * Qt5 RFB-CLIENT is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU Lesser General Public License as 15 | * published by the Free Software Foundation, either version 3 of the License, 16 | * or (at your option) any later version. 17 | * 18 | * Qt5 RFB-CLIENT is distributed in the hope that it will be useful, 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | * GNU Lesser General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU Lesser General Public License 24 | * along with Qt HTML platform plugin. If not, see 25 | * . 26 | */ 27 | 28 | 29 | #ifndef RFBCLIENTCLS_H 30 | #define RFBCLIENTCLS_H 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | 44 | struct PIXEL_FORMAT_STRUCT 45 | { 46 | quint8 bpp; //bits per pixel 47 | quint8 depth; 48 | quint8 big_endian_flag; 49 | quint8 true_color_flag; 50 | quint16 red_max; 51 | quint16 green_max; 52 | quint16 blue_max; 53 | quint8 red_shift; 54 | quint8 green_shift; 55 | quint8 blue_shift; 56 | quint8 padding[3]; 57 | }; 58 | 59 | struct SET_PIXEL_STRUCT 60 | { 61 | quint8 msgType; 62 | quint8 padding[3]; 63 | PIXEL_FORMAT_STRUCT pixelFormat; 64 | }; 65 | 66 | struct SET_ENCODING_STRUCT 67 | { 68 | quint8 msgType; 69 | quint8 padding; 70 | quint16 numOfEncodings; 71 | qint32 encoding; 72 | }; 73 | 74 | struct RFB_RECTS_HEADER_STRUCT 75 | { 76 | unsigned char padding; 77 | quint16 numOfRectangles; 78 | }; 79 | 80 | struct rfbRectHeader 81 | { 82 | quint16 x; 83 | quint16 y; 84 | quint16 width; 85 | quint16 height; 86 | qint32 encoding; 87 | }; 88 | 89 | struct rfbEncodingStruct 90 | { 91 | quint8 msgType; 92 | quint8 padding; 93 | quint16 numOfEncodings; 94 | qint32 enc1; 95 | //qint32 enc2; 96 | }; 97 | 98 | struct pixelFormatStruct 99 | { 100 | quint8 bpp; //bits per pixel 101 | quint8 depth; 102 | quint8 big_endian_flag; 103 | quint8 true_color_flag; 104 | quint16 red_max; 105 | quint16 green_max; 106 | quint16 blue_max; 107 | quint8 red_shift; 108 | quint8 green_shift; 109 | quint8 blue_shift; 110 | quint8 padding[3]; 111 | }; 112 | 113 | struct rfbServerInitStruct 114 | { 115 | quint16 fbWidth; 116 | quint16 fbHeight; 117 | pixelFormatStruct fbPixel; 118 | quint32 fbNameLength; 119 | }; 120 | 121 | struct SENT_KEY_EVENT 122 | { 123 | quint8 msgType; 124 | quint8 press; 125 | quint16 padding; 126 | quint32 keyValue; 127 | }; 128 | 129 | struct SENT_POINTER_EVENT 130 | { 131 | quint8 msgType; 132 | quint8 buttonMask; 133 | quint16 x; 134 | quint16 y; 135 | }; 136 | 137 | 138 | #define COLOR_CONV_NONE 0 139 | #define COLOR_CONV_RGB565_RGB888 1 140 | 141 | #define PIXEL_FORMAT_NONE 0 142 | #define PIXEL_FORMAT_RGB_888 1 143 | #define PIXEL_FORMAT_RGB_565 2 144 | #define PIXEL_FORMAT_RGB_555 3 145 | #define PIXEL_FORMAT_RGB_16_Bit 4 146 | #define PIXEL_FORMAT_RGB_32_Bit 5 147 | 148 | 149 | class rfbclientcls : public QObject 150 | { 151 | Q_OBJECT 152 | public: 153 | explicit rfbclientcls (QObject *parent = 0); 154 | ~rfbclientcls(); 155 | 156 | bool connectToHostTCP(QString server, qint16 port=5900); 157 | bool connectToHostIPC(QString server); 158 | void disconnectFromHost(); 159 | bool performHandshakingProtocol(); 160 | void sendServerPointerEvent(quint16 x, quint16 y, quint8 buttonMask); 161 | void sendServerKeyEvent(quint32 pKey, quint8 press, bool modifier); 162 | 163 | bool pauseRFB(); 164 | bool resumeRFB(); 165 | //void close(); 166 | 167 | QImage pauseResumeImg; 168 | QImage VNCIMAGE; 169 | QImage getVNCImage(); 170 | QPixmap getVNCPixmap(); 171 | 172 | 173 | private: 174 | 175 | bool connectToHost(QString server, qint16 port); 176 | QTcpSocket vncClientTCP; 177 | QLocalSocket vncClientIPC; 178 | 179 | QTimer opsThreadTimer; 180 | 181 | quint16 swap16(quint16 src); 182 | qint16 swap16(qint16 src); 183 | quint32 swap32(quint32 src); 184 | qint32 swap32(qint32 src); 185 | 186 | qint64 writeToHost(unsigned char*src,qint64 size); 187 | qint64 writeToHostNonBlock(unsigned char*src,qint64 size); 188 | qint64 readFromHost (unsigned char *tgt, qint64 size); 189 | quint8 socketMode; 190 | 191 | 192 | bool handleVersionProtocol(); 193 | bool handleSecurityProtocol(); 194 | bool handleClientInitProtocol(); 195 | bool handleServerInitProtocol(); 196 | 197 | //client to server 198 | bool sendClientSetPixelFormat(pixelFormatStruct pixel); 199 | bool sendClientSetEncodings(qint32 encID); 200 | bool sendClientFrameBufferRequestUpdate(int x, int y, int width, int height, int incremental); 201 | 202 | void sendClientKeyEvent(quint32 pKey, quint8 press, bool modifier); 203 | quint32 translateRfbKey(quint32 inkey,bool modifier); 204 | 205 | void sendClientPointerEvent(quint16 x, quint16 y, quint8 buttonMask); 206 | bool sendClientCutText(); 207 | 208 | void newUpdateRFBFB(); 209 | 210 | //new procedure 211 | void processRFBOperationProtocol(); 212 | void getRFBOpsType(); 213 | //void updateFBGetPadding(); 214 | //void updateFBGetNumOfRect(); 215 | //void updateFBGetRectEncoding(); 216 | //void updateFBGetRectRawEncoding(); 217 | //void updateFBGetPixelData(); 218 | //void updateFBGetDesktopSizePseudo(quint16 w, quint16 h); 219 | //void updateFBGetCursorPseudo(); 220 | quint64 readFromRFBServer(unsigned char *data, quint64 size); 221 | 222 | //rfbRectHeader gRFBRH; 223 | //quint16 gTotalRects, gCurrentRect; 224 | //quint64 gTotalPixelSize; 225 | 226 | //quint8 RFBOpsStage; 227 | //QByteArray STREAMBUFFER; 228 | 229 | 230 | qint32 getColorFormat(pixelFormatStruct *pixel); 231 | 232 | qint16 serverMajorVersion; 233 | qint16 serverMinorVersion; 234 | qint16 clientMajorVersion; 235 | qint16 clientMinorVersion; 236 | 237 | pixelFormatStruct clientPixelF; 238 | pixelFormatStruct serverPixelF; 239 | 240 | qint32 clientColorFormat; 241 | qint32 serverColorFormat; 242 | 243 | quint16 serverFBWidth; 244 | quint16 serverFBHeight; 245 | QString serverVNCName; 246 | QString serverName; 247 | qint16 serverPort; 248 | 249 | bool serverConnected; 250 | bool pauseMode; 251 | bool xEmitDisconnecSignal; 252 | 253 | 254 | signals: 255 | void rfbResizeSignal(qint16 width, qint16 height,QString serverName); 256 | void rfbPauseSignal(); 257 | //void rfbCursorPositionSignal (qint32 x, qint32 y); 258 | void rfbFrameBufferUpdateSignal(); 259 | void rfbHostConnectedSignal(); 260 | void rfbHostDisconnectedSignal(); 261 | 262 | public slots: 263 | 264 | private slots: 265 | void vncSockDisconnectedSlot(); 266 | void vncTCPSockErrorSlot(QAbstractSocket::SocketError); 267 | void vncIPCSockErrorSlot(QLocalSocket::LocalSocketError); 268 | void opsThreadTimerTimeOutSlot(); 269 | }; 270 | 271 | 272 | 273 | #ifndef XK_0 274 | 275 | /* $XConsortium: keysym.h,v 1.15 94/04/17 20:10:55 rws Exp $ */ 276 | 277 | /*********************************************************** 278 | 279 | Copyright (c) 1987 X Consortium 280 | 281 | Permission is hereby granted, free of charge, to any person obtaining a copy 282 | of this software and associated documentation files (the "Software"), to deal 283 | in the Software without restriction, including without limitation the rights 284 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 285 | copies of the Software, and to permit persons to whom the Software is 286 | furnished to do so, subject to the following conditions: 287 | 288 | The above copyright notice and this permission notice shall be included in 289 | all copies or substantial portions of the Software. 290 | 291 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 292 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 293 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 294 | X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 295 | AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 296 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 297 | 298 | Except as contained in this notice, the name of the X Consortium shall not be 299 | used in advertising or otherwise to promote the sale, use or other dealings 300 | in this Software without prior written authorization from the X Consortium. 301 | 302 | 303 | Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. 304 | 305 | All Rights Reserved 306 | 307 | Permission to use, copy, modify, and distribute this software and its 308 | documentation for any purpose and without fee is hereby granted, 309 | provided that the above copyright notice appear in all copies and that 310 | both that copyright notice and this permission notice appear in 311 | supporting documentation, and that the name of Digital not be 312 | used in advertising or publicity pertaining to distribution of the 313 | software without specific, written prior permission. 314 | 315 | DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 316 | ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 317 | DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 318 | ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 319 | WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 320 | ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 321 | SOFTWARE. 322 | 323 | ******************************************************************/ 324 | 325 | /* default keysyms */ 326 | #define XK_MISCELLANY 327 | #define XK_XKB_KEYS 328 | #define XK_LATIN1 329 | #define XK_LATIN2 330 | #define XK_LATIN3 331 | #define XK_LATIN4 332 | #define XK_GREEK 333 | 334 | /* $TOG: keysymdef.h /main/25 1997/06/21 10:54:51 kaleb $ */ 335 | 336 | /*********************************************************** 337 | Copyright (c) 1987, 1994 X Consortium 338 | 339 | Permission is hereby granted, free of charge, to any person obtaining 340 | a copy of this software and associated documentation files (the 341 | "Software"), to deal in the Software without restriction, including 342 | without limitation the rights to use, copy, modify, merge, publish, 343 | distribute, sublicense, and/or sell copies of the Software, and to 344 | permit persons to whom the Software is furnished to do so, subject to 345 | the following conditions: 346 | 347 | The above copyright notice and this permission notice shall be included 348 | in all copies or substantial portions of the Software. 349 | 350 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 351 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 352 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 353 | IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR 354 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 355 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 356 | OTHER DEALINGS IN THE SOFTWARE. 357 | 358 | Except as contained in this notice, the name of the X Consortium shall 359 | not be used in advertising or otherwise to promote the sale, use or 360 | other dealings in this Software without prior written authorization 361 | from the X Consortium. 362 | 363 | 364 | Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts 365 | 366 | All Rights Reserved 367 | 368 | Permission to use, copy, modify, and distribute this software and its 369 | documentation for any purpose and without fee is hereby granted, 370 | provided that the above copyright notice appear in all copies and that 371 | both that copyright notice and this permission notice appear in 372 | supporting documentation, and that the name of Digital not be 373 | used in advertising or publicity pertaining to distribution of the 374 | software without specific, written prior permission. 375 | 376 | DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 377 | ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 378 | DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 379 | ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 380 | WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 381 | ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 382 | SOFTWARE. 383 | 384 | ******************************************************************/ 385 | 386 | #define XK_VoidSymbol 0xFFFFFF /* void symbol */ 387 | 388 | #ifdef XK_MISCELLANY 389 | /* 390 | * TTY Functions, cleverly chosen to map to ascii, for convenience of 391 | * programming, but could have been arbitrary (at the cost of lookup 392 | * tables in client code. 393 | */ 394 | 395 | #define XK_BackSpace 0xFF08 /* back space, back char */ 396 | #define XK_Tab 0xFF09 397 | #define XK_Linefeed 0xFF0A /* Linefeed, LF */ 398 | #define XK_Clear 0xFF0B 399 | #define XK_Return 0xFF0D /* Return, enter */ 400 | #define XK_Pause 0xFF13 /* Pause, hold */ 401 | #define XK_Scroll_Lock 0xFF14 402 | #define XK_Sys_Req 0xFF15 403 | #define XK_Escape 0xFF1B 404 | #define XK_Delete 0xFFFF /* Delete, rubout */ 405 | 406 | 407 | 408 | /* International & multi-key character composition */ 409 | 410 | #define XK_Multi_key 0xFF20 /* Multi-key character compose */ 411 | #define XK_SingleCandidate 0xFF3C 412 | #define XK_MultipleCandidate 0xFF3D 413 | #define XK_PreviousCandidate 0xFF3E 414 | 415 | /* Japanese keyboard support */ 416 | 417 | #define XK_Kanji 0xFF21 /* Kanji, Kanji convert */ 418 | #define XK_Muhenkan 0xFF22 /* Cancel Conversion */ 419 | #define XK_Henkan_Mode 0xFF23 /* Start/Stop Conversion */ 420 | #define XK_Henkan 0xFF23 /* Alias for Henkan_Mode */ 421 | #define XK_Romaji 0xFF24 /* to Romaji */ 422 | #define XK_Hiragana 0xFF25 /* to Hiragana */ 423 | #define XK_Katakana 0xFF26 /* to Katakana */ 424 | #define XK_Hiragana_Katakana 0xFF27 /* Hiragana/Katakana toggle */ 425 | #define XK_Zenkaku 0xFF28 /* to Zenkaku */ 426 | #define XK_Hankaku 0xFF29 /* to Hankaku */ 427 | #define XK_Zenkaku_Hankaku 0xFF2A /* Zenkaku/Hankaku toggle */ 428 | #define XK_Touroku 0xFF2B /* Add to Dictionary */ 429 | #define XK_Massyo 0xFF2C /* Delete from Dictionary */ 430 | #define XK_Kana_Lock 0xFF2D /* Kana Lock */ 431 | #define XK_Kana_Shift 0xFF2E /* Kana Shift */ 432 | #define XK_Eisu_Shift 0xFF2F /* Alphanumeric Shift */ 433 | #define XK_Eisu_toggle 0xFF30 /* Alphanumeric toggle */ 434 | #define XK_Zen_Koho 0xFF3D /* Multiple/All Candidate(s) */ 435 | #define XK_Mae_Koho 0xFF3E /* Previous Candidate */ 436 | 437 | /* 0xFF31 thru 0xFF3F are under XK_KOREAN */ 438 | 439 | /* Cursor control & motion */ 440 | 441 | #define XK_Home 0xFF50 442 | #define XK_Left 0xFF51 /* Move left, left arrow */ 443 | #define XK_Up 0xFF52 /* Move up, up arrow */ 444 | #define XK_Right 0xFF53 /* Move right, right arrow */ 445 | #define XK_Down 0xFF54 /* Move down, down arrow */ 446 | #define XK_Prior 0xFF55 /* Prior, previous */ 447 | #define XK_Page_Up 0xFF55 448 | #define XK_Next 0xFF56 /* Next */ 449 | #define XK_Page_Down 0xFF56 450 | #define XK_End 0xFF57 /* EOL */ 451 | #define XK_Begin 0xFF58 /* BOL */ 452 | 453 | 454 | /* Misc Functions */ 455 | 456 | #define XK_Select 0xFF60 /* Select, mark */ 457 | #define XK_Print 0xFF61 458 | #define XK_Execute 0xFF62 /* Execute, run, do */ 459 | #define XK_Insert 0xFF63 /* Insert, insert here */ 460 | #define XK_Undo 0xFF65 /* Undo, oops */ 461 | #define XK_Redo 0xFF66 /* redo, again */ 462 | #define XK_Menu 0xFF67 463 | #define XK_Find 0xFF68 /* Find, search */ 464 | #define XK_Cancel 0xFF69 /* Cancel, stop, abort, exit */ 465 | #define XK_Help 0xFF6A /* Help */ 466 | #define XK_Break 0xFF6B 467 | #define XK_Mode_switch 0xFF7E /* Character set switch */ 468 | #define XK_script_switch 0xFF7E /* Alias for mode_switch */ 469 | #define XK_Num_Lock 0xFF7F 470 | 471 | /* Keypad Functions, keypad numbers cleverly chosen to map to ascii */ 472 | 473 | #define XK_KP_Space 0xFF80 /* space */ 474 | #define XK_KP_Tab 0xFF89 475 | #define XK_KP_Enter 0xFF8D /* enter */ 476 | #define XK_KP_F1 0xFF91 /* PF1, KP_A, ... */ 477 | #define XK_KP_F2 0xFF92 478 | #define XK_KP_F3 0xFF93 479 | #define XK_KP_F4 0xFF94 480 | #define XK_KP_Home 0xFF95 481 | #define XK_KP_Left 0xFF96 482 | #define XK_KP_Up 0xFF97 483 | #define XK_KP_Right 0xFF98 484 | #define XK_KP_Down 0xFF99 485 | #define XK_KP_Prior 0xFF9A 486 | #define XK_KP_Page_Up 0xFF9A 487 | #define XK_KP_Next 0xFF9B 488 | #define XK_KP_Page_Down 0xFF9B 489 | #define XK_KP_End 0xFF9C 490 | #define XK_KP_Begin 0xFF9D 491 | #define XK_KP_Insert 0xFF9E 492 | #define XK_KP_Delete 0xFF9F 493 | #define XK_KP_Equal 0xFFBD /* equals */ 494 | #define XK_KP_Multiply 0xFFAA 495 | #define XK_KP_Add 0xFFAB 496 | #define XK_KP_Separator 0xFFAC /* separator, often comma */ 497 | #define XK_KP_Subtract 0xFFAD 498 | #define XK_KP_Decimal 0xFFAE 499 | #define XK_KP_Divide 0xFFAF 500 | 501 | #define XK_KP_0 0xFFB0 502 | #define XK_KP_1 0xFFB1 503 | #define XK_KP_2 0xFFB2 504 | #define XK_KP_3 0xFFB3 505 | #define XK_KP_4 0xFFB4 506 | #define XK_KP_5 0xFFB5 507 | #define XK_KP_6 0xFFB6 508 | #define XK_KP_7 0xFFB7 509 | #define XK_KP_8 0xFFB8 510 | #define XK_KP_9 0xFFB9 511 | 512 | 513 | 514 | /* 515 | * Auxilliary Functions; note the duplicate definitions for left and right 516 | * function keys; Sun keyboards and a few other manufactures have such 517 | * function key groups on the left and/or right sides of the keyboard. 518 | * We've not found a keyboard with more than 35 function keys total. 519 | */ 520 | 521 | #define XK_F1 0xFFBE 522 | #define XK_F2 0xFFBF 523 | #define XK_F3 0xFFC0 524 | #define XK_F4 0xFFC1 525 | #define XK_F5 0xFFC2 526 | #define XK_F6 0xFFC3 527 | #define XK_F7 0xFFC4 528 | #define XK_F8 0xFFC5 529 | #define XK_F9 0xFFC6 530 | #define XK_F10 0xFFC7 531 | #define XK_F11 0xFFC8 532 | #define XK_L1 0xFFC8 533 | #define XK_F12 0xFFC9 534 | #define XK_L2 0xFFC9 535 | #define XK_F13 0xFFCA 536 | #define XK_L3 0xFFCA 537 | #define XK_F14 0xFFCB 538 | #define XK_L4 0xFFCB 539 | #define XK_F15 0xFFCC 540 | #define XK_L5 0xFFCC 541 | #define XK_F16 0xFFCD 542 | #define XK_L6 0xFFCD 543 | #define XK_F17 0xFFCE 544 | #define XK_L7 0xFFCE 545 | #define XK_F18 0xFFCF 546 | #define XK_L8 0xFFCF 547 | #define XK_F19 0xFFD0 548 | #define XK_L9 0xFFD0 549 | #define XK_F20 0xFFD1 550 | #define XK_L10 0xFFD1 551 | #define XK_F21 0xFFD2 552 | #define XK_R1 0xFFD2 553 | #define XK_F22 0xFFD3 554 | #define XK_R2 0xFFD3 555 | #define XK_F23 0xFFD4 556 | #define XK_R3 0xFFD4 557 | #define XK_F24 0xFFD5 558 | #define XK_R4 0xFFD5 559 | #define XK_F25 0xFFD6 560 | #define XK_R5 0xFFD6 561 | #define XK_F26 0xFFD7 562 | #define XK_R6 0xFFD7 563 | #define XK_F27 0xFFD8 564 | #define XK_R7 0xFFD8 565 | #define XK_F28 0xFFD9 566 | #define XK_R8 0xFFD9 567 | #define XK_F29 0xFFDA 568 | #define XK_R9 0xFFDA 569 | #define XK_F30 0xFFDB 570 | #define XK_R10 0xFFDB 571 | #define XK_F31 0xFFDC 572 | #define XK_R11 0xFFDC 573 | #define XK_F32 0xFFDD 574 | #define XK_R12 0xFFDD 575 | #define XK_F33 0xFFDE 576 | #define XK_R13 0xFFDE 577 | #define XK_F34 0xFFDF 578 | #define XK_R14 0xFFDF 579 | #define XK_F35 0xFFE0 580 | #define XK_R15 0xFFE0 581 | 582 | /* Modifiers */ 583 | 584 | #define XK_Shift_L 0xFFE1 /* Left shift */ 585 | #define XK_Shift_R 0xFFE2 /* Right shift */ 586 | #define XK_Control_L 0xFFE3 /* Left control */ 587 | #define XK_Control_R 0xFFE4 /* Right control */ 588 | #define XK_Caps_Lock 0xFFE5 /* Caps lock */ 589 | #define XK_Shift_Lock 0xFFE6 /* Shift lock */ 590 | 591 | #define XK_Meta_L 0xFFE7 /* Left meta */ 592 | #define XK_Meta_R 0xFFE8 /* Right meta */ 593 | #define XK_Alt_L 0xFFE9 /* Left alt */ 594 | #define XK_Alt_R 0xFFEA /* Right alt */ 595 | #define XK_Super_L 0xFFEB /* Left super */ 596 | #define XK_Super_R 0xFFEC /* Right super */ 597 | #define XK_Hyper_L 0xFFED /* Left hyper */ 598 | #define XK_Hyper_R 0xFFEE /* Right hyper */ 599 | #endif /* XK_MISCELLANY */ 600 | 601 | /* 602 | * ISO 9995 Function and Modifier Keys 603 | * Byte 3 = 0xFE 604 | */ 605 | 606 | #ifdef XK_XKB_KEYS 607 | #define XK_ISO_Lock 0xFE01 608 | #define XK_ISO_Level2_Latch 0xFE02 609 | #define XK_ISO_Level3_Shift 0xFE03 610 | #define XK_ISO_Level3_Latch 0xFE04 611 | #define XK_ISO_Level3_Lock 0xFE05 612 | #define XK_ISO_Group_Shift 0xFF7E /* Alias for mode_switch */ 613 | #define XK_ISO_Group_Latch 0xFE06 614 | #define XK_ISO_Group_Lock 0xFE07 615 | #define XK_ISO_Next_Group 0xFE08 616 | #define XK_ISO_Next_Group_Lock 0xFE09 617 | #define XK_ISO_Prev_Group 0xFE0A 618 | #define XK_ISO_Prev_Group_Lock 0xFE0B 619 | #define XK_ISO_First_Group 0xFE0C 620 | #define XK_ISO_First_Group_Lock 0xFE0D 621 | #define XK_ISO_Last_Group 0xFE0E 622 | #define XK_ISO_Last_Group_Lock 0xFE0F 623 | 624 | #define XK_ISO_Left_Tab 0xFE20 625 | #define XK_ISO_Move_Line_Up 0xFE21 626 | #define XK_ISO_Move_Line_Down 0xFE22 627 | #define XK_ISO_Partial_Line_Up 0xFE23 628 | #define XK_ISO_Partial_Line_Down 0xFE24 629 | #define XK_ISO_Partial_Space_Left 0xFE25 630 | #define XK_ISO_Partial_Space_Right 0xFE26 631 | #define XK_ISO_Set_Margin_Left 0xFE27 632 | #define XK_ISO_Set_Margin_Right 0xFE28 633 | #define XK_ISO_Release_Margin_Left 0xFE29 634 | #define XK_ISO_Release_Margin_Right 0xFE2A 635 | #define XK_ISO_Release_Both_Margins 0xFE2B 636 | #define XK_ISO_Fast_Cursor_Left 0xFE2C 637 | #define XK_ISO_Fast_Cursor_Right 0xFE2D 638 | #define XK_ISO_Fast_Cursor_Up 0xFE2E 639 | #define XK_ISO_Fast_Cursor_Down 0xFE2F 640 | #define XK_ISO_Continuous_Underline 0xFE30 641 | #define XK_ISO_Discontinuous_Underline 0xFE31 642 | #define XK_ISO_Emphasize 0xFE32 643 | #define XK_ISO_Center_Object 0xFE33 644 | #define XK_ISO_Enter 0xFE34 645 | 646 | #define XK_dead_grave 0xFE50 647 | #define XK_dead_acute 0xFE51 648 | #define XK_dead_circumflex 0xFE52 649 | #define XK_dead_tilde 0xFE53 650 | #define XK_dead_macron 0xFE54 651 | #define XK_dead_breve 0xFE55 652 | #define XK_dead_abovedot 0xFE56 653 | #define XK_dead_diaeresis 0xFE57 654 | #define XK_dead_abovering 0xFE58 655 | #define XK_dead_doubleacute 0xFE59 656 | #define XK_dead_caron 0xFE5A 657 | #define XK_dead_cedilla 0xFE5B 658 | #define XK_dead_ogonek 0xFE5C 659 | #define XK_dead_iota 0xFE5D 660 | #define XK_dead_voiced_sound 0xFE5E 661 | #define XK_dead_semivoiced_sound 0xFE5F 662 | #define XK_dead_belowdot 0xFE60 663 | 664 | #define XK_First_Virtual_Screen 0xFED0 665 | #define XK_Prev_Virtual_Screen 0xFED1 666 | #define XK_Next_Virtual_Screen 0xFED2 667 | #define XK_Last_Virtual_Screen 0xFED4 668 | #define XK_Terminate_Server 0xFED5 669 | 670 | #define XK_AccessX_Enable 0xFE70 671 | #define XK_AccessX_Feedback_Enable 0xFE71 672 | #define XK_RepeatKeys_Enable 0xFE72 673 | #define XK_SlowKeys_Enable 0xFE73 674 | #define XK_BounceKeys_Enable 0xFE74 675 | #define XK_StickyKeys_Enable 0xFE75 676 | #define XK_MouseKeys_Enable 0xFE76 677 | #define XK_MouseKeys_Accel_Enable 0xFE77 678 | #define XK_Overlay1_Enable 0xFE78 679 | #define XK_Overlay2_Enable 0xFE79 680 | #define XK_AudibleBell_Enable 0xFE7A 681 | 682 | #define XK_Pointer_Left 0xFEE0 683 | #define XK_Pointer_Right 0xFEE1 684 | #define XK_Pointer_Up 0xFEE2 685 | #define XK_Pointer_Down 0xFEE3 686 | #define XK_Pointer_UpLeft 0xFEE4 687 | #define XK_Pointer_UpRight 0xFEE5 688 | #define XK_Pointer_DownLeft 0xFEE6 689 | #define XK_Pointer_DownRight 0xFEE7 690 | #define XK_Pointer_Button_Dflt 0xFEE8 691 | #define XK_Pointer_Button1 0xFEE9 692 | #define XK_Pointer_Button2 0xFEEA 693 | #define XK_Pointer_Button3 0xFEEB 694 | #define XK_Pointer_Button4 0xFEEC 695 | #define XK_Pointer_Button5 0xFEED 696 | #define XK_Pointer_DblClick_Dflt 0xFEEE 697 | #define XK_Pointer_DblClick1 0xFEEF 698 | #define XK_Pointer_DblClick2 0xFEF0 699 | #define XK_Pointer_DblClick3 0xFEF1 700 | #define XK_Pointer_DblClick4 0xFEF2 701 | #define XK_Pointer_DblClick5 0xFEF3 702 | #define XK_Pointer_Drag_Dflt 0xFEF4 703 | #define XK_Pointer_Drag1 0xFEF5 704 | #define XK_Pointer_Drag2 0xFEF6 705 | #define XK_Pointer_Drag3 0xFEF7 706 | #define XK_Pointer_Drag4 0xFEF8 707 | #define XK_Pointer_Drag5 0xFEFD 708 | 709 | #define XK_Pointer_EnableKeys 0xFEF9 710 | #define XK_Pointer_Accelerate 0xFEFA 711 | #define XK_Pointer_DfltBtnNext 0xFEFB 712 | #define XK_Pointer_DfltBtnPrev 0xFEFC 713 | 714 | #endif 715 | 716 | /* 717 | * 3270 Terminal Keys 718 | * Byte 3 = 0xFD 719 | */ 720 | 721 | #ifdef XK_3270 722 | #define XK_3270_Duplicate 0xFD01 723 | #define XK_3270_FieldMark 0xFD02 724 | #define XK_3270_Right2 0xFD03 725 | #define XK_3270_Left2 0xFD04 726 | #define XK_3270_BackTab 0xFD05 727 | #define XK_3270_EraseEOF 0xFD06 728 | #define XK_3270_EraseInput 0xFD07 729 | #define XK_3270_Reset 0xFD08 730 | #define XK_3270_Quit 0xFD09 731 | #define XK_3270_PA1 0xFD0A 732 | #define XK_3270_PA2 0xFD0B 733 | #define XK_3270_PA3 0xFD0C 734 | #define XK_3270_Test 0xFD0D 735 | #define XK_3270_Attn 0xFD0E 736 | #define XK_3270_CursorBlink 0xFD0F 737 | #define XK_3270_AltCursor 0xFD10 738 | #define XK_3270_KeyClick 0xFD11 739 | #define XK_3270_Jump 0xFD12 740 | #define XK_3270_Ident 0xFD13 741 | #define XK_3270_Rule 0xFD14 742 | #define XK_3270_Copy 0xFD15 743 | #define XK_3270_Play 0xFD16 744 | #define XK_3270_Setup 0xFD17 745 | #define XK_3270_Record 0xFD18 746 | #define XK_3270_ChangeScreen 0xFD19 747 | #define XK_3270_DeleteWord 0xFD1A 748 | #define XK_3270_ExSelect 0xFD1B 749 | #define XK_3270_CursorSelect 0xFD1C 750 | #define XK_3270_PrintScreen 0xFD1D 751 | #define XK_3270_Enter 0xFD1E 752 | #endif 753 | 754 | /* 755 | * Latin 1 756 | * Byte 3 = 0 757 | */ 758 | #ifdef XK_LATIN1 759 | #define XK_space 0x020 760 | #define XK_exclam 0x021 761 | #define XK_quotedbl 0x022 762 | #define XK_numbersign 0x023 763 | #define XK_dollar 0x024 764 | #define XK_percent 0x025 765 | #define XK_ampersand 0x026 766 | #define XK_apostrophe 0x027 767 | #define XK_quoteright 0x027 /* deprecated */ 768 | #define XK_parenleft 0x028 769 | #define XK_parenright 0x029 770 | #define XK_asterisk 0x02a 771 | #define XK_plus 0x02b 772 | #define XK_comma 0x02c 773 | #define XK_minus 0x02d 774 | #define XK_period 0x02e 775 | #define XK_slash 0x02f 776 | #define XK_0 0x030 777 | #define XK_1 0x031 778 | #define XK_2 0x032 779 | #define XK_3 0x033 780 | #define XK_4 0x034 781 | #define XK_5 0x035 782 | #define XK_6 0x036 783 | #define XK_7 0x037 784 | #define XK_8 0x038 785 | #define XK_9 0x039 786 | #define XK_colon 0x03a 787 | #define XK_semicolon 0x03b 788 | #define XK_less 0x03c 789 | #define XK_equal 0x03d 790 | #define XK_greater 0x03e 791 | #define XK_question 0x03f 792 | #define XK_at 0x040 793 | #define XK_A 0x041 794 | #define XK_B 0x042 795 | #define XK_C 0x043 796 | #define XK_D 0x044 797 | #define XK_E 0x045 798 | #define XK_F 0x046 799 | #define XK_G 0x047 800 | #define XK_H 0x048 801 | #define XK_I 0x049 802 | #define XK_J 0x04a 803 | #define XK_K 0x04b 804 | #define XK_L 0x04c 805 | #define XK_M 0x04d 806 | #define XK_N 0x04e 807 | #define XK_O 0x04f 808 | #define XK_P 0x050 809 | #define XK_Q 0x051 810 | #define XK_R 0x052 811 | #define XK_S 0x053 812 | #define XK_T 0x054 813 | #define XK_U 0x055 814 | #define XK_V 0x056 815 | #define XK_W 0x057 816 | #define XK_X 0x058 817 | #define XK_Y 0x059 818 | #define XK_Z 0x05a 819 | #define XK_bracketleft 0x05b 820 | #define XK_backslash 0x05c 821 | #define XK_bracketright 0x05d 822 | #define XK_asciicircum 0x05e 823 | #define XK_underscore 0x05f 824 | #define XK_grave 0x060 825 | #define XK_quoteleft 0x060 /* deprecated */ 826 | #define XK_a 0x061 827 | #define XK_b 0x062 828 | #define XK_c 0x063 829 | #define XK_d 0x064 830 | #define XK_e 0x065 831 | #define XK_f 0x066 832 | #define XK_g 0x067 833 | #define XK_h 0x068 834 | #define XK_i 0x069 835 | #define XK_j 0x06a 836 | #define XK_k 0x06b 837 | #define XK_l 0x06c 838 | #define XK_m 0x06d 839 | #define XK_n 0x06e 840 | #define XK_o 0x06f 841 | #define XK_p 0x070 842 | #define XK_q 0x071 843 | #define XK_r 0x072 844 | #define XK_s 0x073 845 | #define XK_t 0x074 846 | #define XK_u 0x075 847 | #define XK_v 0x076 848 | #define XK_w 0x077 849 | #define XK_x 0x078 850 | #define XK_y 0x079 851 | #define XK_z 0x07a 852 | #define XK_braceleft 0x07b 853 | #define XK_bar 0x07c 854 | #define XK_braceright 0x07d 855 | #define XK_asciitilde 0x07e 856 | 857 | #define XK_nobreakspace 0x0a0 858 | #define XK_exclamdown 0x0a1 859 | #define XK_cent 0x0a2 860 | #define XK_sterling 0x0a3 861 | #define XK_currency 0x0a4 862 | #define XK_yen 0x0a5 863 | #define XK_brokenbar 0x0a6 864 | #define XK_section 0x0a7 865 | #define XK_diaeresis 0x0a8 866 | #define XK_copyright 0x0a9 867 | #define XK_ordfeminine 0x0aa 868 | #define XK_guillemotleft 0x0ab /* left angle quotation mark */ 869 | #define XK_notsign 0x0ac 870 | #define XK_hyphen 0x0ad 871 | #define XK_registered 0x0ae 872 | #define XK_macron 0x0af 873 | #define XK_degree 0x0b0 874 | #define XK_plusminus 0x0b1 875 | #define XK_twosuperior 0x0b2 876 | #define XK_threesuperior 0x0b3 877 | #define XK_acute 0x0b4 878 | #define XK_mu 0x0b5 879 | #define XK_paragraph 0x0b6 880 | #define XK_periodcentered 0x0b7 881 | #define XK_cedilla 0x0b8 882 | #define XK_onesuperior 0x0b9 883 | #define XK_masculine 0x0ba 884 | #define XK_guillemotright 0x0bb /* right angle quotation mark */ 885 | #define XK_onequarter 0x0bc 886 | #define XK_onehalf 0x0bd 887 | #define XK_threequarters 0x0be 888 | #define XK_questiondown 0x0bf 889 | #define XK_Agrave 0x0c0 890 | #define XK_Aacute 0x0c1 891 | #define XK_Acircumflex 0x0c2 892 | #define XK_Atilde 0x0c3 893 | #define XK_Adiaeresis 0x0c4 894 | #define XK_Aring 0x0c5 895 | #define XK_AE 0x0c6 896 | #define XK_Ccedilla 0x0c7 897 | #define XK_Egrave 0x0c8 898 | #define XK_Eacute 0x0c9 899 | #define XK_Ecircumflex 0x0ca 900 | #define XK_Ediaeresis 0x0cb 901 | #define XK_Igrave 0x0cc 902 | #define XK_Iacute 0x0cd 903 | #define XK_Icircumflex 0x0ce 904 | #define XK_Idiaeresis 0x0cf 905 | #define XK_ETH 0x0d0 906 | #define XK_Eth 0x0d0 /* deprecated */ 907 | #define XK_Ntilde 0x0d1 908 | #define XK_Ograve 0x0d2 909 | #define XK_Oacute 0x0d3 910 | #define XK_Ocircumflex 0x0d4 911 | #define XK_Otilde 0x0d5 912 | #define XK_Odiaeresis 0x0d6 913 | #define XK_multiply 0x0d7 914 | #define XK_Ooblique 0x0d8 915 | #define XK_Ugrave 0x0d9 916 | #define XK_Uacute 0x0da 917 | #define XK_Ucircumflex 0x0db 918 | #define XK_Udiaeresis 0x0dc 919 | #define XK_Yacute 0x0dd 920 | #define XK_THORN 0x0de 921 | #define XK_Thorn 0x0de /* deprecated */ 922 | #define XK_ssharp 0x0df 923 | #define XK_agrave 0x0e0 924 | #define XK_aacute 0x0e1 925 | #define XK_acircumflex 0x0e2 926 | #define XK_atilde 0x0e3 927 | #define XK_adiaeresis 0x0e4 928 | #define XK_aring 0x0e5 929 | #define XK_ae 0x0e6 930 | #define XK_ccedilla 0x0e7 931 | #define XK_egrave 0x0e8 932 | #define XK_eacute 0x0e9 933 | #define XK_ecircumflex 0x0ea 934 | #define XK_ediaeresis 0x0eb 935 | #define XK_igrave 0x0ec 936 | #define XK_iacute 0x0ed 937 | #define XK_icircumflex 0x0ee 938 | #define XK_idiaeresis 0x0ef 939 | #define XK_eth 0x0f0 940 | #define XK_ntilde 0x0f1 941 | #define XK_ograve 0x0f2 942 | #define XK_oacute 0x0f3 943 | #define XK_ocircumflex 0x0f4 944 | #define XK_otilde 0x0f5 945 | #define XK_odiaeresis 0x0f6 946 | #define XK_division 0x0f7 947 | #define XK_oslash 0x0f8 948 | #define XK_ugrave 0x0f9 949 | #define XK_uacute 0x0fa 950 | #define XK_ucircumflex 0x0fb 951 | #define XK_udiaeresis 0x0fc 952 | #define XK_yacute 0x0fd 953 | #define XK_thorn 0x0fe 954 | #define XK_ydiaeresis 0x0ff 955 | #endif /* XK_LATIN1 */ 956 | 957 | /* 958 | * Latin 2 959 | * Byte 3 = 1 960 | */ 961 | 962 | #ifdef XK_LATIN2 963 | #define XK_Aogonek 0x1a1 964 | #define XK_breve 0x1a2 965 | #define XK_Lstroke 0x1a3 966 | #define XK_Lcaron 0x1a5 967 | #define XK_Sacute 0x1a6 968 | #define XK_Scaron 0x1a9 969 | #define XK_Scedilla 0x1aa 970 | #define XK_Tcaron 0x1ab 971 | #define XK_Zacute 0x1ac 972 | #define XK_Zcaron 0x1ae 973 | #define XK_Zabovedot 0x1af 974 | #define XK_aogonek 0x1b1 975 | #define XK_ogonek 0x1b2 976 | #define XK_lstroke 0x1b3 977 | #define XK_lcaron 0x1b5 978 | #define XK_sacute 0x1b6 979 | #define XK_caron 0x1b7 980 | #define XK_scaron 0x1b9 981 | #define XK_scedilla 0x1ba 982 | #define XK_tcaron 0x1bb 983 | #define XK_zacute 0x1bc 984 | #define XK_doubleacute 0x1bd 985 | #define XK_zcaron 0x1be 986 | #define XK_zabovedot 0x1bf 987 | #define XK_Racute 0x1c0 988 | #define XK_Abreve 0x1c3 989 | #define XK_Lacute 0x1c5 990 | #define XK_Cacute 0x1c6 991 | #define XK_Ccaron 0x1c8 992 | #define XK_Eogonek 0x1ca 993 | #define XK_Ecaron 0x1cc 994 | #define XK_Dcaron 0x1cf 995 | #define XK_Dstroke 0x1d0 996 | #define XK_Nacute 0x1d1 997 | #define XK_Ncaron 0x1d2 998 | #define XK_Odoubleacute 0x1d5 999 | #define XK_Rcaron 0x1d8 1000 | #define XK_Uring 0x1d9 1001 | #define XK_Udoubleacute 0x1db 1002 | #define XK_Tcedilla 0x1de 1003 | #define XK_racute 0x1e0 1004 | #define XK_abreve 0x1e3 1005 | #define XK_lacute 0x1e5 1006 | #define XK_cacute 0x1e6 1007 | #define XK_ccaron 0x1e8 1008 | #define XK_eogonek 0x1ea 1009 | #define XK_ecaron 0x1ec 1010 | #define XK_dcaron 0x1ef 1011 | #define XK_dstroke 0x1f0 1012 | #define XK_nacute 0x1f1 1013 | #define XK_ncaron 0x1f2 1014 | #define XK_odoubleacute 0x1f5 1015 | #define XK_udoubleacute 0x1fb 1016 | #define XK_rcaron 0x1f8 1017 | #define XK_uring 0x1f9 1018 | #define XK_tcedilla 0x1fe 1019 | #define XK_abovedot 0x1ff 1020 | #endif /* XK_LATIN2 */ 1021 | 1022 | /* 1023 | * Latin 3 1024 | * Byte 3 = 2 1025 | */ 1026 | 1027 | #ifdef XK_LATIN3 1028 | #define XK_Hstroke 0x2a1 1029 | #define XK_Hcircumflex 0x2a6 1030 | #define XK_Iabovedot 0x2a9 1031 | #define XK_Gbreve 0x2ab 1032 | #define XK_Jcircumflex 0x2ac 1033 | #define XK_hstroke 0x2b1 1034 | #define XK_hcircumflex 0x2b6 1035 | #define XK_idotless 0x2b9 1036 | #define XK_gbreve 0x2bb 1037 | #define XK_jcircumflex 0x2bc 1038 | #define XK_Cabovedot 0x2c5 1039 | #define XK_Ccircumflex 0x2c6 1040 | #define XK_Gabovedot 0x2d5 1041 | #define XK_Gcircumflex 0x2d8 1042 | #define XK_Ubreve 0x2dd 1043 | #define XK_Scircumflex 0x2de 1044 | #define XK_cabovedot 0x2e5 1045 | #define XK_ccircumflex 0x2e6 1046 | #define XK_gabovedot 0x2f5 1047 | #define XK_gcircumflex 0x2f8 1048 | #define XK_ubreve 0x2fd 1049 | #define XK_scircumflex 0x2fe 1050 | #endif /* XK_LATIN3 */ 1051 | 1052 | 1053 | /* 1054 | * Latin 4 1055 | * Byte 3 = 3 1056 | */ 1057 | 1058 | #ifdef XK_LATIN4 1059 | #define XK_kra 0x3a2 1060 | #define XK_kappa 0x3a2 /* deprecated */ 1061 | #define XK_Rcedilla 0x3a3 1062 | #define XK_Itilde 0x3a5 1063 | #define XK_Lcedilla 0x3a6 1064 | #define XK_Emacron 0x3aa 1065 | #define XK_Gcedilla 0x3ab 1066 | #define XK_Tslash 0x3ac 1067 | #define XK_rcedilla 0x3b3 1068 | #define XK_itilde 0x3b5 1069 | #define XK_lcedilla 0x3b6 1070 | #define XK_emacron 0x3ba 1071 | #define XK_gcedilla 0x3bb 1072 | #define XK_tslash 0x3bc 1073 | #define XK_ENG 0x3bd 1074 | #define XK_eng 0x3bf 1075 | #define XK_Amacron 0x3c0 1076 | #define XK_Iogonek 0x3c7 1077 | #define XK_Eabovedot 0x3cc 1078 | #define XK_Imacron 0x3cf 1079 | #define XK_Ncedilla 0x3d1 1080 | #define XK_Omacron 0x3d2 1081 | #define XK_Kcedilla 0x3d3 1082 | #define XK_Uogonek 0x3d9 1083 | #define XK_Utilde 0x3dd 1084 | #define XK_Umacron 0x3de 1085 | #define XK_amacron 0x3e0 1086 | #define XK_iogonek 0x3e7 1087 | #define XK_eabovedot 0x3ec 1088 | #define XK_imacron 0x3ef 1089 | #define XK_ncedilla 0x3f1 1090 | #define XK_omacron 0x3f2 1091 | #define XK_kcedilla 0x3f3 1092 | #define XK_uogonek 0x3f9 1093 | #define XK_utilde 0x3fd 1094 | #define XK_umacron 0x3fe 1095 | #endif /* XK_LATIN4 */ 1096 | 1097 | /* 1098 | * Katakana 1099 | * Byte 3 = 4 1100 | */ 1101 | 1102 | #ifdef XK_KATAKANA 1103 | #define XK_overline 0x47e 1104 | #define XK_kana_fullstop 0x4a1 1105 | #define XK_kana_openingbracket 0x4a2 1106 | #define XK_kana_closingbracket 0x4a3 1107 | #define XK_kana_comma 0x4a4 1108 | #define XK_kana_conjunctive 0x4a5 1109 | #define XK_kana_middledot 0x4a5 /* deprecated */ 1110 | #define XK_kana_WO 0x4a6 1111 | #define XK_kana_a 0x4a7 1112 | #define XK_kana_i 0x4a8 1113 | #define XK_kana_u 0x4a9 1114 | #define XK_kana_e 0x4aa 1115 | #define XK_kana_o 0x4ab 1116 | #define XK_kana_ya 0x4ac 1117 | #define XK_kana_yu 0x4ad 1118 | #define XK_kana_yo 0x4ae 1119 | #define XK_kana_tsu 0x4af 1120 | #define XK_kana_tu 0x4af /* deprecated */ 1121 | #define XK_prolongedsound 0x4b0 1122 | #define XK_kana_A 0x4b1 1123 | #define XK_kana_I 0x4b2 1124 | #define XK_kana_U 0x4b3 1125 | #define XK_kana_E 0x4b4 1126 | #define XK_kana_O 0x4b5 1127 | #define XK_kana_KA 0x4b6 1128 | #define XK_kana_KI 0x4b7 1129 | #define XK_kana_KU 0x4b8 1130 | #define XK_kana_KE 0x4b9 1131 | #define XK_kana_KO 0x4ba 1132 | #define XK_kana_SA 0x4bb 1133 | #define XK_kana_SHI 0x4bc 1134 | #define XK_kana_SU 0x4bd 1135 | #define XK_kana_SE 0x4be 1136 | #define XK_kana_SO 0x4bf 1137 | #define XK_kana_TA 0x4c0 1138 | #define XK_kana_CHI 0x4c1 1139 | #define XK_kana_TI 0x4c1 /* deprecated */ 1140 | #define XK_kana_TSU 0x4c2 1141 | #define XK_kana_TU 0x4c2 /* deprecated */ 1142 | #define XK_kana_TE 0x4c3 1143 | #define XK_kana_TO 0x4c4 1144 | #define XK_kana_NA 0x4c5 1145 | #define XK_kana_NI 0x4c6 1146 | #define XK_kana_NU 0x4c7 1147 | #define XK_kana_NE 0x4c8 1148 | #define XK_kana_NO 0x4c9 1149 | #define XK_kana_HA 0x4ca 1150 | #define XK_kana_HI 0x4cb 1151 | #define XK_kana_FU 0x4cc 1152 | #define XK_kana_HU 0x4cc /* deprecated */ 1153 | #define XK_kana_HE 0x4cd 1154 | #define XK_kana_HO 0x4ce 1155 | #define XK_kana_MA 0x4cf 1156 | #define XK_kana_MI 0x4d0 1157 | #define XK_kana_MU 0x4d1 1158 | #define XK_kana_ME 0x4d2 1159 | #define XK_kana_MO 0x4d3 1160 | #define XK_kana_YA 0x4d4 1161 | #define XK_kana_YU 0x4d5 1162 | #define XK_kana_YO 0x4d6 1163 | #define XK_kana_RA 0x4d7 1164 | #define XK_kana_RI 0x4d8 1165 | #define XK_kana_RU 0x4d9 1166 | #define XK_kana_RE 0x4da 1167 | #define XK_kana_RO 0x4db 1168 | #define XK_kana_WA 0x4dc 1169 | #define XK_kana_N 0x4dd 1170 | #define XK_voicedsound 0x4de 1171 | #define XK_semivoicedsound 0x4df 1172 | #define XK_kana_switch 0xFF7E /* Alias for mode_switch */ 1173 | #endif /* XK_KATAKANA */ 1174 | 1175 | /* 1176 | * Arabic 1177 | * Byte 3 = 5 1178 | */ 1179 | 1180 | #ifdef XK_ARABIC 1181 | #define XK_Arabic_comma 0x5ac 1182 | #define XK_Arabic_semicolon 0x5bb 1183 | #define XK_Arabic_question_mark 0x5bf 1184 | #define XK_Arabic_hamza 0x5c1 1185 | #define XK_Arabic_maddaonalef 0x5c2 1186 | #define XK_Arabic_hamzaonalef 0x5c3 1187 | #define XK_Arabic_hamzaonwaw 0x5c4 1188 | #define XK_Arabic_hamzaunderalef 0x5c5 1189 | #define XK_Arabic_hamzaonyeh 0x5c6 1190 | #define XK_Arabic_alef 0x5c7 1191 | #define XK_Arabic_beh 0x5c8 1192 | #define XK_Arabic_tehmarbuta 0x5c9 1193 | #define XK_Arabic_teh 0x5ca 1194 | #define XK_Arabic_theh 0x5cb 1195 | #define XK_Arabic_jeem 0x5cc 1196 | #define XK_Arabic_hah 0x5cd 1197 | #define XK_Arabic_khah 0x5ce 1198 | #define XK_Arabic_dal 0x5cf 1199 | #define XK_Arabic_thal 0x5d0 1200 | #define XK_Arabic_ra 0x5d1 1201 | #define XK_Arabic_zain 0x5d2 1202 | #define XK_Arabic_seen 0x5d3 1203 | #define XK_Arabic_sheen 0x5d4 1204 | #define XK_Arabic_sad 0x5d5 1205 | #define XK_Arabic_dad 0x5d6 1206 | #define XK_Arabic_tah 0x5d7 1207 | #define XK_Arabic_zah 0x5d8 1208 | #define XK_Arabic_ain 0x5d9 1209 | #define XK_Arabic_ghain 0x5da 1210 | #define XK_Arabic_tatweel 0x5e0 1211 | #define XK_Arabic_feh 0x5e1 1212 | #define XK_Arabic_qaf 0x5e2 1213 | #define XK_Arabic_kaf 0x5e3 1214 | #define XK_Arabic_lam 0x5e4 1215 | #define XK_Arabic_meem 0x5e5 1216 | #define XK_Arabic_noon 0x5e6 1217 | #define XK_Arabic_ha 0x5e7 1218 | #define XK_Arabic_heh 0x5e7 /* deprecated */ 1219 | #define XK_Arabic_waw 0x5e8 1220 | #define XK_Arabic_alefmaksura 0x5e9 1221 | #define XK_Arabic_yeh 0x5ea 1222 | #define XK_Arabic_fathatan 0x5eb 1223 | #define XK_Arabic_dammatan 0x5ec 1224 | #define XK_Arabic_kasratan 0x5ed 1225 | #define XK_Arabic_fatha 0x5ee 1226 | #define XK_Arabic_damma 0x5ef 1227 | #define XK_Arabic_kasra 0x5f0 1228 | #define XK_Arabic_shadda 0x5f1 1229 | #define XK_Arabic_sukun 0x5f2 1230 | #define XK_Arabic_switch 0xFF7E /* Alias for mode_switch */ 1231 | #endif /* XK_ARABIC */ 1232 | 1233 | /* 1234 | * Cyrillic 1235 | * Byte 3 = 6 1236 | */ 1237 | #ifdef XK_CYRILLIC 1238 | #define XK_Serbian_dje 0x6a1 1239 | #define XK_Macedonia_gje 0x6a2 1240 | #define XK_Cyrillic_io 0x6a3 1241 | #define XK_Ukrainian_ie 0x6a4 1242 | #define XK_Ukranian_je 0x6a4 /* deprecated */ 1243 | #define XK_Macedonia_dse 0x6a5 1244 | #define XK_Ukrainian_i 0x6a6 1245 | #define XK_Ukranian_i 0x6a6 /* deprecated */ 1246 | #define XK_Ukrainian_yi 0x6a7 1247 | #define XK_Ukranian_yi 0x6a7 /* deprecated */ 1248 | #define XK_Cyrillic_je 0x6a8 1249 | #define XK_Serbian_je 0x6a8 /* deprecated */ 1250 | #define XK_Cyrillic_lje 0x6a9 1251 | #define XK_Serbian_lje 0x6a9 /* deprecated */ 1252 | #define XK_Cyrillic_nje 0x6aa 1253 | #define XK_Serbian_nje 0x6aa /* deprecated */ 1254 | #define XK_Serbian_tshe 0x6ab 1255 | #define XK_Macedonia_kje 0x6ac 1256 | #define XK_Byelorussian_shortu 0x6ae 1257 | #define XK_Cyrillic_dzhe 0x6af 1258 | #define XK_Serbian_dze 0x6af /* deprecated */ 1259 | #define XK_numerosign 0x6b0 1260 | #define XK_Serbian_DJE 0x6b1 1261 | #define XK_Macedonia_GJE 0x6b2 1262 | #define XK_Cyrillic_IO 0x6b3 1263 | #define XK_Ukrainian_IE 0x6b4 1264 | #define XK_Ukranian_JE 0x6b4 /* deprecated */ 1265 | #define XK_Macedonia_DSE 0x6b5 1266 | #define XK_Ukrainian_I 0x6b6 1267 | #define XK_Ukranian_I 0x6b6 /* deprecated */ 1268 | #define XK_Ukrainian_YI 0x6b7 1269 | #define XK_Ukranian_YI 0x6b7 /* deprecated */ 1270 | #define XK_Cyrillic_JE 0x6b8 1271 | #define XK_Serbian_JE 0x6b8 /* deprecated */ 1272 | #define XK_Cyrillic_LJE 0x6b9 1273 | #define XK_Serbian_LJE 0x6b9 /* deprecated */ 1274 | #define XK_Cyrillic_NJE 0x6ba 1275 | #define XK_Serbian_NJE 0x6ba /* deprecated */ 1276 | #define XK_Serbian_TSHE 0x6bb 1277 | #define XK_Macedonia_KJE 0x6bc 1278 | #define XK_Byelorussian_SHORTU 0x6be 1279 | #define XK_Cyrillic_DZHE 0x6bf 1280 | #define XK_Serbian_DZE 0x6bf /* deprecated */ 1281 | #define XK_Cyrillic_yu 0x6c0 1282 | #define XK_Cyrillic_a 0x6c1 1283 | #define XK_Cyrillic_be 0x6c2 1284 | #define XK_Cyrillic_tse 0x6c3 1285 | #define XK_Cyrillic_de 0x6c4 1286 | #define XK_Cyrillic_ie 0x6c5 1287 | #define XK_Cyrillic_ef 0x6c6 1288 | #define XK_Cyrillic_ghe 0x6c7 1289 | #define XK_Cyrillic_ha 0x6c8 1290 | #define XK_Cyrillic_i 0x6c9 1291 | #define XK_Cyrillic_shorti 0x6ca 1292 | #define XK_Cyrillic_ka 0x6cb 1293 | #define XK_Cyrillic_el 0x6cc 1294 | #define XK_Cyrillic_em 0x6cd 1295 | #define XK_Cyrillic_en 0x6ce 1296 | #define XK_Cyrillic_o 0x6cf 1297 | #define XK_Cyrillic_pe 0x6d0 1298 | #define XK_Cyrillic_ya 0x6d1 1299 | #define XK_Cyrillic_er 0x6d2 1300 | #define XK_Cyrillic_es 0x6d3 1301 | #define XK_Cyrillic_te 0x6d4 1302 | #define XK_Cyrillic_u 0x6d5 1303 | #define XK_Cyrillic_zhe 0x6d6 1304 | #define XK_Cyrillic_ve 0x6d7 1305 | #define XK_Cyrillic_softsign 0x6d8 1306 | #define XK_Cyrillic_yeru 0x6d9 1307 | #define XK_Cyrillic_ze 0x6da 1308 | #define XK_Cyrillic_sha 0x6db 1309 | #define XK_Cyrillic_e 0x6dc 1310 | #define XK_Cyrillic_shcha 0x6dd 1311 | #define XK_Cyrillic_che 0x6de 1312 | #define XK_Cyrillic_hardsign 0x6df 1313 | #define XK_Cyrillic_YU 0x6e0 1314 | #define XK_Cyrillic_A 0x6e1 1315 | #define XK_Cyrillic_BE 0x6e2 1316 | #define XK_Cyrillic_TSE 0x6e3 1317 | #define XK_Cyrillic_DE 0x6e4 1318 | #define XK_Cyrillic_IE 0x6e5 1319 | #define XK_Cyrillic_EF 0x6e6 1320 | #define XK_Cyrillic_GHE 0x6e7 1321 | #define XK_Cyrillic_HA 0x6e8 1322 | #define XK_Cyrillic_I 0x6e9 1323 | #define XK_Cyrillic_SHORTI 0x6ea 1324 | #define XK_Cyrillic_KA 0x6eb 1325 | #define XK_Cyrillic_EL 0x6ec 1326 | #define XK_Cyrillic_EM 0x6ed 1327 | #define XK_Cyrillic_EN 0x6ee 1328 | #define XK_Cyrillic_O 0x6ef 1329 | #define XK_Cyrillic_PE 0x6f0 1330 | #define XK_Cyrillic_YA 0x6f1 1331 | #define XK_Cyrillic_ER 0x6f2 1332 | #define XK_Cyrillic_ES 0x6f3 1333 | #define XK_Cyrillic_TE 0x6f4 1334 | #define XK_Cyrillic_U 0x6f5 1335 | #define XK_Cyrillic_ZHE 0x6f6 1336 | #define XK_Cyrillic_VE 0x6f7 1337 | #define XK_Cyrillic_SOFTSIGN 0x6f8 1338 | #define XK_Cyrillic_YERU 0x6f9 1339 | #define XK_Cyrillic_ZE 0x6fa 1340 | #define XK_Cyrillic_SHA 0x6fb 1341 | #define XK_Cyrillic_E 0x6fc 1342 | #define XK_Cyrillic_SHCHA 0x6fd 1343 | #define XK_Cyrillic_CHE 0x6fe 1344 | #define XK_Cyrillic_HARDSIGN 0x6ff 1345 | #endif /* XK_CYRILLIC */ 1346 | 1347 | /* 1348 | * Greek 1349 | * Byte 3 = 7 1350 | */ 1351 | 1352 | #ifdef XK_GREEK 1353 | #define XK_Greek_ALPHAaccent 0x7a1 1354 | #define XK_Greek_EPSILONaccent 0x7a2 1355 | #define XK_Greek_ETAaccent 0x7a3 1356 | #define XK_Greek_IOTAaccent 0x7a4 1357 | #define XK_Greek_IOTAdieresis 0x7a5 1358 | #define XK_Greek_OMICRONaccent 0x7a7 1359 | #define XK_Greek_UPSILONaccent 0x7a8 1360 | #define XK_Greek_UPSILONdieresis 0x7a9 1361 | #define XK_Greek_OMEGAaccent 0x7ab 1362 | #define XK_Greek_accentdieresis 0x7ae 1363 | #define XK_Greek_horizbar 0x7af 1364 | #define XK_Greek_alphaaccent 0x7b1 1365 | #define XK_Greek_epsilonaccent 0x7b2 1366 | #define XK_Greek_etaaccent 0x7b3 1367 | #define XK_Greek_iotaaccent 0x7b4 1368 | #define XK_Greek_iotadieresis 0x7b5 1369 | #define XK_Greek_iotaaccentdieresis 0x7b6 1370 | #define XK_Greek_omicronaccent 0x7b7 1371 | #define XK_Greek_upsilonaccent 0x7b8 1372 | #define XK_Greek_upsilondieresis 0x7b9 1373 | #define XK_Greek_upsilonaccentdieresis 0x7ba 1374 | #define XK_Greek_omegaaccent 0x7bb 1375 | #define XK_Greek_ALPHA 0x7c1 1376 | #define XK_Greek_BETA 0x7c2 1377 | #define XK_Greek_GAMMA 0x7c3 1378 | #define XK_Greek_DELTA 0x7c4 1379 | #define XK_Greek_EPSILON 0x7c5 1380 | #define XK_Greek_ZETA 0x7c6 1381 | #define XK_Greek_ETA 0x7c7 1382 | #define XK_Greek_THETA 0x7c8 1383 | #define XK_Greek_IOTA 0x7c9 1384 | #define XK_Greek_KAPPA 0x7ca 1385 | #define XK_Greek_LAMDA 0x7cb 1386 | #define XK_Greek_LAMBDA 0x7cb 1387 | #define XK_Greek_MU 0x7cc 1388 | #define XK_Greek_NU 0x7cd 1389 | #define XK_Greek_XI 0x7ce 1390 | #define XK_Greek_OMICRON 0x7cf 1391 | #define XK_Greek_PI 0x7d0 1392 | #define XK_Greek_RHO 0x7d1 1393 | #define XK_Greek_SIGMA 0x7d2 1394 | #define XK_Greek_TAU 0x7d4 1395 | #define XK_Greek_UPSILON 0x7d5 1396 | #define XK_Greek_PHI 0x7d6 1397 | #define XK_Greek_CHI 0x7d7 1398 | #define XK_Greek_PSI 0x7d8 1399 | #define XK_Greek_OMEGA 0x7d9 1400 | #define XK_Greek_alpha 0x7e1 1401 | #define XK_Greek_beta 0x7e2 1402 | #define XK_Greek_gamma 0x7e3 1403 | #define XK_Greek_delta 0x7e4 1404 | #define XK_Greek_epsilon 0x7e5 1405 | #define XK_Greek_zeta 0x7e6 1406 | #define XK_Greek_eta 0x7e7 1407 | #define XK_Greek_theta 0x7e8 1408 | #define XK_Greek_iota 0x7e9 1409 | #define XK_Greek_kappa 0x7ea 1410 | #define XK_Greek_lamda 0x7eb 1411 | #define XK_Greek_lambda 0x7eb 1412 | #define XK_Greek_mu 0x7ec 1413 | #define XK_Greek_nu 0x7ed 1414 | #define XK_Greek_xi 0x7ee 1415 | #define XK_Greek_omicron 0x7ef 1416 | #define XK_Greek_pi 0x7f0 1417 | #define XK_Greek_rho 0x7f1 1418 | #define XK_Greek_sigma 0x7f2 1419 | #define XK_Greek_finalsmallsigma 0x7f3 1420 | #define XK_Greek_tau 0x7f4 1421 | #define XK_Greek_upsilon 0x7f5 1422 | #define XK_Greek_phi 0x7f6 1423 | #define XK_Greek_chi 0x7f7 1424 | #define XK_Greek_psi 0x7f8 1425 | #define XK_Greek_omega 0x7f9 1426 | #define XK_Greek_switch 0xFF7E /* Alias for mode_switch */ 1427 | #endif /* XK_GREEK */ 1428 | 1429 | /* 1430 | * Technical 1431 | * Byte 3 = 8 1432 | */ 1433 | 1434 | #ifdef XK_TECHNICAL 1435 | #define XK_leftradical 0x8a1 1436 | #define XK_topleftradical 0x8a2 1437 | #define XK_horizconnector 0x8a3 1438 | #define XK_topintegral 0x8a4 1439 | #define XK_botintegral 0x8a5 1440 | #define XK_vertconnector 0x8a6 1441 | #define XK_topleftsqbracket 0x8a7 1442 | #define XK_botleftsqbracket 0x8a8 1443 | #define XK_toprightsqbracket 0x8a9 1444 | #define XK_botrightsqbracket 0x8aa 1445 | #define XK_topleftparens 0x8ab 1446 | #define XK_botleftparens 0x8ac 1447 | #define XK_toprightparens 0x8ad 1448 | #define XK_botrightparens 0x8ae 1449 | #define XK_leftmiddlecurlybrace 0x8af 1450 | #define XK_rightmiddlecurlybrace 0x8b0 1451 | #define XK_topleftsummation 0x8b1 1452 | #define XK_botleftsummation 0x8b2 1453 | #define XK_topvertsummationconnector 0x8b3 1454 | #define XK_botvertsummationconnector 0x8b4 1455 | #define XK_toprightsummation 0x8b5 1456 | #define XK_botrightsummation 0x8b6 1457 | #define XK_rightmiddlesummation 0x8b7 1458 | #define XK_lessthanequal 0x8bc 1459 | #define XK_notequal 0x8bd 1460 | #define XK_greaterthanequal 0x8be 1461 | #define XK_integral 0x8bf 1462 | #define XK_therefore 0x8c0 1463 | #define XK_variation 0x8c1 1464 | #define XK_infinity 0x8c2 1465 | #define XK_nabla 0x8c5 1466 | #define XK_approximate 0x8c8 1467 | #define XK_similarequal 0x8c9 1468 | #define XK_ifonlyif 0x8cd 1469 | #define XK_implies 0x8ce 1470 | #define XK_identical 0x8cf 1471 | #define XK_radical 0x8d6 1472 | #define XK_includedin 0x8da 1473 | #define XK_includes 0x8db 1474 | #define XK_intersection 0x8dc 1475 | #define XK_union 0x8dd 1476 | #define XK_logicaland 0x8de 1477 | #define XK_logicalor 0x8df 1478 | #define XK_partialderivative 0x8ef 1479 | #define XK_function 0x8f6 1480 | #define XK_leftarrow 0x8fb 1481 | #define XK_uparrow 0x8fc 1482 | #define XK_rightarrow 0x8fd 1483 | #define XK_downarrow 0x8fe 1484 | #endif /* XK_TECHNICAL */ 1485 | 1486 | /* 1487 | * Special 1488 | * Byte 3 = 9 1489 | */ 1490 | 1491 | #ifdef XK_SPECIAL 1492 | #define XK_blank 0x9df 1493 | #define XK_soliddiamond 0x9e0 1494 | #define XK_checkerboard 0x9e1 1495 | #define XK_ht 0x9e2 1496 | #define XK_ff 0x9e3 1497 | #define XK_cr 0x9e4 1498 | #define XK_lf 0x9e5 1499 | #define XK_nl 0x9e8 1500 | #define XK_vt 0x9e9 1501 | #define XK_lowrightcorner 0x9ea 1502 | #define XK_uprightcorner 0x9eb 1503 | #define XK_upleftcorner 0x9ec 1504 | #define XK_lowleftcorner 0x9ed 1505 | #define XK_crossinglines 0x9ee 1506 | #define XK_horizlinescan1 0x9ef 1507 | #define XK_horizlinescan3 0x9f0 1508 | #define XK_horizlinescan5 0x9f1 1509 | #define XK_horizlinescan7 0x9f2 1510 | #define XK_horizlinescan9 0x9f3 1511 | #define XK_leftt 0x9f4 1512 | #define XK_rightt 0x9f5 1513 | #define XK_bott 0x9f6 1514 | #define XK_topt 0x9f7 1515 | #define XK_vertbar 0x9f8 1516 | #endif /* XK_SPECIAL */ 1517 | 1518 | /* 1519 | * Publishing 1520 | * Byte 3 = a 1521 | */ 1522 | 1523 | #ifdef XK_PUBLISHING 1524 | #define XK_emspace 0xaa1 1525 | #define XK_enspace 0xaa2 1526 | #define XK_em3space 0xaa3 1527 | #define XK_em4space 0xaa4 1528 | #define XK_digitspace 0xaa5 1529 | #define XK_punctspace 0xaa6 1530 | #define XK_thinspace 0xaa7 1531 | #define XK_hairspace 0xaa8 1532 | #define XK_emdash 0xaa9 1533 | #define XK_endash 0xaaa 1534 | #define XK_signifblank 0xaac 1535 | #define XK_ellipsis 0xaae 1536 | #define XK_doubbaselinedot 0xaaf 1537 | #define XK_onethird 0xab0 1538 | #define XK_twothirds 0xab1 1539 | #define XK_onefifth 0xab2 1540 | #define XK_twofifths 0xab3 1541 | #define XK_threefifths 0xab4 1542 | #define XK_fourfifths 0xab5 1543 | #define XK_onesixth 0xab6 1544 | #define XK_fivesixths 0xab7 1545 | #define XK_careof 0xab8 1546 | #define XK_figdash 0xabb 1547 | #define XK_leftanglebracket 0xabc 1548 | #define XK_decimalpoint 0xabd 1549 | #define XK_rightanglebracket 0xabe 1550 | #define XK_marker 0xabf 1551 | #define XK_oneeighth 0xac3 1552 | #define XK_threeeighths 0xac4 1553 | #define XK_fiveeighths 0xac5 1554 | #define XK_seveneighths 0xac6 1555 | #define XK_trademark 0xac9 1556 | #define XK_signaturemark 0xaca 1557 | #define XK_trademarkincircle 0xacb 1558 | #define XK_leftopentriangle 0xacc 1559 | #define XK_rightopentriangle 0xacd 1560 | #define XK_emopencircle 0xace 1561 | #define XK_emopenrectangle 0xacf 1562 | #define XK_leftsinglequotemark 0xad0 1563 | #define XK_rightsinglequotemark 0xad1 1564 | #define XK_leftdoublequotemark 0xad2 1565 | #define XK_rightdoublequotemark 0xad3 1566 | #define XK_prescription 0xad4 1567 | #define XK_minutes 0xad6 1568 | #define XK_seconds 0xad7 1569 | #define XK_latincross 0xad9 1570 | #define XK_hexagram 0xada 1571 | #define XK_filledrectbullet 0xadb 1572 | #define XK_filledlefttribullet 0xadc 1573 | #define XK_filledrighttribullet 0xadd 1574 | #define XK_emfilledcircle 0xade 1575 | #define XK_emfilledrect 0xadf 1576 | #define XK_enopencircbullet 0xae0 1577 | #define XK_enopensquarebullet 0xae1 1578 | #define XK_openrectbullet 0xae2 1579 | #define XK_opentribulletup 0xae3 1580 | #define XK_opentribulletdown 0xae4 1581 | #define XK_openstar 0xae5 1582 | #define XK_enfilledcircbullet 0xae6 1583 | #define XK_enfilledsqbullet 0xae7 1584 | #define XK_filledtribulletup 0xae8 1585 | #define XK_filledtribulletdown 0xae9 1586 | #define XK_leftpointer 0xaea 1587 | #define XK_rightpointer 0xaeb 1588 | #define XK_club 0xaec 1589 | #define XK_diamond 0xaed 1590 | #define XK_heart 0xaee 1591 | #define XK_maltesecross 0xaf0 1592 | #define XK_dagger 0xaf1 1593 | #define XK_doubledagger 0xaf2 1594 | #define XK_checkmark 0xaf3 1595 | #define XK_ballotcross 0xaf4 1596 | #define XK_musicalsharp 0xaf5 1597 | #define XK_musicalflat 0xaf6 1598 | #define XK_malesymbol 0xaf7 1599 | #define XK_femalesymbol 0xaf8 1600 | #define XK_telephone 0xaf9 1601 | #define XK_telephonerecorder 0xafa 1602 | #define XK_phonographcopyright 0xafb 1603 | #define XK_caret 0xafc 1604 | #define XK_singlelowquotemark 0xafd 1605 | #define XK_doublelowquotemark 0xafe 1606 | #define XK_cursor 0xaff 1607 | #endif /* XK_PUBLISHING */ 1608 | 1609 | /* 1610 | * APL 1611 | * Byte 3 = b 1612 | */ 1613 | 1614 | #ifdef XK_APL 1615 | #define XK_leftcaret 0xba3 1616 | #define XK_rightcaret 0xba6 1617 | #define XK_downcaret 0xba8 1618 | #define XK_upcaret 0xba9 1619 | #define XK_overbar 0xbc0 1620 | #define XK_downtack 0xbc2 1621 | #define XK_upshoe 0xbc3 1622 | #define XK_downstile 0xbc4 1623 | #define XK_underbar 0xbc6 1624 | #define XK_jot 0xbca 1625 | #define XK_quad 0xbcc 1626 | #define XK_uptack 0xbce 1627 | #define XK_circle 0xbcf 1628 | #define XK_upstile 0xbd3 1629 | #define XK_downshoe 0xbd6 1630 | #define XK_rightshoe 0xbd8 1631 | #define XK_leftshoe 0xbda 1632 | #define XK_lefttack 0xbdc 1633 | #define XK_righttack 0xbfc 1634 | #endif /* XK_APL */ 1635 | 1636 | /* 1637 | * Hebrew 1638 | * Byte 3 = c 1639 | */ 1640 | 1641 | #ifdef XK_HEBREW 1642 | #define XK_hebrew_doublelowline 0xcdf 1643 | #define XK_hebrew_aleph 0xce0 1644 | #define XK_hebrew_bet 0xce1 1645 | #define XK_hebrew_beth 0xce1 /* deprecated */ 1646 | #define XK_hebrew_gimel 0xce2 1647 | #define XK_hebrew_gimmel 0xce2 /* deprecated */ 1648 | #define XK_hebrew_dalet 0xce3 1649 | #define XK_hebrew_daleth 0xce3 /* deprecated */ 1650 | #define XK_hebrew_he 0xce4 1651 | #define XK_hebrew_waw 0xce5 1652 | #define XK_hebrew_zain 0xce6 1653 | #define XK_hebrew_zayin 0xce6 /* deprecated */ 1654 | #define XK_hebrew_chet 0xce7 1655 | #define XK_hebrew_het 0xce7 /* deprecated */ 1656 | #define XK_hebrew_tet 0xce8 1657 | #define XK_hebrew_teth 0xce8 /* deprecated */ 1658 | #define XK_hebrew_yod 0xce9 1659 | #define XK_hebrew_finalkaph 0xcea 1660 | #define XK_hebrew_kaph 0xceb 1661 | #define XK_hebrew_lamed 0xcec 1662 | #define XK_hebrew_finalmem 0xced 1663 | #define XK_hebrew_mem 0xcee 1664 | #define XK_hebrew_finalnun 0xcef 1665 | #define XK_hebrew_nun 0xcf0 1666 | #define XK_hebrew_samech 0xcf1 1667 | #define XK_hebrew_samekh 0xcf1 /* deprecated */ 1668 | #define XK_hebrew_ayin 0xcf2 1669 | #define XK_hebrew_finalpe 0xcf3 1670 | #define XK_hebrew_pe 0xcf4 1671 | #define XK_hebrew_finalzade 0xcf5 1672 | #define XK_hebrew_finalzadi 0xcf5 /* deprecated */ 1673 | #define XK_hebrew_zade 0xcf6 1674 | #define XK_hebrew_zadi 0xcf6 /* deprecated */ 1675 | #define XK_hebrew_qoph 0xcf7 1676 | #define XK_hebrew_kuf 0xcf7 /* deprecated */ 1677 | #define XK_hebrew_resh 0xcf8 1678 | #define XK_hebrew_shin 0xcf9 1679 | #define XK_hebrew_taw 0xcfa 1680 | #define XK_hebrew_taf 0xcfa /* deprecated */ 1681 | #define XK_Hebrew_switch 0xFF7E /* Alias for mode_switch */ 1682 | #endif /* XK_HEBREW */ 1683 | 1684 | /* 1685 | * Thai 1686 | * Byte 3 = d 1687 | */ 1688 | 1689 | #ifdef XK_THAI 1690 | #define XK_Thai_kokai 0xda1 1691 | #define XK_Thai_khokhai 0xda2 1692 | #define XK_Thai_khokhuat 0xda3 1693 | #define XK_Thai_khokhwai 0xda4 1694 | #define XK_Thai_khokhon 0xda5 1695 | #define XK_Thai_khorakhang 0xda6 1696 | #define XK_Thai_ngongu 0xda7 1697 | #define XK_Thai_chochan 0xda8 1698 | #define XK_Thai_choching 0xda9 1699 | #define XK_Thai_chochang 0xdaa 1700 | #define XK_Thai_soso 0xdab 1701 | #define XK_Thai_chochoe 0xdac 1702 | #define XK_Thai_yoying 0xdad 1703 | #define XK_Thai_dochada 0xdae 1704 | #define XK_Thai_topatak 0xdaf 1705 | #define XK_Thai_thothan 0xdb0 1706 | #define XK_Thai_thonangmontho 0xdb1 1707 | #define XK_Thai_thophuthao 0xdb2 1708 | #define XK_Thai_nonen 0xdb3 1709 | #define XK_Thai_dodek 0xdb4 1710 | #define XK_Thai_totao 0xdb5 1711 | #define XK_Thai_thothung 0xdb6 1712 | #define XK_Thai_thothahan 0xdb7 1713 | #define XK_Thai_thothong 0xdb8 1714 | #define XK_Thai_nonu 0xdb9 1715 | #define XK_Thai_bobaimai 0xdba 1716 | #define XK_Thai_popla 0xdbb 1717 | #define XK_Thai_phophung 0xdbc 1718 | #define XK_Thai_fofa 0xdbd 1719 | #define XK_Thai_phophan 0xdbe 1720 | #define XK_Thai_fofan 0xdbf 1721 | #define XK_Thai_phosamphao 0xdc0 1722 | #define XK_Thai_moma 0xdc1 1723 | #define XK_Thai_yoyak 0xdc2 1724 | #define XK_Thai_rorua 0xdc3 1725 | #define XK_Thai_ru 0xdc4 1726 | #define XK_Thai_loling 0xdc5 1727 | #define XK_Thai_lu 0xdc6 1728 | #define XK_Thai_wowaen 0xdc7 1729 | #define XK_Thai_sosala 0xdc8 1730 | #define XK_Thai_sorusi 0xdc9 1731 | #define XK_Thai_sosua 0xdca 1732 | #define XK_Thai_hohip 0xdcb 1733 | #define XK_Thai_lochula 0xdcc 1734 | #define XK_Thai_oang 0xdcd 1735 | #define XK_Thai_honokhuk 0xdce 1736 | #define XK_Thai_paiyannoi 0xdcf 1737 | #define XK_Thai_saraa 0xdd0 1738 | #define XK_Thai_maihanakat 0xdd1 1739 | #define XK_Thai_saraaa 0xdd2 1740 | #define XK_Thai_saraam 0xdd3 1741 | #define XK_Thai_sarai 0xdd4 1742 | #define XK_Thai_saraii 0xdd5 1743 | #define XK_Thai_saraue 0xdd6 1744 | #define XK_Thai_sarauee 0xdd7 1745 | #define XK_Thai_sarau 0xdd8 1746 | #define XK_Thai_sarauu 0xdd9 1747 | #define XK_Thai_phinthu 0xdda 1748 | #define XK_Thai_maihanakat_maitho 0xdde 1749 | #define XK_Thai_baht 0xddf 1750 | #define XK_Thai_sarae 0xde0 1751 | #define XK_Thai_saraae 0xde1 1752 | #define XK_Thai_sarao 0xde2 1753 | #define XK_Thai_saraaimaimuan 0xde3 1754 | #define XK_Thai_saraaimaimalai 0xde4 1755 | #define XK_Thai_lakkhangyao 0xde5 1756 | #define XK_Thai_maiyamok 0xde6 1757 | #define XK_Thai_maitaikhu 0xde7 1758 | #define XK_Thai_maiek 0xde8 1759 | #define XK_Thai_maitho 0xde9 1760 | #define XK_Thai_maitri 0xdea 1761 | #define XK_Thai_maichattawa 0xdeb 1762 | #define XK_Thai_thanthakhat 0xdec 1763 | #define XK_Thai_nikhahit 0xded 1764 | #define XK_Thai_leksun 0xdf0 1765 | #define XK_Thai_leknung 0xdf1 1766 | #define XK_Thai_leksong 0xdf2 1767 | #define XK_Thai_leksam 0xdf3 1768 | #define XK_Thai_leksi 0xdf4 1769 | #define XK_Thai_lekha 0xdf5 1770 | #define XK_Thai_lekhok 0xdf6 1771 | #define XK_Thai_lekchet 0xdf7 1772 | #define XK_Thai_lekpaet 0xdf8 1773 | #define XK_Thai_lekkao 0xdf9 1774 | #endif /* XK_THAI */ 1775 | 1776 | /* 1777 | * Korean 1778 | * Byte 3 = e 1779 | */ 1780 | 1781 | #ifdef XK_KOREAN 1782 | 1783 | #define XK_Hangul 0xff31 /* Hangul start/stop(toggle) */ 1784 | #define XK_Hangul_Start 0xff32 /* Hangul start */ 1785 | #define XK_Hangul_End 0xff33 /* Hangul end, English start */ 1786 | #define XK_Hangul_Hanja 0xff34 /* Start Hangul->Hanja Conversion */ 1787 | #define XK_Hangul_Jamo 0xff35 /* Hangul Jamo mode */ 1788 | #define XK_Hangul_Romaja 0xff36 /* Hangul Romaja mode */ 1789 | #define XK_Hangul_Codeinput 0xff37 /* Hangul code input mode */ 1790 | #define XK_Hangul_Jeonja 0xff38 /* Jeonja mode */ 1791 | #define XK_Hangul_Banja 0xff39 /* Banja mode */ 1792 | #define XK_Hangul_PreHanja 0xff3a /* Pre Hanja conversion */ 1793 | #define XK_Hangul_PostHanja 0xff3b /* Post Hanja conversion */ 1794 | #define XK_Hangul_SingleCandidate 0xff3c /* Single candidate */ 1795 | #define XK_Hangul_MultipleCandidate 0xff3d /* Multiple candidate */ 1796 | #define XK_Hangul_PreviousCandidate 0xff3e /* Previous candidate */ 1797 | #define XK_Hangul_Special 0xff3f /* Special symbols */ 1798 | #define XK_Hangul_switch 0xFF7E /* Alias for mode_switch */ 1799 | 1800 | /* Hangul Consonant Characters */ 1801 | #define XK_Hangul_Kiyeog 0xea1 1802 | #define XK_Hangul_SsangKiyeog 0xea2 1803 | #define XK_Hangul_KiyeogSios 0xea3 1804 | #define XK_Hangul_Nieun 0xea4 1805 | #define XK_Hangul_NieunJieuj 0xea5 1806 | #define XK_Hangul_NieunHieuh 0xea6 1807 | #define XK_Hangul_Dikeud 0xea7 1808 | #define XK_Hangul_SsangDikeud 0xea8 1809 | #define XK_Hangul_Rieul 0xea9 1810 | #define XK_Hangul_RieulKiyeog 0xeaa 1811 | #define XK_Hangul_RieulMieum 0xeab 1812 | #define XK_Hangul_RieulPieub 0xeac 1813 | #define XK_Hangul_RieulSios 0xead 1814 | #define XK_Hangul_RieulTieut 0xeae 1815 | #define XK_Hangul_RieulPhieuf 0xeaf 1816 | #define XK_Hangul_RieulHieuh 0xeb0 1817 | #define XK_Hangul_Mieum 0xeb1 1818 | #define XK_Hangul_Pieub 0xeb2 1819 | #define XK_Hangul_SsangPieub 0xeb3 1820 | #define XK_Hangul_PieubSios 0xeb4 1821 | #define XK_Hangul_Sios 0xeb5 1822 | #define XK_Hangul_SsangSios 0xeb6 1823 | #define XK_Hangul_Ieung 0xeb7 1824 | #define XK_Hangul_Jieuj 0xeb8 1825 | #define XK_Hangul_SsangJieuj 0xeb9 1826 | #define XK_Hangul_Cieuc 0xeba 1827 | #define XK_Hangul_Khieuq 0xebb 1828 | #define XK_Hangul_Tieut 0xebc 1829 | #define XK_Hangul_Phieuf 0xebd 1830 | #define XK_Hangul_Hieuh 0xebe 1831 | 1832 | /* Hangul Vowel Characters */ 1833 | #define XK_Hangul_A 0xebf 1834 | #define XK_Hangul_AE 0xec0 1835 | #define XK_Hangul_YA 0xec1 1836 | #define XK_Hangul_YAE 0xec2 1837 | #define XK_Hangul_EO 0xec3 1838 | #define XK_Hangul_E 0xec4 1839 | #define XK_Hangul_YEO 0xec5 1840 | #define XK_Hangul_YE 0xec6 1841 | #define XK_Hangul_O 0xec7 1842 | #define XK_Hangul_WA 0xec8 1843 | #define XK_Hangul_WAE 0xec9 1844 | #define XK_Hangul_OE 0xeca 1845 | #define XK_Hangul_YO 0xecb 1846 | #define XK_Hangul_U 0xecc 1847 | #define XK_Hangul_WEO 0xecd 1848 | #define XK_Hangul_WE 0xece 1849 | #define XK_Hangul_WI 0xecf 1850 | #define XK_Hangul_YU 0xed0 1851 | #define XK_Hangul_EU 0xed1 1852 | #define XK_Hangul_YI 0xed2 1853 | #define XK_Hangul_I 0xed3 1854 | 1855 | /* Hangul syllable-final (JongSeong) Characters */ 1856 | #define XK_Hangul_J_Kiyeog 0xed4 1857 | #define XK_Hangul_J_SsangKiyeog 0xed5 1858 | #define XK_Hangul_J_KiyeogSios 0xed6 1859 | #define XK_Hangul_J_Nieun 0xed7 1860 | #define XK_Hangul_J_NieunJieuj 0xed8 1861 | #define XK_Hangul_J_NieunHieuh 0xed9 1862 | #define XK_Hangul_J_Dikeud 0xeda 1863 | #define XK_Hangul_J_Rieul 0xedb 1864 | #define XK_Hangul_J_RieulKiyeog 0xedc 1865 | #define XK_Hangul_J_RieulMieum 0xedd 1866 | #define XK_Hangul_J_RieulPieub 0xede 1867 | #define XK_Hangul_J_RieulSios 0xedf 1868 | #define XK_Hangul_J_RieulTieut 0xee0 1869 | #define XK_Hangul_J_RieulPhieuf 0xee1 1870 | #define XK_Hangul_J_RieulHieuh 0xee2 1871 | #define XK_Hangul_J_Mieum 0xee3 1872 | #define XK_Hangul_J_Pieub 0xee4 1873 | #define XK_Hangul_J_PieubSios 0xee5 1874 | #define XK_Hangul_J_Sios 0xee6 1875 | #define XK_Hangul_J_SsangSios 0xee7 1876 | #define XK_Hangul_J_Ieung 0xee8 1877 | #define XK_Hangul_J_Jieuj 0xee9 1878 | #define XK_Hangul_J_Cieuc 0xeea 1879 | #define XK_Hangul_J_Khieuq 0xeeb 1880 | #define XK_Hangul_J_Tieut 0xeec 1881 | #define XK_Hangul_J_Phieuf 0xeed 1882 | #define XK_Hangul_J_Hieuh 0xeee 1883 | 1884 | /* Ancient Hangul Consonant Characters */ 1885 | #define XK_Hangul_RieulYeorinHieuh 0xeef 1886 | #define XK_Hangul_SunkyeongeumMieum 0xef0 1887 | #define XK_Hangul_SunkyeongeumPieub 0xef1 1888 | #define XK_Hangul_PanSios 0xef2 1889 | #define XK_Hangul_KkogjiDalrinIeung 0xef3 1890 | #define XK_Hangul_SunkyeongeumPhieuf 0xef4 1891 | #define XK_Hangul_YeorinHieuh 0xef5 1892 | 1893 | /* Ancient Hangul Vowel Characters */ 1894 | #define XK_Hangul_AraeA 0xef6 1895 | #define XK_Hangul_AraeAE 0xef7 1896 | 1897 | /* Ancient Hangul syllable-final (JongSeong) Characters */ 1898 | #define XK_Hangul_J_PanSios 0xef8 1899 | #define XK_Hangul_J_KkogjiDalrinIeung 0xef9 1900 | #define XK_Hangul_J_YeorinHieuh 0xefa 1901 | 1902 | /* Korean currency symbol */ 1903 | #define XK_Korean_Won 0xeff 1904 | 1905 | #endif /* XK_KOREAN */ 1906 | 1907 | /* Euro currency symbol */ 1908 | #define XK_EuroSign 0x20ac 1909 | 1910 | #endif 1911 | 1912 | 1913 | #endif // RFBCLIENTCLS_H 1914 | -------------------------------------------------------------------------------- /rfbclientwidgetcls.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Azril Azam 3 | * 4 | * 5 | * Desc 6 | * 7 | * This file is a part of the 100% Qt5 VNC RFB-CLIENT implementation without 8 | * using any 3rd party rfb library 9 | * 10 | * rfbclientwidgetcls.cpp 11 | * 12 | * 13 | * Qt5 RFB-CLIENT is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU Lesser General Public License as 15 | * published by the Free Software Foundation, either version 3 of the License, 16 | * or (at your option) any later version. 17 | * 18 | * Qt5 RFB-CLIENT is distributed in the hope that it will be useful, 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | * GNU Lesser General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU Lesser General Public License 24 | * along with Qt HTML platform plugin. If not, see 25 | * . 26 | */ 27 | 28 | #include "rfbclientwidgetcls.h" 29 | 30 | rfbclientwidgetcls::rfbclientwidgetcls(QWidget *parent) : 31 | QWidget(parent) 32 | { 33 | QPalette pl; 34 | 35 | this->vncClient.setParent(this); 36 | 37 | qDebug() << "GLClient init"; 38 | this->setAutoFillBackground(true); 39 | this->setWindowTitle("Testing"); 40 | this->setMouseTracking(true); 41 | this->mouseButtonPressed = 0; 42 | this->mouseX =0; 43 | this->mouseY = 0; 44 | pl.setColor(QPalette::Background,Qt::black); 45 | this->setPalette(pl); 46 | 47 | 48 | this->resize(640,480); 49 | this->setMinimumSize(640,480); 50 | this->setMaximumSize(640,480); 51 | 52 | this->holdCTRLKey = false; 53 | this->screenGrab = false; 54 | 55 | connect(&this->vncClient,SIGNAL(rfbResizeSignal(qint16,qint16,QString)),this,SLOT(vncResizeSlot(qint16,qint16,QString)),Qt::DirectConnection); 56 | connect(&this->vncClient,SIGNAL(rfbFrameBufferUpdateSignal()),this,SLOT(vncFrameBufferUpdateSlot())); 57 | connect(&this->vncClient,SIGNAL(rfbHostConnectedSignal()),this,SLOT(vncHostConnectedSlot())); 58 | connect(&this->vncClient,SIGNAL(rfbHostDisconnectedSignal()),this,SLOT(vncHostDisconnectedSlot())); 59 | connect(&this->vncClient,SIGNAL(rfbPauseSignal()),this,SLOT(vncHostPauseSlot())); 60 | 61 | this->vncConnected = false; 62 | this->myCursor = this->cursor(); 63 | 64 | this->lockedVNC = false; 65 | this->alreadyHasLockedImage = false; 66 | } 67 | 68 | rfbclientwidgetcls::~rfbclientwidgetcls() 69 | { 70 | qDebug() << "rfbclientwidgetcls is going to be deleted"; 71 | 72 | disconnect(&this->vncClient,SIGNAL(rfbResizeSignal(qint16,qint16,QString)),this,SLOT(vncResizeSlot(qint16,qint16,QString))); 73 | disconnect(&this->vncClient,SIGNAL(rfbFrameBufferUpdateSignal()),this,SLOT(vncFrameBufferUpdateSlot())); 74 | disconnect(&this->vncClient,SIGNAL(rfbHostConnectedSignal()),this,SLOT(vncHostConnectedSlot())); 75 | disconnect(&this->vncClient,SIGNAL(rfbHostDisconnectedSignal()),this,SLOT(vncHostDisconnectedSlot())); 76 | disconnect(&this->vncClient,SIGNAL(rfbPauseSignal()),this,SLOT(vncHostPauseSlot())); 77 | 78 | qDebug() << "rfbclientwidget deleted"; 79 | } 80 | 81 | bool rfbclientwidgetcls::connectVNCTCP(QString server, qint16 port) 82 | { 83 | return this->vncClient.connectToHostTCP(server,port); 84 | } 85 | 86 | bool rfbclientwidgetcls::connectVNCIPC(QString server) 87 | { 88 | return this->vncClient.connectToHostIPC(server); 89 | } 90 | 91 | void rfbclientwidgetcls::disconnectVNC() 92 | { 93 | this->vncClient.disconnectFromHost(); 94 | } 95 | 96 | void rfbclientwidgetcls::vncHostPauseSlot() 97 | { 98 | emit this->rfbClientPauseSignal(); 99 | this->repaint(); 100 | } 101 | 102 | void rfbclientwidgetcls::vncHostDisconnectedSlot() 103 | { 104 | if (this->screenGrab) 105 | { 106 | this->screenGrab = false; 107 | qApp->setOverrideCursor(this->myCursor); 108 | this->releaseKeyboard(); 109 | this->releaseMouse(); 110 | if (!this->lockedVNC) 111 | this->resize(640,480); 112 | } 113 | 114 | qDebug("done"); 115 | this->vncConnected = false; 116 | emit this->rfbClientDisconnectedSignal(); 117 | this->repaint(); 118 | 119 | } 120 | 121 | void rfbclientwidgetcls::vncHostConnectedSlot() 122 | { 123 | this->vncConnected = true; 124 | this->lockedVNC = false; 125 | this->alreadyHasLockedImage = false; 126 | 127 | this->resize(240,320); 128 | emit this->rfbClientConnectedSignal(); 129 | qDebug("Widget:: vnc host connected"); 130 | } 131 | 132 | void rfbclientwidgetcls::vncResizeSlot(qint16 width, qint16 height, QString serverVNCName) 133 | { 134 | this->setWindowTitle(serverVNCName); 135 | this->setWindowTitle("NEMD 3.0: WINXP"); 136 | this->oriRFBHeight = height; 137 | this->oriRFBWidth = width; 138 | 139 | //this->resize(width,height); 140 | this->setMinimumHeight(480); 141 | this->setMaximumHeight(height); 142 | this->setMinimumWidth(640); 143 | this->setMaximumWidth(width); 144 | this->resize(width,height); 145 | emit this->vncFrameResizeSignal(); 146 | } 147 | 148 | void rfbclientwidgetcls::vncFrameBufferUpdateSlot() 149 | { 150 | this->repaint(); 151 | } 152 | 153 | QImage rfbclientwidgetcls::getScreenCapture() 154 | { 155 | return this->vncClient.getVNCImage(); 156 | } 157 | 158 | void rfbclientwidgetcls::paintEvent(QPaintEvent *) 159 | { 160 | QPainter qp(this); 161 | //qDebug() << "Scaling Img"; 162 | QImage timg = this->vncClient.getVNCImage().scaled(this->geometry().width(),this->geometry().height(),Qt::IgnoreAspectRatio,Qt::SmoothTransformation); 163 | //QPixmap tpix = this->vncClient->getVNCPixmap().scaled(this->geometry().width(),this->geometry().height(),Qt::IgnoreAspectRatio,Qt::SmoothTransformation); 164 | 165 | 166 | //qp.drawPixmap(0,0,tpix); 167 | 168 | qp.drawImage(0,0,timg); 169 | qp.end(); 170 | //qDebug() << "update image"; 171 | } 172 | 173 | void rfbclientwidgetcls::closeEvent(QCloseEvent *e) 174 | { 175 | e->ignore(); 176 | this->vncClient.disconnectFromHost(); 177 | e->accept(); 178 | qDebug("widget close"); 179 | } 180 | 181 | void rfbclientwidgetcls::keyPressEvent(QKeyEvent *e) 182 | { 183 | if (this->lockedVNC) 184 | return; 185 | 186 | if (!this->vncConnected) 187 | return; 188 | 189 | if (e->key() == Qt::Key_Control) 190 | this->holdCTRLKey = true; 191 | 192 | if (!this->screenGrab) 193 | return; 194 | 195 | /*if ((this->holdCTRLKey) && (e->key() == Qt::Key_Alt)) 196 | { 197 | this->ungrabIO(); 198 | return; 199 | }*/ 200 | 201 | if (e->modifiers() == Qt::NoModifier) 202 | this->vncClient.sendServerKeyEvent(e->key(),1,false); 203 | else 204 | this->vncClient.sendServerKeyEvent(e->key(),1,true); 205 | 206 | } 207 | 208 | void rfbclientwidgetcls::keyReleaseEvent(QKeyEvent *e) 209 | { 210 | if (this->lockedVNC) 211 | return; 212 | 213 | if (!this->vncConnected) 214 | return; 215 | 216 | if (e->key() == Qt::Key_Control) 217 | this->holdCTRLKey = false; 218 | 219 | if (!this->screenGrab) 220 | return; 221 | 222 | 223 | if (e->modifiers() == Qt::NoModifier) 224 | this->vncClient.sendServerKeyEvent(e->key(),0,false); 225 | else 226 | this->vncClient.sendServerKeyEvent(e->key(),0,true); 227 | } 228 | 229 | void rfbclientwidgetcls::mouseMoveEvent(QMouseEvent *e) 230 | { 231 | if (this->lockedVNC) 232 | return; 233 | 234 | if (!this->vncConnected) 235 | return; 236 | 237 | if (!this->screenGrab) 238 | return; 239 | 240 | double a = this->oriRFBWidth; 241 | double b = this->geometry().width(); 242 | double c = this->oriRFBHeight; 243 | double d = this->geometry().height(); 244 | double fx = (a / b) * e->x(); 245 | double fy = (c / d) * e->y(); 246 | 247 | this->mouseX = fx; 248 | this->mouseY = fy; 249 | 250 | this->vncClient.sendServerPointerEvent(this->mouseX,this->mouseY,this->mouseButtonPressed); 251 | } 252 | 253 | void rfbclientwidgetcls::ungrabIO() 254 | { 255 | this->releaseKeyboard(); 256 | //this->releaseMouse(); 257 | this->screenGrab = false; 258 | //qApp->setOverrideCursor(this->myCursor); 259 | this->setCursor(this->myCursor); 260 | emit this->vncUngrabIOSIG(); 261 | } 262 | 263 | void rfbclientwidgetcls::grabIO() 264 | { 265 | this->grabKeyboard(); 266 | //this->grabMouse(); 267 | this->myCursor = this->cursor(); 268 | this->setCursor(QCursor(Qt::UpArrowCursor)); 269 | //qApp->setOverrideCursor(Qt::BlankCursor); 270 | //this->setCursor(QCursor(Qt::BlankCursor)); 271 | this->screenGrab = true; 272 | 273 | //qDebug() << this->mapToGlobal(QPoint(0,0)); 274 | 275 | //this->cursor().setPos(this->mapToGlobal(QPoint(0,0))); 276 | emit this->vncGrabIOSIG(); 277 | 278 | } 279 | 280 | void rfbclientwidgetcls::mousePressEvent(QMouseEvent *e) 281 | { 282 | //if (this->lockedVNC) 283 | // return; 284 | 285 | if (!this->vncConnected) 286 | return; 287 | 288 | /*if (!this->screenGrab) 289 | { 290 | this->grabIO(); 291 | return; 292 | }*/ 293 | 294 | double a = this->oriRFBWidth; 295 | double b = this->geometry().width(); 296 | double c = this->oriRFBHeight; 297 | double d = this->geometry().height(); 298 | double fx = (a / b) * e->x(); 299 | double fy = (c / d) * e->y(); 300 | 301 | this->mouseX = fx; 302 | this->mouseY = fy; 303 | 304 | switch (e->button()) 305 | { 306 | case Qt::LeftButton:this->mouseButtonPressed = 1;break; 307 | case Qt::RightButton:this->mouseButtonPressed = 4;break; 308 | case Qt::MiddleButton: this->mouseButtonPressed = 2;break; 309 | default: this->mouseButtonPressed = 0;break; 310 | } 311 | 312 | this->vncClient.sendServerPointerEvent(this->mouseX,this->mouseY,this->mouseButtonPressed); 313 | } 314 | 315 | void rfbclientwidgetcls::mouseReleaseEvent(QMouseEvent *e) 316 | { 317 | if (this->lockedVNC) 318 | return; 319 | 320 | if (!this->vncConnected) 321 | return; 322 | 323 | if (!this->screenGrab) 324 | return; 325 | 326 | 327 | double a = this->oriRFBWidth; 328 | double b = this->geometry().width(); 329 | double c = this->oriRFBHeight; 330 | double d = this->geometry().height(); 331 | double fx = (a / b) * e->x(); 332 | double fy = (c / d) * e->y(); 333 | 334 | this->mouseX = fx; 335 | this->mouseY = fy; 336 | 337 | /*if (this->mouseX < 0) 338 | this->mouseX = 0; 339 | 340 | if (this->mouseX > this->geometry().width()) 341 | this->mouseX = this->geometry().width(); 342 | 343 | if (this->mouseY < 0) 344 | this->mouseY = 0; 345 | 346 | if (this->mouseY > this->geometry().height()) 347 | this->mouseY = this->geometry().height();*/ 348 | 349 | this->mouseButtonPressed = 0; 350 | this->vncClient.sendServerPointerEvent(this->mouseX,this->mouseY,this->mouseButtonPressed); 351 | } 352 | 353 | void rfbclientwidgetcls::enterEvent(QEvent *) 354 | { 355 | if (!this->vncConnected) 356 | return; 357 | 358 | //dont grab if vnc is pause 359 | if (this->lockedVNC) 360 | return; 361 | this->grabIO(); 362 | /* 363 | this->screenGrab = true; 364 | this->myCursor = this->cursor(); 365 | //this->setCursor(QCursor(Qt::BlankCursor)); 366 | this->grabKeyboard(); 367 | emit this->vncFrameGetFocusSignal();*/ 368 | 369 | } 370 | 371 | void rfbclientwidgetcls::leaveEvent(QEvent *) 372 | { 373 | if (!this->vncConnected) 374 | return; 375 | 376 | if (this->lockedVNC) 377 | return; 378 | 379 | this->ungrabIO(); 380 | 381 | /* this->screenGrab = false; 382 | 383 | if (!this->vncConnected) 384 | return; 385 | 386 | //this->setCursor(this->myCursor); 387 | this->releaseKeyboard();*/ 388 | 389 | } 390 | 391 | void rfbclientwidgetcls::resizeEvent(QResizeEvent *) 392 | { 393 | 394 | } 395 | 396 | bool rfbclientwidgetcls::setPauseRFB() 397 | { 398 | if (this->vncConnected) 399 | { 400 | this->lockedVNC = true; 401 | if (this->vncClient.pauseRFB()) 402 | { 403 | this->ungrabIO(); 404 | this->vncConnected = false; 405 | qDebug() << "repaint for pause"; 406 | this->repaint(); 407 | return true; 408 | } 409 | } 410 | this->lockedVNC = false; 411 | return false; 412 | } 413 | 414 | bool rfbclientwidgetcls::setResumeRFB() 415 | { 416 | if (!this->vncConnected) 417 | { 418 | if (this->vncClient.resumeRFB()) 419 | { 420 | this->vncConnected = true; 421 | this->lockedVNC = false; 422 | qDebug() << "repaint for resume"; 423 | this->repaint(); 424 | return true; 425 | } 426 | } 427 | return false; 428 | } 429 | -------------------------------------------------------------------------------- /rfbclientwidgetcls.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Azril Azam 3 | * 4 | * 5 | * Desc 6 | * 7 | * This file is a part of the 100% Qt5 VNC RFB-CLIENT implementation without 8 | * using any 3rd party rfb library 9 | * 10 | * rfbclientwidgetcls.h defines all constant and functions that are required 11 | * to operates the client as widget container to display the rendered graphic bits 12 | * and to accept keyboard + mouse IO 13 | * 14 | * 15 | * Qt5 RFB-CLIENT is free software: you can redistribute it and/or 16 | * modify it under the terms of the GNU Lesser General Public License as 17 | * published by the Free Software Foundation, either version 3 of the License, 18 | * or (at your option) any later version. 19 | * 20 | * Qt5 RFB-CLIENT is distributed in the hope that it will be useful, 21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | * GNU Lesser General Public License for more details. 24 | * 25 | * You should have received a copy of the GNU Lesser General Public License 26 | * along with Qt HTML platform plugin. If not, see 27 | * . 28 | */ 29 | 30 | #ifndef RFBCLIENTWIDGETCLS_H 31 | #define RFBCLIENTWIDGETCLS_H 32 | 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include "rfbclientcls.h" 39 | #include 40 | #include 41 | 42 | class rfbclientwidgetcls : public QWidget 43 | { 44 | Q_OBJECT 45 | public: 46 | explicit rfbclientwidgetcls(QWidget *parent = 0); 47 | ~rfbclientwidgetcls(); 48 | 49 | bool connectVNCTCP(QString server, qint16 port=5900); 50 | bool connectVNCIPC(QString server); 51 | void disconnectVNC(); 52 | bool setPauseRFB(); 53 | bool setResumeRFB(); 54 | QImage getScreenCapture(); 55 | 56 | 57 | private: 58 | rfbclientcls vncClient; 59 | QPixmap vncPix; 60 | QImage vncImg; 61 | 62 | quint16 updateX, updateY; 63 | bool vncConnected; 64 | quint8 mouseButtonPressed; 65 | qint16 mouseX,mouseY; 66 | QCursor myCursor; 67 | 68 | qint16 oriRFBWidth, oriRFBHeight; 69 | 70 | bool holdCTRLKey; 71 | bool screenGrab; 72 | QPoint globalPos; 73 | 74 | QPoint widgetGlobalPos, cursorGlobalPos; 75 | 76 | bool lockedVNC; 77 | bool alreadyHasLockedImage; 78 | 79 | void grabIO(); 80 | void ungrabIO(); 81 | 82 | signals: 83 | void vncFrameResizeSignal(); 84 | void vncFrameGetFocusSignal(); 85 | void rfbClientConnectedSignal(); 86 | void rfbClientDisconnectedSignal(); 87 | void rfbClientPauseSignal(); 88 | void vncGrabIOSIG(); 89 | void vncUngrabIOSIG(); 90 | 91 | private slots: 92 | void vncResizeSlot(qint16 width, qint16 height,QString serverVNCName); 93 | void vncFrameBufferUpdateSlot(); 94 | void vncHostConnectedSlot(); 95 | void vncHostDisconnectedSlot(); 96 | void vncHostPauseSlot(); 97 | //void vncHostCursorPositionSlot(qint32 x, qint32 y); 98 | 99 | protected: 100 | void paintEvent(QPaintEvent *); 101 | void closeEvent (QCloseEvent *e); 102 | void keyPressEvent(QKeyEvent *e); 103 | void keyReleaseEvent(QKeyEvent *e); 104 | void mouseMoveEvent(QMouseEvent *e); 105 | void mousePressEvent(QMouseEvent *e); 106 | void mouseReleaseEvent(QMouseEvent *e); 107 | void enterEvent(QEvent *); 108 | void leaveEvent(QEvent *); 109 | void resizeEvent(QResizeEvent *); 110 | //void mouseDoubleClickEvent(QMouseEvent *e); 111 | 112 | public slots: 113 | 114 | }; 115 | 116 | #endif // RFBCLIENTWIDGETCLS_H 117 | -------------------------------------------------------------------------------- /vncclient.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2013-01-08T07:27:00 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core gui network 8 | QT += widgets 9 | 10 | TARGET = vncclient 11 | TEMPLATE = app 12 | 13 | QMAKE_CXXFLAGS_DEBUG *= -pg 14 | QMAKE_LFLAGS_DEBUG *= -pg 15 | 16 | 17 | SOURCES += main.cpp \ 18 | rfbclientcls.cpp \ 19 | vncclientwidget2cls.cpp \ 20 | rfbclientwidgetcls.cpp 21 | 22 | HEADERS += \ 23 | rfbclientcls.h \ 24 | vncclientwidget2cls.h \ 25 | rfbclientwidgetcls.h 26 | 27 | OTHER_FILES += 28 | -------------------------------------------------------------------------------- /vncclientwidget2cls.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Azril Azam 3 | * 4 | * 5 | * Desc 6 | * 7 | * This file is a part of the 100% Qt5 VNC RFB-CLIENT implementation without 8 | * using any 3rd party rfb library 9 | * 10 | * rfbclientwidget2cls.cpp 11 | * 12 | * 13 | * Qt5 RFB-CLIENT is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU Lesser General Public License as 15 | * published by the Free Software Foundation, either version 3 of the License, 16 | * or (at your option) any later version. 17 | * 18 | * Qt5 RFB-CLIENT is distributed in the hope that it will be useful, 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | * GNU Lesser General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU Lesser General Public License 24 | * along with Qt HTML platform plugin. If not, see 25 | * . 26 | */ 27 | 28 | #include "vncclientwidget2cls.h" 29 | 30 | vncclientwidget2cls::vncclientwidget2cls(QWidget *parent) : 31 | QWidget(parent) 32 | { 33 | QPalette pl; 34 | this->setAutoFillBackground(true); 35 | pl.setColor(QPalette::Background,Qt::black); 36 | this->setPalette(pl); 37 | 38 | this->widgetResizing = false; 39 | this->rfbWidget.setParent(this); 40 | this->rfbWidget.hide(); 41 | 42 | 43 | this->setMinimumSize(640,480); 44 | 45 | connect(&this->rfbWidget,SIGNAL(vncFrameResizeSignal()),this,SLOT(vncFrameResizeSlot())); 46 | connect(&this->rfbWidget,SIGNAL(rfbClientDisconnectedSignal()),this,SLOT(rfbClientDisconnectedSlot())); 47 | connect(&this->rfbWidget,SIGNAL(rfbClientPauseSignal()),this,SLOT(rfbClientPauseSlot())); 48 | connect(&this->rfbWidget,SIGNAL(vncGrabIOSIG()),this,SLOT(rfbClientScreenLockSlot())); 49 | connect(&this->rfbWidget,SIGNAL(vncUngrabIOSIG()),this,SLOT(rfbClientScreenUnlockSlot())); 50 | 51 | this->rfbWidget.move(0,0); 52 | this->rfbWidget.show(); 53 | this->resize(640,480); 54 | } 55 | 56 | vncclientwidget2cls::~vncclientwidget2cls() 57 | { 58 | 59 | disconnect(&this->rfbWidget,SIGNAL(vncFrameResizeSignal()),this,SLOT(vncFrameResizeSlot())); 60 | //disconnect(this->rfbWidget,SIGNAL(rfbClientConnectedSignal()),this,SLOT(vncClientConnectedSignal())); 61 | disconnect(&this->rfbWidget,SIGNAL(rfbClientDisconnectedSignal()),this,SLOT(rfbClientDisconnectedSlot())); 62 | disconnect(&this->rfbWidget,SIGNAL(rfbClientPauseSignal()),this,SLOT(rfbClientPauseSlot())); 63 | disconnect(&this->rfbWidget,SIGNAL(vncGrabIOSIG()),this,SLOT(rfbClientScreenLockSlot())); 64 | disconnect(&this->rfbWidget,SIGNAL(vncUngrabIOSIG()),this,SLOT(rfbClientScreenUnlockSlot())); 65 | } 66 | 67 | QImage vncclientwidget2cls::getScreenCapture() 68 | { 69 | return this->rfbWidget.getScreenCapture(); 70 | } 71 | 72 | void vncclientwidget2cls::changeEvent(QEvent *E) 73 | { 74 | //handle min max 75 | if (E->type() == QEvent::WindowStateChange) 76 | { 77 | QWindowStateChangeEvent* event = static_cast< QWindowStateChangeEvent* >( E); 78 | 79 | if( event->oldState() & Qt::WindowMinimized ) 80 | this->updateSize(); 81 | else if ( event->oldState() == Qt::WindowNoState && this->windowState() == Qt::WindowMaximized ) 82 | this->updateSize(); 83 | } 84 | } 85 | 86 | bool vncclientwidget2cls::connectVNCIPC(QString server) 87 | { 88 | qDebug() << "Connecting VNCIPC at" << server; 89 | return this->rfbWidget.connectVNCIPC(server); 90 | } 91 | 92 | bool vncclientwidget2cls::connectVNCTCP(QString server, qint16 port) 93 | { 94 | return this->rfbWidget.connectVNCTCP(server,port); 95 | } 96 | 97 | void vncclientwidget2cls::disconnectVNC() 98 | { 99 | this->rfbWidget.disconnectVNC(); 100 | } 101 | 102 | void vncclientwidget2cls::rfbClientDisconnectedSlot() 103 | { 104 | emit this->vncClientDisconnectedSignal(); 105 | } 106 | void vncclientwidget2cls::rfbClientPauseSlot() 107 | { 108 | emit this->vncClientPauseSignal(); 109 | } 110 | 111 | void vncclientwidget2cls::rfbClientConnectedSlot() 112 | { 113 | emit this->vncClientConnectedSignal(); 114 | } 115 | 116 | void vncclientwidget2cls::rfbClientScreenLockSlot() 117 | { 118 | emit this->vncClientScreenLockSignal(); 119 | } 120 | 121 | void vncclientwidget2cls::rfbClientScreenUnlockSlot() 122 | { 123 | emit this->vncClientScreenUnlockSignal(); 124 | } 125 | 126 | void vncclientwidget2cls::resizeEvent(QResizeEvent *) 127 | { 128 | this->updateSize(); 129 | } 130 | 131 | void vncclientwidget2cls::closeEvent(QCloseEvent *E) 132 | { 133 | E->ignore(); 134 | this->disconnectVNC(); 135 | E->accept(); 136 | } 137 | 138 | void vncclientwidget2cls::vncFrameResizeSlot() 139 | { 140 | qDebug() << "updateSize"; 141 | this->updateSize(); 142 | emit this->vncFrameResizeEvent(); 143 | } 144 | 145 | void vncclientwidget2cls::updateSize() 146 | { 147 | this->widgetResizing = true; 148 | 149 | //resize width to rfbwidget 150 | if (this->geometry().width() < this->rfbWidget.maximumWidth()) 151 | this->rfbWidget.resize(this->geometry().width(),this->rfbWidget.geometry().height()); 152 | 153 | //resize width to maximum 154 | if (this->geometry().width() >= this->rfbWidget.maximumWidth()) 155 | this->rfbWidget.resize(this->rfbWidget.maximumWidth(),this->rfbWidget.geometry().height()); 156 | 157 | //resize height to rfbwidget 158 | if (this->geometry().height() < this->rfbWidget.maximumHeight()) 159 | this->rfbWidget.resize(this->rfbWidget.geometry().width(),this->geometry().height()); 160 | 161 | if (this->geometry().height() >= this->rfbWidget.maximumHeight()) 162 | this->rfbWidget.resize(this->rfbWidget.geometry().width(),this->rfbWidget.maximumHeight()); 163 | 164 | if (this->geometry().width() < this->rfbWidget.maximumWidth()) 165 | this->rfbWidget.move(0,this->rfbWidget.y()); 166 | else 167 | { 168 | //move to center 169 | qint32 mX = this->rfbWidget.geometry().width() /2; 170 | qint32 rw = this->geometry().width()/2; 171 | qint32 tgtX = rw - mX; 172 | this->rfbWidget.move(tgtX,this->rfbWidget.y()); 173 | } 174 | 175 | if (this->geometry().height() < this->rfbWidget.maximumHeight()) 176 | this->rfbWidget.move(this->rfbWidget.x(),0); 177 | else 178 | { 179 | qint32 mY = this->rfbWidget.geometry().height()/2; 180 | qint32 rh = this->geometry().height()/2; 181 | qint32 tgtY = rh - mY; 182 | this->rfbWidget.move(this->rfbWidget.x(),tgtY); 183 | } 184 | 185 | 186 | this->widgetResizing = false; 187 | 188 | } 189 | 190 | bool vncclientwidget2cls::setPauseVNC() 191 | { 192 | return this->rfbWidget.setPauseRFB(); 193 | } 194 | 195 | bool vncclientwidget2cls::setResumeVNC() 196 | { 197 | return this->rfbWidget.setResumeRFB(); 198 | } 199 | -------------------------------------------------------------------------------- /vncclientwidget2cls.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Azril Azam 3 | * 4 | * 5 | * Desc 6 | * 7 | * This file is a part of the 100% Qt5 VNC RFB-CLIENT implementation without 8 | * using any 3rd party rfb library 9 | * 10 | * rfbclientwidget2cls.h defines all constant and functions that are required 11 | * to handle the rdb widget on GUI user experiance 12 | * 13 | * 14 | * Qt5 RFB-CLIENT is free software: you can redistribute it and/or 15 | * modify it under the terms of the GNU Lesser General Public License as 16 | * published by the Free Software Foundation, either version 3 of the License, 17 | * or (at your option) any later version. 18 | * 19 | * Qt5 RFB-CLIENT is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU Lesser General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU Lesser General Public License 25 | * along with Qt HTML platform plugin. If not, see 26 | * . 27 | */ 28 | 29 | #ifndef VNCCLIENTWIDGET2CLS_H 30 | #define VNCCLIENTWIDGET2CLS_H 31 | 32 | #include 33 | #include "rfbclientwidgetcls.h" 34 | 35 | class vncclientwidget2cls : public QWidget 36 | { 37 | Q_OBJECT 38 | 39 | public: 40 | explicit vncclientwidget2cls(QWidget *parent = 0); 41 | ~vncclientwidget2cls(); 42 | 43 | bool connectVNCTCP(QString server, qint16 port=5900); 44 | bool connectVNCIPC(QString server); 45 | void disconnectVNC(); 46 | void updateSize(); 47 | bool setPauseVNC(); 48 | bool setResumeVNC(); 49 | QImage getScreenCapture(); 50 | 51 | private: 52 | rfbclientwidgetcls rfbWidget; 53 | bool widgetResizing; 54 | 55 | signals: 56 | 57 | void vncFrameResizeEvent(); 58 | void vncClientConnectedSignal(); 59 | void vncClientDisconnectedSignal(); 60 | void vncClientPauseSignal(); 61 | void vncClientScreenLockSignal(); 62 | void vncClientScreenUnlockSignal(); 63 | 64 | public slots: 65 | 66 | private slots: 67 | void vncFrameResizeSlot(); 68 | void rfbClientConnectedSlot(); 69 | void rfbClientDisconnectedSlot(); 70 | void rfbClientPauseSlot(); 71 | void rfbClientScreenLockSlot(); 72 | void rfbClientScreenUnlockSlot(); 73 | 74 | protected: 75 | void resizeEvent(QResizeEvent *); 76 | void changeEvent(QEvent *E); 77 | void closeEvent(QCloseEvent *E); 78 | }; 79 | 80 | 81 | 82 | #endif // VNCCLIENTWIDGET2CLS_H 83 | --------------------------------------------------------------------------------