Cleanup of Motif hints. Ignore hints forbidding minimize/maximize.

Fix using isResizable()/isMovable() instead of only checking the Motif hint.

svn path=/trunk/kdebase/kwin/; revision=252351
This commit is contained in:
Luboš Luňák 2003-09-19 11:14:16 +00:00
parent d5dd99ba82
commit d8406cf439
5 changed files with 24 additions and 28 deletions

View file

@ -110,11 +110,9 @@ Client::Client( Workspace *ws )
keep_above = FALSE;
keep_below = FALSE;
is_shape = FALSE;
may_move = TRUE;
may_resize = TRUE;
may_minimize = TRUE;
may_maximize = TRUE;
may_close = TRUE;
motif_may_move = TRUE;
motif_may_resize = TRUE;
motif_may_close = TRUE;
fullscreen_mode = FullScreenNone;
skip_taskbar = FALSE;
original_skip_taskbar = false;
@ -577,7 +575,7 @@ void Client::hideClient( bool hide )
bool Client::isMinimizable() const
{
if( !wantsTabFocus() // SELI co NET::Utility? a proc wantsTabFocus() - skiptaskbar? ?
|| !may_minimize || ( isSpecialWindow() && !isOverride()))
|| ( isSpecialWindow() && !isOverride()))
return false;
if( isTransient())
{ // transients may be minimized only if mainwindow is not shown
@ -977,7 +975,7 @@ static void sendClientMessage(Window w, Atom a, long x)
*/
bool Client::isCloseable() const
{
return may_close && ( !isSpecialWindow() || isOverride()); // TODO is NET::Override special?
return motif_may_close && ( !isSpecialWindow() || isOverride()); // TODO is NET::Override special?
}
/*!
@ -1577,7 +1575,7 @@ bool Client::wantsInput() const
*/
bool Client::isMovable() const
{
return may_move && !isFullScreen() &&
return motif_may_move && !isFullScreen() &&
( !isSpecialWindow() || isOverride() || isSplash() || isToolbar()) && // allow moving of splashscreens :)
( maximizeMode() != MaximizeFull || options->moveResizeMaximizedWindows() );
}

View file

@ -396,7 +396,6 @@ class Client : public QObject, public KDecorationDefines
uint active :1;
uint keep_above : 1; // NET::KeepAbove (was stays_on_top)
uint is_shape :1;
uint may_move :1;
uint skip_taskbar :1;
uint original_skip_taskbar :1; // unaffected by KWin
uint Pdeletewindow :1; // does the window understand the DeleteWindow protocol?
@ -406,10 +405,9 @@ class Client : public QObject, public KDecorationDefines
uint input :1; // does the window want input in its wm_hints
uint store_settings : 1;
uint skip_pager : 1;
uint may_resize : 1;
uint may_maximize : 1;
uint may_minimize : 1;
uint may_close : 1;
uint motif_may_resize : 1;
uint motif_may_move :1;
uint motif_may_close : 1;
uint keep_below : 1; // NET::KeepBelow
uint minimized : 1;
uint hidden : 1; // forcibly hidden by calling hide()

View file

@ -744,7 +744,7 @@ void Client::configureRequestEvent( XConfigureRequestEvent* e )
QPoint np( nx-ox, ny-oy);
#if 0
if ( windowType() == NET::Normal && may_move )
if ( windowType() == NET::Normal && isMovable())
{
// crap for broken netscape
QRect area = workspace()->clientArea();

View file

@ -547,7 +547,7 @@ void Client::checkDirection( int new_diff, int old_diff, QRect& rect, const QRec
}
return;
}
if( may_resize )
if( isResizable())
{
if( rect.width() > area.width())
rect.setWidth( area.width());
@ -559,17 +559,17 @@ void Client::checkDirection( int new_diff, int old_diff, QRect& rect, const QRec
rect.setRight( area.right() - ( old_diff - 1 ));
}
}
if( may_move )
if( isMovable())
{
if( old_diff < 0 ) // was in left third, keep distance from left edge
rect.moveLeft( area.left() + ( -old_diff - 1 ));
else // old_diff > 0 // was in right third, keep distance from right edge
rect.moveRight( area.right() - ( old_diff - 1 ));
}
// this may_resize block is copied from above, the difference is
// this isResizable() block is copied from above, the difference is
// the condition with 'area.width() / 2' - for windows that are not wide,
// moving is preffered to resizing
if( may_resize )
if( isResizable())
{
if( old_diff < 0 )
rect.setLeft( area.left() + ( -old_diff - 1 ) );
@ -579,7 +579,7 @@ void Client::checkDirection( int new_diff, int old_diff, QRect& rect, const QRec
}
if( rect.right() < area.left() + 5 || rect.left() > area.right() - 5 )
{ // not visible (almost) at all - try to make it at least partially visible
if( may_move )
if( isMovable())
{
if( rect.left() < area.left() + 5 )
rect.moveRight( area.left() + 5 );
@ -772,7 +772,7 @@ void Client::sendSyntheticConfigureNotify()
*/
bool Client::isResizable() const
{
if ( !isMovable() || !may_resize || isSplash())
if ( !isMovable() || !motif_may_resize || isSplash())
return FALSE;
if ( ( xSizeHint.flags & PMaxSize) == 0 || (xSizeHint.flags & PMinSize ) == 0 )
@ -788,7 +788,7 @@ bool Client::isMaximizable() const
{
if ( maximizeMode() != MaximizeRestore )
return TRUE;
if( !isResizable() || isToolbar() || !may_maximize ) // SELI isToolbar() ?
if( !isResizable() || isToolbar()) // SELI isToolbar() ?
return false;
if( xSizeHint.max_height < 32767 || xSizeHint.max_width < 32767 ) // sizes are 16bit with X
return false;

View file

@ -101,11 +101,11 @@ bool Client::manage( Window w, bool isMapped )
bool mresize, mmove, mminimize, mmaximize, mclose;
if( Motif::funcFlags( client, mresize, mmove, mminimize, mmaximize, mclose ))
{
may_resize = mresize;
may_move = mmove;
may_minimize = mminimize;
may_maximize = mmaximize;
may_close = mclose;
motif_may_resize = mresize; // this should be set using minsize==maxsize, but oh well
motif_may_move = mmove;
// mminimize; - ignore, bogus - e.g. shading or sending to another desktop is "minimizing" too
// mmaximize; - ignore, bogus - maximizing is basically just resizing
motif_may_close = mclose; // motif apps like to crash when they set this hint and WM closes them anyway
}
XClassHint classHint;
@ -272,7 +272,7 @@ bool Client::manage( Window w, bool isMapped )
if (xSizeHint.flags & PMinSize)
geom.setSize( geom.size().expandedTo( QSize(xSizeHint.min_width, xSizeHint.min_height ) ) );
if( may_move )
if( isMovable())
{
if( geom.x() > area.right() || geom.y() > area.bottom())
placementDone = FALSE; // weird, do not trust.
@ -290,7 +290,7 @@ bool Client::manage( Window w, bool isMapped )
placementDone = TRUE;
}
if (( !isSpecialWindow() || isToolbar()) && may_move )
if (( !isSpecialWindow() || isToolbar()) && isMovable())
{
if ( geometry().right() > area.right() && width() < area.width() )
move( area.right() - width(), y() );