Esempio n. 1
0
void KSystemTray::minimizeRestore(bool restore)
{
    QWidget *pw = parentWidget();
    if(!pw)
        return;
#ifdef Q_WS_X11
    KWin::WindowInfo info = KWin::windowInfo(pw->winId(), NET::WMGeometry | NET::WMDesktop);
    if(restore)
    {
        if(d->on_all_desktops)
            KWin::setOnAllDesktops(pw->winId(), true);
        else
            KWin::setCurrentDesktop(info.desktop());
        pw->move(info.geometry().topLeft()); // avoid placement policies
        pw->show();
        pw->raise();
        KWin::activateWindow(pw->winId());
    }
    else
    {
        d->on_all_desktops = info.onAllDesktops();
        pw->hide();
    }
#endif
}
Esempio n. 2
0
KWin::WindowInfo *Desktop::windowAtPosition(const QPoint &p, QPoint *internalpos)
{
	QRect r;
	const QValueList<WId> &list(pager()->kwin()->stackingOrder());
	if (list.count() <= 0)
		return 0L;

	for (QValueList<WId>::ConstIterator it = list.fromLast(); ; --it)
	{
		KWin::WindowInfo* info = pager()->info( *it );
		if (shouldPaintWindow(info))
		{
			r=info->geometry();
			convertRectS2P(r);
			if (r.contains(p))
			{
				if (internalpos)
				{
					internalpos->setX(p.x()-r.x());
					internalpos->setY(p.y()-r.y());
				}
				return info;
			}
		}

		if (it == list.begin())
			break;
	}
	return 0L;
}