handling close without weird error messages. Dynamic style changes

without jumping.

svn path=/trunk/kdebase/kwin/; revision=32546
This commit is contained in:
Matthias Ettrich 1999-11-02 00:32:31 +00:00
parent cb82f77388
commit b62982b6d1
3 changed files with 36 additions and 41 deletions

View file

@ -254,34 +254,36 @@ WindowWrapper::WindowWrapper( WId w, Client *parent, const char* name)
// we don't want the window to be destroyed when we are destroyed
XAddToSaveSet(qt_xdisplay(), win );
// overwrite Qt-defaults because we need SubstructureNotifyMask
XSelectInput( qt_xdisplay(), winId(),
KeyPressMask | KeyReleaseMask |
ButtonPressMask | ButtonReleaseMask |
KeymapStateMask |
ButtonMotionMask |
PointerMotionMask | // need this, too!
EnterWindowMask | LeaveWindowMask |
FocusChangeMask |
ExposureMask |
StructureNotifyMask |
SubstructureRedirectMask |
SubstructureNotifyMask
);
XSelectInput( qt_xdisplay(), w,
FocusChangeMask |
PropertyChangeMask
);
// set the border width to 0
XWindowChanges wc;
wc.border_width = 0;
XConfigureWindow( qt_xdisplay(), win, CWBorderWidth, &wc );
// finally, get the window
// get the window
XReparentWindow( qt_xdisplay(), win, winId(), 0, 0 );
// // overwrite Qt-defaults because we need SubstructureNotifyMask
// XSelectInput( qt_xdisplay(), winId(),
// KeyPressMask | KeyReleaseMask |
// ButtonPressMask | ButtonReleaseMask |
// KeymapStateMask |
// ButtonMotionMask |
// PointerMotionMask | // need this, too!
// EnterWindowMask | LeaveWindowMask |
// FocusChangeMask |
// ExposureMask |
// StructureNotifyMask |
// SubstructureRedirectMask |
// SubstructureNotifyMask
// );
XSelectInput( qt_xdisplay(), w,
FocusChangeMask |
PropertyChangeMask |
StructureNotifyMask
);
// install a passive grab to catch mouse button events
XGrabButton(qt_xdisplay(), AnyButton, AnyModifier, winId(), FALSE,
ButtonPressMask, GrabModeSync, GrabModeSync,
@ -403,6 +405,7 @@ Client::Client( Workspace *ws, WId w, QWidget *parent, const char *name, WFlags
: QWidget( parent, name, f | WStyle_Customize | WStyle_NoBorder )
{
reparented = FALSE;
wspace = ws;
win = w;
XWindowAttributes attr;
@ -426,8 +429,6 @@ Client::Client( Workspace *ws, WId w, QWidget *parent, const char *name, WFlags
transient_for = None;
is_sticky = FALSE;
ignore_unmap = 0;
getIcons();
getWindowProtocols();
getWmNormalHints(); // get xSizeHint
@ -499,9 +500,6 @@ void Client::manage( bool isMapped )
if ( options->focusPolicyIsReasonable() )
workspace()->requestFocus( this );
// ignore unmap notify send by the xserver cause the window was already mapped
if ( isMapped )
ignore_unmap++;
}
@ -587,6 +585,9 @@ bool Client::windowEvent( XEvent * e)
return TRUE; // hack for motif apps like netscape
setActive( FALSE );
break;
case ReparentNotify:
reparented = TRUE;
break;
default:
break;
}
@ -622,12 +623,6 @@ bool Client::mapRequest( XMapRequestEvent& /* e */ )
bool Client::unmapNotify( XUnmapEvent& e )
{
if ( ignore_unmap ) {
ignore_unmap--;
return TRUE;
}
switch ( mappingState() ) {
case IconicState:
// only react on sent events, all others are produced by us
@ -635,13 +630,15 @@ bool Client::unmapNotify( XUnmapEvent& e )
withdraw();
break;
case NormalState:
if ( !reparented )
return TRUE; // we produced this event
if ( !windowWrapper()->isVisible() && !e.send_event )
return TRUE; // this event was produced by us as well
// maybe we will be destroyed soon. Check this first.
XEvent ev;
QApplication::syncX();
if ( XCheckTypedWindowEvent (qt_xdisplay(), windowWrapper()->winId(),
if ( XCheckTypedWindowEvent (qt_xdisplay(), win,
DestroyNotify, &ev) ){
workspace()->destroyClient( this );
return TRUE;
@ -874,8 +871,6 @@ void Client::mouseMoveEvent( QMouseEvent * e)
return;
}
QRect oldGeom( geom );
if ( !moveResizeMode )
{
QPoint p( e->pos() - moveOffset );

View file

@ -196,7 +196,7 @@ private:
void sendSynteticConfigureNotify();
int state;
bool active;
int ignore_unmap;
bool reparented;
QRect original_geometry;
QRect geom; //### TODO
bool shaded;

View file

@ -162,18 +162,18 @@ bool Workspace::workspaceEvent( XEvent * e )
if ( e->xunmap.event != e->xunmap.window ) // hide wm typical event from Qt
return TRUE;
case ReparentNotify:
c = findClient( e->xreparent.window );
if ( c )
(void) c->windowEvent( e );
//do not confuse Qt with these events. After all, _we_ are the
//window manager who does the reparenting.
return true;
return TRUE;
case DestroyNotify:
return destroyClient( findClient( e->xdestroywindow.window ) );
case MapRequest:
qDebug("map request");
if ( e->xmaprequest.parent == root ) {
qDebug("map request on root window");
c = findClient( e->xmaprequest.window );
if ( !c ) {
qDebug("didn't find a client, make a new one");
c = clientFactory( this, e->xmaprequest.window );
if ( root != qt_xrootwin() ) {
// TODO may use QWidget:.create