From 2ff73028a0525c47cf2fbe2b7ebebf6dd4eecd0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 19 Nov 2009 08:34:28 +0000 Subject: [PATCH] Make it possible to move windows across screens in desktop grid. BUG: 213845 svn path=/trunk/KDE/kdebase/workspace/; revision=1051265 --- effects.cpp | 7 +++++++ effects.h | 1 + effects/desktopgrid/desktopgrid.cpp | 3 +++ lib/kwineffects.h | 3 ++- 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/effects.cpp b/effects.cpp index da00950144..ba54e5117a 100644 --- a/effects.cpp +++ b/effects.cpp @@ -458,6 +458,13 @@ void EffectsHandlerImpl::windowToDesktop( EffectWindow* w, int desktop ) Workspace::self()->sendClientToDesktop( cl, desktop, true ); } +void EffectsHandlerImpl::windowToScreen( EffectWindow* w, int screen ) + { + Client* cl = dynamic_cast< Client* >( static_cast(w)->window()); + if( cl && !cl->isDesktop() && !cl->isDock() && !cl->isTopMenu()) + Workspace::self()->sendClientToScreen( cl, screen ); + } + void EffectsHandlerImpl::setShowingDesktop( bool showing ) { Workspace::self()->setShowingDesktop( showing ); diff --git a/effects.h b/effects.h index 0becb616af..651a74d833 100644 --- a/effects.h +++ b/effects.h @@ -55,6 +55,7 @@ class EffectsHandlerImpl : public EffectsHandler virtual EffectWindow* activeWindow() const; virtual void moveWindow( EffectWindow* w, const QPoint& pos, bool snap = false, double snapAdjust = 1.0 ); virtual void windowToDesktop( EffectWindow* w, int desktop ); + virtual void windowToScreen( EffectWindow* w, int screen ); virtual void setShowingDesktop( bool showing ); virtual int currentDesktop() const; diff --git a/effects/desktopgrid/desktopgrid.cpp b/effects/desktopgrid/desktopgrid.cpp index c65c436d60..c677326296 100644 --- a/effects/desktopgrid/desktopgrid.cpp +++ b/effects/desktopgrid/desktopgrid.cpp @@ -451,6 +451,9 @@ void DesktopGridEffect::windowInputMouseEvent( Window, QEvent* e ) if( d != highlightedDesktop && !windowMove->isOnAllDesktops() ) { effects->windowToDesktop( windowMove, d ); // Not true all desktop move + const int screen = effects->screenNumber( me->pos() ); + if( screen != windowMove->screen() ) + effects->windowToScreen( windowMove, screen ); } effects->addRepaintFull(); } diff --git a/lib/kwineffects.h b/lib/kwineffects.h index a28cb2154a..95da2c48f1 100644 --- a/lib/kwineffects.h +++ b/lib/kwineffects.h @@ -170,7 +170,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 107 +#define KWIN_EFFECT_API_VERSION_MINOR 108 #define KWIN_EFFECT_API_VERSION KWIN_EFFECT_API_MAKE_VERSION( \ KWIN_EFFECT_API_VERSION_MAJOR, KWIN_EFFECT_API_VERSION_MINOR ) @@ -563,6 +563,7 @@ class KWIN_EXPORT EffectsHandler virtual EffectWindow* activeWindow() const = 0 ; virtual void moveWindow( EffectWindow* w, const QPoint& pos, bool snap = false, double snapAdjust = 1.0 ) = 0; virtual void windowToDesktop( EffectWindow* w, int desktop ) = 0; + virtual void windowToScreen( EffectWindow* w, int desktop ) = 0; virtual void setShowingDesktop( bool showing ) = 0; // Desktops