Changeset View
Changeset View
Standalone View
Standalone View
src/kwindowsystem.cpp
Show First 20 Lines • Show All 449 Lines • ▼ Show 20 Line(s) | |||||
450 | } | 450 | } | ||
451 | 451 | | |||
452 | void KWindowSystem::demandAttention(WId win, bool set) | 452 | void KWindowSystem::demandAttention(WId win, bool set) | ||
453 | { | 453 | { | ||
454 | Q_D(KWindowSystem); | 454 | Q_D(KWindowSystem); | ||
455 | d->demandAttention(win, set); | 455 | d->demandAttention(win, set); | ||
456 | } | 456 | } | ||
457 | 457 | | |||
458 | #ifndef KWINDOWSYSTEM_NO_DEPRECATED | 458 | #ifndef KWINDOWSYSTEM_NO_DEPRECATED | ||
zzag: Coding style: For pointers or references, use a single space before '*' or '&', but not after. | |||||
459 | WId KWindowSystem::transientFor(WId win) | 459 | WId KWindowSystem::transientFor(WId win) | ||
460 | { | 460 | { | ||
461 | Q_D(KWindowSystem); | 461 | Q_D(KWindowSystem); | ||
462 | return d->transientFor(win); | 462 | return d->transientFor(win); | ||
463 | } | 463 | } | ||
464 | #endif | | |||
465 | 464 | | |||
466 | void KWindowSystem::setMainWindow(QWidget *subWidget, WId mainWindowId) | 465 | void KWindowSystem::setMainWindow(QWidget *subWidget, WId mainWindowId) | ||
467 | { | 466 | { | ||
468 | // Set the WA_NativeWindow attribute to force the creation of the QWindow. | 467 | // Set the WA_NativeWindow attribute to force the creation of the QWindow. | ||
469 | // Without this QWidget::windowHandle() returns 0. | 468 | // Without this QWidget::windowHandle() returns 0. | ||
470 | subWidget->setAttribute(Qt::WA_NativeWindow, true); | 469 | subWidget->setAttribute(Qt::WA_NativeWindow, true); | ||
471 | QWindow *subWindow = subWidget->windowHandle(); | 470 | QWindow *subWindow = subWidget->windowHandle(); | ||
472 | Q_ASSERT(subWindow); | 471 | Q_ASSERT(subWindow); | ||
472 | setMainWindow(subWindow, mainWindowId); | ||||
473 | } | ||||
474 | #endif | ||||
473 | 475 | | |||
476 | void KWindowSystem::setMainWindow(QWindow *subWindow, WId mainWindowId) | ||||
477 | { | ||||
474 | QWindow *mainWindow = QWindow::fromWinId(mainWindowId); | 478 | QWindow *mainWindow = QWindow::fromWinId(mainWindowId); | ||
475 | if (!mainWindow) { | 479 | if (mainWindow) { // foreign windows not supported on all platforms | ||
476 | // foreign windows not supported on all platforms | | |||
477 | return; | | |||
478 | } | | |||
479 | // mainWindow is not the child of any object, so make sure it gets deleted at some point | | |||
480 | connect(subWidget, &QObject::destroyed, mainWindow, &QObject::deleteLater); | | |||
481 | subWindow->setTransientParent(mainWindow); | 480 | subWindow->setTransientParent(mainWindow); | ||
481 | | ||||
482 | // mainWindow is not the child of any object, so make sure it gets deleted at some point | ||||
483 | connect(subWindow, &QObject::destroyed, mainWindow, &QObject::deleteLater); | ||||
484 | } | ||||
482 | } | 485 | } | ||
483 | 486 | | |||
484 | #ifndef KWINDOWSYSTEM_NO_DEPRECATED | 487 | #ifndef KWINDOWSYSTEM_NO_DEPRECATED | ||
485 | WId KWindowSystem::groupLeader(WId win) | 488 | WId KWindowSystem::groupLeader(WId win) | ||
486 | { | 489 | { | ||
Each time this method is called a new foreign QWindow object will be created. Can you please explain why leaking those objects is okay? zzag: Each time this method is called a new foreign QWindow object will be created. Can you please… | |||||
Ah I didn't realize that QWindow::fromWinId was allocating a QWindow [IMHO it should have been called createFromWinId, then], but indeed it's logical. Fixed. dfaure: Ah I didn't realize that QWindow::fromWinId was allocating a QWindow [IMHO it should have been… | |||||
487 | Q_D(KWindowSystem); | 490 | Q_D(KWindowSystem); | ||
488 | return d->groupLeader(win); | 491 | return d->groupLeader(win); | ||
489 | } | 492 | } | ||
490 | #endif | 493 | #endif | ||
491 | 494 | | |||
492 | QPixmap KWindowSystem::icon(WId win, int width, int height, bool scale) | 495 | QPixmap KWindowSystem::icon(WId win, int width, int height, bool scale) | ||
493 | { | 496 | { | ||
494 | return icon(win, width, height, scale, NETWM | WMHints | ClassHint | XApp); | 497 | return icon(win, width, height, scale, NETWM | WMHints | ClassHint | XApp); | ||
▲ Show 20 Lines • Show All 257 Lines • Show Last 20 Lines |
Coding style: For pointers or references, use a single space before '*' or '&', but not after.
https://techbase.kde.org/Policies/Frameworks_Coding_Style#Whitespace