Changeset 58921 in vbox
- Timestamp:
- Nov 30, 2015 7:07:00 PM (9 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/widgets
- Files:
-
- 2 edited
-
UIHostComboEditor.cpp (modified) (4 diffs)
-
UIHostComboEditor.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIHostComboEditor.cpp
r53221 r58921 22 22 /* Qt includes: */ 23 23 # include <QApplication> 24 # include <QKeyEvent> 24 25 # include <QStyleOption> 25 26 # include <QStylePainter> 26 # include <QKeyEvent>27 27 # include <QTimer> 28 # ifdef Q_WS_X11 29 # include <QX11Info> 30 # endif /* Q_WS_X11 */ 28 31 29 32 /* GUI includes: */ … … 31 34 # include "UIExtraDataDefs.h" 32 35 # include "UIIconPool.h" 36 # include "VBoxGlobal.h" 33 37 # include "QIToolButton.h" 34 # include "VBoxGlobal.h" 38 #ifdef Q_WS_MAC 39 # include "UICocoaApplication.h" 40 # include "VBoxUtils-darwin.h" 41 #endif /* Q_WS_MAC */ 35 42 36 43 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 37 44 45 /* GUI includes: */ 46 #ifdef Q_WS_MAC 47 # include "DarwinKeyboard.h" 48 #endif /* Q_WS_MAC */ 38 49 #ifdef Q_WS_WIN 39 # undef LOWORD40 # undef HIWORD41 # undef LOBYTE42 # undef HIBYTE43 # include <windows.h>44 50 # include "WinKeyboard.h" 45 51 #endif /* Q_WS_WIN */ 46 52 #ifdef Q_WS_X11 53 # include "XKeyboard.h" 54 #endif /* Q_WS_X11 */ 55 56 /* External includes: */ 57 #ifdef Q_WS_MAC 58 # include <Carbon/Carbon.h> 59 #endif /* Q_WS_MAC */ 47 60 #ifdef Q_WS_X11 48 61 # include <X11/Xlib.h> 49 62 # include <X11/Xutil.h> 50 63 # include <X11/keysym.h> 51 # ifdef KeyPress 52 const int XKeyPress = KeyPress; 53 const int XKeyRelease = KeyRelease; 54 # undef KeyPress 55 # undef KeyRelease 56 # endif /* KeyPress */ 57 # include "XKeyboard.h" 58 # include <QX11Info> 64 # if QT_VERSION >= 0x050000 65 # include <xcb/xcb.h> 66 # endif /* QT_VERSION >= 0x050000 */ 59 67 #endif /* Q_WS_X11 */ 60 61 #ifdef Q_WS_MAC62 # include "UICocoaApplication.h"63 # include "DarwinKeyboard.h"64 # include "VBoxUtils.h"65 # include <Carbon/Carbon.h>66 #endif /* Q_WS_MAC */67 68 68 69 /* Namespaces: */ … … 518 519 519 520 #ifdef Q_WS_X11 520 #pragma GCC diagnostic push 521 #pragma GCC diagnostic ignored "-Wdeprecated-declarations" 521 # pragma GCC diagnostic push 522 # pragma GCC diagnostic ignored "-Wdeprecated-declarations" 523 # if QT_VERSION >= 0x050000 524 bool UIHostComboEditorPrivate::nativeEvent(const QByteArray &eventType, void *pMessage, long *pResult) 525 { 526 /* Make sure it's XCB event: */ 527 AssertReturn(eventType == "xcb_generic_event_t", QLineEdit::nativeEvent(eventType, pMessage, pResult)); 528 xcb_generic_event_t *pEvent = static_cast<xcb_generic_event_t*>(pMessage); 529 530 /* Check if some XCB event should be filtered out. 531 * Returning @c true means filtering-out, 532 * Returning @c false means passing event to Qt. */ 533 switch (pEvent->response_type & ~0x80) 534 { 535 /* Watch for key-events: */ 536 case XCB_KEY_PRESS: 537 case XCB_KEY_RELEASE: 538 { 539 /* Parse key-event: */ 540 xcb_key_press_event_t *pKeyEvent = static_cast<xcb_key_press_event_t*>(pMessage); 541 const KeySym ks = ::XKeycodeToKeysym(QX11Info::display(), pKeyEvent->detail, 0); 542 const int iKeySym = static_cast<const int>(ks); 543 /* Handle key-event: */ 544 return processKeyEvent(iKeySym, (pEvent->response_type & ~0x80) == XCB_KEY_PRESS); 545 } 546 default: 547 break; 548 } 549 550 /* Call to base-class: */ 551 return QLineEdit::nativeEvent(eventType, pMessage, pResult); 552 } 553 # else /* QT_VERSION < 0x050000 */ 522 554 bool UIHostComboEditorPrivate::x11Event(XEvent *pEvent) 523 555 { … … 542 574 return false; 543 575 } 544 #pragma GCC diagnostic pop 576 # endif /* QT_VERSION < 0x050000 */ 577 # pragma GCC diagnostic pop 545 578 #endif /* Q_WS_X11 */ 546 579 -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIHostComboEditor.h
r55401 r58921 147 147 #endif /* Q_WS_WIN */ 148 148 #ifdef Q_WS_X11 149 # if QT_VERSION >= 0x050000 150 bool nativeEvent(const QByteArray &eventType, void *pMessage, long *pResult); 151 # else /* QT_VERSION < 0x050000 */ 149 152 bool x11Event(XEvent *pEvent); 153 # endif /* QT_VERSION < 0x050000 */ 150 154 #endif /* Q_WS_X11 */ 151 155 #ifdef Q_WS_MAC
Note:
See TracChangeset
for help on using the changeset viewer.

