From 82c96c4bc7f0f96d35f9d7b20cf69c6ce96d6c6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Tue, 13 Feb 2007 14:09:23 +0000 Subject: [PATCH] Implement _NET_DESKTOP_LAYOUT. svn path=/trunk/KDE/kdebase/workspace/; revision=633205 --- events.cpp | 274 ++++++++++------------------------------------- org.kde.KWin.xml | 14 +-- workspace.cpp | 158 ++++++++++----------------- workspace.h | 95 ++++------------ 4 files changed, 133 insertions(+), 408 deletions(-) diff --git a/events.cpp b/events.cpp index 8fba53295b..c110f704db 100644 --- a/events.cpp +++ b/events.cpp @@ -21,9 +21,6 @@ License. See the file "COPYING" for the exact licensing terms. #include "tabbox.h" #include "group.h" #include "rules.h" -#include "unmanaged.h" -#include "scene.h" -#include "effects.h" #include #include @@ -86,10 +83,6 @@ void WinInfo::changeState( unsigned long state, unsigned long mask ) m_client->setFullScreen( true, false ); } -void WinInfo::disable() - { - m_client = NULL; // only used when the object is passed to Deleted - } // **************************************** // RootInfo @@ -206,10 +199,15 @@ bool Workspace::workspaceEvent( XEvent * e ) XUngrabKeyboard( display(), xTime() ); } - if ( e->type == PropertyNotify || e->type == ClientMessage ) + if( e->type == PropertyNotify || e->type == ClientMessage ) { - if ( netCheck( e ) ) - return true; + unsigned long dirty[ NETRootInfo::PROPERTIES_SIZE ]; + rootInfo->event( e, dirty, NETRootInfo::PROPERTIES_SIZE ); + if( dirty[ NETRootInfo::PROTOCOLS ] & NET::DesktopNames ) + saveDesktopSettings(); + if( dirty[ NETRootInfo::PROTOCOLS2 ] & NET::WM2DesktopLayout ) + setDesktopLayout( rootInfo->desktopLayoutOrientation(), rootInfo->desktopLayoutColumnsRows().width(), + rootInfo->desktopLayoutColumnsRows().height(), rootInfo->desktopLayoutCorner()); } // events that should be handled before Clients can get them @@ -225,8 +223,6 @@ bool Workspace::workspaceEvent( XEvent * e ) tab_box->handleMouseEvent( e ); return true; } - if( effects && effects->checkInputWindowEvent( e )) - return true; break; case KeyPress: { @@ -271,11 +267,6 @@ bool Workspace::workspaceEvent( XEvent * e ) if( c->windowEvent( e )) return true; } - else if( Unmanaged* c = findUnmanaged( WindowMatchPredicate( e->xany.window ))) - { - if( c->windowEvent( e )) - return true; - } else { Window special = findSpecialEventWindow( e ); @@ -333,8 +324,13 @@ bool Workspace::workspaceEvent( XEvent * e ) } return true; } + return ( e->xunmap.event != e->xunmap.window ); // hide wm typical event from Qt } + case MapNotify: + + return ( e->xmap.event != e->xmap.window ); // hide wm typical event from Qt + case ReparentNotify: { //do not confuse Qt with these events. After all, _we_ are the @@ -384,19 +380,6 @@ bool Workspace::workspaceEvent( XEvent * e ) } break; } - case MapNotify: - { - if( e->xmap.override_redirect ) - { - Unmanaged* c = findUnmanaged( WindowMatchPredicate( e->xmap.window )); - if( c == NULL ) - c = createUnmanaged( e->xmap.window ); - if( c ) - return c->windowEvent( e ); - } - return ( e->xmap.event != e->xmap.window ); // hide wm typical event from Qt - } - case EnterNotify: { if ( QWhatsThis::inWhatsThisMode() ) @@ -473,29 +456,7 @@ bool Workspace::workspaceEvent( XEvent * e ) if( electricBorder( e )) return true; break; - case MappingNotify: - XRefreshKeyboardMapping( &e->xmapping ); - tab_box->updateKeyMapping(); - break; - case Expose: - if( e->xexpose.window == rootWindow() && compositing()) // root window needs repainting - addRepaint( e->xexpose.x, e->xexpose.y, e->xexpose.width, e->xexpose.height ); - break; default: - if( e->type == Extensions::randrNotifyEvent() && Extensions::randrAvailable() ) - { -#ifdef HAVE_XRANDR - XRRUpdateConfiguration( e ); -#endif - if( compositing() ) - { - // desktopResized() should take care of when the size or - // shape of the desktop has changed, but we also want to - // catch refresh rate changes - finishCompositing(); - QTimer::singleShot( 0, this, SLOT( setupCompositing() ) ); - } - } break; } return false; @@ -535,20 +496,6 @@ Window Workspace::findSpecialEventWindow( XEvent* e ) }; } -/*! - Handles client messages sent to the workspace - */ -bool Workspace::netCheck( XEvent* e ) - { - unsigned int dirty = rootInfo->event( e ); - - if ( dirty & NET::DesktopNames ) - saveDesktopSettings(); - - return dirty != 0; - } - - // **************************************** // Client // **************************************** @@ -561,7 +508,6 @@ bool Client::windowEvent( XEvent* e ) if( e->xany.window == window()) // avoid doing stuff on frame or wrapper { unsigned long dirty[ 2 ]; - double old_opacity = opacity(); info->event( e, dirty, 2 ); // pass through the NET stuff if ( ( dirty[ WinInfo::PROTOCOLS ] & NET::WMName ) != 0 ) @@ -592,21 +538,6 @@ bool Client::windowEvent( XEvent* e ) if( demandAttentionKNotifyTimer != NULL ) demandAttentionKNotify(); } - if( dirty[ WinInfo::PROTOCOLS2 ] & NET::WM2Opacity ) - { - if( compositing()) - { - addRepaintFull(); - scene->windowOpacityChanged( this ); - if( effects ) - effects->windowOpacityChanged( effectWindow(), old_opacity ); - } - else - { // forward to the frame if there's possibly another compositing manager running - NETWinInfo i( display(), frameId(), rootWindow(), 0 ); - i.setOpacity( info->opacity()); - } - } } // TODO move all focus handling stuff to separate file? @@ -687,23 +618,15 @@ bool Client::windowEvent( XEvent* e ) workspace()->updateColormap(); } break; - case VisibilityNotify: - visibilityNotifyEvent( &e->xvisibility ); - break; default: if( e->xany.window == window()) + { + if( e->type == Shape::shapeEvent() ) { - if( e->type == Extensions::shapeNotifyEvent() ) - { - detectShape( window()); // workaround for #19644 - updateShape(); - } - } - if( e->xany.window == frameId()) - { - if( e->type == Extensions::damageNotifyEvent()) - damageNotifyEvent( reinterpret_cast< XDamageNotifyEvent* >( e )); + is_shape = Shape::hasShape( window()); // workaround for #19644 + updateShape(); } + } break; } return true; // eat all events @@ -906,7 +829,6 @@ void Client::configureRequestEvent( XConfigureRequestEvent* e ) */ void Client::propertyNotifyEvent( XPropertyEvent* e ) { - Toplevel::propertyNotifyEvent( e ); if( e->window != window()) return; // ignore frame/wrapper switch ( e->atom ) @@ -930,6 +852,10 @@ void Client::propertyNotifyEvent( XPropertyEvent* e ) default: if ( e->atom == atoms->wm_protocols ) getWindowProtocols(); + else if (e->atom == atoms->wm_client_leader ) + getWmClientLeader(); + else if( e->atom == atoms->wm_window_role ) + window_role = staticWindowRole( window()); else if( e->atom == atoms->motif_wm_hints ) getMotifHints(); break; @@ -1069,18 +995,13 @@ void Client::ungrabButton( int modifier ) */ void Client::updateMouseGrab() { - if( workspace()->globalShortcutsDisabled()) - { - XUngrabButton( display(), AnyButton, AnyModifier, wrapperId()); - // keep grab for the simple click without modifiers if needed - if( !( !options->clickRaise || not_obscured )) - grabButton( None ); - return; - } if( isActive() && !workspace()->forcedGlobalMouseGrab()) // see Workspace::establishTabBoxGrab() { // remove the grab for no modifiers only if the window // is unobscured or if the user doesn't want click raise + // (it is unobscured if it the topmost in the unconstrained stacking order, i.e. it is + // the most recently raised window) + bool not_obscured = workspace()->topClientOnDesktop( workspace()->currentDesktop(), true, false ) == this; if( !options->clickRaise || not_obscured ) ungrabButton( None ); else @@ -1100,6 +1021,37 @@ void Client::updateMouseGrab() } } +int qtToX11Button( Qt::ButtonState button ) + { + if( button == Qt::LeftButton ) + return Button1; + else if( button == Qt::MidButton ) + return Button2; + else if( button == Qt::RightButton ) + return Button3; + return AnyButton; + } + +int qtToX11State( Qt::ButtonState buttons, Qt::KeyboardModifiers modifiers ) + { + int ret = 0; + if( buttons & Qt::LeftButton ) + ret |= Button1Mask; + if( buttons & Qt::MidButton ) + ret |= Button2Mask; + if( buttons & Qt::RightButton ) + ret |= Button3Mask; + if( modifiers & Qt::ShiftModifier ) + ret |= ShiftMask; + if( modifiers & Qt::ControlModifier ) + ret |= ControlMask; + if( modifiers & Qt::AltModifier ) + ret |= KKeyServer::modXAlt(); + if( modifiers & Qt::MetaModifier ) + ret |= KKeyServer::modXMeta(); + return ret; + } + // Qt propagates mouse events up the widget hierachy, which means events // for the decoration window cannot be (easily) intercepted as X11 events bool Client::eventFilter( QObject* o, QEvent* e ) @@ -1143,15 +1095,6 @@ bool Client::eventFilter( QObject* o, QEvent* e ) // on the decoration widget. if( ev->size() != size()) return true; - // HACK: Avoid decoration redraw delays. On resize Qt sets WA_WStateConfigPending - // which delays all painting until a matching ConfigureNotify event comes. - // But this process itself is the window manager, so it's not needed - // to wait for that event, the geometry is known. - // Note that if Qt in the future changes how this flag is handled and what it - // triggers then this may potentionally break things. See mainly QETWidget::translateConfigEvent(). - decoration->widget()->setAttribute( Qt::WA_WState_ConfigPending, false ); - decoration->widget()->update(); - return false; } return false; } @@ -1493,17 +1436,6 @@ void Client::focusOutEvent( XFocusOutEvent* e ) setActive( false ); } -void Client::visibilityNotifyEvent( XVisibilityEvent * e) - { - if( e->window != frameId()) - return; // care only about the whole frame - bool new_not_obscured = e->state == VisibilityUnobscured; - if( not_obscured == new_not_obscured ) - return; - not_obscured = new_not_obscured; - updateMouseGrab(); - } - // performs _NET_WM_MOVERESIZE void Client::NETMoveResize( int x_root, int y_root, NET::Direction direction ) { @@ -1565,7 +1497,7 @@ void Client::keyPressEvent( uint key_code ) bool is_alt = key_code & Qt::ALT; key_code = key_code & 0xffff; int delta = is_control?1:is_alt?32:8; - QPoint pos = cursorPos(); + QPoint pos = QCursor::pos(); switch ( key_code ) { case Qt::Key_Left: @@ -1598,98 +1530,6 @@ void Client::keyPressEvent( uint key_code ) QCursor::setPos( pos ); } -// **************************************** -// Unmanaged -// **************************************** - -bool Unmanaged::windowEvent( XEvent* e ) - { - double old_opacity = opacity(); - unsigned long dirty[ 2 ]; - info->event( e, dirty, 2 ); // pass through the NET stuff - if( dirty[ NETWinInfo::PROTOCOLS2 ] & NET::WM2Opacity ) - { - if( compositing()) - { - addRepaintFull(); - scene->windowOpacityChanged( this ); - if( effects ) - effects->windowOpacityChanged( effectWindow(), old_opacity ); - } - } - switch (e->type) - { - case UnmapNotify: - unmapNotifyEvent( &e->xunmap ); - break; - case MapNotify: - mapNotifyEvent( &e->xmap ); - break; - case ConfigureNotify: - configureNotifyEvent( &e->xconfigure ); - break; - case PropertyNotify: - propertyNotifyEvent( &e->xproperty ); - default: - { - if( e->type == Extensions::shapeNotifyEvent() ) - { - detectShape( window()); - if( compositing() ) - discardWindowPixmap(); - if( scene != NULL ) - scene->windowGeometryShapeChanged( this ); - } - if( e->type == Extensions::damageNotifyEvent()) - damageNotifyEvent( reinterpret_cast< XDamageNotifyEvent* >( e )); - break; - } - } - return false; // don't eat events, even our own unmanaged widgets are tracked - } - -void Unmanaged::mapNotifyEvent( XMapEvent* ) - { - } - -void Unmanaged::unmapNotifyEvent( XUnmapEvent* ) - { - release(); - } - -void Unmanaged::configureNotifyEvent( XConfigureEvent* e ) - { - if( effects ) - effects->checkInputWindowStacking(); // keep them on top - QRect newgeom( e->x, e->y, e->width, e->height ); - if( newgeom == geom ) - return; - workspace()->addRepaint( geometry()); // damage old area - geom = newgeom; - if( scene != NULL ) - scene->windowGeometryShapeChanged( this ); - discardWindowPixmap(); - } - -// **************************************** -// Toplevel -// **************************************** - -void Toplevel::propertyNotifyEvent( XPropertyEvent* e ) - { - if( e->window != window()) - return; // ignore frame/wrapper - switch ( e->atom ) - { - default: - if (e->atom == atoms->wm_client_leader ) - getWmClientLeader(); - else if( e->atom == atoms->wm_window_role ) - getWindowRole(); - break; - } - } - // **************************************** // Group // **************************************** diff --git a/org.kde.KWin.xml b/org.kde.KWin.xml index a42c9ebd25..dc4d4a6029 100644 --- a/org.kde.KWin.xml +++ b/org.kde.KWin.xml @@ -1,7 +1,7 @@ - + @@ -23,11 +23,6 @@ - - - - - @@ -38,11 +33,6 @@ - - - - - - + diff --git a/workspace.cpp b/workspace.cpp index 294dc91bb5..6f81a24e0e 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -43,10 +43,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 "deleted.h" -#include "effects.h" #include #include @@ -98,7 +94,6 @@ Workspace::Workspace( bool restore ) popupinfo (0), popup (0), advanced_popup (0), - trans_popup (0), desk_popup (0), desk_popup_index (0), keys (0), @@ -128,16 +123,12 @@ 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 ), - overlay( None ), - transSlider( NULL ), - transButton( NULL ) + forced_global_mouse_grab( false ) { (void) new KWinAdaptor( this ); - QDBusConnection::sessionBus().registerObject("/KWin", this); - + QDBusConnection dbus = QDBusConnection::sessionBus(); + dbus.registerObject("/KWin", this); + dbus.connect(QString(), "/KWin", "org.kde.KWin", "reloadConfig", this, SLOT(slotReloadConfig())); _self = this; mgr = new PluginMgr; root = rootWindow(); @@ -178,12 +169,10 @@ Workspace::Workspace( bool restore ) ColormapChangeMask | SubstructureRedirectMask | SubstructureNotifyMask | - FocusChangeMask | // for NotifyDetailNone - ExposureMask + FocusChangeMask // for NotifyDetailNone ); - Extensions::init(); - setupCompositing(); + Shape::init(); // compatibility long data = 1; @@ -289,6 +278,7 @@ void Workspace::init() NET::WM2ExtendedStrut | NET::WM2KDETemporaryRules | NET::WM2ShowingDesktop | + NET::WM2DesktopLayout | 0 , NET::ActionMove | @@ -332,7 +322,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())); @@ -370,10 +359,7 @@ void Workspace::init() XWindowAttributes attr; XGetWindowAttributes(display(), wins[i], &attr); if (attr.override_redirect ) - { - createUnmanaged( wins[ i ] ); continue; - } if( topmenu_space && topmenu_space->winId() == wins[ i ] ) continue; if (attr.map_state != IsUnmapped) @@ -435,7 +421,6 @@ void Workspace::init() Workspace::~Workspace() { - finishCompositing(); blockStackingUpdates( true ); // TODO grabXServer(); // use stacking_order, so that kwin --replace keeps stacking order @@ -445,12 +430,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 +479,6 @@ Client* Workspace::createClient( Window w, bool is_mapped ) return NULL; } addClient( c, Allowed ); - if( scene ) - scene->windowAdded( c ); - if( effects ) - effects->windowAdded( c->effectWindow()); - 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->effectWindow()); return c; } @@ -556,11 +519,7 @@ void Workspace::addClient( Client* c, allowed_t ) updateStackingOrder( true ); // propagate new client if( c->isUtility() || c->isMenu() || c->isToolbar()) updateToolWindows( true ); - } - -void Workspace::addUnmanaged( Unmanaged* c, allowed_t ) - { - unmanaged.append( c ); + checkNonExistentClients(); } /* @@ -617,28 +576,6 @@ void Workspace::removeClient( Client* c, allowed_t ) updateClientArea(); } -void Workspace::removeUnmanaged( Unmanaged* c, allowed_t ) - { - assert( unmanaged.contains( c )); - unmanaged.removeAll( c ); - } - -void Workspace::addDeleted( Deleted* c, allowed_t ) - { - assert( !deleted.contains( c )); - deleted.append( c ); - } - -void Workspace::removeDeleted( Deleted* c, allowed_t ) - { - assert( deleted.contains( c )); - if( scene ) - scene->windowDeleted( c ); - if( effects ) - effects->windowDeleted( c->effectWindow()); - deleted.removeAll( c ); - } - void Workspace::updateFocusChains( Client* c, FocusChainChange change ) { if( !c->wantsTabFocus()) // doesn't want tab focus, remove @@ -664,7 +601,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 @@ -684,7 +627,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 ); @@ -701,7 +650,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() @@ -919,6 +874,11 @@ void Workspace::updateColormap() } } +void Workspace::slotReloadConfig() +{ + reconfigure(); +} + void Workspace::reconfigure() { reconfigureTimer.start( 200 ); @@ -935,7 +895,7 @@ void Workspace::slotSettingsChanged(int category) /*! Reread settings */ -KWIN_PROCEDURE( CheckBorderSizesProcedure, Client, cl->checkBorderSizes() ); +KWIN_PROCEDURE( CheckBorderSizesProcedure, cl->checkBorderSizes() ); void Workspace::slotReconfigure() { @@ -992,11 +952,6 @@ void Workspace::slotReconfigure() updateTopMenuGeometry(); updateCurrentTopMenu(); } - - if( options->useTranslucency ) - setupCompositing(); - else - finishCompositing(); loadWindowRules(); for( ClientList::Iterator it = clients.begin(); @@ -1279,15 +1234,16 @@ bool Workspace::setCurrentDesktop( int new_desktop ) // and active_client is on_all_desktops and under mouse (hence == old_active_client), // conserve focus (thanks to Volker Schatz ) else if( active_client && active_client->isShown( true ) && active_client->isOnCurrentDesktop()) - c= active_client; + c = active_client; + + if( c == NULL && !desktops.isEmpty()) + c = findDesktop( true, currentDesktop()); if( c != active_client ) setActiveClient( NULL, Allowed ); if ( c ) requestFocus( c ); - else if( !desktops.isEmpty() ) - requestFocus( findDesktop( true, currentDesktop())); else focusToNull(); @@ -1309,10 +1265,6 @@ bool Workspace::setCurrentDesktop( int new_desktop ) if( old_desktop != 0 ) // not for the very first time popupinfo->showInfo( desktopName(currentDesktop()) ); - - if( effects != NULL && old_desktop != 0 ) - effects->desktopChanged( old_desktop ); - return true; } @@ -1545,25 +1497,26 @@ void Workspace::sendClientToDesktop( Client* c, int desk, bool dont_activate ) updateClientArea(); } -void Workspace::setDesktopLayout(int o, int x, int y) +void Workspace::setDesktopLayout(NET::Orientation o, int x, int y,NET::DesktopLayoutCorner c) { - layoutOrientation = (Qt::Orientation) o; + Q_UNUSED( c ); // I don't find this worth bothering, feel free to + layoutOrientation = ( o == NET::OrientationHorizontal ? Qt::Horizontal : Qt::Vertical ); layoutX = x; layoutY = y; } void Workspace::calcDesktopLayout(int &x, int &y) const { - x = layoutX; + x = layoutX; // <= 0 means compute it from the other and total number of desktops y = layoutY; - if ((x == -1) && (y > 0)) + if((x <= 0) && (y > 0)) x = (numberOfDesktops()+y-1) / y; - else if ((y == -1) && (x > 0)) + else if((y <=0) && (x > 0)) y = (numberOfDesktops()+x-1) / x; - if (x == -1) + if(x <=0) x = 1; - if (y == -1) + if (y <= 0) y = 1; } @@ -1695,7 +1648,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; @@ -1896,7 +1849,7 @@ bool Workspace::keyPressMouseEmulation( XKeyEvent& ev ) bool is_alt = km & Mod1Mask; bool is_shift = km & ShiftMask; int delta = is_control?1:is_alt?32:8; - QPoint pos = cursorPos(); + QPoint pos = QCursor::pos(); switch ( kc ) { @@ -2048,8 +2001,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); diff --git a/workspace.h b/workspace.h index 2dac69770d..d52e3f2116 100644 --- a/workspace.h +++ b/workspace.h @@ -18,8 +18,6 @@ License. See the file "COPYING" for the exact licensing terms. #include #include #include -#include -#include #include "utils.h" #include "kdecoration.h" @@ -79,7 +77,7 @@ class Workspace : public QObject, public KDecorationDefines virtual ~Workspace(); static Workspace * self() { return _self; } - + bool workspaceEvent( XEvent * ); KDecoration* createDecoration( KDecorationBridge* bridge ); @@ -89,9 +87,6 @@ class Workspace : public QObject, public KDecorationDefines template< typename T > Client* findClient( T predicate ); template< typename T1, typename T2 > void forEachClient( T1 procedure, T2 predicate ); template< typename T > void forEachClient( T procedure ); - template< typename T > Unmanaged* findUnmanaged( T predicate ); - template< typename T1, typename T2 > void forEachUnmanaged( T1 procedure, T2 predicate ); - template< typename T > void forEachUnmanaged( T procedure ); QRect clientArea( clientAreaOption, const QPoint& p, int desktop ) const; QRect clientArea( clientAreaOption, const Client* c ) const; @@ -186,7 +181,7 @@ class Workspace : public QObject, public KDecorationDefines ClientList ensureStackingOrder( const ClientList& clients ) const; - Client* topClientOnDesktop( int desktop, bool unconstrained = false ) const; + Client* topClientOnDesktop( int desktop, bool unconstrained = false, bool only_normal = true ) const; Client* findDesktop( bool topmost, int desktop ) const; void sendClientToDesktop( Client* c, int desktop, bool dont_activate ); void windowToPreviousDesktop( Client* c ); @@ -195,10 +190,6 @@ class Workspace : public QObject, public KDecorationDefines // KDE4 remove me - and it's also in the DCOP interface :( void showWindowMenuAt( unsigned long id, int x, int y ); - void loadEffect( const QString& name ); - - void unloadEffect( const QString& name ); - /** * Shows the menu operations menu for the client and makes it active if * it's not already. @@ -233,7 +224,7 @@ class Workspace : public QObject, public KDecorationDefines void circulateDesktopApplications(); QString desktopName( int desk ) const; - void setDesktopLayout(int o, int x, int y); + void setDesktopLayout(NET::Orientation o, int x, int y, NET::DesktopLayoutCorner c); void setShowingDesktop( bool showing ); void resetShowingDesktop( bool keep_hidden ); bool showingDesktop() const; @@ -243,17 +234,14 @@ class Workspace : public QObject, public KDecorationDefines void sendPingToWindow( Window w, Time timestamp ); // called from Client::pingWindow() void sendTakeActivity( Client* c, Time timestamp, long flags ); // called from Client::takeActivity() - void removeClient( Client*, allowed_t ); // only called from Client::destroyClient() or Client::releaseWindow() + // only called from Client::destroyClient() or Client::releaseWindow() + void removeClient( Client*, allowed_t ); void setActiveClient( Client*, allowed_t ); Group* findGroup( Window leader ) const; void addGroup( Group* group, allowed_t ); void removeGroup( Group* group, allowed_t ); Group* findClientLeaderGroup( const Client* c ) const; - void removeUnmanaged( Unmanaged*, allowed_t ); // only called from Unmanaged::release() - void removeDeleted( Deleted*, allowed_t ); - void addDeleted( Deleted*, allowed_t ); - bool checkStartupNotification( Window w, KStartupInfoId& id, KStartupInfoData& data ); void focusToNull(); // SELI public? @@ -288,17 +276,6 @@ class Workspace : public QObject, public KDecorationDefines void requestDelayFocus( Client* ); void toggleTopDockShadows(bool on); - - void addRepaint( const QRect& r ); - void addRepaint( int x, int y, int w, int h ); - void addRepaintFull(); - // creates XComposite overlay window, call initOverlay() afterwards - bool createOverlay(); - // init overlay and the destination window in it - void setupOverlay( Window window ); - // destroys XComposite overlay window - void destroyOverlay(); - Window overlayWindow(); public slots: void refresh(); @@ -429,14 +406,15 @@ class Workspace : public QObject, public KDecorationDefines void cleanupTemporaryRules(); void writeWindowRules(); void slotBlockShortcuts(int data); - void setPopupClientOpacity( QAction* action ); - void setupCompositing(); - void performCompositing(); - void lostCMSelection(); + void slotReloadConfig(); + // kompmgr + void setPopupClientOpacity(int v); + void resetClientOpacity(); + void setTransButtonText(int value); + // end protected: bool keyPressMouseEmulation( XKeyEvent& ev ); - bool netCheck( XEvent* e ); private: void init(); @@ -480,8 +458,6 @@ class Workspace : public QObject, public KDecorationDefines // this is the right way to create a new client Client* createClient( Window w, bool is_mapped ); void addClient( Client* c, allowed_t ); - Unmanaged* createUnmanaged( Window w ); - void addUnmanaged( Unmanaged* c, allowed_t ); Window findSpecialEventWindow( XEvent* e ); @@ -523,9 +499,6 @@ class Workspace : public QObject, public KDecorationDefines void closeActivePopup(); void updateClientArea( bool force ); - - void finishCompositing(); - bool windowRepaintsPending() const; SystemTrayWindowList systemTrayWins; @@ -562,12 +535,10 @@ class Workspace : public QObject, public KDecorationDefines ClientList clients; ClientList desktops; - UnmanagedList unmanaged; - DeletedList deleted; - ClientList unconstrained_stacking_order; - ClientList stacking_order; - QVector< ClientList > focus_chain; + ClientList unconstrained_stacking_order; // topmost last + ClientList stacking_order; // topmost last + QVector< ClientList > focus_chain; // currently ative last ClientList global_focus_chain; // this one is only for things like tabbox's MRU ClientList should_get_focus; // last is most recent ClientList attention_chain; @@ -601,7 +572,6 @@ class Workspace : public QObject, public KDecorationDefines QMenu *popup; QMenu *advanced_popup; - QMenu *trans_popup; QMenu *desk_popup; int desk_popup_index; @@ -685,14 +655,12 @@ class Workspace : public QObject, public KDecorationDefines bool forced_global_mouse_grab; friend class StackingUpdatesBlocker; - KSelectionOwner* cm_selection; - QTimer compositeTimer; - QTime lastCompositePaint; - int compositeRate; - QRegion repaints_region; - Window overlay; // XComposite overlay window + //kompmgr QSlider *transSlider; QPushButton *transButton; + + private: + friend bool performTransiencyCheck(); }; // helper for Workspace::blockStackingUpdates() being called in pairs (true/false) @@ -835,11 +803,6 @@ inline bool Workspace::globalShortcutsDisabled() const return global_shortcuts_disabled || global_shortcuts_disabled_for_client; } -inline Window Workspace::overlayWindow() - { - return overlay; - } - template< typename T > inline Client* Workspace::findClient( T predicate ) { @@ -867,27 +830,7 @@ inline void Workspace::forEachClient( T procedure ) return forEachClient( procedure, TruePredicate()); } -template< typename T > -inline Unmanaged* Workspace::findUnmanaged( T predicate ) - { - return findUnmanagedInList( unmanaged, predicate ); - } - -template< typename T1, typename T2 > -inline void Workspace::forEachUnmanaged( T1 procedure, T2 predicate ) - { - for ( UnmanagedList::ConstIterator it = unmanaged.begin(); it != unmanaged.end(); ++it) - if ( predicate( const_cast< const Unmanaged* >( *it))) - procedure( *it ); - } - -template< typename T > -inline void Workspace::forEachUnmanaged( T procedure ) - { - return forEachUnmanaged( procedure, TruePredicate()); - } - -KWIN_COMPARE_PREDICATE( ClientMatchPredicate, Client, const Client*, cl == value ); +KWIN_COMPARE_PREDICATE( ClientMatchPredicate, const Client*, cl == value ); inline bool Workspace::hasClient( const Client* c ) { return findClient( ClientMatchPredicate( c ));