From 1add59200c08a5a12432101c0a8f8545eb00cd9c Mon Sep 17 00:00:00 2001 From: Waldo Bastian Date: Mon, 11 Sep 2000 18:59:26 +0000 Subject: [PATCH] WABA: Fixes BR6808 and BR7983. #6808: selecting a "Decoration" by right-clicking on a window de-iconify windows. #7983: SHIP STOPPER: kwin - titlebars get <2> after the name of the application when changing decorations Reviewed by gis. svn path=/trunk/kdebase/kwin/; revision=63563 --- client.cpp | 45 ++++++++++++++++++++++++++++++--------------- client.h | 7 ++++++- workspace.cpp | 3 ++- 3 files changed, 38 insertions(+), 17 deletions(-) diff --git a/client.cpp b/client.cpp index 1841c6cdd4..e02c23f22c 100644 --- a/client.cpp +++ b/client.cpp @@ -476,7 +476,7 @@ Client::~Client() Manages the clients. This means handling the very first maprequest: reparenting, initial geometry, initial state, placement, etc. */ -bool Client::manage( bool isMapped, bool doNotShow ) +bool Client::manage( bool isMapped, bool doNotShow, bool isInitial ) { if (layout()) @@ -551,17 +551,20 @@ bool Client::manage( bool isMapped, bool doNotShow ) } // initial state - int state = NormalState; - if ( session ) { - if ( session->iconified ) - state = IconicState; - } else { - // find out the initial state. Several possibilities exist - XWMHints * hints = XGetWMHints(qt_xdisplay(), win ); - if (hints && (hints->flags & StateHint)) - state = hints->initial_state; - if (hints) - XFree(hints); + int init_state = NormalState; + if ( isInitial) + { + if ( session ) { + if ( session->iconified ) + init_state = IconicState; + } else { + // find out the initial state. Several possibilities exist + XWMHints * hints = XGetWMHints(qt_xdisplay(), win ); + if (hints && (hints->flags & StateHint)) + init_state = hints->initial_state; + if (hints) + XFree(hints); + } } // initial desktop placement - note we don't clobber desk if it is @@ -591,10 +594,12 @@ bool Client::manage( bool isMapped, bool doNotShow ) info->setDesktop( desk ); + if (isInitial) + { + setMappingState( init_state ); + } - setMappingState( state ); - - bool showMe = state == NormalState && isOnDesktop( workspace()->currentDesktop() ); + bool showMe = (state == NormalState) && isOnDesktop( workspace()->currentDesktop() ); if ( workspace()->isNotManaged( caption() ) ) doNotShow = TRUE; @@ -2561,6 +2566,16 @@ void Client::autoRaise() autoRaiseTimer = 0; } +void Client::cloneMode(Client *client) +{ + shaded = client->shaded; + geom_restore = client->geom_restore; + max_mode = client->max_mode; +// cmap = client->cmap; + state = client->state; + setCaption(client->caption()); +} + NoBorderClient::NoBorderClient( Workspace *ws, WId w, QWidget *parent, const char *name ) : Client( ws, w, parent, name ) diff --git a/client.h b/client.h index d036e3399a..25e918ae06 100644 --- a/client.h +++ b/client.h @@ -74,7 +74,7 @@ public: virtual bool windowEvent( XEvent * ); - bool manage( bool isMapped = FALSE, bool doNotShow = FALSE ); + bool manage( bool isMapped = FALSE, bool doNotShow = FALSE, bool isInitial = TRUE ); void setMappingState( int s ); int mappingState() const; @@ -166,6 +166,11 @@ public: Colormap colormap() const; + /** + * Clone settings from other client. + */ + void cloneMode(Client *); + public slots: void iconify(); void closeWindow(); diff --git a/workspace.cpp b/workspace.cpp index 40d14cf1de..c9a3113465 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -2631,8 +2631,9 @@ void Workspace::slotResetAllClients() (*jt) = newClient; jt = focus_chain.find (oldClient); (*jt) = newClient; + newClient->cloneMode(oldClient); delete oldClient; - bool showIt = newClient->manage( TRUE, TRUE ); + bool showIt = newClient->manage( TRUE, TRUE, FALSE ); if ( prev ) { Window stack[2]; stack[0] = prev->winId();;