diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2010-02-05 15:25:23 +0100 |
---|---|---|
committer | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2010-02-05 16:22:43 +0100 |
commit | 1efb2693b15f23f269be1db393a83af132924e06 (patch) | |
tree | 8ed2801a64ca3e37233b984d252e44c59841d96e /src/gui/image/qpixmap_x11.cpp | |
parent | 00d08740a1a5234c7f73eb634dcd45092b97dacd (diff) |
Added new mouse cursor types.
Added Qt::DragCopyCursor, DragMoveCursor and DragLinkCursor that are already
used internally for drag-n-drop, but were not exposed before. On X11 made them
use themed cursors through the Xcursor library.
Drag-n-drop now use these new cursors.
Inspired-by: David Benjamin MR#2215
Reviewed-by: Bradley T. Hughes
Diffstat (limited to 'src/gui/image/qpixmap_x11.cpp')
-rw-r--r-- | src/gui/image/qpixmap_x11.cpp | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/gui/image/qpixmap_x11.cpp b/src/gui/image/qpixmap_x11.cpp index 0e66e093c6..4de5bc4035 100644 --- a/src/gui/image/qpixmap_x11.cpp +++ b/src/gui/image/qpixmap_x11.cpp @@ -1141,7 +1141,7 @@ void QX11PixmapData::fromImage(const QImage &img, } } -void QX11PixmapData::bitmapFromImage(const QImage &image) +Qt::HANDLE QX11PixmapData::createBitmapFromImage(const QImage &image) { QImage img = image.convertToFormat(QImage::Format_MonoLSB); const QRgb c0 = QColor(Qt::black).rgb(); @@ -1154,10 +1154,8 @@ void QX11PixmapData::bitmapFromImage(const QImage &image) char *bits; uchar *tmp_bits; - w = img.width(); - h = img.height(); - d = 1; - is_null = (w <= 0 || h <= 0); + int w = img.width(); + int h = img.height(); int bpl = (w + 7) / 8; int ibpl = img.bytesPerLine(); if (bpl != ibpl) { @@ -1176,18 +1174,26 @@ void QX11PixmapData::bitmapFromImage(const QImage &image) bits = (char *)img.bits(); tmp_bits = 0; } - hd = (Qt::HANDLE)XCreateBitmapFromData(xinfo.display(), - RootWindow(xinfo.display(), xinfo.screen()), + Qt::HANDLE hd = (Qt::HANDLE)XCreateBitmapFromData(X11->display, + QX11Info::appRootWindow(), bits, w, h); + if (tmp_bits) // Avoid purify complaint + delete [] tmp_bits; + return hd; +} +void QX11PixmapData::bitmapFromImage(const QImage &image) +{ + w = image.width(); + h = image.height(); + d = 1; + is_null = (w <= 0 || h <= 0); + hd = createBitmapFromImage(image); #ifndef QT_NO_XRENDER if (X11->use_xrender) picture = XRenderCreatePicture(X11->display, hd, XRenderFindStandardFormat(X11->display, PictStandardA1), 0, 0); #endif // QT_NO_XRENDER - - if (tmp_bits) // Avoid purify complaint - delete [] tmp_bits; } void QX11PixmapData::fill(const QColor &fillColor) |