本文整理汇总了C++中kwin::WindowInfo类的典型用法代码示例。如果您正苦于以下问题:C++ WindowInfo类的具体用法?C++ WindowInfo怎么用?C++ WindowInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WindowInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: showAgain
void Window::showAgain() {
mLineEdit->clear();
mView->clear();
updateWindowInfoList();
WindowInfoList::ConstIterator
it = mWindowInfoList.begin(),
end = mWindowInfoList.end();
for (; it!=end; ++it) {
KWin::WindowInfo info = *it;
QListViewItem* item = new QListViewItem(mView, info.visibleName());
QPixmap pix = KWin::icon(info.win(), 16, 16, true);
item->setPixmap(0, pix);
}
if (!mWindowInfoList.empty()) {
mView->setSelected(mView->firstChild(), true);
}
QRect rect = QApplication::desktop()->availableGeometry();
int width = mView->columnWidth(0) + 30;
int height = 300;
move(
rect.left() + (rect.width() - width) / 2,
rect.top() + (rect.height() - height) / 2
);
resize(width, height);
show();
KWin::forceActiveWindow(winId());
}
示例2:
bool RKWardApplication::x11EventFilter (XEvent *e) {
if (detect_x11_creations) {
if (e->type == CreateNotify) {
if (e->xcreatewindow.parent == qt_xrootwin ()) {
KWin::WindowInfo info = KWin::windowInfo (e->xcreatewindow.window);
// 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 give 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)) {
KWin::WindowInfo wininfo = KWin::windowInfo (e->xproperty.window);
name_watchers_list[e->xproperty.window]->setCaption (wininfo.name ());
return true;
}
}
}
return KApplication::x11EventFilter (e);
}
示例3: pager
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;
}
示例4: raiseWindow
bool raiseWindow(QWidget *w, unsigned)
#endif
{
Event e(EventRaiseWindow, w);
if (e.process())
return false;
#ifdef USE_KDE
/* info.currentDesktop is 0 when iconified :(
also onAllDesktops is 0 when Objekt isn't
shown already */
#if KDE_IS_VERSION(3,2,0)
KWin::WindowInfo info = KWin::windowInfo(w->winId());
if ((!info.onAllDesktops()) || (desk == 0)) {
if (desk == 0) desk = KWin::currentDesktop();
KWin::setOnDesktop(w->winId(), desk);
}
#else
KWin::Info info = KWin::info(w->winId());
if ((!info.onAllDesktops) || (desk == 0)) {
if (desk == 0) desk = KWin::currentDesktop();
KWin::setOnDesktop(w->winId(), desk);
}
#endif
#endif
w->show();
w->showNormal();
w->raise();
#ifdef WIN32
AttachThreadInput(GetWindowThreadProcessId(GetForegroundWindow(),NULL), GetCurrentThreadId(), TRUE);
SetForegroundWindow(w->winId());
SetFocus(w->winId());
AttachThreadInput(GetWindowThreadProcessId(GetForegroundWindow(),NULL), GetCurrentThreadId(), FALSE);
#endif
return true;
}
示例5: saveGeometry
EXPORT void saveGeometry(QWidget *w, Data geo[5])
{
if (w == NULL)
return;
QPoint pos = w->pos();
QSize size = w->size();
geo[0].value = pos.x();
geo[1].value = pos.y();
geo[2].value = size.width();
geo[3].value = size.height();
#ifdef WIN32
if (GetWindowLongA(w->winId(), GWL_EXSTYLE) & WS_EX_TOOLWINDOW){
int dc = GetSystemMetrics(SM_CYCAPTION);
int ds = GetSystemMetrics(SM_CYSMCAPTION);
geo[1].value += dc - ds;
geo[3].value -= (dc - ds) * 2;
}
#endif
#ifdef USE_KDE
#if KDE_IS_VERSION(3,1,94)
KWin::WindowInfo info = KWin::windowInfo(w->winId());
geo[4].value = info.desktop();
if (info.onAllDesktops())
geo[4].value = (unsigned)(-1);
#else
KWin::Info info = KWin::info(w->winId());
geo[4].value = info.desktop;
if (info.onAllDesktops)
geo[4].value = (unsigned)(-1);
#endif
#endif
}
示例6: minimizeRestore
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
}
示例7: slotWindowAdded
void KPager::slotWindowAdded( WId win)
{
KWin::WindowInfo* inf = info( win );
if (!inf)
return; // never should be here
for ( int i=1; i <= (int) m_desktops.count(); ++i)
{
if ( inf->isOnDesktop( i ))
m_desktops[i-1]->repaint(false);
}
}
示例8: info
KWin::WindowInfo* KPager::info( WId win )
{
KWin::WindowInfo* info = m_windows[win];
if (!info )
{
info = new KWin::WindowInfo( KWin::windowInfo( win ) );
if( !info->valid() || info->desktop() == 0 )
{
delete info;
return NULL; // window no longer valid
}
m_windows.insert( (long) win, info );
}
return info;
}
示例9: switchToWindow
void Window::switchToWindow(QListViewItem* item) {
QString itemName = item->text(0);
WindowInfoList::ConstIterator
it = mWindowInfoList.begin(),
end = mWindowInfoList.end();
for (; it!=end; ++it) {
KWin::WindowInfo info = *it;
if (info.visibleName() == itemName) {
hide();
KWin::forceActiveWindow(info.win());
return;
}
}
}
示例10: slotWindowRemoved
void KPager::slotWindowRemoved( WId win )
{
KWin::WindowInfo* inf = m_windows[win];
if (inf)
{
bool onAllDesktops = inf->onAllDesktops();
int desktop = inf->desktop();
m_windows.remove( (long)win );
Desktop::removeCachedPixmap(win);
for (int i = 1; i <= (int) m_desktops.count(); ++i)
{
if (onAllDesktops || desktop == i)
m_desktops[i-1]->repaint(false);
}
}
}
示例11: mousePressEvent
void Desktop::mousePressEvent( QMouseEvent * ev)
{
bool showWindows= KPagerConfigDialog::m_showWindows;
if (ev->button()==LeftButton){
pressPos = ev->pos();
}
else if ((ev->button()==MidButton)&&(showWindows))
startDrag(ev->pos());
else if (ev->button()==RightButton) {
QPoint pos;
KWin::WindowInfo *info = windowAtPosition(ev->pos(), &pos);
if ( info && showWindows )
pager()->showPopupMenu(info->win(), mapToGlobal(ev->pos()));
else
pager()->showPopupMenu(0, mapToGlobal(ev->pos()));
}
}
示例12: updateWindowInfoList
void Window::updateWindowInfoList() {
KWinModule kwinModule;
typedef QValueList<WId> WIdList;
const WIdList & list = kwinModule.windows();
WIdList::ConstIterator
it = list.begin(),
end = list.end();
mWindowInfoList.clear();
for (; it!=end; ++it) {
KWin::WindowInfo info = KWin::windowInfo(*it);
NET::WindowType type = info.windowType(NET::AllTypesMask);
if (type != NET::Desktop && type != NET::Dock && type != NET::Menu) {
mWindowInfoList << info;
}
}
}
示例13: mouseReleaseEvent
void Desktop::mouseReleaseEvent( QMouseEvent *ev )
{
/** Note that mouseReleaseEvent is not called when releasing the mouse
to drop a window in this desktop */
if (ev->button()==LeftButton)
{
bool showWindows= KPagerConfigDialog::m_showWindows;
QPoint pos;
KWin::setCurrentDesktop(m_desk);
if (showWindows)
{
KWin::WindowInfo *info = windowAtPosition(ev->pos(), &pos);
if (info)
{
KWin::forceActiveWindow(info->win());
// if ( static_cast<WindowDrawMode>( KPagerConfigDialog::m_windowDrawMode ) == Pixmap )
// m_windowPixmapsDirty.replace(info->win,true);
}
}
}
}
示例14: showHide
/**
* Show/hide playlist global shortcut and PlayerWindow PlaylistButton connect to this slot
* RULES:
* 1. hidden & iconified -> deiconify & show @n
* 2. hidden & deiconified -> show @n
* 3. shown & iconified -> deiconify @n
* 4. shown & deiconified -> hide @n
* 5. don't hide if there is no tray icon or playerWindow. todo (I can't be arsed) @n
*
* @note isMinimized() can only be true if the window isShown()
* this has taken me hours to get right, change at your peril!
* there are more contingencies than you can believe
*/
void PlaylistWindow::showHide() //SLOT
{
const KWin::WindowInfo info = KWin::windowInfo( winId() );
const uint desktop = KWin::currentDesktop();
const bool isOnThisDesktop = info.isOnDesktop( desktop );
const bool isShaded = false;
if( isShaded )
{
KWin::clearState( winId(), NET::Shaded );
setShown( true );
}
if( !isOnThisDesktop )
{
KWin::setOnDesktop( winId(), desktop );
setShown( true );
}
else if( !info.isMinimized() && !isShaded ) setShown( !isShown() );
if( isShown() ) KWin::deIconifyWindow( winId() );
}
示例15: KAction
KSystemTray::KSystemTray(QWidget *parent, const char *name) : QLabel(parent, name, WType_TopLevel)
{
#ifdef Q_WS_X11
QXEmbed::initialize();
#endif
d = new KSystemTrayPrivate;
d->actionCollection = new KActionCollection(this);
#ifdef Q_WS_X11
KWin::setSystemTrayWindowFor(winId(), parent ? parent->topLevelWidget()->winId() : qt_xrootwin());
#endif
setBackgroundMode(X11ParentRelative);
setBackgroundOrigin(WindowOrigin);
hasQuit = 0;
menu = new KPopupMenu(this);
menu->insertTitle(kapp->miniIcon(), kapp->caption());
move(-1000, -1000);
KStdAction::quit(this, SLOT(maybeQuit()), d->actionCollection);
if(parentWidget())
{
new KAction(i18n("Minimize"), KShortcut(), this, SLOT(minimizeRestoreAction()), d->actionCollection, "minimizeRestore");
#ifdef Q_WS_X11
KWin::WindowInfo info = KWin::windowInfo(parentWidget()->winId());
d->on_all_desktops = info.onAllDesktops();
#else
d->on_all_desktops = false;
#endif
}
else
{
d->on_all_desktops = false;
}
setCaption(KGlobal::instance()->aboutData()->programName());
setAlignment(alignment() | Qt::AlignVCenter | Qt::AlignHCenter);
}