fixed min/max handling, handle palette changes properly
svn path=/trunk/kdebase/kwin/; revision=35018
This commit is contained in:
parent
1f00484d60
commit
bad93649e3
6 changed files with 42 additions and 24 deletions
34
client.cpp
34
client.cpp
|
@ -97,7 +97,7 @@ WindowWrapper::WindowWrapper( WId w, Client *parent, const char* name)
|
|||
setMouseTracking( TRUE );
|
||||
|
||||
setBackgroundColor( colorGroup().background() );
|
||||
|
||||
|
||||
// we don't want the window to be destroyed when we are destroyed
|
||||
XAddToSaveSet(qt_xdisplay(), win );
|
||||
|
||||
|
@ -341,6 +341,7 @@ void Client::manage( bool isMapped )
|
|||
// geom.setSize( geom.size().boundedTo( QSize(xSizeHint.max_width, xSizeHint.max_height ) ) );
|
||||
}
|
||||
|
||||
windowWrapper()->resize( geom.size() );
|
||||
// the clever activate() trick is necessary
|
||||
layout()->activate();
|
||||
// resize( geom.width() + width() - windowWrapper()->width(),
|
||||
|
@ -351,7 +352,7 @@ void Client::manage( bool isMapped )
|
|||
move( geom.x(), geom.y() );
|
||||
gravitate( FALSE );
|
||||
|
||||
if ( !placementDone ) {
|
||||
if ( !placementDone && !transient_for ) {
|
||||
workspace()->doPlacement( this );
|
||||
placementDone = TRUE;
|
||||
}
|
||||
|
@ -707,19 +708,28 @@ QSize Client::sizeForWindowSize( const QSize& wsize, bool ignore_height) const
|
|||
h = bh + sy * xSizeHint.height_inc;
|
||||
}
|
||||
}
|
||||
|
||||
if (xSizeHint.flags & PMinSize) {
|
||||
w = QMAX( xSizeHint.min_width, w );
|
||||
}
|
||||
if (xSizeHint.flags & PMaxSize) {
|
||||
w = QMIN( xSizeHint.max_width, w );
|
||||
}
|
||||
|
||||
int ww = wwrap->width();
|
||||
int wh = 0;
|
||||
if ( !wwrap->testWState( WState_ForceHide ) )
|
||||
wh = wwrap->height();
|
||||
|
||||
|
||||
if ( ignore_height && wsize.height() == 0 )
|
||||
h = 0;
|
||||
|
||||
return QSize( QMIN( QMAX( width() - ww + w, minimumWidth() ),
|
||||
maximumWidth() ),
|
||||
ignore_height? height()-wh+h : (QMIN( QMAX( height() - wh + h, minimumHeight() ),
|
||||
maximumHeight() ) ) );
|
||||
return QSize( width() - ww + w, height()-wh+h );
|
||||
|
||||
// return QSize( QMIN( QMAX( width() - ww + w, minimumWidth() ),
|
||||
// maximumWidth() ),
|
||||
// ignore_height? height()-wh+h : (QMIN( QMAX( height() - wh + h, minimumHeight() ),
|
||||
// maximumHeight() ) ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1061,7 +1071,7 @@ int Client::minimumHeight() const
|
|||
/*!
|
||||
Returns the maximum size. This function differs from QWidget::maximumSize()
|
||||
and is to be preferred
|
||||
*/
|
||||
*/
|
||||
QSize Client::maximumSize() const
|
||||
{
|
||||
return QSize( maximumWidth(), maximumHeight() );
|
||||
|
@ -1121,16 +1131,16 @@ void Client::maximize( MaximizeMode m)
|
|||
{
|
||||
if ( isShade() )
|
||||
setShade( FALSE );
|
||||
|
||||
|
||||
if ( geom_restore.isNull() ) {
|
||||
geom_restore = geometry();
|
||||
switch ( m ) {
|
||||
case MaximizeVertical:
|
||||
setGeometry( QRect( QPoint( x(), workspace()->geometry().top() ),
|
||||
setGeometry( QRect( QPoint( x(), workspace()->geometry().top() ),
|
||||
adjustedSize( QSize( width(), workspace()->geometry().height()) ) ) );
|
||||
break;
|
||||
case MaximizeHorizontal:
|
||||
setGeometry( QRect( QPoint( workspace()->geometry().left(), y() ),
|
||||
setGeometry( QRect( QPoint( workspace()->geometry().left(), y() ),
|
||||
adjustedSize( QSize( workspace()->geometry().width(), height() ) ) ) );
|
||||
break;
|
||||
default:
|
||||
|
@ -1481,7 +1491,7 @@ void Client::setMask( const QRegion & reg)
|
|||
|
||||
|
||||
|
||||
NoBorderClient::NoBorderClient( Workspace *ws, WId w, QWidget *parent=0, const char *name=0 )
|
||||
NoBorderClient::NoBorderClient( Workspace *ws, WId w, QWidget *parent, const char *name )
|
||||
: Client( ws, w, parent, name )
|
||||
{
|
||||
QHBoxLayout* h = new QHBoxLayout( this );
|
||||
|
|
2
main.cpp
2
main.cpp
|
@ -80,7 +80,7 @@ Application::~Application()
|
|||
for ( WorkspaceList::Iterator it = workspaces.begin(); it != workspaces.end(); ++it) {
|
||||
delete (*it);
|
||||
}
|
||||
delete options;
|
||||
delete options;
|
||||
}
|
||||
|
||||
bool Application::x11EventFilter( XEvent *e )
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
#include "options.h"
|
||||
#include <qpalette.h>
|
||||
#include <qpixmap.h>
|
||||
#include <qapplication.h>
|
||||
#include <kapp.h>
|
||||
#include <kconfig.h>
|
||||
#include <kglobal.h>
|
||||
|
||||
Options::Options()
|
||||
: QObject( 0, 0)
|
||||
{
|
||||
int i;
|
||||
for(i=0; i < KWINCOLORS*2; ++i)
|
||||
|
@ -16,6 +17,8 @@ Options::Options()
|
|||
placement = Smart;
|
||||
animate_shade = true;
|
||||
anim_steps = 100;
|
||||
|
||||
connect( kapp, SIGNAL( appearanceChanged() ), this, SLOT(reload() ) );
|
||||
}
|
||||
|
||||
Options::~Options(){
|
||||
|
|
15
options.h
15
options.h
|
@ -1,15 +1,21 @@
|
|||
#ifndef OPTIONS_H
|
||||
#define OPTIONS_H
|
||||
|
||||
#include <qobject.h>
|
||||
#include <qfont.h>
|
||||
#include <qpalette.h>
|
||||
|
||||
// increment this when you add a color type (mosfet)
|
||||
#define KWINCOLORS 8
|
||||
|
||||
class Options {
|
||||
class Options : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
Options();
|
||||
~Options();
|
||||
|
||||
|
||||
/*!
|
||||
Different focus policies:
|
||||
<ul>
|
||||
|
@ -36,7 +42,7 @@ public:
|
|||
*/
|
||||
enum FocusPolicy { ClickToFocus, FocusFollowsMouse, FocusUnderMouse, FocusStricklyUnderMouse };
|
||||
FocusPolicy focusPolicy;
|
||||
|
||||
|
||||
enum MoveResizeMode { Transparent, Opaque };
|
||||
|
||||
/**
|
||||
|
@ -84,11 +90,10 @@ public:
|
|||
* Return the number of animation steps (would this be general?)
|
||||
*/
|
||||
const int animSteps() { return anim_steps; };
|
||||
// When restarting is implemented this should get called (mosfet).
|
||||
|
||||
public slots:
|
||||
void reload();
|
||||
|
||||
Options();
|
||||
~Options();
|
||||
protected:
|
||||
QFont activeFont, inactiveFont;
|
||||
QColor colors[KWINCOLORS*2];
|
||||
|
|
|
@ -189,7 +189,7 @@ StdClient::StdClient( Workspace *ws, WId w, QWidget *parent, const char *name )
|
|||
g->setRowStretch( 1, 10 );
|
||||
g->addWidget( windowWrapper(), 1, 1 );
|
||||
g->addItem( new QSpacerItem( 0, 0, QSizePolicy::Fixed, QSizePolicy::Expanding ) );
|
||||
|
||||
|
||||
g->addColSpacing(0, 2);
|
||||
g->addColSpacing(2, 2);
|
||||
g->addRowSpacing(2, 2);
|
||||
|
@ -227,11 +227,11 @@ StdClient::StdClient( Workspace *ws, WId w, QWidget *parent, const char *name )
|
|||
button[0]->setIconSet(isActive() ? *menu_pix : *dis_menu_pix);
|
||||
else
|
||||
button[0]->setIconSet( miniIcon() );
|
||||
|
||||
|
||||
connect( button[0], SIGNAL( pressed() ), this, SLOT( menuButtonPressed() ) );
|
||||
button[0]->setPopupDelay( 0 );
|
||||
button[0]->setPopup( workspace()->clientPopup( this ) );
|
||||
|
||||
|
||||
button[1]->setIconSet(isSticky() ? isActive() ? *pindown_pix : *dis_pindown_pix :
|
||||
isActive() ? *pinup_pix : *dis_pinup_pix );
|
||||
connect( button[1], SIGNAL( clicked() ), this, ( SLOT( toggleSticky() ) ) );
|
||||
|
@ -306,7 +306,7 @@ void StdClient::stickyChange( bool s)
|
|||
button[1]->setIconSet( s?*pindown_pix:*pinup_pix );
|
||||
}
|
||||
|
||||
void StdClient::paintEvent( QPaintEvent* e)
|
||||
void StdClient::paintEvent( QPaintEvent* )
|
||||
{
|
||||
QPainter p( this );
|
||||
QRect t = titlebar->geometry();
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
const bool options_traverse_all = FALSE; // TODO
|
||||
|
||||
TabBox::TabBox( Workspace *ws, const char *name=0 )
|
||||
TabBox::TabBox( Workspace *ws, const char *name )
|
||||
: QWidget( 0, name, WStyle_Customize | WStyle_NoBorder )
|
||||
{
|
||||
wspace = ws;
|
||||
|
|
Loading…
Reference in a new issue