From 91d73bedca08a969b56781b92976a1a710074a59 Mon Sep 17 00:00:00 2001 From: Matthias Ettrich Date: Mon, 29 Nov 1999 02:49:20 +0000 Subject: [PATCH] animated shading works again. Shortcut for shading possible "Window shade" svn path=/trunk/kdebase/kwin/; revision=35392 --- README | 2 +- client.cpp | 8 ++++---- kwinbindings.cpp | 1 + options.cpp | 10 ++-------- workspace.cpp | 17 ++++++++++++++--- workspace.h | 3 ++- 6 files changed, 24 insertions(+), 17 deletions(-) diff --git a/README b/README index 111b89a1e4..593e934233 100644 --- a/README +++ b/README @@ -10,7 +10,7 @@ Currently supported options in the kwinrc: MoveMode=Opaque|Transparent ResizeMode=Opaque|Transparent Placement=Smart|Random|Cascade -AnimateShade=TRUE|FALSE +AnimateShade=true|false AnimSteps= BorderSnapZone= WindowSnapZone= diff --git a/client.cpp b/client.cpp index f30c698463..3e84eaf0cd 100644 --- a/client.cpp +++ b/client.cpp @@ -1356,8 +1356,8 @@ void Client::setShade( bool s ) windowWrapper()->hide(); repaint( FALSE ); // force direct repaint setWFlags( WNorthWestGravity ); - int step = QMAX( 15, QABS( h - s.height() ) / as )+1; - do { + int step = QMAX( 4, QABS( h - s.height() ) / as )+1; + do { h -= step; resize ( s.width(), h ); QApplication::syncX(); @@ -1368,8 +1368,8 @@ void Client::setShade( bool s ) int h = height(); QSize s( sizeForWindowSize( windowWrapper()->size(), TRUE ) ); setWFlags( WNorthWestGravity ); - int step = QMAX( 15, QABS( h - s.height() ) / as )+1; - do { + int step = QMAX( 4, QABS( h - s.height() ) / as )+1; + do { h += step; resize ( s.width(), h ); // assume a border diff --git a/kwinbindings.cpp b/kwinbindings.cpp index fe4af0b5e9..73caded50b 100644 --- a/kwinbindings.cpp +++ b/kwinbindings.cpp @@ -14,3 +14,4 @@ keys->insertItem(i18n("Window maximize vertical"),"Window maximize vertical", ""); keys->insertItem(i18n("Window maximize horizontal"),"Window maximize horizontal", ""); keys->insertItem(i18n("Window iconify"),"Window iconify", ""); + keys->insertItem(i18n("Window shade"),"Window shade", ""); diff --git a/options.cpp b/options.cpp index c400bc16c9..995dad4921 100644 --- a/options.cpp +++ b/options.cpp @@ -13,12 +13,6 @@ Options::Options() cg[i] = NULL; reload(); - //CT fix them for now. Will be read from rc - placement = Smart; - animate_shade = false; - anim_steps = 20; - border_snap_zone = window_snap_zone = 10; - connect( kapp, SIGNAL( appearanceChanged() ), this, SLOT(reload() ) ); } @@ -151,9 +145,9 @@ void Options::reload() else if (val == "Random") placement = Random; else if (val == "Cascade") placement = Cascade; - animate_shade = config->readBoolEntry("AnimateShade", false); + animate_shade = config->readBoolEntry("AnimateShade", TRUE ); - anim_steps = config->readNumEntry("AnimSteps", 20); + anim_steps = config->readNumEntry("AnimSteps", 50); border_snap_zone = config->readNumEntry("BorderSnapZone", 10); window_snap_zone = config->readNumEntry("WindowSnapZone", 10); diff --git a/workspace.cpp b/workspace.cpp index e7f1bb1677..6014c50be8 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -26,7 +26,7 @@ extern Time kwin_time; // Necessary since shaped window are an extension to X static int kwin_has_shape = 0; static int kwin_shape_event = 0; - +static bool block_focus = FALSE; // does the window w need a shape combine mask around it? bool Shape::hasShape( WId w){ int xws, yws, xbs, ybs; @@ -835,7 +835,7 @@ void Workspace::clientHidden( Client* c ) focus_chain.remove( c ); focus_chain.prepend( c ); } - if ( options->focusPolicyIsReasonable() ) { + if ( !block_focus && options->focusPolicyIsReasonable() ) { for ( ClientList::ConstIterator it = focus_chain.fromLast(); it != focus_chain.begin(); --it) { if ( (*it)->isVisible() ) { requestFocus( *it ); @@ -1283,6 +1283,9 @@ void Workspace::setCurrentDesktop( int new_desktop ){ if (new_desktop == current_desktop || new_desktop < 1 || new_desktop > number_of_desktops ) return; + active_client = 0; + block_focus = TRUE; + /* optimized Desktop switching: unmapping done from back to front mapping done from front to back => less exposure events @@ -1307,7 +1310,8 @@ void Workspace::setCurrentDesktop( int new_desktop ){ PropModeReplace, (unsigned char *)¤t_desktop, 1); - // try to restore the focus on this desktop + // restore the focus on this desktop + block_focus = FALSE; Client* c = active_client?active_client:previousClient(0); Client* stop = c; while ( c && !c->isVisible() ) { @@ -1499,6 +1503,7 @@ void Workspace::createKeybindings(){ keys->connectItem( "Window maximize horizontal", this, SLOT( slotWindowMaximizeHorizontal() ) ); keys->connectItem( "Window maximize vertical", this, SLOT( slotWindowMaximizeVertical() ) ); keys->connectItem( "Window iconify", this, SLOT( slotWindowIconify() ) ); + keys->connectItem( "Window shade", this, SLOT( slotWindowShade() ) ); keys->readSettings(); } @@ -1550,6 +1555,12 @@ void Workspace::slotWindowIconify() popup_client->iconify(); } +void Workspace::slotWindowShade() +{ + if ( popup_client ) + popup_client->setShade( !popup_client->isShade() ); +} + void Workspace::desktopPopupAboutToShow() { if ( !desk_popup ) diff --git a/workspace.h b/workspace.h index 3247620730..486eca9d5b 100644 --- a/workspace.h +++ b/workspace.h @@ -119,6 +119,7 @@ public slots: void slotWindowMaximizeVertical(); void slotWindowMaximizeHorizontal(); void slotWindowIconify(); + void slotWindowShade(); void slotWindowOperations(); void slotWindowClose(); @@ -177,7 +178,7 @@ private: bool removeDockwin( WId w ); void propagateDockwins(); DockWindow findDockwin( WId w ); - + //CT needed for cascading+ struct CascadingInfo { QPoint pos;