From 576d4a1cce4a58cca9dddfb8b3878b66169aabcf Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Thu, 17 May 2012 05:16:10 +0900 Subject: [PATCH] Fix xcb plugin compilation for -qconfig large MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I1ee1fb9c140396e83272d607ee4dd63ce2c50b8d Reviewed-by: Samuel Rødal Reviewed-by: Lars Knoll --- src/plugins/platforms/xcb/qxcbclipboard.cpp | 4 ++++ src/plugins/platforms/xcb/qxcbclipboard.h | 4 ++++ src/plugins/platforms/xcb/qxcbconnection.cpp | 22 ++++++++++++++++++- src/plugins/platforms/xcb/qxcbconnection.h | 8 +++++++ src/plugins/platforms/xcb/qxcbdrag.cpp | 4 ++++ src/plugins/platforms/xcb/qxcbdrag.h | 4 ++++ src/plugins/platforms/xcb/qxcbintegration.cpp | 4 ++++ src/plugins/platforms/xcb/qxcbintegration.h | 4 ++++ src/plugins/platforms/xcb/qxcbmime.cpp | 4 ++++ src/plugins/platforms/xcb/qxcbmime.h | 4 ++++ src/plugins/platforms/xcb/qxcbwindow.cpp | 4 ++++ 11 files changed, 65 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/xcb/qxcbclipboard.cpp b/src/plugins/platforms/xcb/qxcbclipboard.cpp index 63ce73993f..6852d964d4 100644 --- a/src/plugins/platforms/xcb/qxcbclipboard.cpp +++ b/src/plugins/platforms/xcb/qxcbclipboard.cpp @@ -56,6 +56,8 @@ QT_BEGIN_NAMESPACE +#ifndef QT_NO_CLIPBOARD + class QXcbClipboardMime : public QXcbMime { Q_OBJECT @@ -862,6 +864,8 @@ QByteArray QXcbClipboard::getSelection(xcb_atom_t selection, xcb_atom_t target, return buf; } +#endif // QT_NO_CLIPBOARD + QT_END_NAMESPACE #include "qxcbclipboard.moc" diff --git a/src/plugins/platforms/xcb/qxcbclipboard.h b/src/plugins/platforms/xcb/qxcbclipboard.h index 1b3f12b279..d279355e13 100644 --- a/src/plugins/platforms/xcb/qxcbclipboard.h +++ b/src/plugins/platforms/xcb/qxcbclipboard.h @@ -49,6 +49,8 @@ QT_BEGIN_NAMESPACE +#ifndef QT_NO_CLIPBOARD + class QXcbConnection; class QXcbScreen; class QXcbClipboardMime; @@ -107,6 +109,8 @@ private: }; +#endif // QT_NO_CLIPBOARD + QT_END_NAMESPACE #endif // QXCBCLIPBOARD_H diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 3d17e38159..d9c3352747 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -186,8 +186,12 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, const char m_wmSupport.reset(new QXcbWMSupport(this)); m_keyboard = new QXcbKeyboard(this); +#ifndef QT_NO_CLIPBOARD m_clipboard = new QXcbClipboard(this); +#endif +#ifndef QT_NO_DRAGANDDROP m_drag = new QXcbDrag(this); +#endif #ifdef XCB_USE_DRI2 initializeDri2(); @@ -197,8 +201,12 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, const char QXcbConnection::~QXcbConnection() { +#ifndef QT_NO_CLIPBOARD delete m_clipboard; - +#endif +#ifndef QT_NO_DRAGANDDROP + delete m_drag; +#endif // Delete screens in reverse order to avoid crash in case of multiple screens while (!m_screens.isEmpty()) delete m_screens.takeLast(); @@ -562,15 +570,23 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event) case XCB_SELECTION_REQUEST: { xcb_selection_request_event_t *sr = (xcb_selection_request_event_t *)event; +#ifndef QT_NO_DRAGANDDROP if (sr->selection == atom(QXcbAtom::XdndSelection)) m_drag->handleSelectionRequest(sr); else +#endif + { +#ifndef QT_NO_CLIPBOARD m_clipboard->handleSelectionRequest(sr); +#endif + } break; } case XCB_SELECTION_CLEAR: setTime(((xcb_selection_clear_event_t *)event)->time); +#ifndef QT_NO_CLIPBOARD m_clipboard->handleSelectionClearRequest((xcb_selection_clear_event_t *)event); +#endif handled = true; break; case XCB_SELECTION_NOTIFY: @@ -594,7 +610,9 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event) if (!handled) { if (response_type == xfixes_first_event + XCB_XFIXES_SELECTION_NOTIFY) { setTime(((xcb_xfixes_selection_notify_event_t *)event)->timestamp); +#ifndef QT_NO_CLIPBOARD m_clipboard->handleXFixesSelectionRequest((xcb_xfixes_selection_notify_event_t *)event); +#endif handled = true; } else if (has_randr_extension && response_type == xrandr_first_event + XCB_RANDR_SCREEN_CHANGE_NOTIFY) { xcb_randr_screen_change_notify_event_t *change_event = (xcb_randr_screen_change_notify_event_t *)event; @@ -744,11 +762,13 @@ void QXcbConnection::handleClientMessageEvent(const xcb_client_message_event_t * if (event->format != 32) return; +#ifndef QT_NO_DRAGANDDROP if (event->type == atom(QXcbAtom::XdndStatus)) { drag()->handleStatus(event); } else if (event->type == atom(QXcbAtom::XdndFinished)) { drag()->handleFinished(event); } +#endif QXcbWindow *window = platformWindowFromId(event->window); if (!window) diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 86eaf5d7d9..9fbeb9f5f6 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -310,8 +310,12 @@ public: QXcbKeyboard *keyboard() const { return m_keyboard; } +#ifndef QT_NO_CLIPBOARD QXcbClipboard *clipboard() const { return m_clipboard; } +#endif +#ifndef QT_NO_DRAGANDDROP QXcbDrag *drag() const { return m_drag; } +#endif QXcbWMSupport *wmSupport() const { return m_wmSupport.data(); } @@ -393,8 +397,12 @@ private: xcb_window_t m_connectionEventListener; QXcbKeyboard *m_keyboard; +#ifndef QT_NO_CLIPBOARD QXcbClipboard *m_clipboard; +#endif +#ifndef QT_NO_DRAGANDDROP QXcbDrag *m_drag; +#endif QScopedPointer m_wmSupport; QXcbNativeInterface *m_nativeInterface; diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp index 42c240ef8e..3299180577 100644 --- a/src/plugins/platforms/xcb/qxcbdrag.cpp +++ b/src/plugins/platforms/xcb/qxcbdrag.cpp @@ -61,6 +61,8 @@ QT_BEGIN_NAMESPACE +#ifndef QT_NO_DRAGANDDROP + //#define DND_DEBUG #ifdef DND_DEBUG #define DEBUG qDebug @@ -1261,4 +1263,6 @@ QStringList QXcbDropData::formats_sys() const return formats; } +#endif // QT_NO_DRAGANDDROP + QT_END_NAMESPACE diff --git a/src/plugins/platforms/xcb/qxcbdrag.h b/src/plugins/platforms/xcb/qxcbdrag.h index 595018458f..b404d26ed5 100644 --- a/src/plugins/platforms/xcb/qxcbdrag.h +++ b/src/plugins/platforms/xcb/qxcbdrag.h @@ -59,6 +59,8 @@ QT_BEGIN_NAMESPACE +#ifndef QT_NO_DRAGANDDROP + class QMouseEvent; class QWindow; class QXcbConnection; @@ -161,6 +163,8 @@ private: xcb_window_t findRealWindow(const QPoint & pos, xcb_window_t w, int md, bool ignoreNonXdndAwareWindows); }; +#endif // QT_NO_DRAGANDDROP + QT_END_NAMESPACE #endif diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 8dba6e1464..9fbf21abc2 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -226,15 +226,19 @@ QPlatformNativeInterface * QXcbIntegration::nativeInterface() const return m_nativeInterface.data(); } +#ifndef QT_NO_CLIPBOARD QPlatformClipboard *QXcbIntegration::clipboard() const { return m_connections.at(0)->clipboard(); } +#endif +#ifndef QT_NO_DRAGANDDROP QPlatformDrag *QXcbIntegration::drag() const { return m_connections.at(0)->drag(); } +#endif QPlatformInputContext *QXcbIntegration::inputContext() const { diff --git a/src/plugins/platforms/xcb/qxcbintegration.h b/src/plugins/platforms/xcb/qxcbintegration.h index b2245e4de0..1eeaa6e914 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.h +++ b/src/plugins/platforms/xcb/qxcbintegration.h @@ -72,8 +72,12 @@ public: QPlatformNativeInterface *nativeInterface()const; +#ifndef QT_NO_CLIPBOARD QPlatformClipboard *clipboard() const; +#endif +#ifndef QT_NO_DRAGANDDROP QPlatformDrag *drag() const; +#endif QPlatformInputContext *inputContext() const; diff --git a/src/plugins/platforms/xcb/qxcbmime.cpp b/src/plugins/platforms/xcb/qxcbmime.cpp index bcc94baed7..6676af0a05 100644 --- a/src/plugins/platforms/xcb/qxcbmime.cpp +++ b/src/plugins/platforms/xcb/qxcbmime.cpp @@ -54,6 +54,8 @@ QT_BEGIN_NAMESPACE +#ifndef QT_NO_DRAGANDDROP + QXcbMime::QXcbMime() : QInternalMimeData() { } @@ -289,4 +291,6 @@ xcb_atom_t QXcbMime::mimeAtomForFormat(QXcbConnection *connection, const QString return 0; } +#endif // QT_NO_DRAGANDDROP + QT_END_NAMESPACE diff --git a/src/plugins/platforms/xcb/qxcbmime.h b/src/plugins/platforms/xcb/qxcbmime.h index e6a7ccc834..c7bbc2c4fa 100644 --- a/src/plugins/platforms/xcb/qxcbmime.h +++ b/src/plugins/platforms/xcb/qxcbmime.h @@ -51,6 +51,8 @@ QT_BEGIN_NAMESPACE +#ifndef QT_NO_DRAGANDDROP + class QXcbMime : public QInternalMimeData { Q_OBJECT public: @@ -67,6 +69,8 @@ public: const QList &atoms, QByteArray *requestedEncoding); }; +#endif // QT_NO_DRAGANDDROP + QT_END_NAMESPACE #endif // QXCBMIME_H diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index b319c358d8..168a4419c5 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -376,7 +376,9 @@ void QXcbWindow::create() if (window()->windowFlags() & Qt::WindowTransparentForInput) setTransparentForMouseEvents(true); +#ifndef QT_NO_DRAGANDDROP connection()->drag()->dndEnable(this, true); +#endif } QXcbWindow::~QXcbWindow() @@ -1298,6 +1300,7 @@ void QXcbWindow::handleClientMessageEvent(const xcb_client_message_event_t *even } else { qWarning() << "QXcbWindow: Unhandled WM_PROTOCOLS message:" << connection()->atomName(event->data.data32[0]); } +#ifndef QT_NO_DRAGANDDROP } else if (event->type == atom(QXcbAtom::XdndEnter)) { connection()->drag()->handleEnter(window(), event); } else if (event->type == atom(QXcbAtom::XdndPosition)) { @@ -1306,6 +1309,7 @@ void QXcbWindow::handleClientMessageEvent(const xcb_client_message_event_t *even connection()->drag()->handleLeave(window(), event); } else if (event->type == atom(QXcbAtom::XdndDrop)) { connection()->drag()->handleDrop(window(), event); +#endif } else if (event->type == atom(QXcbAtom::_XEMBED)) { // QSystemTrayIcon } else { qWarning() << "QXcbWindow: Unhandled client message:" << connection()->atomName(event->type);