Detect fullscreen hack state even while mapped (MPlayer).

svn path=/trunk/kdebase/kwin/; revision=333175
This commit is contained in:
Luboš Luňák 2004-07-27 08:36:28 +00:00
parent 8033d09cce
commit 5979a50bb6
3 changed files with 35 additions and 6 deletions

View file

@ -330,6 +330,8 @@ class Client : public QObject, public KDecorationDefines
void updateAllowedActions( bool force = false );
QSize sizeForClientSize( const QSize&, Sizemode mode = SizemodeAny ) const;
void changeMaximize( bool horizontal, bool vertical, bool adjust );
bool checkFullScreenHack( const QRect& geom ) const;
void updateFullScreenHack( const QRect& geom );
void getWmNormalHints();
void getMotifHints();
void getIcons();

View file

@ -1367,7 +1367,8 @@ void Client::configureRequest( int value_mask, int rx, int ry, int rw, int rh, i
++block_geometry;
move( new_pos );
plainResize( ns ); // TODO must(?) resize before gravitating?
if( !from_tool && ( !isSpecialWindow() || isToolbar()))
updateFullScreenHack( QRect( new_pos, QSize( nw, nh )));
if( !from_tool && ( !isSpecialWindow() || isToolbar()) && !isFullScreen())
keepInArea( workspace()->clientArea( WorkArea, this ));
--block_geometry;
setGeometry( QRect( calculateGravitation( false, gravity ), size()), ForceGeometrySet );
@ -1402,7 +1403,8 @@ void Client::configureRequest( int value_mask, int rx, int ry, int rw, int rh, i
xSizeHint.win_gravity = gravity;
resizeWithChecks( ns );
xSizeHint.win_gravity = save_gravity;
if( !from_tool && ( !isSpecialWindow() || isToolbar()))
updateFullScreenHack( QRect( calculateGravitation( true, xSizeHint.win_gravity ), QSize( nw, nh )));
if( !from_tool && ( !isSpecialWindow() || isToolbar()) && !isFullScreen())
keepInArea( workspace()->clientArea( WorkArea, this ));
}
}
@ -1851,6 +1853,8 @@ void Client::resetMaximize()
bool Client::isFullScreenable( bool fullscreen_hack ) const
{
if( !rules()->checkFullScreen( true ))
return false;
if( fullscreen_hack )
return isNormalWindow() || isOverride();
else // don't check size constrains - some apps request fullscreen despite requesting fixed size
@ -1900,6 +1904,32 @@ void Client::setFullScreen( bool set, bool user )
updateWindowRules();
}
bool Client::checkFullScreenHack( const QRect& geom ) const
{
// if it's noborder window, and has size of one screen or the whole desktop geometry, it's fullscreen hack
return (( geom.size() == workspace()->clientArea( FullArea, geom.center(), desktop()).size()
|| geom.size() == workspace()->clientArea( ScreenArea, geom.center(), desktop()).size())
&& noBorder() && !isUserNoBorder() && isFullScreenable( true ));
}
void Client::updateFullScreenHack( const QRect& geom )
{
bool is_hack = checkFullScreenHack( geom );
if( fullscreen_mode == FullScreenNone && is_hack )
{
fullscreen_mode = FullScreenHack;
updateDecoration( false, false );
setGeometry( workspace()->clientArea( FullScreenArea, this ));
}
else if( fullscreen_mode == FullScreenHack && !is_hack )
{
fullscreen_mode = FullScreenNone;
updateDecoration( false, false );
// whoever called this must setup correct geometry
}
StackingUpdatesBlocker blocker( workspace());
workspace()->updateClientLayer( this ); // active fullscreens get different layer
}
static QRect* visible_bound = 0;
static GeometryTip* geometryTip = 0;

View file

@ -197,10 +197,7 @@ bool Client::manage( Window w, bool isMapped )
else
area = workspace()->clientArea( PlacementArea, 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()
|| geom.size() == workspace()->clientArea( ScreenArea, geom.center(), desktop()).size())
&& noBorder() && !isUserNoBorder() && isFullScreenable( true ))
if( checkFullScreenHack( geom ))
{
fullscreen_mode = FullScreenHack;
geom = workspace()->clientArea( FullScreenArea, geom.center(), desktop());