本文整理汇总了C++中KWindowInfo类的典型用法代码示例。如果您正苦于以下问题:C++ KWindowInfo类的具体用法?C++ KWindowInfo怎么用?C++ KWindowInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KWindowInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: scrollTasks
// Scroll tasks
void daisy::scrollTasks(int delta)
{
WId widstore_tmp = 0;WId wid_tmp = 0;
QList<WId> real_taskDict;QList<WId> taskDict = KWindowSystem::windows();QList<WId>::ConstIterator it;
KWindowInfo taskInfo = KWindowSystem::windowInfo( m_focusedWindow, NET::WMState, NET::WM2WindowClass );
for (it = taskDict.begin(); it != taskDict.end(); ++it )
{
TaskPtr task_tmp = TaskManager::TaskManager::self()->findTask( *it );
if ( task_tmp ){real_taskDict << *it;}
}
if (real_taskDict.size() > 0)
{
if ( real_taskDict.indexOf( KWindowSystem::activeWindow() ) != -1 ){widstore_tmp = KWindowSystem::activeWindow();}
else{widstore_tmp = m_focusedWindow;}
{
if (delta >0)
{
if (real_taskDict.indexOf( widstore_tmp ) < real_taskDict.size()-1 ){wid_tmp = real_taskDict[real_taskDict.indexOf( widstore_tmp )+1];}
else{wid_tmp = real_taskDict[0];}
}
else
{
if (real_taskDict.indexOf( widstore_tmp ) > 0 ){wid_tmp = real_taskDict[real_taskDict.indexOf( widstore_tmp )-1];}
else{wid_tmp = real_taskDict[real_taskDict.size()-1];}
}
if (real_taskDict.size() == 1)
{
taskInfo = KWindowSystem::windowInfo( wid_tmp, NET::WMState, NET::WM2WindowClass );
if ( !taskInfo.isMinimized() )KWindowSystem::minimizeWindow( wid_tmp, true );
else focusTask(wid_tmp);
}
else focusTask(wid_tmp);
}
}
}
示例2: KWindowInfo
bool RKWardApplication::x11EventFilter (XEvent *e) {
if (detect_x11_creations) {
if (e->type == CreateNotify) {
if (e->xcreatewindow.parent == QX11Info::appRootWindow ()) {
KWindowInfo info = KWindowInfo (e->xcreatewindow.window, NET::WMName | NET::WMWindowType);
// at this point, we used to check, whether this window has some name or another. This heuristic allowed to sieve out helper windows of the window manager. However, since R 2.8.0, sometimes the window is mapped, before it has been given a name.
// Now we rely on the fact (we hope it *is* a fact), that the device window is always the first one created.
if ((info.windowType (0xFFFF) != 0) && (!created_window)) {
created_window = e->xcreatewindow.window;
return true;
}
} else {
RK_ASSERT (false);
}
}
}
if (e->type == PropertyNotify) {
if (e->xproperty.atom == wm_name_property) {
if (name_watchers_list.contains (e->xproperty.window)) {
KWindowInfo wininfo = KWindowInfo (e->xproperty.window, NET::WMName);
name_watchers_list[e->xproperty.window]->setCaption (wininfo.name ());
return true;
}
}
}
return KApplication::x11EventFilter (e);
}
示例3: actionTriggered
void Notification::mouseReleaseEvent(QMouseEvent * event)
{
// qDebug() << "CLICKED" << event;
QString appName;
QString windowTitle;
if (m_actionWidget && m_actionWidget->hasDefaultAction())
{
emit actionTriggered(m_actionWidget->defaultAction());
return;
}
for (WId i : KWindowSystem::stackingOrder())
{
KWindowInfo info = KWindowInfo(i, NET::WMName | NET::WMVisibleName);
appName = info.name();
windowTitle = info.visibleName();
// qDebug() << " " << i << "APPNAME" << appName << "TITLE" << windowTitle;
if (appName.isEmpty())
{
QWidget::mouseReleaseEvent(event);
return;
}
if (appName == appLabel->text() || windowTitle == appLabel->text())
{
KWindowSystem::raiseWindow(i);
closeButton_clicked();
return;
}
}
}
示例4: KMenu
//-----------------------------------------------------------------------------
// Elaborate Tasks Menu
void daisy::elabTaskMenu( QList<WId> taskDict, int clickedlaunch_tmp )
{
delete m_task_menu;
m_task_menu = new KMenu();
taskDrawers.clear();
QList<WId>::ConstIterator it;
for (it = taskDict.begin(); it != taskDict.end(); ++it )
{
KWindowInfo taskInfo = KWindowSystem::windowInfo( *it, NET::WMName | NET::WMVisibleName | NET::WMWindowType | NET::WMVisibleIconName , NET::WM2StartupId | NET::WM2WindowClass | NET::WM2WindowRole );
QString visiconame_tmp = taskInfo.visibleIconName();
QString visname_tmp = taskInfo.visibleName();
QString iconame_tmp = m_values[clickedlaunch_tmp][2];
m_act_1 = new QAction(KIcon(iconame_tmp), visiconame_tmp, this);
connect(m_act_1, SIGNAL(triggered(bool)), this, SLOT(taskMenuClicked()));
m_task_menu->addAction ( m_act_1 );
taskDrawers << *it;
}
m_task_menu->exec( QCursor::pos() );
}
示例5: KWindowInfo
void KWindowInfo::showMessage( QWidget *window, const QString &text, int timeout )
{
KWindowInfo *info = new KWindowInfo( window );
info->autoDel = true;
info->message( text, timeout );
if ( timeout == 0 )
delete info;
}
示例6: closeTask
//-----------------------------------------------------------------------------
// Close task
//FIXME
void daisy::closeTask(WId id)
{
KWindowInfo taskInfo = KWindowSystem::windowInfo( id, NET::WMState );
if ( taskInfo.valid() )
{
NETRootInfo ri( QX11Info::display(), NET::CloseWindow );
ri.closeWindowRequest( id );
}
}
示例7: focusTask
//-----------------------------------------------------------------------------
// Focus task
//FIXME
void daisy::focusTask(WId id)
{
KWindowInfo taskInfo = KWindowSystem::windowInfo( id, NET::WMState, NET::WM2WindowClass );
if ( taskInfo.valid() )
{
KWindowSystem::unminimizeWindow( id, true );
KWindowSystem::activateWindow( id );
}
}
示例8: onWindowAdded
void WindowListModel::onWindowAdded(WId id)
{
KWindowInfo kwi = KWindowSystem::self()->windowInfo(id, NET::WMName | NET::WMVisibleName | NET::WMVisibleIconName | NET::WMWindowType);
if( ( kwi.windowType(NET::NormalMask) == NET::Normal ) && ( id != m_kdevWinId ) ) {
beginInsertRows( QModelIndex(), m_winList.count(), m_winList.count() + 1 );
m_winList.append( kwi );
// qDebug() << "onWindowAdded " << kwi.visibleName() << "(" << id << ")";
endInsertRows();
}
}
示例9: defined
void GraphicalUi::hideMainWidget()
{
#if defined(HAVE_KDE4) && defined(Q_WS_X11)
KWindowInfo info = KWindowSystem::windowInfo(mainWidget()->winId(), NET::WMDesktop | NET::WMFrameExtents);
_onAllDesktops = info.onAllDesktops();
#endif
if (instance()->isHidingMainWidgetAllowed())
mainWidget()->hide();
}
示例10: KWindowInfo
void AppKbdKeeper::switchToGroup(uint group)
{
KWindowInfo info = KWindowInfo(KWindowSystem::activeWindow(), 0, NET::WM2WindowClass);
QString app = info.windowClassName();
m_mapping[app] = group;
m_layout.lockGroup(group);
m_info.setCurrentGroup(group);
emit changed();
}
示例11: XUngrabPointer
void TitleWidget::mouseMoveEvent(QGraphicsSceneMouseEvent* event)
{
Plasma::IconWidget::mouseMoveEvent(event);
if (m_drag && (event->buttons() & Qt::LeftButton))
{
WId wid = KWindowSystem::activeWindow();
if (wid) {
XUngrabPointer(QX11Info::display(), QX11Info::appTime());
NETRootInfo rootInfo(QX11Info::display(), NET::WMMoveResize);
KWindowInfo info = KWindowSystem::windowInfo(wid, NET::WMGeometry);
int x;
int y;
QPointF p = event->screenPos();
if (p.x() > info.geometry().x() && p.x() < info.geometry().x() + info.geometry().width())
x = p.x();
else
x = info.geometry().x();
if (p.y() > info.geometry().y() && p.y() < info.geometry().y() + info.geometry().height())
y = p.y();
else
y = info.geometry().y();
rootInfo.moveResizeRequest( wid, x, y, NET::Move);
}
}
}
示例12: QTimer
void SwitchWindow::wheelEvent(QGraphicsSceneWheelEvent *event)
{
//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, SIGNAL(timeout()), this, SLOT(clearWindowsOrder()));
m_clearOrderTimer->setSingleShot(true);
m_clearOrderTimer->setInterval(1000);
}
m_clearOrderTimer->start();
}
const WId activeWindow = KWindowSystem::activeWindow();
const bool up = event->delta() > 0;
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);
}
示例13: matchTask
//-----------------------------------------------------------------------------
// Match a task by its name
//FIXME
WId daisy::matchTask(QString name)
{
QList<WId> taskDict = KWindowSystem::windows();
QList<WId>::ConstIterator it;
for (it = taskDict.begin(); it != taskDict.end(); ++it )
{
KWindowInfo taskInfo = KWindowSystem::windowInfo( *it, NET::WMName | NET::WMVisibleName , NET::WM2WindowClass );
if ( name == QString(taskInfo.windowClassName()) || name == QString(taskInfo.windowClassClass().toLower()) )
{
return *it;
}
}
return 0;
}
示例14: KWindowInfo
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));
}
}
}
示例15: 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);
}
}