move the "To Desktop" menu to the right place again

instead of just appending it

svn path=/trunk/KDE/kdebase/workspace/; revision=657251
This commit is contained in:
Dirk Mueller 2007-04-23 16:49:41 +00:00
parent fc27b480d8
commit e218e7e01d
3 changed files with 400 additions and 565 deletions

View file

@ -19,12 +19,11 @@ License. See the file "COPYING" for the exact licensing terms.
#include "client.h" #include "client.h"
#include "workspace.h" #include "workspace.h"
#include "effects.h"
#include <fixx11h.h> #include <fixx11h.h>
#include <QPushButton> #include <QPushButton>
#include <QSlider> #include <QSlider>
#include <QToolTip>
#include <kglobalsettings.h> #include <kglobalsettings.h>
#include <kiconloader.h> #include <kiconloader.h>
#include <klocale.h> #include <klocale.h>
@ -61,7 +60,7 @@ QMenu* Workspace::clientPopup()
advanced_popup->setFont(KGlobalSettings::menuFont()); advanced_popup->setFont(KGlobalSettings::menuFont());
mKeepAboveOpAction = advanced_popup->addAction( i18n("Keep &Above Others") ); mKeepAboveOpAction = advanced_popup->addAction( i18n("Keep &Above Others") );
mKeepAboveOpAction->setIcon( KIcon( "up" ) ); mKeepAboveOpAction->setIcon( KIcon( "go-up" ) );
KAction *kaction = qobject_cast<KAction*>( keys->action("Window Above Other Windows") ); KAction *kaction = qobject_cast<KAction*>( keys->action("Window Above Other Windows") );
if ( kaction!=0 ) if ( kaction!=0 )
mKeepAboveOpAction->setShortcut( kaction->globalShortcut().primary() ); mKeepAboveOpAction->setShortcut( kaction->globalShortcut().primary() );
@ -69,7 +68,7 @@ QMenu* Workspace::clientPopup()
mKeepAboveOpAction->setData( Options::KeepAboveOp ); mKeepAboveOpAction->setData( Options::KeepAboveOp );
mKeepBelowOpAction = advanced_popup->addAction( i18n("Keep &Below Others") ); mKeepBelowOpAction = advanced_popup->addAction( i18n("Keep &Below Others") );
mKeepBelowOpAction->setIcon( KIcon( "down" ) ); mKeepBelowOpAction->setIcon( KIcon( "go-down" ) );
kaction = qobject_cast<KAction*>( keys->action("Window Below Other Windows") ); kaction = qobject_cast<KAction*>( keys->action("Window Below Other Windows") );
if ( kaction!=0 ) if ( kaction!=0 )
mKeepBelowOpAction->setShortcut( kaction->globalShortcut().primary() ); mKeepBelowOpAction->setShortcut( kaction->globalShortcut().primary() );
@ -77,7 +76,7 @@ QMenu* Workspace::clientPopup()
mKeepBelowOpAction->setData( Options::KeepBelowOp ); mKeepBelowOpAction->setData( Options::KeepBelowOp );
mFullScreenOpAction = advanced_popup->addAction( i18n("&Fullscreen") ); mFullScreenOpAction = advanced_popup->addAction( i18n("&Fullscreen") );
mFullScreenOpAction->setIcon( KIcon( "window_fullscreen" ) ); mFullScreenOpAction->setIcon( KIcon( "view-fullscreen" ) );
kaction = qobject_cast<KAction*>( keys->action("Window Fullscreen") ); kaction = qobject_cast<KAction*>( keys->action("Window Fullscreen") );
if ( kaction!=0 ) if ( kaction!=0 )
mFullScreenOpAction->setShortcut( kaction->globalShortcut().primary() ); mFullScreenOpAction->setShortcut( kaction->globalShortcut().primary() );
@ -109,21 +108,23 @@ QMenu* Workspace::clientPopup()
action = popup->addMenu( advanced_popup ); action = popup->addMenu( advanced_popup );
action->setText( i18n("Ad&vanced") ); action->setText( i18n("Ad&vanced") );
desk_popup_index = popup->actions().count();
if (options->useTranslucency){ if (options->useTranslucency){
trans_popup = new QMenu( popup ); QMenu *trans_popup = new QMenu( popup );
trans_popup->setFont(KGlobalSettings::menuFont()); QVBoxLayout *transLayout = new QVBoxLayout(trans_popup);
connect( trans_popup, SIGNAL( triggered(QAction*) ), this, SLOT( setPopupClientOpacity(QAction*))); trans_popup->setLayout( transLayout );
const int levels[] = { 100, 90, 75, 50, 25, 10 }; transButton = new QPushButton(trans_popup);
for( unsigned int i = 0; transButton->setObjectName("transButton");
i < sizeof( levels ) / sizeof( levels[ 0 ] ); transButton->setToolTip( i18n("Reset opacity to default value"));
++i ) transSlider = new QSlider(trans_popup);
{ transSlider->setObjectName( "transSlider" );
action = trans_popup->addAction( QString::number( levels[ i ] ) + "%" ); transSlider->setRange( 0, 100 );
action->setCheckable( true ); transSlider->setValue( 100 );
action->setData( levels[ i ] ); transSlider->setOrientation( Qt::Vertical );
} transSlider->setToolTip( i18n("Slide this to set the window's opacity"));
connect(transButton, SIGNAL(clicked()), SLOT(resetClientOpacity()));
connect(transButton, SIGNAL(clicked()), trans_popup, SLOT(hide()));
connect(transSlider, SIGNAL(valueChanged(int)), SLOT(setTransButtonText(int)));
connect(transSlider, SIGNAL(valueChanged(int)), this, SLOT(setPopupClientOpacity(int)));
action = popup->addMenu( trans_popup ); action = popup->addMenu( trans_popup );
action->setText( i18n("&Opacity") ); action->setText( i18n("&Opacity") );
} }
@ -173,7 +174,7 @@ QMenu* Workspace::clientPopup()
} }
mCloseOpAction = popup->addAction( i18n("&Close") ); mCloseOpAction = popup->addAction( i18n("&Close") );
mCloseOpAction->setIcon( KIcon( "fileclose" ) ); mCloseOpAction->setIcon( KIcon( "window-close" ) );
kaction = qobject_cast<KAction*>( keys->action("Window Close") ); kaction = qobject_cast<KAction*>( keys->action("Window Close") );
if ( kaction!=0 ) if ( kaction!=0 )
mCloseOpAction->setShortcut( kaction->globalShortcut().primary() ); mCloseOpAction->setShortcut( kaction->globalShortcut().primary() );
@ -182,14 +183,31 @@ QMenu* Workspace::clientPopup()
return popup; return popup;
} }
void Workspace::setPopupClientOpacity( QAction* action ) //sets the transparency of the client to given value(given by slider)
void Workspace::setPopupClientOpacity(int value)
{ {
if( active_popup_client == NULL ) // TODO
return;
int level = action->data().toInt();
active_popup_client->setOpacity( level / 100.0 );
} }
void Workspace::setTransButtonText(int value)
{
value = 100 - value;
if(value < 0)
transButton->setText("000 %");
else if (value >= 100 )
transButton->setText("100 %");
else if(value < 10)
transButton->setText("00"+QString::number(value)+" %");
else if(value < 100)
transButton->setText('0'+QString::number(value)+" %");
}
void Workspace::resetClientOpacity()
{
// TODO
}
/*! /*!
The client popup menu will become visible soon. The client popup menu will become visible soon.
@ -224,16 +242,6 @@ void Workspace::clientPopupAboutToShow()
mNoBorderOpAction->setChecked( active_popup_client->noBorder() ); mNoBorderOpAction->setChecked( active_popup_client->noBorder() );
mMinimizeOpAction->setEnabled( active_popup_client->isMinimizable() ); mMinimizeOpAction->setEnabled( active_popup_client->isMinimizable() );
mCloseOpAction->setEnabled( active_popup_client->isCloseable() ); mCloseOpAction->setEnabled( active_popup_client->isCloseable() );
if (options->useTranslucency)
{
foreach( QAction* action, trans_popup->actions())
{
if( action->data().toInt() == qRound( active_popup_client->opacity() * 100 ))
action->setChecked( true );
else
action->setChecked( false );
}
}
} }
@ -249,9 +257,9 @@ void Workspace::initDesktopPopup()
connect( desk_popup, SIGNAL( aboutToShow() ), connect( desk_popup, SIGNAL( aboutToShow() ),
this, SLOT( desktopPopupAboutToShow() ) ); this, SLOT( desktopPopupAboutToShow() ) );
QAction *action = popup->addMenu( desk_popup ); QAction *action = desk_popup->menuAction();
popup->insertAction(mMoveOpAction, action);
action->setText( i18n("To &Desktop") ); action->setText( i18n("To &Desktop") );
action->setData( desk_popup_index );
} }
/*! /*!
@ -438,7 +446,7 @@ void Workspace::clientPopupActivated( QAction *action )
} }
void Workspace::performWindowOperation( Client* c, Options::WindowOperation op ) void Workspace::performWindowOperation( Client* c, Options::WindowOperation op )
{ {
if ( !c ) if ( !c )
return; return;
@ -447,19 +455,19 @@ void Workspace::performWindowOperation( Client* c, Options::WindowOperation op )
QCursor::setPos( c->geometry().center() ); QCursor::setPos( c->geometry().center() );
if (op == Options::ResizeOp || op == Options::UnrestrictedResizeOp ) if (op == Options::ResizeOp || op == Options::UnrestrictedResizeOp )
QCursor::setPos( c->geometry().bottomRight()); QCursor::setPos( c->geometry().bottomRight());
switch ( op ) switch ( op )
{ {
case Options::MoveOp: case Options::MoveOp:
c->performMouseCommand( Options::MouseMove, cursorPos() ); c->performMouseCommand( Options::MouseMove, QCursor::pos() );
break; break;
case Options::UnrestrictedMoveOp: case Options::UnrestrictedMoveOp:
c->performMouseCommand( Options::MouseUnrestrictedMove, cursorPos() ); c->performMouseCommand( Options::MouseUnrestrictedMove, QCursor::pos() );
break; break;
case Options::ResizeOp: case Options::ResizeOp:
c->performMouseCommand( Options::MouseResize, cursorPos() ); c->performMouseCommand( Options::MouseResize, QCursor::pos() );
break; break;
case Options::UnrestrictedResizeOp: case Options::UnrestrictedResizeOp:
c->performMouseCommand( Options::MouseUnrestrictedResize, cursorPos() ); c->performMouseCommand( Options::MouseUnrestrictedResize, QCursor::pos() );
break; break;
case Options::CloseOp: case Options::CloseOp:
c->closeWindow(); c->closeWindow();
@ -481,7 +489,7 @@ void Workspace::performWindowOperation( Client* c, Options::WindowOperation op )
c->minimize(); c->minimize();
break; break;
case Options::ShadeOp: case Options::ShadeOp:
c->performMouseCommand( Options::MouseShade, cursorPos()); c->performMouseCommand( Options::MouseShade, QCursor::pos());
break; break;
case Options::OnAllDesktopsOp: case Options::OnAllDesktopsOp:
c->setOnAllDesktops( !c->isOnAllDesktops() ); c->setOnAllDesktops( !c->isOnAllDesktops() );
@ -511,7 +519,7 @@ void Workspace::performWindowOperation( Client* c, Options::WindowOperation op )
break; break;
} }
case Options::OperationsOp: case Options::OperationsOp:
c->performMouseCommand( Options::MouseShade, cursorPos()); c->performMouseCommand( Options::MouseShade, QCursor::pos());
break; break;
case Options::WindowRulesOp: case Options::WindowRulesOp:
editWindowRules( c, false ); editWindowRules( c, false );
@ -536,7 +544,7 @@ void Workspace::performWindowOperation( Client* c, Options::WindowOperation op )
bool Client::performMouseCommand( Options::MouseCommand command, QPoint globalPos, bool handled ) bool Client::performMouseCommand( Options::MouseCommand command, QPoint globalPos, bool handled )
{ {
bool replay = false; bool replay = false;
switch (command) switch (command)
{ {
case Options::MouseRaise: case Options::MouseRaise:
workspace()->raiseClient( this ); workspace()->raiseClient( this );
@ -676,10 +684,10 @@ bool Client::performMouseCommand( Options::MouseCommand command, QPoint globalPo
workspace()->windowToNextDesktop( this ); workspace()->windowToNextDesktop( this );
break; break;
case Options::MouseOpacityMore: case Options::MouseOpacityMore:
setOpacity( qMin( opacity() + 0.1, 1.0 )); // TODO
break; break;
case Options::MouseOpacityLess: case Options::MouseOpacityLess:
setOpacity( qMax( opacity() - 0.1, 0.0 )); // TODO
break; break;
case Options::MouseNothing: case Options::MouseNothing:
replay = true; replay = true;
@ -694,24 +702,6 @@ void Workspace::showWindowMenuAt( unsigned long, int, int )
slotWindowOperations(); slotWindowOperations();
} }
void Workspace::loadEffect( const QString& name )
{
if( effects )
static_cast<EffectsHandlerImpl*>(effects)->loadEffect( name );
}
void Workspace::toggleEffect( const QString& name )
{
if( effects )
static_cast<EffectsHandlerImpl*>(effects)->toggleEffect( name );
}
void Workspace::unloadEffect( const QString& name )
{
if( effects )
static_cast<EffectsHandlerImpl*>(effects)->unloadEffect( name );
}
void Workspace::slotActivateAttentionWindow() void Workspace::slotActivateAttentionWindow()
{ {
if( attention_chain.count() > 0 ) if( attention_chain.count() > 0 )
@ -721,13 +711,13 @@ void Workspace::slotActivateAttentionWindow()
void Workspace::slotSwitchDesktopNext() void Workspace::slotSwitchDesktopNext()
{ {
int d = currentDesktop() + 1; int d = currentDesktop() + 1;
if ( d > numberOfDesktops() ) if ( d > numberOfDesktops() )
{ {
if ( options->rollOverDesktops ) if ( options->rollOverDesktops )
{ {
d = 1; d = 1;
} }
else else
{ {
return; return;
} }
@ -738,7 +728,7 @@ void Workspace::slotSwitchDesktopNext()
void Workspace::slotSwitchDesktopPrevious() void Workspace::slotSwitchDesktopPrevious()
{ {
int d = currentDesktop() - 1; int d = currentDesktop() - 1;
if ( d <= 0 ) if ( d <= 0 )
{ {
if ( options->rollOverDesktops ) if ( options->rollOverDesktops )
d = numberOfDesktops(); d = numberOfDesktops();
@ -923,7 +913,7 @@ void Workspace::slotWindowToNextDesktop()
{ {
windowToNextDesktop( active_popup_client ? active_popup_client : active_client ); windowToNextDesktop( active_popup_client ? active_popup_client : active_client );
} }
void Workspace::windowToNextDesktop( Client* c ) void Workspace::windowToNextDesktop( Client* c )
{ {
int d = currentDesktop() + 1; int d = currentDesktop() + 1;
@ -945,7 +935,7 @@ void Workspace::slotWindowToPreviousDesktop()
{ {
windowToPreviousDesktop( active_popup_client ? active_popup_client : active_client ); windowToPreviousDesktop( active_popup_client ? active_popup_client : active_client );
} }
void Workspace::windowToPreviousDesktop( Client* c ) void Workspace::windowToPreviousDesktop( Client* c )
{ {
int d = currentDesktop() - 1; int d = currentDesktop() - 1;
@ -1040,7 +1030,7 @@ void Workspace::slotSendToDesktop( QAction *action )
int desk = action->data().toInt(); int desk = action->data().toInt();
if ( !active_popup_client ) if ( !active_popup_client )
return; return;
if ( desk == 0 ) if ( desk == 0 )
{ // the 'on_all_desktops' menu entry { // the 'on_all_desktops' menu entry
active_popup_client->setOnAllDesktops( !active_popup_client->isOnAllDesktops()); active_popup_client->setOnAllDesktops( !active_popup_client->isOnAllDesktops());
return; return;
@ -1199,7 +1189,7 @@ bool Workspace::shortcutAvailable( const KShortcut& cut, Client* ignore ) const
++it ) ++it )
{ {
if( (*it) != ignore && (*it)->shortcut() == cut ) if( (*it) != ignore && (*it)->shortcut() == cut )
return false; return false;
} }
return true; return true;
} }

File diff suppressed because it is too large Load diff

View file

@ -18,8 +18,6 @@ License. See the file "COPYING" for the exact licensing terms.
#include <QCursor> #include <QCursor>
#include <netwm.h> #include <netwm.h>
#include <kxmessages.h> #include <kxmessages.h>
#include <qdatetime.h>
#include <kmanagerselection.h>
#include "utils.h" #include "utils.h"
#include "kdecoration.h" #include "kdecoration.h"
@ -36,6 +34,7 @@ class KStartupInfoId;
class KStartupInfoData; class KStartupInfoData;
class QSlider; class QSlider;
class QPushButton; class QPushButton;
class K3Process;
namespace KWin namespace KWin
{ {
@ -78,9 +77,8 @@ class Workspace : public QObject, public KDecorationDefines
virtual ~Workspace(); virtual ~Workspace();
static Workspace * self() { return _self; } static Workspace * self() { return _self; }
bool workspaceEvent( XEvent * ); bool workspaceEvent( XEvent * );
bool workspaceEvent( QEvent * );
KDecoration* createDecoration( KDecorationBridge* bridge ); KDecoration* createDecoration( KDecorationBridge* bridge );
@ -89,9 +87,6 @@ class Workspace : public QObject, public KDecorationDefines
template< typename T > Client* findClient( T predicate ); template< typename T > Client* findClient( T predicate );
template< typename T1, typename T2 > void forEachClient( T1 procedure, T2 predicate ); template< typename T1, typename T2 > void forEachClient( T1 procedure, T2 predicate );
template< typename T > void forEachClient( T procedure ); 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 QPoint& p, int desktop ) const;
QRect clientArea( clientAreaOption, const Client* c ) const; QRect clientArea( clientAreaOption, const Client* c ) const;
@ -155,10 +150,7 @@ class Workspace : public QObject, public KDecorationDefines
void clientHidden( Client* ); void clientHidden( Client* );
void clientAttentionChanged( Client* c, bool set ); void clientAttentionChanged( Client* c, bool set );
void checkElectricBorder(const QPoint &pos, Time time); void clientMoved(const QPoint &pos, Time time);
void reserveElectricBorder( ElectricBorder border );
void unreserveElectricBorder( ElectricBorder border );
void reserveElectricBorderSwitching( bool reserve );
/** /**
* Returns the current virtual desktop of this workspace * Returns the current virtual desktop of this workspace
@ -169,27 +161,16 @@ class Workspace : public QObject, public KDecorationDefines
*/ */
int numberOfDesktops() const; int numberOfDesktops() const;
void setNumberOfDesktops( int n ); void setNumberOfDesktops( int n );
void calcDesktopLayout(int* x, int* y, Qt::Orientation* orientation) const;
QWidget* desktopWidget(); QWidget* desktopWidget();
// for TabBox // for TabBox
Client* currentTabBoxClient() const; Client* nextFocusChainClient(Client*) const;
ClientList currentTabBoxClientList() const; Client* previousFocusChainClient(Client*) const;
int currentTabBoxDesktop() const; Client* nextStaticClient(Client*) const;
QList< int > currentTabBoxDesktopList() const; Client* previousStaticClient(Client*) const;
void setTabBoxClient(Client*);
void setTabBoxDesktop(int);
Client* nextClientFocusChain(Client*) const;
Client* previousClientFocusChain(Client*) const;
Client* nextClientStatic(Client*) const;
Client* previousClientStatic(Client*) const;
int nextDesktopFocusChain( int iDesktop ) const; int nextDesktopFocusChain( int iDesktop ) const;
int previousDesktopFocusChain( int iDesktop ) const; int previousDesktopFocusChain( int iDesktop ) const;
int nextDesktopStatic( int iDesktop ) const;
int previousDesktopStatic( int iDesktop ) const;
void refTabBox();
void unrefTabBox();
void closeTabBox(); void closeTabBox();
/** /**
@ -200,7 +181,7 @@ class Workspace : public QObject, public KDecorationDefines
ClientList ensureStackingOrder( const ClientList& clients ) const; 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; Client* findDesktop( bool topmost, int desktop ) const;
void sendClientToDesktop( Client* c, int desktop, bool dont_activate ); void sendClientToDesktop( Client* c, int desktop, bool dont_activate );
void windowToPreviousDesktop( Client* c ); void windowToPreviousDesktop( Client* c );
@ -209,11 +190,6 @@ class Workspace : public QObject, public KDecorationDefines
// KDE4 remove me - and it's also in the DCOP interface :( // KDE4 remove me - and it's also in the DCOP interface :(
void showWindowMenuAt( unsigned long id, int x, int y ); void showWindowMenuAt( unsigned long id, int x, int y );
void loadEffect( const QString& name );
void toggleEffect( const QString& name );
void unloadEffect( const QString& name );
/** /**
* Shows the menu operations menu for the client and makes it active if * Shows the menu operations menu for the client and makes it active if
* it's not already. * it's not already.
@ -237,6 +213,8 @@ class Workspace : public QObject, public KDecorationDefines
WindowRules findWindowRules( const Client*, bool ); WindowRules findWindowRules( const Client*, bool );
void rulesUpdated(); void rulesUpdated();
void discardUsedWindowRules( Client* c, bool withdraw ); void discardUsedWindowRules( Client* c, bool withdraw );
void disableRulesUpdates( bool disable );
bool rulesUpdatesDisabled() const;
// dcop interface // dcop interface
void cascadeDesktop(); void cascadeDesktop();
@ -248,7 +226,7 @@ class Workspace : public QObject, public KDecorationDefines
void circulateDesktopApplications(); void circulateDesktopApplications();
QString desktopName( int desk ) const; 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 setShowingDesktop( bool showing );
void resetShowingDesktop( bool keep_hidden ); void resetShowingDesktop( bool keep_hidden );
bool showingDesktop() const; bool showingDesktop() const;
@ -258,17 +236,14 @@ class Workspace : public QObject, public KDecorationDefines
void sendPingToWindow( Window w, Time timestamp ); // called from Client::pingWindow() void sendPingToWindow( Window w, Time timestamp ); // called from Client::pingWindow()
void sendTakeActivity( Client* c, Time timestamp, long flags ); // called from Client::takeActivity() 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 ); void setActiveClient( Client*, allowed_t );
Group* findGroup( Window leader ) const; Group* findGroup( Window leader ) const;
void addGroup( Group* group, allowed_t ); void addGroup( Group* group, allowed_t );
void removeGroup( Group* group, allowed_t ); void removeGroup( Group* group, allowed_t );
Group* findClientLeaderGroup( const Client* c ) const; 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 ); bool checkStartupNotification( Window w, KStartupInfoId& id, KStartupInfoData& data );
void focusToNull(); // SELI public? void focusToNull(); // SELI public?
@ -281,7 +256,6 @@ class Workspace : public QObject, public KDecorationDefines
bool globalShortcutsDisabled() const; bool globalShortcutsDisabled() const;
void disableGlobalShortcuts( bool disable ); void disableGlobalShortcuts( bool disable );
void disableGlobalShortcutsForClient( bool disable ); void disableGlobalShortcutsForClient( bool disable );
QPoint cursorPos();
void sessionSaveStarted(); void sessionSaveStarted();
void sessionSaveDone(); void sessionSaveDone();
@ -305,19 +279,6 @@ class Workspace : public QObject, public KDecorationDefines
void toggleTopDockShadows(bool on); void toggleTopDockShadows(bool on);
// when adding repaints caused by a window, you probably want to use
// either Toplevel::addRepaint() or Toplevel::addWorkspaceRepaint()
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: public slots:
void refresh(); void refresh();
// keybindings // keybindings
@ -447,16 +408,15 @@ class Workspace : public QObject, public KDecorationDefines
void cleanupTemporaryRules(); void cleanupTemporaryRules();
void writeWindowRules(); void writeWindowRules();
void slotBlockShortcuts(int data); void slotBlockShortcuts(int data);
void setPopupClientOpacity( QAction* action ); void slotReloadConfig();
void setupCompositing(); // kompmgr
void performCompositing(); void setPopupClientOpacity(int v);
void lostCMSelection(); void resetClientOpacity();
void updateElectricBorders(); void setTransButtonText(int value);
void resetCursorPosTime(); // end
protected: protected:
bool keyPressMouseEmulation( XKeyEvent& ev ); bool keyPressMouseEmulation( XKeyEvent& ev );
bool netCheck( XEvent* e );
private: private:
void init(); void init();
@ -464,17 +424,16 @@ class Workspace : public QObject, public KDecorationDefines
void readShortcuts(); void readShortcuts();
void initDesktopPopup(); void initDesktopPopup();
void setupWindowShortcut( Client* c ); void setupWindowShortcut( Client* c );
void checkCursorPos();
bool startKDEWalkThroughWindows(); bool startKDEWalkThroughWindows();
bool startWalkThroughDesktops( TabBoxMode mode ); // TabBoxDesktopMode | TabBoxDesktopListMode bool startWalkThroughDesktops( int mode ); // TabBox::Mode::DesktopMode | DesktopListMode
bool startWalkThroughDesktops(); bool startWalkThroughDesktops();
bool startWalkThroughDesktopList(); bool startWalkThroughDesktopList();
void KDEWalkThroughWindows( bool forward ); void KDEWalkThroughWindows( bool forward );
void CDEWalkThroughWindows( bool forward ); void CDEWalkThroughWindows( bool forward );
void walkThroughDesktops( bool forward ); void walkThroughDesktops( bool forward );
void KDEOneStepThroughWindows( bool forward ); void KDEOneStepThroughWindows( bool forward );
void oneStepThroughDesktops( bool forward, TabBoxMode mode ); // TabBoxDesktopMode | TabBoxDesktopListMode void oneStepThroughDesktops( bool forward, int mode ); // TabBox::Mode::DesktopMode | DesktopListMode
void oneStepThroughDesktops( bool forward ); void oneStepThroughDesktops( bool forward );
void oneStepThroughDesktopList( bool forward ); void oneStepThroughDesktopList( bool forward );
bool establishTabBoxGrab(); bool establishTabBoxGrab();
@ -501,8 +460,6 @@ class Workspace : public QObject, public KDecorationDefines
// this is the right way to create a new client // this is the right way to create a new client
Client* createClient( Window w, bool is_mapped ); Client* createClient( Window w, bool is_mapped );
void addClient( Client* c, allowed_t ); void addClient( Client* c, allowed_t );
Unmanaged* createUnmanaged( Window w );
void addUnmanaged( Unmanaged* c, allowed_t );
Window findSpecialEventWindow( XEvent* e ); Window findSpecialEventWindow( XEvent* e );
@ -528,21 +485,22 @@ class Workspace : public QObject, public KDecorationDefines
void tabBoxKeyRelease( const XKeyEvent& ev ); void tabBoxKeyRelease( const XKeyEvent& ev );
// electric borders // electric borders
void destroyElectricBorders(); void checkElectricBorders( bool force = false );
bool electricBorderEvent(XEvent * e); void createBorderWindows();
void electricBorderSwitchDesktop( ElectricBorder border, const QPoint& pos ); void destroyBorderWindows();
bool electricBorder(XEvent * e);
void raiseElectricBorders();
// ------------------ // ------------------
void helperDialog( const QString& message, const Client* c ); void helperDialog( const QString& message, const Client* c );
void calcDesktopLayout(int &x, int &y) const;
QMenu* clientPopup(); QMenu* clientPopup();
void closeActivePopup(); void closeActivePopup();
void updateClientArea( bool force ); void updateClientArea( bool force );
void finishCompositing();
bool windowRepaintsPending() const;
SystemTrayWindowList systemTrayWins; SystemTrayWindowList systemTrayWins;
@ -563,6 +521,7 @@ class Workspace : public QObject, public KDecorationDefines
QList<Rules*> rules; QList<Rules*> rules;
KXMessages temporaryRulesMessages; KXMessages temporaryRulesMessages;
QTimer rulesUpdatedTimer; QTimer rulesUpdatedTimer;
bool rules_updates_disabled;
static const char* windowTypeToTxt( NET::WindowType type ); static const char* windowTypeToTxt( NET::WindowType type );
static NET::WindowType txtToWindowType( const char* txt ); static NET::WindowType txtToWindowType( const char* txt );
static bool sessionInfoWindowTypeMatch( Client* c, SessionInfo* info ); static bool sessionInfoWindowTypeMatch( Client* c, SessionInfo* info );
@ -579,12 +538,10 @@ class Workspace : public QObject, public KDecorationDefines
ClientList clients; ClientList clients;
ClientList desktops; ClientList desktops;
UnmanagedList unmanaged;
DeletedList deleted;
ClientList unconstrained_stacking_order; ClientList unconstrained_stacking_order; // topmost last
ClientList stacking_order; ClientList stacking_order; // topmost last
QVector< ClientList > focus_chain; QVector< ClientList > focus_chain; // currently ative last
ClientList global_focus_chain; // this one is only for things like tabbox's MRU ClientList global_focus_chain; // this one is only for things like tabbox's MRU
ClientList should_get_focus; // last is most recent ClientList should_get_focus; // last is most recent
ClientList attention_chain; ClientList attention_chain;
@ -618,9 +575,7 @@ class Workspace : public QObject, public KDecorationDefines
QMenu *popup; QMenu *popup;
QMenu *advanced_popup; QMenu *advanced_popup;
QMenu *trans_popup;
QMenu *desk_popup; QMenu *desk_popup;
int desk_popup_index;
KActionCollection *keys; KActionCollection *keys;
KActionCollection *client_keys; KActionCollection *client_keys;
@ -665,8 +620,12 @@ class Workspace : public QObject, public KDecorationDefines
KStartupInfo* startup; KStartupInfo* startup;
ElectricBorder electric_current_border; bool electric_have_borders;
Window electric_windows[ ELECTRIC_COUNT ]; int electric_current_border;
WId electric_top_border;
WId electric_bottom_border;
WId electric_left_border;
WId electric_right_border;
int electricLeft; int electricLeft;
int electricRight; int electricRight;
int electricTop; int electricTop;
@ -674,7 +633,6 @@ class Workspace : public QObject, public KDecorationDefines
Time electric_time_first; Time electric_time_first;
Time electric_time_last; Time electric_time_last;
QPoint electric_push_point; QPoint electric_push_point;
int electric_reserved[ ELECTRIC_COUNT ]; // corners/edges used by something
Qt::Orientation layoutOrientation; Qt::Orientation layoutOrientation;
int layoutX; int layoutX;
@ -699,14 +657,12 @@ class Workspace : public QObject, public KDecorationDefines
bool forced_global_mouse_grab; bool forced_global_mouse_grab;
friend class StackingUpdatesBlocker; friend class StackingUpdatesBlocker;
KSelectionOwner* cm_selection; //kompmgr
QTimer compositeTimer;
QTime lastCompositePaint;
int compositeRate;
QRegion repaints_region;
Window overlay; // XComposite overlay window
QSlider *transSlider; QSlider *transSlider;
QPushButton *transButton; QPushButton *transButton;
private:
friend bool performTransiencyCheck();
}; };
// helper for Workspace::blockStackingUpdates() being called in pairs (true/false) // helper for Workspace::blockStackingUpdates() being called in pairs (true/false)
@ -731,7 +687,6 @@ class RootInfo : public NETRootInfo
protected: protected:
virtual void changeNumberOfDesktops(int n); virtual void changeNumberOfDesktops(int n);
virtual void changeCurrentDesktop(int d); virtual void changeCurrentDesktop(int d);
// virtual void changeActiveWindow(Window w); the extended version is used
virtual void changeActiveWindow(Window w,NET::RequestSource src, Time timestamp, Window active_window); virtual void changeActiveWindow(Window w,NET::RequestSource src, Time timestamp, Window active_window);
virtual void closeWindow(Window w); virtual void closeWindow(Window w);
virtual void moveResize(Window w, int x_root, int y_root, unsigned long direction); virtual void moveResize(Window w, int x_root, int y_root, unsigned long direction);
@ -849,9 +804,10 @@ inline bool Workspace::globalShortcutsDisabled() const
return global_shortcuts_disabled || global_shortcuts_disabled_for_client; return global_shortcuts_disabled || global_shortcuts_disabled_for_client;
} }
inline Window Workspace::overlayWindow() inline
bool Workspace::rulesUpdatesDisabled() const
{ {
return overlay; return rules_updates_disabled;
} }
template< typename T > template< typename T >
@ -881,27 +837,7 @@ inline void Workspace::forEachClient( T procedure )
return forEachClient( procedure, TruePredicate()); return forEachClient( procedure, TruePredicate());
} }
template< typename T > KWIN_COMPARE_PREDICATE( ClientMatchPredicate, const Client*, cl == value );
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 );
inline bool Workspace::hasClient( const Client* c ) inline bool Workspace::hasClient( const Client* c )
{ {
return findClient( ClientMatchPredicate( c )); return findClient( ClientMatchPredicate( c ));