summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qdnd_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2011-06-05 23:29:26 +0200
committerLars Knoll <lars.knoll@nokia.com>2011-06-07 15:50:53 +0200
commitc3f9de62966d32d8e33d62eb374fe2657a4cfebe (patch)
treee8c36f4d887d3647a2ff71fd534cc1a550553822 /src/gui/kernel/qdnd_p.h
parent30b7c6512cde501e0e5da6e2a6dd2d8113092269 (diff)
Implement XDnD in the xcb plugin
Ported most of the code to support dragging from qdnd_x11.cpp to xcb. Some features are still not working 100% correct, but it's becoming usable. Reviewed-by: Samuel
Diffstat (limited to 'src/gui/kernel/qdnd_p.h')
-rw-r--r--src/gui/kernel/qdnd_p.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/gui/kernel/qdnd_p.h b/src/gui/kernel/qdnd_p.h
index 3ba2869a8f..2eebcf6158 100644
--- a/src/gui/kernel/qdnd_p.h
+++ b/src/gui/kernel/qdnd_p.h
@@ -59,6 +59,7 @@
#include "QtGui/qdrag.h"
#include "QtGui/qpixmap.h"
#include "QtGui/qcursor.h"
+#include "QtGui/qwindow.h"
#include "QtCore/qpoint.h"
#include "private/qobject_p.h"
@@ -108,6 +109,44 @@ public:
Qt::DropAction defaultDropAction;
};
+class QShapedPixmapWindow : public QWindow {
+ QPixmap pixmap;
+public:
+ QShapedPixmapWindow() :
+ QWindow(0)
+ {
+ setWindowFlags(Qt::Tool | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint);
+ // ### Should we set the surface type to raster?
+ // ### FIXME
+// setAttribute(Qt::WA_TransparentForMouseEvents);
+ }
+
+ void move(const QPoint &p) {
+ QRect g = geometry();
+ g.setTopLeft(p);
+ setGeometry(g);
+ }
+ void setPixmap(QPixmap pm)
+ {
+ pixmap = pm;
+ // ###
+// if (!pixmap.mask().isNull()) {
+// setMask(pixmap.mask());
+// } else {
+// clearMask();
+// }
+ setGeometry(QRect(geometry().topLeft(), pm.size()));
+ }
+
+ // ### Get it painted again!
+// void paintEvent(QPaintEvent*)
+// {
+// QPainter p(this);
+// p.drawPixmap(0,0,pixmap);
+// }
+};
+
+
class Q_GUI_EXPORT QDragManager : public QObject {
Q_OBJECT
@@ -159,6 +198,8 @@ public:
// Shift/Ctrl handling, and final drop status
Qt::DropAction global_accepted_action;
+ QShapedPixmapWindow *shapedPixmapWindow;
+
private:
QMimeData *platformDropData;