handling close without weird error messages. Dynamic style changes
without jumping. svn path=/trunk/kdebase/kwin/; revision=32546
This commit is contained in:
parent
cb82f77388
commit
b62982b6d1
3 changed files with 36 additions and 41 deletions
65
client.cpp
65
client.cpp
|
@ -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
|
// we don't want the window to be destroyed when we are destroyed
|
||||||
XAddToSaveSet(qt_xdisplay(), win );
|
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
|
// set the border width to 0
|
||||||
XWindowChanges wc;
|
XWindowChanges wc;
|
||||||
wc.border_width = 0;
|
wc.border_width = 0;
|
||||||
XConfigureWindow( qt_xdisplay(), win, CWBorderWidth, &wc );
|
XConfigureWindow( qt_xdisplay(), win, CWBorderWidth, &wc );
|
||||||
|
|
||||||
// finally, get the window
|
// get the window
|
||||||
XReparentWindow( qt_xdisplay(), win, winId(), 0, 0 );
|
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
|
// install a passive grab to catch mouse button events
|
||||||
XGrabButton(qt_xdisplay(), AnyButton, AnyModifier, winId(), FALSE,
|
XGrabButton(qt_xdisplay(), AnyButton, AnyModifier, winId(), FALSE,
|
||||||
ButtonPressMask, GrabModeSync, GrabModeSync,
|
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 )
|
: QWidget( parent, name, f | WStyle_Customize | WStyle_NoBorder )
|
||||||
{
|
{
|
||||||
|
|
||||||
|
reparented = FALSE;
|
||||||
wspace = ws;
|
wspace = ws;
|
||||||
win = w;
|
win = w;
|
||||||
XWindowAttributes attr;
|
XWindowAttributes attr;
|
||||||
|
@ -426,8 +429,6 @@ Client::Client( Workspace *ws, WId w, QWidget *parent, const char *name, WFlags
|
||||||
transient_for = None;
|
transient_for = None;
|
||||||
is_sticky = FALSE;
|
is_sticky = FALSE;
|
||||||
|
|
||||||
ignore_unmap = 0;
|
|
||||||
|
|
||||||
getIcons();
|
getIcons();
|
||||||
getWindowProtocols();
|
getWindowProtocols();
|
||||||
getWmNormalHints(); // get xSizeHint
|
getWmNormalHints(); // get xSizeHint
|
||||||
|
@ -499,9 +500,6 @@ void Client::manage( bool isMapped )
|
||||||
if ( options->focusPolicyIsReasonable() )
|
if ( options->focusPolicyIsReasonable() )
|
||||||
workspace()->requestFocus( this );
|
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
|
return TRUE; // hack for motif apps like netscape
|
||||||
setActive( FALSE );
|
setActive( FALSE );
|
||||||
break;
|
break;
|
||||||
|
case ReparentNotify:
|
||||||
|
reparented = TRUE;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -622,12 +623,6 @@ bool Client::mapRequest( XMapRequestEvent& /* e */ )
|
||||||
bool Client::unmapNotify( XUnmapEvent& e )
|
bool Client::unmapNotify( XUnmapEvent& e )
|
||||||
{
|
{
|
||||||
|
|
||||||
if ( ignore_unmap ) {
|
|
||||||
ignore_unmap--;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
switch ( mappingState() ) {
|
switch ( mappingState() ) {
|
||||||
case IconicState:
|
case IconicState:
|
||||||
// only react on sent events, all others are produced by us
|
// only react on sent events, all others are produced by us
|
||||||
|
@ -635,13 +630,15 @@ bool Client::unmapNotify( XUnmapEvent& e )
|
||||||
withdraw();
|
withdraw();
|
||||||
break;
|
break;
|
||||||
case NormalState:
|
case NormalState:
|
||||||
|
if ( !reparented )
|
||||||
|
return TRUE; // we produced this event
|
||||||
if ( !windowWrapper()->isVisible() && !e.send_event )
|
if ( !windowWrapper()->isVisible() && !e.send_event )
|
||||||
return TRUE; // this event was produced by us as well
|
return TRUE; // this event was produced by us as well
|
||||||
|
|
||||||
// maybe we will be destroyed soon. Check this first.
|
// maybe we will be destroyed soon. Check this first.
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
QApplication::syncX();
|
QApplication::syncX();
|
||||||
if ( XCheckTypedWindowEvent (qt_xdisplay(), windowWrapper()->winId(),
|
if ( XCheckTypedWindowEvent (qt_xdisplay(), win,
|
||||||
DestroyNotify, &ev) ){
|
DestroyNotify, &ev) ){
|
||||||
workspace()->destroyClient( this );
|
workspace()->destroyClient( this );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -874,8 +871,6 @@ void Client::mouseMoveEvent( QMouseEvent * e)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QRect oldGeom( geom );
|
|
||||||
|
|
||||||
if ( !moveResizeMode )
|
if ( !moveResizeMode )
|
||||||
{
|
{
|
||||||
QPoint p( e->pos() - moveOffset );
|
QPoint p( e->pos() - moveOffset );
|
||||||
|
|
2
client.h
2
client.h
|
@ -196,7 +196,7 @@ private:
|
||||||
void sendSynteticConfigureNotify();
|
void sendSynteticConfigureNotify();
|
||||||
int state;
|
int state;
|
||||||
bool active;
|
bool active;
|
||||||
int ignore_unmap;
|
bool reparented;
|
||||||
QRect original_geometry;
|
QRect original_geometry;
|
||||||
QRect geom; //### TODO
|
QRect geom; //### TODO
|
||||||
bool shaded;
|
bool shaded;
|
||||||
|
|
|
@ -162,18 +162,18 @@ bool Workspace::workspaceEvent( XEvent * e )
|
||||||
if ( e->xunmap.event != e->xunmap.window ) // hide wm typical event from Qt
|
if ( e->xunmap.event != e->xunmap.window ) // hide wm typical event from Qt
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case ReparentNotify:
|
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
|
//do not confuse Qt with these events. After all, _we_ are the
|
||||||
//window manager who does the reparenting.
|
//window manager who does the reparenting.
|
||||||
return true;
|
return TRUE;
|
||||||
case DestroyNotify:
|
case DestroyNotify:
|
||||||
return destroyClient( findClient( e->xdestroywindow.window ) );
|
return destroyClient( findClient( e->xdestroywindow.window ) );
|
||||||
case MapRequest:
|
case MapRequest:
|
||||||
qDebug("map request");
|
|
||||||
if ( e->xmaprequest.parent == root ) {
|
if ( e->xmaprequest.parent == root ) {
|
||||||
qDebug("map request on root window");
|
|
||||||
c = findClient( e->xmaprequest.window );
|
c = findClient( e->xmaprequest.window );
|
||||||
if ( !c ) {
|
if ( !c ) {
|
||||||
qDebug("didn't find a client, make a new one");
|
|
||||||
c = clientFactory( this, e->xmaprequest.window );
|
c = clientFactory( this, e->xmaprequest.window );
|
||||||
if ( root != qt_xrootwin() ) {
|
if ( root != qt_xrootwin() ) {
|
||||||
// TODO may use QWidget:.create
|
// TODO may use QWidget:.create
|
||||||
|
|
Loading…
Reference in a new issue