enabled by default, but will be made configurable soon. There is a known issue with an incorrect geometry shown with konsole, but that's its fault, and I'll get to that shortly (xterm does the right thing). Disclaimer: If it jams - force it. If it breaks, it probably needed replacing anyway. svn path=/trunk/kdebase/kwin/; revision=197992remotes/origin/Plasma/5.0
parent
63fbbb6f83
commit
235b534b26
4 changed files with 125 additions and 4 deletions
@ -0,0 +1,65 @@ |
||||
/*
|
||||
* $Id$ |
||||
* Window Geometry Display |
||||
* Copyright (c) 2003, Karol Szwed <kszwed@kde.org> |
||||
*/ |
||||
|
||||
#include "geometrytip.h" |
||||
|
||||
using namespace KWinInternal; |
||||
|
||||
|
||||
GeometryTip::GeometryTip( const Client* client, const XSizeHints* xSizeHints ): |
||||
QLabel(NULL, "kwingeometry", WStyle_Customize | WStyle_StaysOnTop | |
||||
WStyle_NoBorder | WX11BypassWM ) |
||||
{ |
||||
c = client; |
||||
setMargin(1); |
||||
setIndent(0); |
||||
setLineWidth(1); |
||||
setFrameStyle( QFrame::Raised | QFrame::StyledPanel ); |
||||
setAlignment( AlignCenter | AlignTop ); |
||||
sizeHints = xSizeHints; |
||||
} |
||||
|
||||
GeometryTip::~GeometryTip() |
||||
{ |
||||
} |
||||
|
||||
void GeometryTip::setGeometry( const QRect& geom ) |
||||
{ |
||||
int w, h; |
||||
int bw, bh; |
||||
QWidget* wrap = c->windowWrapper(); |
||||
|
||||
w = wrap->width(); |
||||
h = wrap->height(); |
||||
|
||||
if (sizeHints) { |
||||
if (!(sizeHints->flags & PBaseSize)) { |
||||
bw = 0; |
||||
bh = 0; |
||||
} else { |
||||
bw = sizeHints->base_width; |
||||
bh = sizeHints->base_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;
|
||||
|
||||
} |
||||
} |
||||
|
||||
QString pos; |
||||
pos.sprintf( "%+d,%+d (<b>%d x %d</b>)", |
||||
geom.x(), geom.y(), w, h ); |
||||
setText( pos ); |
||||
adjustSize(); |
||||
move( geom.x() + ((geom.width() - width()) / 2), |
||||
geom.y() + ((geom.height() - height()) / 2) ); |
||||
} |
||||
|
||||
|
||||
@ -0,0 +1,30 @@ |
||||
/*
|
||||
* $Id$ |
||||
* Window Geometry Display |
||||
* Copyright (c) 2003, Karol Szwed <kszwed@kde.org> |
||||
*/ |
||||
|
||||
#ifndef KWIN_GEOMETRY_TIP_H |
||||
#define KWIN_GEOMETRY_TIP_H |
||||
|
||||
#include <qlabel.h> |
||||
#include "client.h" |
||||
|
||||
namespace KWinInternal { |
||||
|
||||
class GeometryTip: public QLabel |
||||
{ |
||||
Q_OBJECT |
||||
public: |
||||
GeometryTip( const Client* client, const XSizeHints* xSizeHints ); |
||||
~GeometryTip(); |
||||
void setGeometry( const QRect& geom ); |
||||
|
||||
private: |
||||
const XSizeHints* sizeHints; |
||||
const Client* c; |
||||
}; |
||||
|
||||
}; |
||||
|
||||
#endif |
||||
Loading…
Reference in new issue