Fix position of gravitated windows after a crash.
http://lists.kde.org/?l=kwin&m=123149700221501&w=2 svn path=/trunk/KDE/kdebase/workspace/; revision=925062
This commit is contained in:
parent
1c2ba6ea17
commit
1297fe6daa
3 changed files with 18 additions and 0 deletions
11
geometry.cpp
11
geometry.cpp
|
@ -793,6 +793,17 @@ void Workspace::updateTopMenuGeometry( Client* c )
|
|||
updateTopMenuGeometry( *it );
|
||||
}
|
||||
|
||||
// When kwin crashes, windows will not be gravitated back to their original position
|
||||
// and will remain offset by the size of the decoration. So when restarting, fix this
|
||||
// (the property with the size of the frame remains on the window after the crash).
|
||||
void Workspace::fixPositionAfterCrash( Window w, const XWindowAttributes& attr )
|
||||
{
|
||||
NETWinInfo i( display(), w, rootWindow(), NET::WMFrameExtents );
|
||||
NETStrut frame = i.frameExtents();
|
||||
if( frame.left != 0 || frame.top != 0 )
|
||||
XMoveWindow( display(), w, attr.x - frame.left, attr.y - frame.top );
|
||||
}
|
||||
|
||||
//********************************************
|
||||
// Client
|
||||
//********************************************
|
||||
|
|
|
@ -40,6 +40,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <kactioncollection.h>
|
||||
#include <kaction.h>
|
||||
#include <kconfiggroup.h>
|
||||
#include <kcmdlineargs.h>
|
||||
#include <QtDBus/QtDBus>
|
||||
|
||||
#include "client.h"
|
||||
|
@ -388,6 +389,7 @@ void Workspace::init()
|
|||
Window root_return, parent_return;
|
||||
Window* wins;
|
||||
XQueryTree( display(), rootWindow(), &root_return, &parent_return, &wins, &nwins );
|
||||
bool fixoffset = KCmdLineArgs::parsedArgs()->getOption( "crashes" ).toInt() > 0;
|
||||
for( i = 0; i < nwins; i++ )
|
||||
{
|
||||
XWindowAttributes attr;
|
||||
|
@ -400,8 +402,12 @@ void Workspace::init()
|
|||
if( topmenu_space && topmenu_space->winId() == wins[i] )
|
||||
continue;
|
||||
if( attr.map_state != IsUnmapped )
|
||||
{
|
||||
if( fixoffset )
|
||||
fixPositionAfterCrash( wins[ i ], attr );
|
||||
createClient( wins[i], true );
|
||||
}
|
||||
}
|
||||
if( wins )
|
||||
XFree( (void*)( wins ));
|
||||
|
||||
|
|
|
@ -569,6 +569,7 @@ class Workspace : public QObject, public KDecorationDefines
|
|||
void setupTopMenuHandling();
|
||||
void updateTopMenuGeometry( Client* c = NULL );
|
||||
void updateToolWindows( bool also_hide );
|
||||
void fixPositionAfterCrash( Window w, const XWindowAttributes& attr );
|
||||
|
||||
/// This is the right way to create a new client
|
||||
Client* createClient( Window w, bool is_mapped );
|
||||
|
|
Loading…
Reference in a new issue