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); } }
/** * 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() ); }
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(); }
bool PlaylistWindow::isReallyShown() const { const KWin::WindowInfo info = KWin::windowInfo( winId() ); return isShown() && !info.isMinimized() && info.isOnDesktop( KWin::currentDesktop() ); }