slow down resize with a timer

svn path=/trunk/kdebase/kwin/; revision=48784
This commit is contained in:
Matthias Ettrich 2000-05-07 23:10:21 +00:00
parent 1671d0ddc7
commit 0b154e4b7c
2 changed files with 28 additions and 4 deletions

View file

@ -14,6 +14,7 @@ Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
#include <qlayout.h>
#include <qpainter.h>
#include <qwhatsthis.h>
#include <qtimer.h>
#include "workspace.h"
#include "client.h"
#include "events.h"
@ -107,6 +108,7 @@ WindowWrapper::WindowWrapper( WId w, Client *parent, const char* name)
: QWidget( parent, name )
{
win = w;
timer = 0;
setMouseTracking( TRUE );
setBackgroundColor( colorGroup().background() );
@ -203,13 +205,29 @@ QSizePolicy WindowWrapper::sizePolicy() const
void WindowWrapper::resizeEvent( QResizeEvent * )
{
if ( win && reparented ) {
XMoveResizeWindow( qt_xdisplay(), win,
0, 0, width(), height() );
if ( isVisible() ) {
delete timer;
timer = new QTimer( this );
connect( timer, SIGNAL( timeout() ), this, SLOT( doResize() ) );
timer->start( 5, TRUE );
} else {
XMoveResizeWindow( qt_xdisplay(), win,
0, 0, width(), height() );
}
if ( ((Client*)parentWidget())->shape() )
((Client*)parentWidget())->updateShape();
}
}
void WindowWrapper::doResize()
{
delete timer;
timer = 0;
XMoveResizeWindow( qt_xdisplay(), win,
0, 0, width(), height() );
}
void WindowWrapper::showEvent( QShowEvent* )
{
if ( win ) {
@ -1058,7 +1076,8 @@ void Client::leaveEvent( QEvent * )
void Client::setGeometry( int x, int y, int w, int h )
{
QWidget::setGeometry(x, y, w, h);
sendSynteticConfigureNotify();
if ( !isResize() )
sendSynteticConfigureNotify();
}
/*!
@ -1228,7 +1247,7 @@ void Client::maximize( MaximizeMode m)
if (isShade())
setShade( FALSE );
if (geom_restore.isNull()) {
Events::raise( Events::Maximize );

View file

@ -11,6 +11,7 @@ Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
#include <qframe.h>
#include <qvbox.h>
#include <qpixmap.h>
#include <qtimer.h>
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
@ -39,10 +40,14 @@ protected:
void hideEvent( QHideEvent* );
bool x11Event( XEvent * ); // X11 event
private slots:
void doResize();
private:
WId win;
Time lastMouseEventTime;
bool reparented;
QTimer* timer;
};
inline WId WindowWrapper::window() const