[kwin/kcmrules] Use a pointer for the KWindowInfo member variable
The reason for this change is that the default ctor of KWindowInfo creates a broken object. Calling any method in it will result in a crush. Thus it is scheduled for removal in kwindowsystem framework causing this code to no longer compile. The solution is to use a pointer and set it to null as long as the window has not been detected yet. To ensure that this doesn't fail badly an assert is added to the getter in DetectWidget.
This commit is contained in:
parent
c96df87475
commit
823222567e
2 changed files with 11 additions and 10 deletions
|
@ -78,19 +78,19 @@ void DetectDialog::readWindow(WId w)
|
|||
emit detectionDone(false);
|
||||
return;
|
||||
}
|
||||
info = KWindowSystem::windowInfo(w, -1U, -1U); // read everything
|
||||
if (!info.valid()) {
|
||||
info.reset(new KWindowInfo(w, -1U, -1U)); // read everything
|
||||
if (!info->valid()) {
|
||||
emit detectionDone(false);
|
||||
return;
|
||||
}
|
||||
wmclass_class = info.windowClassClass();
|
||||
wmclass_name = info.windowClassName();
|
||||
role = info.windowRole();
|
||||
type = info.windowType(NET::NormalMask | NET::DesktopMask | NET::DockMask
|
||||
wmclass_class = info->windowClassClass();
|
||||
wmclass_name = info->windowClassName();
|
||||
role = info->windowRole();
|
||||
type = info->windowType(NET::NormalMask | NET::DesktopMask | NET::DockMask
|
||||
| NET::ToolbarMask | NET::MenuMask | NET::DialogMask | NET::OverrideMask | NET::TopMenuMask
|
||||
| NET::UtilityMask | NET::SplashMask);
|
||||
title = info.name();
|
||||
machine = info.clientMachine();
|
||||
title = info->name();
|
||||
machine = info->clientMachine();
|
||||
executeDialog();
|
||||
}
|
||||
|
||||
|
|
|
@ -77,13 +77,14 @@ private:
|
|||
QByteArray machine;
|
||||
DetectWidget* widget;
|
||||
QScopedPointer<QDialog> grabber;
|
||||
KWindowInfo info;
|
||||
QScopedPointer<KWindowInfo> info;
|
||||
};
|
||||
|
||||
inline
|
||||
const KWindowInfo& DetectDialog::windowInfo() const
|
||||
{
|
||||
return info;
|
||||
Q_ASSERT(!info.isNull());
|
||||
return *(info.data());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
Loading…
Reference in a new issue