Fix usage of PBaseSize and PMinSize in size hints. Makes geometry tip
show proper size for xterm. svn path=/trunk/KDE/kdebase/kwin/; revision=415390
This commit is contained in:
parent
4bc13d6293
commit
e4c84f39e4
3 changed files with 12 additions and 27 deletions
|
@ -177,6 +177,7 @@ version 2.0
|
|||
? - PSize, PPosition, USize, UPosition
|
||||
? - clients - Qt simply sets both
|
||||
+ - PWinGravity - window geometry constraints have higher priority than gravity
|
||||
/ - PBaseSize - PMinSize is not used as a fallback for size increments
|
||||
+ - (the rest)
|
||||
/ 4.1.2.4
|
||||
+ - input - see 4.1.7
|
||||
|
|
12
geometry.cpp
12
geometry.cpp
|
@ -1075,6 +1075,9 @@ QSize Client::sizeForClientSize( const QSize& wsize, Sizemode mode, bool noframe
|
|||
double min_aspect_h = xSizeHint.min_aspect.y; // and multiplying would go wrong otherwise
|
||||
double max_aspect_w = xSizeHint.max_aspect.x;
|
||||
double max_aspect_h = xSizeHint.max_aspect.y;
|
||||
// According to ICCCM 4.1.2.3 PMinSize should be a fallback for PBaseSize for size increments,
|
||||
// but not for aspect ratio. Since this code comes from FVWM, handles both at the same time,
|
||||
// and I have no idea how it works, let's hope nobody relies on that.
|
||||
w -= xSizeHint.base_width;
|
||||
h -= xSizeHint.base_height;
|
||||
int max_width = max_size.width() - xSizeHint.base_width;
|
||||
|
@ -1200,14 +1203,13 @@ void Client::getWmNormalHints()
|
|||
xSizeHint.flags = 0;
|
||||
// set defined values for the fields, even if they're not in flags
|
||||
|
||||
// basesize is just like minsize, except for minsize is not used for aspect ratios
|
||||
// keep basesize only for aspect ratios, for size increments, keep the base
|
||||
// value in minsize - see ICCCM 4.1.2.3
|
||||
if( xSizeHint.flags & PBaseSize )
|
||||
{
|
||||
if( ! ( xSizeHint.flags & PMinSize )) // PBaseSize and PMinSize are equivalent
|
||||
// PBaseSize is a fallback for PMinSize according to ICCCM 4.1.2.3
|
||||
// The other way around PMinSize is not a complete fallback for PBaseSize,
|
||||
// so that's not handled here.
|
||||
if( ! ( xSizeHint.flags & PMinSize ))
|
||||
{
|
||||
xSizeHint.flags |= PMinSize;
|
||||
xSizeHint.min_width = xSizeHint.base_width;
|
||||
xSizeHint.min_height = xSizeHint.base_height;
|
||||
}
|
||||
|
|
|
@ -36,33 +36,15 @@ GeometryTip::~GeometryTip()
|
|||
|
||||
void GeometryTip::setGeometry( const QRect& geom )
|
||||
{
|
||||
int w, h;
|
||||
int bw, bh;
|
||||
|
||||
w = geom.width();
|
||||
h = geom.height();
|
||||
int w = geom.width();
|
||||
int h = geom.height();
|
||||
|
||||
if (sizeHints)
|
||||
{
|
||||
// PBaseSize is only for aspect ratios, see Client::getWMNormalHints()
|
||||
if (!(sizeHints->flags & PMinSize))
|
||||
{
|
||||
bw = 0;
|
||||
bh = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
bw = sizeHints->min_width;
|
||||
bh = sizeHints->min_height;
|
||||
}
|
||||
|
||||
if (sizeHints->flags & PResizeInc)
|
||||
{
|
||||
if (sizeHints->width_inc > 0)
|
||||
w = (w - bw) / sizeHints->width_inc;
|
||||
if (sizeHints->height_inc > 0)
|
||||
h = (h - bh) / sizeHints->height_inc;
|
||||
|
||||
w = ( w - sizeHints->base_width ) / sizeHints->width_inc;
|
||||
h = ( h - sizeHints->base_height ) / sizeHints->height_inc;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue