| Line | Source | Count |
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | | - |
| 9 | | - |
| 10 | QPlatformWindow::QPlatformWindow(QWindow *window) | - |
| 11 | : QPlatformSurface(window) | - |
| 12 | , d_ptr(new QPlatformWindowPrivate) | - |
| 13 | { | - |
| 14 | QPlatformWindowPrivate * const d = d_func(); | - |
| 15 | d->rect = window->geometry(); | - |
| 16 | } | - |
| 17 | | - |
| 18 | | - |
| 19 | | - |
| 20 | | - |
| 21 | QPlatformWindow::~QPlatformWindow() | - |
| 22 | { | - |
| 23 | } | - |
| 24 | | - |
| 25 | | - |
| 26 | | - |
| 27 | | - |
| 28 | QWindow *QPlatformWindow::window() const | - |
| 29 | { | - |
| 30 | return static_cast<QWindow *>(m_surface); | - |
| 31 | } | - |
| 32 | | - |
| 33 | | - |
| 34 | | - |
| 35 | | - |
| 36 | QPlatformWindow *QPlatformWindow::parent() const | - |
| 37 | { | - |
| 38 | return window()->parent() ? window()->parent()->handle() : 0; | - |
| 39 | } | - |
| 40 | | - |
| 41 | | - |
| 42 | | - |
| 43 | | - |
| 44 | | - |
| 45 | QPlatformScreen *QPlatformWindow::screen() const | - |
| 46 | { | - |
| 47 | QScreen *scr = window()->screen(); | - |
| 48 | return scr ? scr->handle() : nullptr; | - |
| 49 | } | - |
| 50 | | - |
| 51 | | - |
| 52 | | - |
| 53 | | - |
| 54 | QSurfaceFormat QPlatformWindow::format() const | - |
| 55 | { | - |
| 56 | return QSurfaceFormat(); | - |
| 57 | } | - |
| 58 | void QPlatformWindow::setGeometry(const QRect &rect) | - |
| 59 | { | - |
| 60 | QPlatformWindowPrivate * const d = d_func(); | - |
| 61 | d->rect = rect; | - |
| 62 | } | - |
| 63 | | - |
| 64 | | - |
| 65 | | - |
| 66 | | - |
| 67 | QRect QPlatformWindow::geometry() const | - |
| 68 | { | - |
| 69 | const QPlatformWindowPrivate * const d = d_func(); | - |
| 70 | return d->rect; | - |
| 71 | } | - |
| 72 | QRect QPlatformWindow::normalGeometry() const | - |
| 73 | { | - |
| 74 | return QRect(); | - |
| 75 | } | - |
| 76 | | - |
| 77 | QMargins QPlatformWindow::frameMargins() const | - |
| 78 | { | - |
| 79 | return QMargins(); | - |
| 80 | } | - |
| 81 | | - |
| 82 | | - |
| 83 | | - |
| 84 | | - |
| 85 | | - |
| 86 | | - |
| 87 | | - |
| 88 | void QPlatformWindow::setVisible(bool visible) | - |
| 89 | { | - |
| 90 | (void)visible;; | - |
| 91 | QRect rect(QPoint(), geometry().size()); | - |
| 92 | QWindowSystemInterface::handleExposeEvent(window(), rect); | - |
| 93 | QWindowSystemInterface::flushWindowSystemEvents(); | - |
| 94 | } | - |
| 95 | | - |
| 96 | | - |
| 97 | | - |
| 98 | | - |
| 99 | | - |
| 100 | void QPlatformWindow::setWindowFlags(Qt::WindowFlags flags) | - |
| 101 | { | - |
| 102 | (void)flags;; | - |
| 103 | } | - |
| 104 | | - |
| 105 | | - |
| 106 | | - |
| 107 | | - |
| 108 | | - |
| 109 | | - |
| 110 | | - |
| 111 | bool QPlatformWindow::isExposed() const | - |
| 112 | { | - |
| 113 | return window()->isVisible(); | - |
| 114 | } | - |
| 115 | | - |
| 116 | | - |
| 117 | | - |
| 118 | | - |
| 119 | | - |
| 120 | | - |
| 121 | | - |
| 122 | bool QPlatformWindow::isActive() const | - |
| 123 | { | - |
| 124 | return false; | - |
| 125 | } | - |
| 126 | bool QPlatformWindow::isEmbedded(const QPlatformWindow *parentWindow) const | - |
| 127 | { | - |
| 128 | (void)parentWindow;; | - |
| 129 | return false; | - |
| 130 | } | - |
| 131 | QPoint QPlatformWindow::mapToGlobal(const QPoint &pos) const | - |
| 132 | { | - |
| 133 | const QPlatformWindow *p = this; | - |
| 134 | QPoint result = pos; | - |
| 135 | while (p) { | - |
| 136 | result += p->geometry().topLeft(); | - |
| 137 | p = p->parent(); | - |
| 138 | } | - |
| 139 | return result; | - |
| 140 | } | - |
| 141 | QPoint QPlatformWindow::mapFromGlobal(const QPoint &pos) const | - |
| 142 | { | - |
| 143 | const QPlatformWindow *p = this; | - |
| 144 | QPoint result = pos; | - |
| 145 | while (p) { | - |
| 146 | result -= p->geometry().topLeft(); | - |
| 147 | p = p->parent(); | - |
| 148 | } | - |
| 149 | return result; | - |
| 150 | } | - |
| 151 | | - |
| 152 | | - |
| 153 | | - |
| 154 | | - |
| 155 | | - |
| 156 | | - |
| 157 | | - |
| 158 | void QPlatformWindow::setWindowState(Qt::WindowState) | - |
| 159 | { | - |
| 160 | } | - |
| 161 | | - |
| 162 | | - |
| 163 | | - |
| 164 | | - |
| 165 | WId QPlatformWindow::winId() const | - |
| 166 | { | - |
| 167 | | - |
| 168 | | - |
| 169 | | - |
| 170 | | - |
| 171 | return WId(1); | - |
| 172 | } | - |
| 173 | void QPlatformWindow::setParent(const QPlatformWindow *parent) | - |
| 174 | { | - |
| 175 | (void)parent;; | - |
| 176 | QMessageLogger(__FILE__, 269275, __PRETTY_FUNCTION__).warning("This plugin does not support setParent!"); | - |
| 177 | } | - |
| 178 | void QPlatformWindow::setWindowTitle(const QString &title) { (void)title;; } | - |
| 179 | | - |
| 180 | | - |
| 181 | | - |
| 182 | | - |
| 183 | void QPlatformWindow::setWindowFilePath(const QString &filePath) { (void)filePath;; } | - |
| 184 | | - |
| 185 | | - |
| 186 | | - |
| 187 | | - |
| 188 | void QPlatformWindow::setWindowIcon(const QIcon &icon) { (void)icon;; } | - |
| 189 | | - |
| 190 | | - |
| 191 | | - |
| 192 | | - |
| 193 | void QPlatformWindow::raise() { QMessageLogger(__FILE__, 295301, __PRETTY_FUNCTION__).warning("This plugin does not support raise()"); } | - |
| 194 | | - |
| 195 | | - |
| 196 | | - |
| 197 | | - |
| 198 | void QPlatformWindow::lower() { QMessageLogger(__FILE__, 300306, __PRETTY_FUNCTION__).warning("This plugin does not support lower()"); } | - |
| 199 | | - |
| 200 | | - |
| 201 | | - |
| 202 | | - |
| 203 | | - |
| 204 | | - |
| 205 | | - |
| 206 | void QPlatformWindow::propagateSizeHints() {QMessageLogger(__FILE__, 308314, __PRETTY_FUNCTION__).warning("This plugin does not support propagateSizeHints()"); } | - |
| 207 | | - |
| 208 | | - |
| 209 | | - |
| 210 | | - |
| 211 | void QPlatformWindow::setOpacity(qreal level) | - |
| 212 | { | - |
| 213 | (void)level;; | - |
| 214 | QMessageLogger(__FILE__, 316322, __PRETTY_FUNCTION__).warning("This plugin does not support setting window opacity"); | - |
| 215 | } | - |
| 216 | | - |
| 217 | | - |
| 218 | | - |
| 219 | | - |
| 220 | | - |
| 221 | void QPlatformWindow::setMask(const QRegion ®ion) | - |
| 222 | { | - |
| 223 | (void)region;; | - |
| 224 | QMessageLogger(__FILE__, 326332, __PRETTY_FUNCTION__).warning("This plugin does not support setting window masks"); | - |
| 225 | } | - |
| 226 | void QPlatformWindow::requestActivateWindow() | - |
| 227 | { | - |
| 228 | QWindowSystemInterface::handleWindowActivated(window()); | - |
| 229 | } | - |
| 230 | void QPlatformWindow::handleContentOrientationChange(Qt::ScreenOrientation orientation) | - |
| 231 | { | - |
| 232 | (void)orientation;; | - |
| 233 | } | - |
| 234 | qreal QPlatformWindow::devicePixelRatio() const | - |
| 235 | { | - |
| 236 | return 1.0; | - |
| 237 | } | - |
| 238 | | - |
| 239 | bool QPlatformWindow::setKeyboardGrabEnabled(bool grab) | - |
| 240 | { | - |
| 241 | (void)grab;; | - |
| 242 | QMessageLogger(__FILE__, 376382, __PRETTY_FUNCTION__).warning("This plugin does not support grabbing the keyboard"); | - |
| 243 | return false; | - |
| 244 | } | - |
| 245 | | - |
| 246 | bool QPlatformWindow::setMouseGrabEnabled(bool grab) | - |
| 247 | { | - |
| 248 | (void)grab;; | - |
| 249 | QMessageLogger(__FILE__, 383389, __PRETTY_FUNCTION__).warning("This plugin does not support grabbing the mouse"); | - |
| 250 | return false; | - |
| 251 | } | - |
| 252 | | - |
| 253 | | - |
| 254 | | - |
| 255 | | - |
| 256 | | - |
| 257 | | - |
| 258 | bool QPlatformWindow::setWindowModified(bool modified) | - |
| 259 | { | - |
| 260 | (void)modified;; | - |
| 261 | return false; | - |
| 262 | } | - |
| 263 | void QPlatformWindow::windowEvent(QEvent *event) | - |
| 264 | { | - |
| 265 | (void)event;; | - |
| 266 | } | - |
| 267 | bool QPlatformWindow::startSystemResize(const QPoint &pos, Qt::Corner corner) | - |
| 268 | { | - |
| 269 | (void)pos; | - |
| 270 | (void)corner; | - |
| 271 | return false; | - |
| 272 | } | - |
| 273 | void QPlatformWindow::setFrameStrutEventsEnabled(bool enabled) | - |
| 274 | { | - |
| 275 | (void)enabled; | - |
| 276 | } | - |
| 277 | | - |
| 278 | | - |
| 279 | | - |
| 280 | | - |
| 281 | | - |
| 282 | | - |
| 283 | bool QPlatformWindow::frameStrutEventsEnabled() const | - |
| 284 | { | - |
| 285 | return false; | - |
| 286 | } | - |
| 287 | QString QPlatformWindow::formatWindowTitle(const QString &title, const QString &separator) | - |
| 288 | { | - |
| 289 | QString fullTitle = title; | - |
| 290 | if (QGuiApplicationPrivate::displayName && !title.endsWith(*QGuiApplicationPrivate::displayName)) { | - |
| 291 | | - |
| 292 | if (!fullTitle.isEmpty()) | - |
| 293 | fullTitle += separator; | - |
| 294 | fullTitle += *QGuiApplicationPrivate::displayName; | - |
| 295 | } else if (fullTitle.isEmpty()) { | - |
| 296 | | - |
| 297 | fullTitle = QCoreApplication::applicationName(); | - |
| 298 | } | - |
| 299 | return fullTitle; | - |
| 300 | } | - |
| 301 | QPlatformScreen *QPlatformWindow::screenForGeometry(const QRect &newGeometry) const | - |
| 302 | { | - |
| 303 | QPlatformScreen *currentScreen = screen(); | - |
| 304 | QPlatformScreen *fallback = currentScreen; | - |
| 305 | | - |
| 306 | | - |
| 307 | QPoint center = newGeometry.isEmpty()| TRUE | never evaluated | | FALSE | never evaluated |
? newGeometry.topLeft() : newGeometry.center(); | 0 |
| 308 | if (window()->type() == Qt::ForeignWindow| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 309 | center = mapToGlobal(center - newGeometry.topLeft()); never executed: center = mapToGlobal(center - newGeometry.topLeft()); | 0 |
| 310 | | - |
| 311 | if (!parent()| TRUE | never evaluated | | FALSE | never evaluated |
&& currentScreen| TRUE | never evaluated | | FALSE | never evaluated |
&& !currentScreen->geometry().contains(center)| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 312 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(currentScreen->virtualSiblings())>::type> _container_((const auto screens = currentScreen->virtualSiblings())); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1)(); | - |
| 313 | for (QPlatformScreen *screen = *_container_.i; _container_.control; _container_.control = 0: screens) { | - |
| 314 | if (const QRect screenGeometry = screen->geometry().(); | - |
| 315 | if (screenGeometry.| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
contains(center)| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 316 | return never executed: return screen; screen;never executed: return screen; | 0 |
| 317 | if (screen->geometry().screenGeometry.| TRUE | never evaluated | | FALSE | never evaluated |
intersects(newGeometry)| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 318 | fallback = screen; never executed: fallback = screen; | 0 |
| 319 | } never executed: end of block | 0 |
| 320 | } never executed: end of block | 0 |
| 321 | return never executed: return fallback; fallback;never executed: return fallback; | 0 |
| 322 | } | - |
| 323 | | - |
| 324 | | - |
| 325 | | - |
| 326 | | - |
| 327 | QSize QPlatformWindow::constrainWindowSize(const QSize &size) | - |
| 328 | { | - |
| 329 | return size.expandedTo(QSize(0, 0)).boundedTo(QSize(((1<<24)-1), ((1<<24)-1))); | - |
| 330 | } | - |
| 331 | void QPlatformWindow::setAlertState(bool enable) | - |
| 332 | { | - |
| 333 | (void)enable; | - |
| 334 | } | - |
| 335 | bool QPlatformWindow::isAlertState() const | - |
| 336 | { | - |
| 337 | return false; | - |
| 338 | } | - |
| 339 | | - |
| 340 | | - |
| 341 | | - |
| 342 | | - |
| 343 | | - |
| 344 | static inline const QScreen *effectiveScreen(const QWindow *window) | - |
| 345 | { | - |
| 346 | if (!window| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 347 | return never executed: return QGuiApplication::primaryScreen(); QGuiApplication::primaryScreen();never executed: return QGuiApplication::primaryScreen(); | 0 |
| 348 | const QScreen *screen = window->screen(); | - |
| 349 | if (!screen| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 350 | return never executed: return QGuiApplication::primaryScreen(); QGuiApplication::primaryScreen();never executed: return QGuiApplication::primaryScreen(); | 0 |
| 351 | | - |
| 352 | const QList<QScreen *> siblings = screen->virtualSiblings(); | - |
| 353 | if (siblings.size() > 1| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 354 | const QPoint referencePoint = window->transientParent()| TRUE | never evaluated | | FALSE | never evaluated |
? window->transientParent()->geometry().center() : QCursor::pos(); | 0 |
| 355 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(siblings)>::type> _container_((siblings)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1)for (const QScreen *sibling = *_container_.i; _container_.control; _container_.control = 0: siblings) { | - |
| 356 | if (sibling->geometry().contains(referencePoint)| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 357 | return never executed: return sibling; sibling;never executed: return sibling; | 0 |
| 358 | } never executed: end of block | 0 |
| 359 | } never executed: end of block | 0 |
| 360 | | - |
| 361 | return never executed: return screen; screen;never executed: return screen; | 0 |
| 362 | } | - |
| 363 | void QPlatformWindow::invalidateSurface() | - |
| 364 | { | - |
| 365 | } | - |
| 366 | | - |
| 367 | static QSize fixInitialSize(QSize size, const QWindow *w, | - |
| 368 | int defaultWidth, int defaultHeight) | - |
| 369 | { | - |
| 370 | if (size.width() == 0) { | - |
| 371 | const int minWidth = w->minimumWidth(); | - |
| 372 | size.setWidth(minWidth > 0 ? minWidth : defaultWidth); | - |
| 373 | } | - |
| 374 | if (size.height() == 0) { | - |
| 375 | const int minHeight = w->minimumHeight(); | - |
| 376 | size.setHeight(minHeight > 0 ? minHeight : defaultHeight); | - |
| 377 | } | - |
| 378 | return size; | - |
| 379 | } | - |
| 380 | QRect QPlatformWindow::initialGeometry(const QWindow *w, | - |
| 381 | const QRect &initialGeometry, int defaultWidth, int defaultHeight) | - |
| 382 | { | - |
| 383 | if (!w->isTopLevel()) { | - |
| 384 | const qreal factor = QHighDpiScaling::factor(w); | - |
| 385 | const QSize size = fixInitialSize(QHighDpi::fromNative(initialGeometry.size(), factor), | - |
| 386 | w, defaultWidth, defaultHeight); | - |
| 387 | return QRect(initialGeometry.topLeft(), QHighDpi::toNative(size, factor)); | - |
| 388 | } | - |
| 389 | const QScreen *screen = effectiveScreen(w); | - |
| 390 | if (!screen) | - |
| 391 | return initialGeometry; | - |
| 392 | QRect rect(QHighDpi::fromNativePixels(initialGeometry, w)); | - |
| 393 | rect.setSize(fixInitialSize(rect.size(), w, defaultWidth, defaultHeight)); | - |
| 394 | if (qt_window_private(const_cast<QWindow*>(w))->positionAutomatic | - |
| 395 | && w->type() != Qt::Popup) { | - |
| 396 | const QRect availableGeometry = screen->availableGeometry(); | - |
| 397 | | - |
| 398 | if (rect.height() < (availableGeometry.height() * 8) / 9 | - |
| 399 | && rect.width() < (availableGeometry.width() * 8) / 9) { | - |
| 400 | const QWindow *tp = w->transientParent(); | - |
| 401 | if (tp) { | - |
| 402 | | - |
| 403 | rect.moveCenter(tp->geometry().center()); | - |
| 404 | } else { | - |
| 405 | | - |
| 406 | | - |
| 407 | rect.moveCenter(availableGeometry.center()); | - |
| 408 | } | - |
| 409 | } | - |
| 410 | } | - |
| 411 | return QHighDpi::toNativePixels(rect, screen); | - |
| 412 | } | - |
| 413 | void QPlatformWindow::requestUpdate() | - |
| 414 | { | - |
| 415 | static int timeout = -1; | - |
| 416 | if (timeout == -1) { | - |
| 417 | bool ok = false; | - |
| 418 | timeout = qEnvironmentVariableIntValue("QT_QPA_UPDATE_IDLE_TIME", &ok); | - |
| 419 | if (!ok) | - |
| 420 | timeout = 5; | - |
| 421 | } | - |
| 422 | | - |
| 423 | QWindow *w = window(); | - |
| 424 | QWindowPrivate *wp = (QWindowPrivate *) QObjectPrivate::get(w); | - |
| 425 | ((!(wp->updateTimer == 0)) ? qt_assert("wp->updateTimer == 0",__FILE__,658667) : qt_noop()); | - |
| 426 | wp->updateTimer = w->startTimer(timeout, Qt::PreciseTimer); | - |
| 427 | } | - |
| 428 | | - |
| 429 | | - |
| 430 | | - |
| 431 | | - |
| 432 | QSize QPlatformWindow::windowMinimumSize() const | - |
| 433 | { | - |
| 434 | return constrainWindowSize(QHighDpi::toNativePixels(window()->minimumSize(), window())); | - |
| 435 | } | - |
| 436 | | - |
| 437 | | - |
| 438 | | - |
| 439 | | - |
| 440 | QSize QPlatformWindow::windowMaximumSize() const | - |
| 441 | { | - |
| 442 | return constrainWindowSize(QHighDpi::toNativePixels(window()->maximumSize(), window())); | - |
| 443 | } | - |
| 444 | | - |
| 445 | | - |
| 446 | | - |
| 447 | | - |
| 448 | QSize QPlatformWindow::windowBaseSize() const | - |
| 449 | { | - |
| 450 | return QHighDpi::toNativePixels(window()->baseSize(), window()); | - |
| 451 | } | - |
| 452 | | - |
| 453 | | - |
| 454 | | - |
| 455 | | - |
| 456 | QSize QPlatformWindow::windowSizeIncrement() const | - |
| 457 | { | - |
| 458 | QSize increment = window()->sizeIncrement(); | - |
| 459 | if (!QHighDpiScaling::isActive()) | - |
| 460 | return increment; | - |
| 461 | | - |
| 462 | | - |
| 463 | | - |
| 464 | if (increment.isEmpty()) | - |
| 465 | increment = QSize(1, 1); | - |
| 466 | | - |
| 467 | return QHighDpi::toNativePixels(increment, window()); | - |
| 468 | } | - |
| 469 | | - |
| 470 | | - |
| 471 | | - |
| 472 | | - |
| 473 | QRect QPlatformWindow::windowGeometry() const | - |
| 474 | { | - |
| 475 | return QHighDpi::toNativePixels(window()->geometry(), window()); | - |
| 476 | } | - |
| 477 | | - |
| 478 | | - |
| 479 | | - |
| 480 | | - |
| 481 | QRect QPlatformWindow::windowFrameGeometry() const | - |
| 482 | { | - |
| 483 | return QHighDpi::toNativePixels(window()->frameGeometry(), window()); | - |
| 484 | } | - |
| 485 | | - |
| 486 | | - |
| 487 | | - |
| 488 | | - |
| 489 | | - |
| 490 | | - |
| 491 | | - |
| 492 | QRectF QPlatformWindow::closestAcceptableGeometry(const QWindow *qWindow, const QRectF &nativeRect) | - |
| 493 | { | - |
| 494 | const QRectF rectF = QHighDpi::fromNativePixels(nativeRect, qWindow); | - |
| 495 | const QRectF correctedGeometryF = qt_window_private(const_cast<QWindow *>(qWindow))->closestAcceptableGeometry(rectF); | - |
| 496 | return !correctedGeometryF.isEmpty() && rectF != correctedGeometryF | - |
| 497 | ? QHighDpi::toNativePixels(correctedGeometryF, qWindow) : nativeRect; | - |
| 498 | } | - |
| 499 | | - |
| 500 | QRectF QPlatformWindow::windowClosestAcceptableGeometry(const QRectF &nativeRect) const | - |
| 501 | { | - |
| 502 | return QPlatformWindow::closestAcceptableGeometry(window(), nativeRect); | - |
| 503 | } | - |
| 504 | | - |
| | |