Add a checkbox to enable/disable the geometry tip, making it _OFF_ by default,

as was planned. Also, it should never crash now.

Hopefully this will make pmax a bit happier ;-)

svn path=/trunk/kdebase/kwin/; revision=198711
This commit is contained in:
Karol Szwed 2003-01-10 10:54:57 +00:00
parent b35e581f69
commit 4577f0f474
5 changed files with 67 additions and 24 deletions

View file

@ -1668,14 +1668,16 @@ void Client::mousePressEvent( QMouseEvent * e)
*/
void Client::mouseReleaseEvent( QMouseEvent * e)
{
if ( (e->stateAfter() & MouseButtonMask) == 0 ) {
buttonDown = FALSE;
if ( moveResizeMode ) {
// Do this here just in case.
if (geometryTip) {
geometryTip->hide();
delete geometryTip;
geometryTip = NULL;
}
if ( (e->stateAfter() & MouseButtonMask) == 0 ) {
buttonDown = FALSE;
if ( moveResizeMode ) {
clearbound();
stopMoveResize();
setGeometry( geom );
@ -1797,8 +1799,9 @@ void Client::mouseMoveEvent( QMouseEvent * e)
drawbound( geom );
}
#if 0
// Position and Size display
if (options->showGeometryTip())
{
if (!geometryTip)
geometryTip = new GeometryTip( this, &xSizeHint );
@ -1807,7 +1810,7 @@ void Client::mouseMoveEvent( QMouseEvent * e)
geometryTip->show();
geometryTip->raise();
}
#endif
}
}
else if ( isMove() && geom.topLeft() != geometry().topLeft() ) {
geom.moveTopLeft( workspace()->adjustClientPosition( this, geom.topLeft() ) );
@ -1829,7 +1832,8 @@ void Client::mouseMoveEvent( QMouseEvent * e)
break;
}
#if 0
if (options->showGeometryTip())
{
// Position and Size display
if (!geometryTip)
geometryTip = new GeometryTip( this, &xSizeHint );
@ -1839,7 +1843,7 @@ void Client::mouseMoveEvent( QMouseEvent * e)
geometryTip->show();
geometryTip->raise();
}
#endif
}
}
if ( isMove() )

View file

