From e4c84f39e49f86c20b45a77ef9fe53a866cbcab6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Wed, 18 May 2005 13:59:59 +0000 Subject: [PATCH] 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 --- COMPLIANCE | 1 + geometry.cpp | 12 +++++++----- geometrytip.cpp | 26 ++++---------------------- 3 files changed, 12 insertions(+), 27 deletions(-) diff --git a/COMPLIANCE b/COMPLIANCE index 4d0a2543c3..e63455e4f6 100644 --- a/COMPLIANCE +++ b/COMPLIANCE @@ -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 diff --git a/geometry.cpp b/geometry.cpp index 3c29480331..95ee762130 100644 --- a/geometry.cpp +++ b/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; } diff --git a/geometrytip.cpp b/geometrytip.cpp index 268d28e655..c8a046950b 100644 --- a/geometrytip.cpp +++ b/geometrytip.cpp @@ -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; } }