diff --git a/client.h b/client.h index 79b50651d6..e75f2c3464 100644 --- a/client.h +++ b/client.h @@ -80,7 +80,7 @@ class Client : public QObject, public KDecorationDefines void windowEvent( XEvent* e ); virtual bool eventFilter( QObject* o, QEvent* e ); - bool manage( Window w, bool isMapped ); + bool manage( Window w, bool isMapped, bool useCursorPos ); void releaseWindow( bool on_shutdown = false ); diff --git a/events.cpp b/events.cpp index d0724d1bfc..1d169cd61b 100644 --- a/events.cpp +++ b/events.cpp @@ -317,7 +317,7 @@ bool Workspace::workspaceEvent( XEvent * e ) // if ( e->xmaprequest.parent == root ) { //###TODO store previously destroyed client ids if ( addSystemTrayWin( e->xmaprequest.window ) ) return TRUE; - c = createClient( e->xmaprequest.window, false ); + c = createClient( e->xmaprequest.window, false, true ); if ( c != NULL && root != qt_xrootwin() ) { // TODO what is this? // TODO may use QWidget:.create diff --git a/manage.cpp b/manage.cpp index 0a4a8f9e1e..8758a65005 100644 --- a/manage.cpp +++ b/manage.cpp @@ -33,7 +33,7 @@ namespace KWinInternal reparenting, initial geometry, initial state, placement, etc. Returns false if KWin is not going to manage this window. */ -bool Client::manage( Window w, bool isMapped ) +bool Client::manage( Window w, bool isMapped, bool useCursorPos ) { XWindowAttributes attr; if( !XGetWindowAttributes(qt_xdisplay(), w, &attr)) @@ -181,7 +181,7 @@ bool Client::manage( Window w, bool isMapped ) if ( session ) geom = session->geometry; - QRect area = workspace()->clientArea( PlacementArea, geom.center(), desktop()); + QRect area = workspace()->clientArea( PlacementArea, useCursorPos ? QCursor::pos() : geom.center(), desktop()); // if it's noborder window, and has size of one screen or the whole desktop geometry, it's fullscreen hack if( ( geom.size() == workspace()->clientArea( FullArea, geom.center(), desktop()).size() diff --git a/workspace.cpp b/workspace.cpp index 68e93c15bc..242e29e1d4 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -403,11 +403,11 @@ Workspace::~Workspace() _self = 0; } -Client* Workspace::createClient( Window w, bool is_mapped ) +Client* Workspace::createClient( Window w, bool is_mapped, bool use_cursor_pos ) { StackingUpdatesBlocker blocker( this ); Client* c = new Client( this ); - if( !c->manage( w, is_mapped )) + if( !c->manage( w, is_mapped, use_cursor_pos )) { Client::deleteClient( c, Allowed ); return NULL; diff --git a/workspace.h b/workspace.h index 544860c8f3..b24c19c124 100644 --- a/workspace.h +++ b/workspace.h @@ -346,7 +346,7 @@ class Workspace : public QObject, public KWinInterface, public KDecorationDefine void updateToolWindows( bool also_hide ); // this is the right way to create a new client - Client* createClient( Window w, bool is_mapped ); + Client* createClient( Window w, bool is_mapped, bool use_cursor_pos = false ); void addClient( Client* c, allowed_t ); Window findSpecialEventWindow( XEvent* e );