diff --git a/group.cpp b/group.cpp index d52f0094bc..cf69600875 100644 --- a/group.cpp +++ b/group.cpp @@ -73,6 +73,14 @@ bool performTransiencyCheck() it2 != mains.end(); ++it2 ) { + if( !Workspace::self()->clients.contains( *it2 ) + && !Workspace::self()->desktops.contains( *it2 )) + { + kDebug() << "TC:" << *it1 << " has non-existent main client " << endl; + kDebug() << "TC2:" << *it2 << endl; // this may crash + ret = false; + continue; + } if( !(*it2)->transients_list.contains( *it1 )) { kdDebug() << "TC:" << *it1 << " has main client " << *it2 << " but main client does not have it as a transient" << endl; @@ -85,6 +93,14 @@ bool performTransiencyCheck() it2 != trans.end(); ++it2 ) { + if( !Workspace::self()->clients.contains( *it2 ) + && !Workspace::self()->desktops.contains( *it2 )) + { + kDebug() << "TC:" << *it1 << " has non-existent transient " << endl; + kDebug() << "TC2:" << *it2 << endl; // this may crash + ret = false; + continue; + } if( !(*it2)->mainClients().contains( *it1 )) { kdDebug() << "TC:" << *it1 << " has transient " << *it2 << " but transient does not have it as a main client" << endl; diff --git a/workspace.cpp b/workspace.cpp index d406f65fdb..a9638cef5a 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -42,9 +42,6 @@ License. See the file "COPYING" for the exact licensing terms. #include "group.h" #include "rules.h" #include "kwinadaptor.h" -#include "unmanaged.h" -#include "scene.h" -#include "effects.h" #include #include @@ -96,7 +93,6 @@ Workspace::Workspace( bool restore ) popupinfo (0), popup (0), advanced_popup (0), - trans_popup (0), desk_popup (0), desk_popup_index (0), keys (0), @@ -126,13 +122,7 @@ Workspace::Workspace( bool restore ) topmenu_space( NULL ), set_active_client_recursion( 0 ), block_stacking_updates( 0 ), - forced_global_mouse_grab( false ), - cm_selection( NULL ), - compositeRate( 0 ), - damage_region( None ), - overlay( None ), - transSlider( NULL ), - transButton( NULL ) + forced_global_mouse_grab( false ) { new KWinAdaptor( "org.kde.kwin", "/KWin", QDBusConnection::sessionBus(), this ); @@ -176,12 +166,10 @@ Workspace::Workspace( bool restore ) ColormapChangeMask | SubstructureRedirectMask | SubstructureNotifyMask | - FocusChangeMask | // for NotifyDetailNone - ExposureMask + FocusChangeMask // for NotifyDetailNone ); - Extensions::init(); - setupCompositing(); + Shape::init(); // compatibility long data = 1; @@ -330,7 +318,6 @@ void Workspace::init() connect(&reconfigureTimer, SIGNAL(timeout()), this, SLOT(slotReconfigure())); connect( &updateToolWindowsTimer, SIGNAL( timeout()), this, SLOT( slotUpdateToolWindows())); - connect( &compositeTimer, SIGNAL( timeout()), SLOT( performCompositing())); connect(KGlobalSettings::self(), SIGNAL(appearanceChanged()), this, SLOT(slotReconfigure())); @@ -368,11 +355,7 @@ void Workspace::init() XWindowAttributes attr; XGetWindowAttributes(display(), wins[i], &attr); if (attr.override_redirect ) - { - if( attr.map_state != IsUnmapped && attr.c_class != InputOnly && compositing()) - createUnmanaged( wins[ i ] ); continue; - } if( topmenu_space && topmenu_space->winId() == wins[ i ] ) continue; if (attr.map_state != IsUnmapped) @@ -435,7 +418,6 @@ void Workspace::init() Workspace::~Workspace() { - finishCompositing(); blockStackingUpdates( true ); // TODO grabXServer(); // use stacking_order, so that kwin --replace keeps stacking order @@ -445,12 +427,12 @@ Workspace::~Workspace() { // only release the window (*it)->releaseWindow( true ); - // no removeClient() is called ! + // No removeClient() is called, it does more than just removing. + // However, remove from some lists to e.g. prevent performTransiencyCheck() + // from crashing. + clients.remove( *it ); + desktops.remove( *it ); } - for( UnmanagedList::ConstIterator it = unmanaged.begin(); - it != unmanaged.end(); - ++it ) - (*it)->release(); delete desktop_widget; delete tab_box; delete popupinfo; @@ -494,28 +476,6 @@ Client* Workspace::createClient( Window w, bool is_mapped ) return NULL; } addClient( c, Allowed ); - if( scene ) - scene->windowAdded( c ); - if( effects ) - effects->windowAdded( c ); - return c; - } - -Unmanaged* Workspace::createUnmanaged( Window w ) - { - if( w == overlay ) - return NULL; - Unmanaged* c = new Unmanaged( this ); - if( !c->track( w )) - { - Unmanaged::deleteUnmanaged( c, Allowed ); - return NULL; - } - addUnmanaged( c, Allowed ); - if( scene ) - scene->windowAdded( c ); - if( effects ) - effects->windowAdded( c ); return c; } @@ -558,11 +518,6 @@ void Workspace::addClient( Client* c, allowed_t ) updateToolWindows( true ); } -void Workspace::addUnmanaged( Unmanaged* c, allowed_t ) - { - unmanaged.append( c ); - } - /* Destroys the client \a c */ @@ -582,10 +537,6 @@ void Workspace::removeClient( Client* c, allowed_t ) Notify::raise( Notify::Delete ); Q_ASSERT( clients.contains( c ) || desktops.contains( c )); - if( scene ) - scene->windowDeleted( c ); - if( effects ) - effects->windowDeleted( c ); clients.removeAll( c ); desktops.removeAll( c ); unconstrained_stacking_order.removeAll( c ); @@ -621,16 +572,6 @@ void Workspace::removeClient( Client* c, allowed_t ) updateClientArea(); } -void Workspace::removeUnmanaged( Unmanaged* c, allowed_t ) - { - assert( unmanaged.contains( c )); - if( scene ) - scene->windowDeleted( c ); - if( effects ) - effects->windowDeleted( c ); - unmanaged.removeAll( c ); - } - void Workspace::updateFocusChains( Client* c, FocusChainChange change ) { if( !c->wantsTabFocus()) // doesn't want tab focus, remove @@ -656,7 +597,13 @@ void Workspace::updateFocusChains( Client* c, FocusChainChange change ) focus_chain[ i ].prepend( c ); } else if( !focus_chain[ i ].contains( c )) - focus_chain[ i ].prepend( c ); // otherwise add as the last one + { // add it after the active one + if( active_client != NULL && active_client != c + && !focus_chain[ i ].isEmpty() && focus_chain[ i ].last() == active_client ) + focus_chain[ i ].insert( focus_chain[ i ].size() - 1, c ); + else + focus_chain[ i ].append( c ); // otherwise add as the first one + } } } else //now only on desktop, remove it anywhere else @@ -676,7 +623,13 @@ void Workspace::updateFocusChains( Client* c, FocusChainChange change ) focus_chain[ i ].prepend( c ); } else if( !focus_chain[ i ].contains( c )) - focus_chain[ i ].prepend( c ); + { // add it after the active one + if( active_client != NULL && active_client != c + && !focus_chain[ i ].isEmpty() && focus_chain[ i ].last() == active_client ) + focus_chain[ i ].insert( focus_chain[ i ].size() - 1, c ); + else + focus_chain[ i ].append( c ); // otherwise add as the first one + } } else focus_chain[ i ].removeAll( c ); @@ -693,7 +646,13 @@ void Workspace::updateFocusChains( Client* c, FocusChainChange change ) global_focus_chain.prepend( c ); } else if( !global_focus_chain.contains( c )) - global_focus_chain.prepend( c ); + { // add it after the active one + if( active_client != NULL && active_client != c + && !global_focus_chain.isEmpty() && global_focus_chain.last() == active_client ) + global_focus_chain.insert( global_focus_chain.size() - 1, c ); + else + global_focus_chain.append( c ); // otherwise add as the first one + } } void Workspace::updateCurrentTopMenu() @@ -927,7 +886,7 @@ void Workspace::slotSettingsChanged(int category) /*! Reread settings */ -KWIN_PROCEDURE( CheckBorderSizesProcedure, Client, cl->checkBorderSizes() ); +KWIN_PROCEDURE( CheckBorderSizesProcedure, cl->checkBorderSizes() ); void Workspace::slotReconfigure() { @@ -984,11 +943,6 @@ void Workspace::slotReconfigure() updateTopMenuGeometry(); updateCurrentTopMenu(); } - - if( options->useTranslucency ) - setupCompositing(); - else - finishCompositing(); loadWindowRules(); for( ClientList::Iterator it = clients.begin(); @@ -1278,11 +1232,18 @@ bool Workspace::setCurrentDesktop( int new_desktop ) if ( c ) requestFocus( c ); - else if( !desktops.isEmpty() ) - requestFocus( findDesktop( true, currentDesktop())); else focusToNull(); + if( !desktops.isEmpty() ) + { + Window w_tmp; + int i_tmp; + XGetInputFocus( display(), &w_tmp, &i_tmp ); + if( w_tmp == null_focus_window ) // CHECKME? + requestFocus( findDesktop( true, currentDesktop())); + } + updateCurrentTopMenu(); // Update focus chain: @@ -1683,7 +1644,7 @@ void Workspace::slotGrabWindow() QPixmap snapshot = QPixmap::grabWindow( active_client->frameId() ); //No XShape - no work. - if( Extensions::shapeAvailable()) + if( Shape::available()) { //As the first step, get the mask from XShape. int count, order; @@ -2036,8 +1997,7 @@ void Workspace::createBorderWindows() XSetWindowAttributes attributes; unsigned long valuemask; attributes.override_redirect = True; - attributes.event_mask = (EnterWindowMask | LeaveWindowMask | - VisibilityChangeMask); + attributes.event_mask = ( EnterWindowMask | LeaveWindowMask ); valuemask= (CWOverrideRedirect | CWEventMask | CWCursor ); attributes.cursor = XCreateFontCursor(display(), XC_sb_up_arrow);