emit desktopPresenceChanged from Client:setDesktop

and forward it to scripted effects

CCBUG: 326903
REVIEW: 114080
This commit is contained in:
Thomas Lübking 2013-11-17 21:45:21 +01:00
parent 03b23e21d9
commit c378bf4f7c
6 changed files with 21 additions and 2 deletions

View file

@ -1457,6 +1457,7 @@ void Client::setDesktop(int desktop)
return;
int was_desk = desk;
const bool wasOnCurrentDesktop = isOnCurrentDesktop();
desk = desktop;
info->setDesktop(desktop);
if ((was_desk == NET::OnAllDesktops) != (desktop == NET::OnAllDesktops)) {
@ -1486,6 +1487,8 @@ void Client::setDesktop(int desktop)
if (tabGroup())
tabGroup()->updateStates(this, TabGroup::Desktop);
emit desktopChanged();
if (wasOnCurrentDesktop != isOnCurrentDesktop())
emit desktopPresenceChanged(this, was_desk);
}
/**

View file

@ -719,6 +719,7 @@ signals:
void activeChanged();
void captionChanged();
void desktopChanged();
void desktopPresenceChanged(KWin::Client*, int); // to be forwarded by Workspace
void fullScreenChanged();
void transientChanged();
void modalChanged();

View file

@ -228,6 +228,7 @@ EffectsHandlerImpl::EffectsHandlerImpl(Compositor *compositor, Scene *scene)
Workspace *ws = Workspace::self();
VirtualDesktopManager *vds = VirtualDesktopManager::self();
connect(ws, SIGNAL(currentDesktopChanged(int,KWin::Client*)), SLOT(slotDesktopChanged(int,KWin::Client*)));
connect(ws, SIGNAL(desktopPresenceChanged(KWin::Client*,int)), SLOT(slotDesktopPresenceChanged(KWin::Client*,int)));
connect(ws, SIGNAL(clientAdded(KWin::Client*)), this, SLOT(slotClientAdded(KWin::Client*)));
connect(ws, SIGNAL(unmanagedAdded(KWin::Unmanaged*)), this, SLOT(slotUnmanagedAdded(KWin::Unmanaged*)));
connect(ws, SIGNAL(clientActivated(KWin::Client*)), this, SLOT(slotClientActivated(KWin::Client*)));
@ -642,6 +643,11 @@ void EffectsHandlerImpl::slotDesktopChanged(int old, Client *c)
}
}
void EffectsHandlerImpl::slotDesktopPresenceChanged(Client *c, int old)
{
emit desktopPresenceChanged(c->effectWindow(), old, c->desktop());
}
void EffectsHandlerImpl::slotWindowDamaged(Toplevel* t, const QRect& r)
{
if (!t->effectWindow()) {

View file

@ -214,6 +214,7 @@ public Q_SLOTS:
protected Q_SLOTS:
void slotDesktopChanged(int old, KWin::Client *withClient);
void slotDesktopPresenceChanged(KWin::Client *c, int old);
void slotClientAdded(KWin::Client *c);
void slotClientShown(KWin::Toplevel*);
void slotUnmanagedAdded(KWin::Unmanaged *u);

View file

@ -947,6 +947,15 @@ Q_SIGNALS:
* @deprecated
*/
void desktopChanged(int oldDesktop, int newDesktop);
/**
* Signal emitted when a window moved to another desktop
* NOTICE that this does NOT imply that the desktop has changed
* The @param window which is moved to the new desktop
* @param oldDesktop The previous desktop of the window
* @param newDesktop The new desktop of the window
* @since 4.11.4
*/
void desktopPresenceChanged(KWin::EffectWindow *window, int oldDesktop, int newDesktop);
/**
* Signal emitted when the number of currently existing desktops is changed.
* @param old The previous number of desktops in used.

View file

@ -471,6 +471,7 @@ Client* Workspace::createClient(xcb_window_t w, bool is_mapped)
#ifdef KWIN_BUILD_SCREENEDGES
connect(c, SIGNAL(clientFullScreenSet(KWin::Client*,bool,bool)), ScreenEdges::self(), SIGNAL(checkBlocking()));
#endif
connect(c, SIGNAL(desktopPresenceChanged(KWin::Client*,int)), SIGNAL(desktopPresenceChanged(KWin::Client*,int)), Qt::QueuedConnection);
if (!c->manage(w, is_mapped)) {
Client::deleteClient(c);
return NULL;
@ -1166,8 +1167,6 @@ void Workspace::sendClientToDesktop(Client* c, int desk, bool dont_activate)
return;
desk = c->desktop(); // Client did range checking
emit desktopPresenceChanged(c, old_desktop);
if (c->isOnDesktop(VirtualDesktopManager::self()->current())) {
if (c->wantsTabFocus() && options->focusPolicyIsReasonable() &&
!was_on_desktop && // for stickyness changes