Changeset 59344 in vbox
- Timestamp:
- Jan 14, 2016 12:25:30 PM (9 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 2 edited
-
UIMachineView.cpp (modified) (4 diffs)
-
UIMachineView.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
r59079 r59344 97 97 #endif /* Q_WS_MAC */ 98 98 #ifdef Q_WS_X11 99 # if QT_VERSION >= 0x050000 100 # include <xcb/xcb.h> 101 # else /* QT_VERSION < 0x050000 */ 99 # if QT_VERSION < 0x050000 102 100 # include <X11/XKBlib.h> 103 101 # ifdef KeyPress … … 111 109 # undef FocusIn 112 110 # endif /* KeyPress */ 113 # endif /* QT_VERSION < 0x050000 */ 111 # else /* QT_VERSION >= 0x050000 */ 112 # include <xcb/xcb.h> 113 # endif /* QT_VERSION >= 0x050000 */ 114 114 #endif /* Q_WS_X11 */ 115 115 … … 122 122 #endif 123 123 124 125 #ifdef Q_WS_X11126 # if QT_VERSION >= 0x050000127 /*********************************************************************************************************************************128 * Class UIViewport implementation. *129 *********************************************************************************************************************************/130 131 UIViewport::UIViewport(UIMachineView *pParent)132 : QWidget(pParent)133 , m_pMachineView(pParent)134 {135 }136 137 bool UIViewport::nativeEvent(const QByteArray &eventType, void *pMessage, long *pResult)138 {139 /* Make sure it's XCB event: */140 AssertReturn(eventType == "xcb_generic_event_t", QWidget::nativeEvent(eventType, pMessage, pResult));141 xcb_generic_event_t *pEvent = static_cast<xcb_generic_event_t*>(pMessage);142 143 /* Check if some XCB event should be filtered out.144 * Returning @c true means filtering-out,145 * Returning @c false means passing event to Qt. */146 switch (pEvent->response_type & ~0x80)147 {148 /* Watch for key-events: */149 case XCB_KEY_PRESS:150 case XCB_KEY_RELEASE:151 {152 /* Delegate key-event handling to the keyboard-handler: */153 return machineView()->machineLogic()->keyboardHandler()->nativeEventFilter(pMessage, machineView()->screenId());154 }155 default:156 break;157 }158 159 /* Call to base-class: */160 return QWidget::nativeEvent(eventType, pMessage, pResult);161 }162 # endif /* QT_VERSION >= 0x050000 */163 #endif /* Q_WS_X11 */164 165 /*********************************************************************************************************************************166 * Class UIMachineView implementation. *167 *********************************************************************************************************************************/168 124 169 125 /* static */ … … 668 624 { 669 625 /* Prepare viewport: */ 670 #ifdef Q_WS_X11671 # if QT_VERSION >= 0x050000672 setViewport(new UIViewport(this));673 # endif /* QT_VERSION >= 0x050000 */674 #endif /* Q_WS_X11 */675 626 AssertPtrReturnVoid(viewport()); 676 627 { -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h
r59342 r59344 58 58 class CSession; 59 59 #ifdef Q_WS_X11 60 # if QT_VERSION >= 0x050000 61 class UIMachineView; 62 # else /* QT_VERSION < 0x050000 */ 60 # if QT_VERSION < 0x050000 63 61 typedef union _XEvent XEvent; 64 62 # endif /* QT_VERSION < 0x050000 */ … … 68 66 #endif /* VBOX_WITH_DRAG_AND_DROP */ 69 67 70 71 #ifdef Q_WS_X1172 # if QT_VERSION >= 0x05000073 /** X11: Qt5: QWidget extension used as UIMachineView's viewport.74 * This class is currently required because of Qt5 policy change about75 * native keyboard events now being delivered directly to a focus-holder76 * (UIMachineView's viewport) instead of delivering it to top-most widget77 * (UIMachineWindow) and then propagating down to the focus-holder, which78 * with Qt4 allowed us to handle such events in focus-holder's focus-proxy79 * (UIMachineView) instead of focus-holder itself. */80 class UIViewport : public QWidget81 {82 Q_OBJECT;83 84 public:85 86 /** Constructor which brings the @a pParent machine-view. */87 UIViewport(UIMachineView *pParent);88 89 /** Returns the reference to the parent machine-view. */90 const UIMachineView* machineView() { return m_pMachineView; }91 92 protected:93 94 /** Qt5: Handles any native @a pMessage of the predefined @a eventType,95 * allowing to set the @a pResult to be returned to the issuer. */96 virtual bool nativeEvent(const QByteArray &eventType, void *pMessage, long *pResult);97 98 private:99 100 /** Holds the reference to the parent machine-view. */101 const UIMachineView *m_pMachineView;102 };103 # endif /* QT_VERSION >= 0x050000 */104 #endif /* Q_WS_X11 */105 68 106 69 class UIMachineView : public QAbstractScrollArea … … 453 416 friend class UIFrameBufferPrivate; 454 417 friend class VBoxOverlayFrameBuffer; 455 #ifdef Q_WS_X11456 # if QT_VERSION >= 0x050000457 friend class UIViewport;458 # endif /* QT_VERSION >= 0x050000 */459 #endif /* Q_WS_X11 */460 418 }; 461 419
Note:
See TracChangeset
for help on using the changeset viewer.

