本文整理汇总了C++中kwin::WindowInfo类的典型用法代码示例。如果您正苦于以下问题:C++ WindowInfo类的具体用法?C++ WindowInfo怎么用?C++ WindowInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WindowInfo类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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());
}
开发者ID:agateau,项目名称:switcha,代码行数:32,代码来源:window.cpp
示例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);
}
开发者ID:svn2github,项目名称:rkward-svn-mirror,代码行数:29,代码来源:rkwardapplication.cpp
示例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;
}
开发者ID:,项目名称:,代码行数:30,代码来源:
示例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;
}
开发者ID:,项目名称:,代码行数:35,代码来源:
示例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
}
开发者ID:,项目名称:,代码行数:32,代码来源:
示例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
}
开发者ID:,项目名称:,代码行数:25,代码来源:
示例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);
}
}
开发者ID:,项目名称:,代码行数:12,代码来源:
示例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;
}
开发者ID:,项目名称:,代码行数:15,代码来源:
示例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;
}
}
}
开发者ID:agateau,项目名称:switcha,代码行数:16,代码来源:window.cpp
示例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);
}
}
}
开发者ID:,项目名称:,代码行数:16,代码来源:
示例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()));
}
}
开发者ID:,项目名称:,代码行数:17,代码来源:
示例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;
}
}
}
开发者ID:agateau,项目名称:switcha,代码行数:18,代码来源:window.cpp
示例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);
}
}
}
}
开发者ID:,项目名称:,代码行数:22,代码来源:
示例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() );
}
开发者ID:tmarques,项目名称:waheela,代码行数:36,代码来源:playlistwindow.cpp
示例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);
}
开发者ID:,项目名称:,代码行数:37,代码来源:
示例16: slotWindowChanged
void KPager::slotWindowChanged( WId win , unsigned int prop)
{
bool repaint=false;
KWin::WindowInfo* inf = m_windows[win];
if (!inf)
{
inf=info(win);
prop=0; // info already calls KWin::info, so there's no need
// to update anything else.
repaint=true;
};
bool onAllDesktops = inf ? inf->onAllDesktops() : false;
int desktop = inf ? inf->desktop() : 0;
if (prop)
{
m_windows.remove( (long) win );
inf = info( win );
}
if((prop & ~( NET::WMName | NET::WMVisibleName )) != 0 )
repaint = true;
if (repaint)
for ( int i=1; i <= (int) m_desktops.count(); ++i)
{
if ((inf && (inf->isOnDesktop(i)))
|| onAllDesktops || desktop == i )
{
m_desktops[i-1]->repaint(false);
}
}
// redrawDesktops();
}
开发者ID:,项目名称:,代码行数:36,代码来源:
示例17: setTargetWindow
void KSysTrayCmd::setTargetWindow( const KWin::WindowInfo &info )
{
disconnect( kwinmodule, SIGNAL(windowAdded(WId)), this, SLOT(windowAdded(WId)) );
connect( kwinmodule, SIGNAL(windowChanged(WId)), SLOT(windowChanged(WId)) );
win = info.win();
KWin::setSystemTrayWindowFor( winId(), win );
refresh();
show();
if ( isVisible )
KWin::activateWindow( win );
else
hideWindow();
// Always on top ?
if (onTop)
{
KWin::setState(win, NET::StaysOnTop);
}
}
开发者ID:,项目名称:,代码行数:20,代码来源:
示例18: init
void KWindowListMenu::init()
{
int i, d;
i = 0;
int nd = twin_module->numberOfDesktops();
int cd = twin_module->currentDesktop();
WId active_window = twin_module->activeWindow();
// Make sure the popup is not too wide, otherwise clicking in the middle of kdesktop
// wouldn't leave any place for the popup, and release would activate some menu entry.
int maxwidth = kapp->desktop()->screenGeometry( this ).width() / 2 - 100;
clear();
map.clear();
int unclutter = insertItem( i18n("Unclutter Windows"),
this, TQT_SLOT( slotUnclutterWindows() ) );
int cascade = insertItem( i18n("Cascade Windows"),
this, TQT_SLOT( slotCascadeWindows() ) );
// if we only have one desktop we won't be showing titles, so put a separator in
if (nd == 1)
{
insertSeparator();
}
TQValueList<KWin::WindowInfo> windows;
for (TQValueList<WId>::ConstIterator it = twin_module->windows().begin();
it != twin_module->windows().end(); ++it) {
windows.append( KWin::windowInfo( *it, NET::WMDesktop ));
}
bool show_all_desktops_group = ( nd > 1 );
for (d = 1; d <= nd + (show_all_desktops_group ? 1 : 0); d++) {
bool on_all_desktops = ( d > nd );
int items = 0;
if (!active_window && d == cd)
setItemChecked(1000 + d, true);
NameSortedInfoList list;
list.setAutoDelete(true);
for (TQValueList<KWin::WindowInfo>::ConstIterator it = windows.begin();
it != windows.end(); ++it) {
if (((*it).desktop() == d) || (on_all_desktops && (*it).onAllDesktops())
|| (!show_all_desktops_group && (*it).onAllDesktops())) {
list.inSort(new KWin::WindowInfo( (*it).win(),
NET::WMVisibleName | NET::WMState | NET::XAWMState | NET::WMWindowType,
NET::WM2GroupLeader | NET::WM2TransientFor ));
}
}
for (KWin::WindowInfo* info = list.first(); info; info = list.next(), ++i)
{
TQString itemText = KStringHandler::cPixelSqueeze(info->visibleNameWithState(), fontMetrics(), maxwidth);
NET::WindowType windowType = info->windowType( NET::NormalMask | NET::DesktopMask
| NET::DockMask | NET::ToolbarMask | NET::MenuMask | NET::DialogMask
| NET::OverrideMask | NET::TopMenuMask | NET::UtilityMask | NET::SplashMask );
if ( (windowType == NET::Normal || windowType == NET::Unknown
|| (windowType == NET::Dialog && standaloneDialog( info, list )))
&& !(info->state() & NET::SkipTaskbar) ) {
TQPixmap pm = KWin::icon(info->win(), 16, 16, true );
items++;
// ok, we have items on this desktop, let's show the title
if ( items == 1 && nd > 1 )
{
if( !on_all_desktops )
insertTitle(twin_module->desktopName( d ), 1000 + d);
else
insertTitle(i18n("On All Desktops"), 2000 );
}
// Avoid creating unwanted accelerators.
itemText.replace('&', TQString::fromLatin1("&&"));
insertItem( pm, itemText, i);
map.insert(i, info->win());
if (info->win() == active_window)
setItemChecked(i, true);
}
}
if (d == cd)
{
setItemEnabled(unclutter, items > 0);
setItemEnabled(cascade, items > 0);
}
}
// no windows?
if (i == 0)
{
if (nd > 1)
{
// because we don't have any titles, nor a separator
insertSeparator();
}
//.........这里部分代码省略.........
开发者ID:Fat-Zer,项目名称:tdelibs,代码行数:101,代码来源:twindowlistmenu.cpp
示例19: isReallyShown
bool PlaylistWindow::isReallyShown() const
{
const KWin::WindowInfo info = KWin::windowInfo( winId() );
return isShown() && !info.isMinimized() && info.isOnDesktop( KWin::currentDesktop() );
}
开发者ID:tmarques,项目名称:waheela,代码行数:5,代码来源:playlistwindow.cpp
注:本文中的kwin::WindowInfo类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论