From 13c2f21e9dd5707004c470fb1f9e8136620497c1 Mon Sep 17 00:00:00 2001 From: Lucas Murray Date: Sun, 8 Feb 2009 08:45:21 +0000 Subject: [PATCH] Added EffectWindow::acceptsFocus(). Prevent present windows from displaying windows that cannot be focused anyway (Such as conky). svn path=/trunk/KDE/kdebase/workspace/; revision=923091 --- effects.cpp | 8 ++++++++ effects.h | 1 + effects/presentwindows/presentwindows.cpp | 2 ++ lib/kwineffects.h | 6 +++++- 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/effects.cpp b/effects.cpp index 949ecd96b1..52dda8e9f5 100644 --- a/effects.cpp +++ b/effects.cpp @@ -1343,6 +1343,14 @@ bool EffectWindowImpl::isManaged() const return dynamic_cast< const Client* >( toplevel ) != NULL; } +bool EffectWindowImpl::acceptsFocus() const + { + const Client* client = dynamic_cast< const Client* >( toplevel ); + if( !client ) + return true; // We don't actually know... + return client->wantsInput(); + } + bool EffectWindowImpl::isModal() const { if( Client* c = dynamic_cast< Client* >( toplevel )) diff --git a/effects.h b/effects.h index e78eb7057e..d4416b1a52 100644 --- a/effects.h +++ b/effects.h @@ -237,6 +237,7 @@ class EffectWindowImpl : public EffectWindow virtual bool isComboBox() const; virtual bool isDNDIcon() const; virtual bool isManaged() const; // managed or override-redirect + virtual bool acceptsFocus() const; virtual bool isModal() const; virtual EffectWindow* findModal(); diff --git a/effects/presentwindows/presentwindows.cpp b/effects/presentwindows/presentwindows.cpp index 4f7a6d8d2c..b7d0d7988b 100644 --- a/effects/presentwindows/presentwindows.cpp +++ b/effects/presentwindows/presentwindows.cpp @@ -1268,6 +1268,8 @@ bool PresentWindowsEffect::isSelectableWindow( EffectWindow *w ) return false; if( w->isDeleted() ) return false; + if( !w->acceptsFocus() ) + return false; if( !m_allDesktops && !w->isOnCurrentDesktop() ) return false; if( !m_tabBoxEnabled && m_ignoreMinimized && w->isMinimized() ) diff --git a/lib/kwineffects.h b/lib/kwineffects.h index 206a618df4..89ccf1ec7b 100644 --- a/lib/kwineffects.h +++ b/lib/kwineffects.h @@ -164,7 +164,7 @@ X-KDE-Library=kwin4_effect_cooleffect #define KWIN_EFFECT_API_MAKE_VERSION( major, minor ) (( major ) << 8 | ( minor )) #define KWIN_EFFECT_API_VERSION_MAJOR 0 -#define KWIN_EFFECT_API_VERSION_MINOR 58 +#define KWIN_EFFECT_API_VERSION_MINOR 59 #define KWIN_EFFECT_API_VERSION KWIN_EFFECT_API_MAKE_VERSION( \ KWIN_EFFECT_API_VERSION_MAJOR, KWIN_EFFECT_API_VERSION_MINOR ) @@ -843,6 +843,10 @@ class KWIN_EXPORT EffectWindow * aspects, as opposed to override-redirect windows that are entirely handled by the application). */ virtual bool isManaged() const = 0; // whether it's managed or override-redirect + /** + * Returns whether or not the window can accept keyboard focus. + */ + virtual bool acceptsFocus() const = 0; virtual bool isModal() const = 0; virtual EffectWindow* findModal() = 0;