possibility to iconify, deiconify without animation

propagate new desktop on desktop switches _before_ showing new windows

svn path=/trunk/kdebase/kwin/; revision=54279
This commit is contained in:
Matthias Ettrich 2000-06-24 17:58:10 +00:00
parent ce9f4a2365
commit 3958a3a1e1
4 changed files with 37 additions and 9 deletions

View file

@ -36,6 +36,9 @@ Atoms::Atoms()
atoms[n] = &net_wm_context_help;
names[n++] = (char *) "_NET_WM_CONTEXT_HELP";
atoms[n] = &kde_wm_change_state;
names[n++] = (char *) "_KDE_WM_CHANGE_STATE";
XInternAtoms( qt_xdisplay(), names, n, FALSE, atoms_return );
for (int i = 0; i < n; i++ )
*atoms[i] = atoms_return[i];

View file

@ -20,6 +20,7 @@ public:
Atom motif_wm_hints;
Atom net_wm_context_help;
Atom kde_wm_change_state;
};

View file

@ -36,6 +36,8 @@ extern Time kwin_time;
static bool resizeHorizontalDirectionFixed = FALSE;
static bool resizeVerticalDirectionFixed = FALSE;
static bool blockAnimation = FALSE;
static QRect* visible_bound = 0;
@ -685,7 +687,11 @@ bool Client::mapRequest( XMapRequestEvent& /* e */ )
manage();
break;
case IconicState:
// only show window if we're on current desktop
if ( isOnDesktop( workspace()->currentDesktop() ) )
show();
else
setMappingState( NormalState );
break;
case NormalState:
// only show window if we're on current desktop
@ -856,7 +862,23 @@ bool Client::propertyNotify( XPropertyEvent& e )
*/
bool Client::clientMessage( XClientMessageEvent& e )
{
if ( e.message_type == atoms->wm_change_state) {
if ( e.message_type == atoms->kde_wm_change_state ) {
if ( e.data.l[0] == IconicState && isNormal() ) {
if ( e.data.l[1] )
blockAnimation = TRUE;
iconify();
} else if ( e.data.l[1] == NormalState && isIconified() ) {
if ( e.data.l[1] )
blockAnimation = TRUE;
// only show window if we're on current desktop
if ( isOnDesktop( workspace()->currentDesktop() ) )
show();
else
setMappingState( NormalState );
}
blockAnimation = FALSE;
} else if ( e.message_type == atoms->wm_change_state) {
if ( e.data.l[0] == IconicState && isNormal() )
iconify();
return TRUE;
@ -2159,6 +2181,8 @@ QRect Client::adjustedClientArea( const QRect& area ) const
void Client::animateIconifyOrDeiconify( bool iconify)
{
if ( blockAnimation )
return;
// the function is a bit tricky since it will ensure that an
// animation action needs always the same time regardless of the
// performance of the machine or the X-Server.

View file

@ -1648,15 +1648,15 @@ void Workspace::setCurrentDesktop( int new_desktop ){
(*it)->hide();
}
}
current_desktop = new_desktop;
rootInfo->setCurrentDesktop( current_desktop ); // propagate befor the shows below
for ( ClientList::ConstIterator it = stacking_order.fromLast(); it != stacking_order.end(); --it) {
if ( (*it)->isOnDesktop( new_desktop ) && !(*it)->isIconified() ) {
(*it)->show();
}
}
}
current_desktop = new_desktop;
rootInfo->setCurrentDesktop( current_desktop );
// restore the focus on this desktop
block_focus = FALSE;