Keep fullscreen windows covering the whole screen when it is the topmost

window on its xinerama screen.
FEATURE: 126817


svn path=/trunk/KDE/kdebase/workspace/; revision=851204
icc-effect-5.14.5
Luboš Luňák 2008-08-23 09:20:42 +00:00
parent a707d588c3
commit 818070d3aa
6 changed files with 29 additions and 16 deletions

View File

@ -150,6 +150,7 @@ class Client
void setFullScreen( bool set, bool user );
bool isFullScreen() const;
bool isFullScreenable( bool fullscreen_hack = false ) const;
bool isActiveFullScreen() const;
bool userCanSetFullScreen() const;
QRect geometryFSRestore() const { return geom_fs_restore; } // only for session saving
int fullScreenMode() const { return fullscreen_mode; } // only for session saving

View File

@ -944,7 +944,8 @@ void Client::enterNotifyEvent( XCrossingEvent* e )
if ( options->autoRaise && !isDesktop() &&
!isDock() && !isTopMenu() && workspace()->focusChangeEnabled() &&
workspace()->topClientOnDesktop( workspace()->currentDesktop()) != this )
workspace()->topClientOnDesktop( workspace()->currentDesktop(),
options->separateScreenFocus ? screen() : -1 ) != this )
{
delete autoRaiseTimer;
autoRaiseTimer = new QTimer( this );
@ -1063,7 +1064,7 @@ void Client::updateMouseGrab()
{
XUngrabButton( display(), AnyButton, AnyModifier, wrapperId());
// keep grab for the simple click without modifiers if needed (see below)
bool not_obscured = workspace()->topClientOnDesktop( workspace()->currentDesktop(), true, false ) == this;
bool not_obscured = workspace()->topClientOnDesktop( workspace()->currentDesktop(), -1, true, false ) == this;
if( !( !options->clickRaise || not_obscured ))
grabButton( None );
return;
@ -1079,7 +1080,7 @@ void Client::updateMouseGrab()
// is unobscured or if the user doesn't want click raise
// (it is unobscured if it the topmost in the unconstrained stacking order, i.e. it is
// the most recently raised window)
bool not_obscured = workspace()->topClientOnDesktop( workspace()->currentDesktop(), true, false ) == this;
bool not_obscured = workspace()->topClientOnDesktop( workspace()->currentDesktop(), -1, true, false ) == this;
if( !options->clickRaise || not_obscured )
ungrabButton( None );
else

View File

@ -1860,6 +1860,7 @@ void Client::setGeometry( int x, int y, int w, int h, ForceGeometry_t force )
updateWindowRules();
checkMaximizeGeometry();
workspace()->checkActiveScreen( this );
workspace()->updateStackingOrder();
if( resized )
{
discardWindowPixmap();
@ -1932,6 +1933,7 @@ void Client::plainResize( int w, int h, ForceGeometry_t force )
updateWindowRules();
checkMaximizeGeometry();
workspace()->checkActiveScreen( this );
workspace()->updateStackingOrder();
discardWindowPixmap();
if( scene != NULL )
scene->windowGeometryShapeChanged( this );
@ -1974,6 +1976,7 @@ void Client::move( int x, int y, ForceGeometry_t force )
updateWindowRules();
checkMaximizeGeometry();
workspace()->checkActiveScreen( this );
workspace()->updateStackingOrder();
// client itself is not damaged
addWorkspaceRepaint( geom_before_block );
addWorkspaceRepaint( geom ); // trigger repaint of window's new location

View File

@ -224,8 +224,8 @@ void Workspace::propagateClients( bool propagate_new_clients )
or of any other special kind are excluded. Also if the window
doesn't accept focus it's excluded.
*/
// TODO misleading name for this method
Client* Workspace::topClientOnDesktop( int desktop, bool unconstrained, bool only_normal ) const
// TODO misleading name for this method, too many slightly different ways to use it
Client* Workspace::topClientOnDesktop( int desktop, int screen, bool unconstrained, bool only_normal ) const
{
// TODO Q_ASSERT( block_stacking_updates == 0 );
ClientList list;
@ -239,6 +239,8 @@ Client* Workspace::topClientOnDesktop( int desktop, bool unconstrained, bool onl
{
if( list.at( i )->isOnDesktop( desktop ) && list.at( i )->isShown( false ))
{
if( screen != -1 && list.at( i )->screen() != screen )
continue;
if( !only_normal )
return list.at( i );
if( list.at( i )->wantsTabFocus() && !list.at( i )->isSpecialWindow())
@ -281,7 +283,8 @@ void Workspace::raiseOrLowerClient( Client *c)
most_recently_raised->isShown( true ) && c->isOnCurrentDesktop())
topmost = most_recently_raised;
else
topmost = topClientOnDesktop( c->isOnAllDesktops() ? currentDesktop() : c->desktop());
topmost = topClientOnDesktop( c->isOnAllDesktops() ? currentDesktop() : c->desktop(),
options->separateScreenFocus ? c->screen() : -1 );
if( c == topmost)
lowerClient(c);
@ -832,17 +835,22 @@ Layer Client::belongsToLayer() const
return DockLayer;
if( isTopMenu())
return DockLayer;
// only raise fullscreen above docks if it's the topmost window in unconstrained stacking order,
// i.e. the window set to be topmost by the user (also includes transients of the fullscreen window)
const Client* ac = workspace()->mostRecentlyActivatedClient(); // instead of activeClient() - avoids flicker
const Client* top = workspace()->topClientOnDesktop( desktop(), true, false );
if( isFullScreen() && ac != NULL && top != NULL
&& ( ac == this || this->group() == ac->group())
&& ( top == this || this->group() == top->group()))
if( isActiveFullScreen())
return ActiveLayer;
if( keepAbove())
return AboveLayer;
return NormalLayer;
}
bool Client::isActiveFullScreen() const
{
// only raise fullscreen above docks if it's the topmost window in unconstrained stacking order,
// i.e. the window set to be topmost by the user (also includes transients of the fullscreen window)
const Client* ac = workspace()->mostRecentlyActivatedClient(); // instead of activeClient() - avoids flicker
const Client* top = workspace()->topClientOnDesktop( desktop(), screen(), true, false );
return( isFullScreen() && ac != NULL && top != NULL
// not needed, for xinerama && ( ac == this || this->group() == ac->group())
&& ( top == this || this->group() == top->group()));
}
} // namespace

View File

@ -422,7 +422,7 @@ void Workspace::init()
&& activeClient() == NULL && should_get_focus.count() == 0 ) // no client activated in manage()
{
if( new_active_client == NULL )
new_active_client = topClientOnDesktop( currentDesktop());
new_active_client = topClientOnDesktop( currentDesktop(), -1 );
if( new_active_client == NULL && !desktops.isEmpty() )
new_active_client = findDesktop( true, currentDesktop());
}

View File

@ -137,6 +137,7 @@ class Workspace : public QObject, public KDecorationDefines
void updateClientLayer( Client* c );
void raiseOrLowerClient( Client * );
void restoreSessionStackingOrder( Client* c );
void updateStackingOrder( bool propagate_new_clients = false );
void forceRestacking();
void clientHidden( Client* );
@ -196,7 +197,7 @@ class Workspace : public QObject, public KDecorationDefines
ClientList ensureStackingOrder( const ClientList& clients ) const;
Client* topClientOnDesktop( int desktop, bool unconstrained = false, bool only_normal = true ) const;
Client* topClientOnDesktop( int desktop, int screen, bool unconstrained = false, bool only_normal = true ) const;
Client* findDesktop( bool topmost, int desktop ) const;
void sendClientToDesktop( Client* c, int desktop, bool dont_activate );
void windowToPreviousDesktop( Client* c );
@ -517,7 +518,6 @@ class Workspace : public QObject, public KDecorationDefines
bool establishTabBoxGrab();
void removeTabBoxGrab();
void updateStackingOrder( bool propagate_new_clients = false );
ToplevelList compositingStackingOrder() const;
void propagateClients( bool propagate_new_clients ); // called only from updateStackingOrder
ClientList constrainedStackingOrder();