本文整理汇总了C++中KWindowInfo::hasState方法的典型用法代码示例。如果您正苦于以下问题:C++ KWindowInfo::hasState方法的具体用法?C++ KWindowInfo::hasState怎么用?C++ KWindowInfo::hasState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KWindowInfo
的用法示例。
在下文中一共展示了KWindowInfo::hasState方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkAttention
//-----------------------------------------------------------------------------
// ATTENTION
void daisy::checkAttention( KWindowInfo taskInfo, QString widclass_tmp )
{
if ( taskInfo.hasState( NET::DemandsAttention ) && !m_attentionwindow.contains( m_alias.indexOf( widclass_tmp )) )
{
m_attentionwindow << m_alias.indexOf( widclass_tmp );
}
else if ( m_attentionwindow.contains( m_alias.indexOf( widclass_tmp )) )
{
m_attentionwindow.removeAt(m_attentionwindow.indexOf( m_alias.indexOf( widclass_tmp )) );
}
}
示例2: onWindowChanged
void DesktopSwitch::onWindowChanged(WId id, NET::Properties properties, NET::Properties2 properties2)
{
if (properties.testFlag(NET::WMState) && isWindowHighlightable(id))
{
KWindowInfo info = KWindowInfo(id, NET::WMDesktop | NET::WMState);
int desktop = info.desktop();
if (!info.valid() || info.onAllDesktops())
return;
else
{
DesktopSwitchButton *button = static_cast<DesktopSwitchButton *>(m_buttons->button(desktop - 1));
if(button)
button->setUrgencyHint(id, info.hasState(NET::DemandsAttention));
}
}
}
示例3: toggShadeTask
//-----------------------------------------------------------------------------
// Toggle Shade task
//FIXME
void daisy::toggShadeTask(WId id)
{
KWindowInfo taskInfo = KWindowSystem::windowInfo( id, NET::WMState, NET::WM2WindowClass );
if ( taskInfo.valid() )
{
if ( taskInfo.hasState( NET::Shaded ) )
{
KWindowSystem::clearState( id, NET::Shaded );
KWindowSystem::unminimizeWindow( id, true );
// KWindowSystem::activateWindow( id );
}
else
{
KWindowSystem::setState( id, NET::Shaded );
// KWindowSystem::setState( id, NET::DemandsAttention );//FOR TESTING, COMMENT AFTER
}
}
}
示例4: showMenu
void WindowList::showMenu(bool onlyCurrentDesktop)
{
QList<WId> windows = KWindowSystem::windows();
QList<QAction*> actionList;
QList< QList<QAction*> > windowList;
int amount = 0;
int number = 0;
qDeleteAll(m_listMenu->actions());
//m_listMenu->clear();
if (!onlyCurrentDesktop) {
m_listMenu->addTitle(i18n("Actions"));
QAction *unclutterAction = m_listMenu->addAction(i18n("Unclutter Windows"));
QAction *cascadeAction = m_listMenu->addAction(i18n("Cascade Windows"));
connect(unclutterAction, SIGNAL(triggered()), m_listMenu, SLOT(slotUnclutterWindows()));
connect(cascadeAction, SIGNAL(triggered()), m_listMenu, SLOT(slotCascadeWindows()));
}
for (int i = 0; i <= KWindowSystem::numberOfDesktops(); ++i) {
windowList.append(QList<QAction*>());
}
for (int i = 0; i < windows.count(); ++i) {
KWindowInfo window = KWindowSystem::windowInfo(windows.at(i), (NET::WMGeometry | NET::WMFrameExtents | NET::WMWindowType | NET::WMDesktop | NET::WMState | NET::XAWMState | NET::WMVisibleName));
NET::WindowType type = window.windowType(NET::NormalMask | NET::DialogMask | NET::OverrideMask | NET::UtilityMask | NET::DesktopMask | NET::DockMask | NET::TopMenuMask | NET::SplashMask | NET::ToolbarMask | NET::MenuMask);
if ((onlyCurrentDesktop && !window.isOnDesktop(KWindowSystem::currentDesktop())) || type == NET::Desktop || type == NET::Dock || type == NET::TopMenu || type == NET::Splash || type == NET::Menu || type == NET::Toolbar || window.hasState(NET::SkipPager)) {
windows.removeAt(i);
--i;
continue;
}
++amount;
QAction *action = new QAction(QIcon(KWindowSystem::icon(windows.at(i))), window.visibleName(), this);
action->setData((unsigned long long) windows.at(i));
QString window_title = QString(action->text());
window_title.truncate(55);
action->setText(window_title);
QFont font = QFont(action->font());
if (window.isMinimized()) {
font.setItalic(true);
} else if (KWindowSystem::activeWindow() == windows.at(i)) {
font.setUnderline(true);
font.setBold(true);
}
action->setFont(font);
number = ((onlyCurrentDesktop || window.onAllDesktops()) ? 0 : window.desktop());
QList<QAction*> subList = windowList.value(number);
subList.append(action);
windowList.replace(number, subList);
}
const bool useSubMenus = (!onlyCurrentDesktop && KWindowSystem::numberOfDesktops() > 1 && (amount / KWindowSystem::numberOfDesktops()) > 5);
if (amount && useSubMenus) {
m_listMenu->addTitle(i18n("Desktops"));
}
for (int i = 0; i <= KWindowSystem::numberOfDesktops(); ++i) {
if (windowList.value(i).isEmpty()) {
continue;
}
KMenu *subMenu = NULL;
QAction *subMenuAction = NULL;
QString title = (i ? KWindowSystem::desktopName(i) : (onlyCurrentDesktop ? i18n("Current desktop") : i18n("On all desktops")));
if (useSubMenus) {
subMenuAction = m_listMenu->addAction(title);
subMenu = new KMenu(m_listMenu);
subMenu->installEventFilter(this);
} else {
m_listMenu->addTitle(title);
}
for (int j = 0; j < windowList.value(i).count(); ++j) {
if (useSubMenus) {
subMenu->addAction(windowList.value(i).value(j));
} else {
m_listMenu->addAction(windowList.value(i).value(j));
}
}
if (useSubMenus) {
subMenuAction->setMenu(subMenu);
}
//.........这里部分代码省略.........