KShare/platformspecifics/u32/u32backend.cpp

22 lines
799 B
C++
Raw Normal View History

2017-05-13 11:03:46 +02:00
#include "u32backend.hpp"
#include <QCursor>
#include <QtWin>
#include <windows.h>
2017-05-13 23:33:36 +02:00
std::tuple<QPoint, QPixmap> getCursor() {
2017-05-13 11:03:46 +02:00
CURSORINFO cursorInfo;
cursorInfo.cbSize = sizeof(cursorInfo);
if (GetCursorInfo(&cursorInfo)) {
if (cursorInfo.flags == CURSOR_SHOWING) {
ICONINFO info; // It took me 5 hours to get to here
if (GetIconInfo(cursorInfo.hCursor, &info)) {
2017-05-13 23:33:36 +02:00
return std::tuple<QPoint, QPixmap>(QPoint(info.xHotspot, info.yHotspot), QtWin::fromHBITMAP(info.hbmColor));
2017-05-13 11:03:46 +02:00
} else
2017-05-13 23:33:36 +02:00
return std::tuple<QPoint, QPixmap>(QPoint(0, 0), QPixmap());
2017-05-13 11:03:46 +02:00
} else
2017-05-13 23:33:36 +02:00
return std::tuple<QPoint, QPixmap>(QPoint(0, 0), QPixmap());
2017-05-13 11:03:46 +02:00
} else
2017-05-13 23:33:36 +02:00
return std::tuple<QPoint, QPixmap>(QPoint(0, 0), QPixmap());
2017-05-13 11:03:46 +02:00
}