@ -54,6 +54,7 @@
#define KWIN_MINIMIZE_ANIM "AnimateMinimize"
#define KWIN_MINIMIZE_ANIM_SPEED "AnimateMinimizeSpeed"
#define KWIN_RESIZE_OPAQUE "ResizeMode"
#define KWIN_GEOMETRY "GeometryTip"
#define KWIN_AUTORAISE_INTERVAL "AutoRaiseInterval"
#define KWIN_AUTORAISE "AutoRaise"
#define KWIN_CLICKRAISE "ClickRaise"
@ -699,6 +700,13 @@ KMovingConfig::KMovingConfig (bool _standAlone, KConfig *_config, QWidget *paren
" while resizing it, instead of just showing a window 'skeleton'. The result may not be satisfying"
" on slow machines.") );
geometryTipOn = new QCheckBox(i18n("Display window geometry when moving or resizing"), windowsBox);
bLay->addWidget(geometryTipOn);
QWhatsThis::add(geometryTipOn, i18n("Enable this option if you want a window's geometry to be displayed"
" while it is being moved or resized. The window position relative"
" to the top-left corner of the screen is displayed together with"
" its size."));
QGridLayout *rLay = new QGridLayout(2,3);
bLay->addLayout(rLay);
rLay->setColStretch(0,0);
@ -824,6 +832,7 @@ KMovingConfig::KMovingConfig (bool _standAlone, KConfig *_config, QWidget *paren
// Any changes goes to slotChanged()
connect( opaque, SIGNAL(clicked()), SLOT(changed()));
connect( resizeOpaqueOn, SIGNAL(clicked()), SLOT(changed()));
connect( geometryTipOn, SIGNAL(clicked()), SLOT(changed()));
connect( minimizeAnimOn, SIGNAL(clicked() ), SLOT(changed()));
connect( minimizeAnimSlider, SIGNAL(valueChanged(int)), SLOT(changed()));
connect( moveResizeMaximized, SIGNAL(toggled(bool)), SLOT(changed()));
@ -843,6 +852,16 @@ void KMovingConfig::setMove(int trans)
opaque->setChecked(trans == OPAQUE);
}
void KMovingConfig::setGeometryTip(bool showGeometryTip)
{
geometryTipOn->setChecked(showGeometryTip);
}
bool KMovingConfig::getGeometryTip()
{
return geometryTipOn->isChecked();
}
// placement policy --- CT 31jan98 ---
int KMovingConfig::getPlacement()
{
@ -918,6 +937,10 @@ void KMovingConfig::load( void )
else if ( key == "Transparent")
setResizeOpaque(RESIZE_TRANSPARENT);
//KS 10Jan2003 - Geometry Tip during window move/resize
bool showGeomTip = config->readBoolEntry(KWIN_GEOMETRY, false);
setGeometryTip( showGeomTip );
// placement policy --- CT 19jan98 ---
key = config->readEntry(KWIN_PLACEMENT);
//CT 13mar98 interactive placement
@ -981,6 +1004,7 @@ void KMovingConfig::save( void )
else
config->writeEntry(KWIN_MOVE,"Opaque");
config->writeEntry(KWIN_GEOMETRY, getGeometryTip());
// placement policy --- CT 31jan98 ---
v =getPlacement();
@ -1031,6 +1055,7 @@ void KMovingConfig::defaults()
{
setMove(OPAQUE);
setResizeOpaque(RESIZE_TRANSPARENT);
setGeometryTip(false);
setPlacement(SMART_PLACEMENT);
setMoveResizeMaximized(true);

View file

@ -135,17 +135,19 @@ private:
bool getMinimizeAnim( void );
int getMinimizeAnimSpeed( void );
int getResizeOpaque ( void );
bool getGeometryTip( void ); //KS
int getPlacement( void ); //CT
void setMove(int);
void setResizeOpaque(int);
void setGeometryTip(bool); //KS
void setPlacement(int); //CT
void setMoveResizeMaximized(bool);
QButtonGroup *windowsBox;
QCheckBox *opaque;
QCheckBox *resizeOpaqueOn;
QCheckBox *geometryTipOn;
QCheckBox* minimizeAnimOn;
QSlider *minimizeAnimSlider;
QLabel *minimizeAnimSlowLabel, *minimizeAnimFastLabel;

View file

@ -31,6 +31,7 @@ public:
bool animate_tooltips;
int electric_borders;
int electric_border_delay;
bool show_geometry_tip;
};
};
@ -170,7 +171,7 @@ void Options::reload()
moveMode = config->readEntry("MoveMode", "Opaque" ) == "Opaque"?Opaque:Transparent;
resizeMode = config->readEntry("ResizeMode", "Opaque" ) == "Opaque"?Opaque:Transparent;
moveResizeMaximizedWindows = config->readBoolEntry("MoveResizeMaximizedWindows", true );
d->show_geometry_tip = config->readBoolEntry("GeometryTip", false);
QString val;
@ -325,6 +326,11 @@ Options::MouseCommand Options::mouseCommand(const QString &name)
return MouseNothing;
}
bool Options::showGeometryTip()
{
return d->show_geometry_tip;
}
QString Options::titleButtonsLeft()
{
return d->title_buttons_left;

View file

@ -253,6 +253,12 @@ public:
static WindowOperation windowOperation(const QString &name );
static MouseCommand mouseCommand(const QString &name);
/**
* @returns true if the Geometry Tip should be shown during a window move/resize.
* @since 3.2
*/
bool showGeometryTip();
/**
* @returns true if the style should use custom button positions
* @see #titleButtonsLeft