- handle initial state iconic

- handle maprequests when being iconified properly
- do not unshade xemacs 32000 pixels high

svn path=/trunk/kdebase/kwin/; revision=34014
This commit is contained in:
Matthias Ettrich 1999-11-16 01:25:42 +00:00
parent f1dbea6ae5
commit 9a0ea6b949
4 changed files with 53 additions and 21 deletions

View file

@ -151,6 +151,15 @@ QSizePolicy WindowWrapper::sizePolicy() const
}
/**
Gives layout the illusion the wrapper was visible
*/
void WindowWrapper::pseudoShow()
{
clearWState( WState_ForceHide );
}
void WindowWrapper::resizeEvent( QResizeEvent * )
{
if ( win ) {
@ -349,17 +358,23 @@ void Client::manage( bool isMapped )
updateShape();
}
// find out the initial state. Several possibilities exist
XWMHints * hints = XGetWMHints(qt_xdisplay(), win );
int state = NormalState;
if (hints && (hints->flags & StateHint))
state = hints->initial_state;
if (hints)
XFree(hints);
// ### TODO check XGetWMHints() for initial mapping state, icon, etc. pp.
// assume window wants to be visible on the current desktop
desk = KWM::desktop( win ); //workspace()->currentDesktop();
setMappingState( NormalState );
if ( isOnDesktop( workspace()->currentDesktop() ) ) {
setMappingState( state );
if ( state == NormalState && isOnDesktop( workspace()->currentDesktop() ) ) {
show();
}
if ( options->focusPolicyIsReasonable() )
workspace()->requestFocus( this );
}
}
@ -506,7 +521,7 @@ bool Client::unmapNotify( XUnmapEvent& e )
// maybe we will be destroyed soon. Check this first.
XEvent ev;
if ( XCheckTypedWindowEvent (qt_xdisplay(), win,
if ( XCheckTypedWindowEvent (qt_xdisplay(), windowWrapper()->winId(),
DestroyNotify, &ev) ){
workspace()->destroyClient( this );
return TRUE;
@ -691,14 +706,14 @@ QSize Client::sizeForWindowSize( const QSize& wsize, bool ignore_height) const
}
int ww = wwrap->width();
int wh = 0;
int wh = 0;;
if ( !wwrap->testWState( WState_ForceHide ) )
wh = wwrap->height();
return QSize( QMIN( QMAX( width() - ww + w, minimumWidth() ),
maximumWidth() ),
ignore_height? height()-wh : QMIN( QMAX( height() - wh + h, minimumHeight() ),
maximumHeight() ) );
ignore_height? height()-wh : (QMIN( QMAX( height() - wh + h, minimumHeight() ),
maximumHeight() ) ) );
}
@ -740,6 +755,15 @@ void Client::mouseReleaseEvent( QMouseEvent * e)
}
}
/*!
*/
void Client::resizeEvent( QResizeEvent * e)
{
QWidget::resizeEvent( e );
}
/*!
Reimplemented to provide move/resize
*/
@ -1306,9 +1330,10 @@ void Client::setShade( bool s )
resize (s );
} else {
QSize s( sizeForWindowSize( windowWrapper()->size() ) );
resize ( s );
windowWrapper()->show();
layout()->activate();
resize ( s );
repaint();
if ( isActive() )
workspace()->requestFocus( this );
}

View file

@ -26,6 +26,8 @@ public:
QSize sizeHint() const;
QSizePolicy sizePolicy() const;
void pseudoShow();
protected:
void resizeEvent( QResizeEvent * );
void showEvent( QShowEvent* );
@ -146,6 +148,7 @@ protected:
void mousePressEvent( QMouseEvent * );
void mouseReleaseEvent( QMouseEvent * );
void mouseMoveEvent( QMouseEvent * );
void resizeEvent( QResizeEvent * );
void enterEvent( QEvent * );
void leaveEvent( QEvent * );
void showEvent( QShowEvent* );

View file

@ -298,7 +298,7 @@ void StdClient::stickyChange( bool s)
button[1]->setIconSet( s?*pindown_pix:*pinup_pix );
}
void StdClient::paintEvent( QPaintEvent* )
void StdClient::paintEvent( QPaintEvent* e)
{
QPainter p( this );
QRect t = titlebar->geometry();

View file

@ -263,9 +263,9 @@ bool Workspace::workspaceEvent( XEvent * e )
return TRUE;
return destroyClient( findClient( e->xdestroywindow.window ) );
case MapRequest:
if ( e->xmaprequest.parent == root ) {
c = findClient( e->xmaprequest.window );
if ( !c ) {
if ( e->xmaprequest.parent == root ) {
if ( addDockwin( e->xmaprequest.window ) )
return TRUE;
c = clientFactory( this, e->xmaprequest.window );
@ -274,11 +274,14 @@ bool Workspace::workspaceEvent( XEvent * e )
XReparentWindow( qt_xdisplay(), c->winId(), root, 0, 0 );
}
if ( c != desktop_client ) {
focus_chain.prepend( c );
clients.append( c );
stacking_order.append( c );
}
propagateClients();
}
}
if ( c ) {
bool result = c->windowEvent( e );
if ( c == desktop_client )
setDesktopClient( c );
@ -410,6 +413,7 @@ bool Workspace::destroyClient( Client* c)
{
if ( !c )
return FALSE;
qDebug("Workspace:.destroyClient");
clients.remove( c );
stacking_order.remove( c );
focus_chain.remove( c );