| 268 | } |
| 269 | |
| 270 | void WindowPicker::mouseReleaseEvent(QMouseEvent *event) |
| 271 | { |
| 272 | if (event->button() == Qt::LeftButton) { |
| 273 | #if defined(Q_OS_WIN) |
| 274 | POINT mousePos; |
| 275 | mousePos.x = event->globalX(); |
| 276 | mousePos.y = event->globalY(); |
| 277 | |
| 278 | HWND nativeWindow = GetAncestor(WindowFromPoint(mousePos), GA_ROOT); |
| 279 | #elif defined(Q_OS_LINUX) |
| 280 | Window nativeWindow = os::windowUnderCursor(false); |
| 281 | #endif |
| 282 | |
| 283 | if ((WId)nativeWindow == winId()) { |
| 284 | cancel(); |
| 285 | return; |
| 286 | } |
| 287 | |
| 288 | mTaken = true; |
| 289 | |
| 290 | setWindowFlags(windowFlags() ^ Qt::WindowStaysOnTopHint); |
| 291 | close(); |
| 292 | |
| 293 | #ifdef Q_OS_LINUX |
| 294 | emit pixmap(QPixmap::grabWindow(mCurrentWindow)); |
| 295 | #else |
| 296 | emit pixmap(os::grabWindow((WId)nativeWindow)); |
| 297 | #endif |
| 298 | |
| 299 | return; |
| 300 | } |
| 301 | |
| 302 | close(); |
| 303 | } |
| 304 |
nothing calls this directly
no outgoing calls
no test coverage detected