本文整理汇总了C++中KWindowInfo::isOnCurrentDesktop方法的典型用法代码示例。如果您正苦于以下问题:C++ KWindowInfo::isOnCurrentDesktop方法的具体用法?C++ KWindowInfo::isOnCurrentDesktop怎么用?C++ KWindowInfo::isOnCurrentDesktop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KWindowInfo
的用法示例。
在下文中一共展示了KWindowInfo::isOnCurrentDesktop方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setMaximized
void Task::setMaximized(bool maximize)
{
KWindowInfo info = KWindowSystem::windowInfo(d->win, NET::WMState | NET::XAWMState | NET::WMDesktop);
bool on_current = info.isOnCurrentDesktop();
if (!on_current) {
KWindowSystem::setCurrentDesktop(info.desktop());
}
if (info.isMinimized()) {
KWindowSystem::unminimizeWindow(d->win);
}
if (!on_current) {
KWindowSystem::forceActiveWindow(d->win);
}
}
示例2: doSwitch
void SwitchWindow::doSwitch(bool up)
{
//TODO somehow find the "next" or "previous" window
//without changing hte window order (don't want to always go between two windows)
if (m_windowsOrder.isEmpty()) {
m_windowsOrder = KWindowSystem::stackingOrder();
} else {
if (!m_clearOrderTimer) {
m_clearOrderTimer = new QTimer(this);
connect(m_clearOrderTimer, &QTimer::timeout, this, &SwitchWindow::clearWindowsOrder);
m_clearOrderTimer->setSingleShot(true);
m_clearOrderTimer->setInterval(1000);
}
m_clearOrderTimer->start();
}
const WId activeWindow = KWindowSystem::activeWindow();
bool next = false;
WId first = 0;
WId last = 0;
for (int i = 0; i < m_windowsOrder.count(); ++i) {
const WId id = m_windowsOrder.at(i);
const KWindowInfo info(id, NET::WMDesktop | NET::WMVisibleName | NET::WMWindowType);
if (info.windowType(NET::NormalMask | NET::DialogMask | NET::UtilityMask) != -1 && info.isOnCurrentDesktop()) {
if (next) {
KWindowSystem::forceActiveWindow(id);
return;
}
if (first == 0) {
first = id;
}
if (id == activeWindow) {
if (up) {
next = true;
} else if (last) {
KWindowSystem::forceActiveWindow(last);
return;
}
}
last = id;
}
}
KWindowSystem::forceActiveWindow(up ? first : last);
}