From 0040bb699beed1938daa6d32ef9a0218de36bf91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Sat, 21 Apr 2007 10:26:02 +0000 Subject: [PATCH] Better painting of moved window. svn path=/branches/work/kwin_composite/; revision=656410 --- COMPOSITE_TODO | 6 ++++++ effects/desktopgrid.cpp | 42 ++++++++++++++++++++++++++++------------- effects/desktopgrid.h | 1 + 3 files changed, 36 insertions(+), 13 deletions(-) diff --git a/COMPOSITE_TODO b/COMPOSITE_TODO index 79b670403b..8ebecc5d1d 100644 --- a/COMPOSITE_TODO +++ b/COMPOSITE_TODO @@ -179,6 +179,12 @@ Effects framework TODO * check Scene::updateTimeDiff() - should the time be 0 or 1? +* DesktopGridEffect has somewhat broken stacking order while moving windows + - the window is in proper layer when on its desktop but on top of everything when moved + to another desktop, due to its desktop being painted later + - maybe there should be PAINT_WINDOW_TOP (_LAST or whatever) that'd make it painted always + on top of everything + Effects TODO =============================== diff --git a/effects/desktopgrid.cpp b/effects/desktopgrid.cpp index 5ef0be54a8..e4d56b3110 100644 --- a/effects/desktopgrid.cpp +++ b/effects/desktopgrid.cpp @@ -98,7 +98,11 @@ void DesktopGridEffect::prePaintWindow( EffectWindow* w, int* mask, QRegion* pai else w->disablePainting( EffectWindow::PAINT_DISABLED_BY_DESKTOP ); if( w == window_move ) + { *mask |= PAINT_WINDOW_TRANSFORMED; + if( w->isOnAllDesktops() && painting_desktop != effects->currentDesktop()) + w->disablePainting( EffectWindow::PAINT_DISABLED_BY_DESKTOP ); + } } effects->prePaintWindow( w, mask, paint, clip, time ); } @@ -115,23 +119,35 @@ void DesktopGridEffect::paintScreen( int mask, QRegion region, ScreenPaintData& paintSlide( mask, region, data ); return; } + int desktop_with_move = -1; + if( window_move != NULL ) + desktop_with_move = window_move->isOnAllDesktops() ? effects->currentDesktop() : window_move->desktop(); for( int desktop = 1; desktop <= effects->numberOfDesktops(); ++desktop ) { - QRect rect = desktopRect( desktop, true ); - if( region.contains( rect )) // this desktop needs painting - { - painting_desktop = desktop; - ScreenPaintData d = data; - QRect normal = desktopRect( effects->currentDesktop(), false ); - d.xTranslate += rect.x(); // - normal.x(); - d.yTranslate += rect.y(); // - normal.y(); - d.xScale *= rect.width() / float( normal.width()); - d.yScale *= rect.height() / float( normal.height()); - // TODO mask parts that are not visible? - effects->paintScreen( mask, region, d ); - } + if( desktop != desktop_with_move ) + paintScreenDesktop( desktop, mask, region, data ); + } + // paint the desktop with the window being moved as the last one, i.e. on top of others + if( desktop_with_move != -1 ) + paintScreenDesktop( desktop_with_move, mask, region, data ); + } + +void DesktopGridEffect::paintScreenDesktop( int desktop, int mask, QRegion region, ScreenPaintData data ) + { + QRect rect = desktopRect( desktop, true ); + if( region.contains( rect )) // this desktop needs painting + { + painting_desktop = desktop; + ScreenPaintData d = data; + QRect normal = desktopRect( effects->currentDesktop(), false ); + d.xTranslate += rect.x(); // - normal.x(); + d.yTranslate += rect.y(); // - normal.y(); + d.xScale *= rect.width() / float( normal.width()); + d.yScale *= rect.height() / float( normal.height()); + // TODO mask parts that are not visible? + effects->paintScreen( mask, region, d ); } } diff --git a/effects/desktopgrid.h b/effects/desktopgrid.h index d50b336ec8..d567f9592e 100644 --- a/effects/desktopgrid.h +++ b/effects/desktopgrid.h @@ -42,6 +42,7 @@ class DesktopGridEffect void setup(); void finish(); void paintSlide( int mask, QRegion region, const ScreenPaintData& data ); + void paintScreenDesktop( int desktop, int mask, QRegion region, ScreenPaintData data ); void slideDesktopChanged( int old ); float progress; bool activated;