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

View file

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

View file

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

View file

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