コード例 #1
0
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;
        }
    }
}
コード例 #2
0
ファイル: rkwardapplication.cpp プロジェクト: KDE/rkward
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
0
ファイル: daisyTasks.cpp プロジェクト: baddwin/daisyplasma
//-----------------------------------------------------------------------------
// Window added
void daisy::windowAdded(WId id)
{
  if (!m_drawerscleared)clearDrawers();
  KWindowInfo taskInfo = KWindowSystem::windowInfo( id, NET::WMName | NET::WMVisibleName , NET::WM2WindowClass );
  
  if ( m_alias.indexOf( taskInfo.windowClassName() ) != -1 )
  {
    m_activetasks << m_alias.indexOf( taskInfo.windowClassName() );
    if ( m_showindicons )emit update();
  }
  else if ( m_alias.indexOf( QString(taskInfo.windowClassClass().toLower()) ) != -1 )
  {
    m_activetasks << m_alias.indexOf( QString(taskInfo.windowClassClass().toLower()) );
    if ( m_showindicons )emit update();
  }
  else if ( m_alias.indexOf( taskInfo.name() ) != -1 )
  {
    m_activetasks << m_alias.indexOf( taskInfo.name() );
    if ( m_showindicons )emit update();
  }
  
}
コード例 #4
0
ファイル: daisyTasks.cpp プロジェクト: baddwin/daisyplasma
//-----------------------------------------------------------------------------
// Window removed
//FIXME
void daisy::windowRemoved(WId id)
{
  if (!m_drawerscleared)clearDrawers();
  m_closingwindow = -1;
    
  KWindowInfo taskInfo = KWindowSystem::windowInfo( id, NET::WMName | NET::WMVisibleName , NET::WM2WindowClass );
  if ( m_alias.indexOf( taskInfo.windowClassName() ) != -1 )
  {
    m_closingwindow = m_alias.indexOf( taskInfo.windowClassName() );
    if ( m_showindicons )m_up_tmr->setInterval(1500);m_up_tmr->start();
  }
  else if ( m_alias.indexOf( QString(taskInfo.windowClassClass().toLower()) ) != -1 )
  {
    m_closingwindow = m_alias.indexOf( QString(taskInfo.windowClassClass().toLower()) );
    if ( m_showindicons )m_up_tmr->setInterval(1500);m_up_tmr->start();
  }
  else if ( m_alias.indexOf( taskInfo.name() ) != -1 )
  {
    m_closingwindow = m_alias.indexOf( taskInfo.name() );
    if ( m_showindicons )m_up_tmr->setInterval(1500);m_up_tmr->start();
  }
  else if ( m_alias.indexOf( taskInfo.visibleName() ) != -1 )
  {
    m_closingwindow = m_alias.indexOf( taskInfo.visibleName() );
    if ( m_showindicons )m_up_tmr->setInterval(1500);m_up_tmr->start();
  }
  
  else
  {
    getAllTasks();
  }
  
  
  if ( m_showindicons )emit update();
  
}
コード例 #5
0
ファイル: daisyTasks.cpp プロジェクト: baddwin/daisyplasma
//-----------------------------------------------------------------------------
// Get task
bool daisy::getTaskPtr( 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 ( taskInfo.windowClassName() == name || taskInfo.visibleName() == name || taskInfo.name() == name || QString(taskInfo.windowClassClass().toLower()) == name  )
    {
      m_task = TaskManager::TaskManager::self()->findTask( *it );
      return true;
    }
  }
  return false;
  
}
コード例 #6
0
ファイル: sniproxy.cpp プロジェクト: stativ/xembed-sni-proxy
QString SNIProxy::Title() const
{
    KWindowInfo window (m_windowId, NET::WMName);
    return window.name();
}