Ported/compile-fixed some code in khotkeys and kwin (that was not fun)

Small changes in other places, removed some unnecessary #include <kkeydialog.h> where they showed up.

Related to this kdelibs commit:
KKeyDialog: Renamed to KShortcutsDialog
KKeyChooser: Renamed to KShortcutsEditor
KKeyButton: Replaced by KKeySequenceWidget and KShortcutWidget. KKeySequenceWidget uses modified code from KKeyButton.
KShortcutDialog: Removed

svn path=/trunk/KDE/kdebase/workspace/; revision=648582
This commit is contained in:
Andreas Hartmetz 2007-03-31 19:04:28 +00:00
parent efa28b23f5
commit ee217245fb
8 changed files with 151 additions and 371 deletions

View file

@ -680,10 +680,15 @@ void RulesWidget::prepareWindowSpecific( WId window )
void RulesWidget::shortcutEditClicked()
{
#ifdef __GNUC__
#warning KShortcutDialog is gone, and it's a good opportunity to clean up here
#endif
#if 0
EditShortcutDialog dlg( topLevelWidget());
dlg.setShortcut( shortcut->text());
if( dlg.exec() == QDialog::Accepted )
shortcut->setText( dlg.shortcut());
#endif
}
RulesDialog::RulesDialog( QWidget* parent, const char* name )
@ -733,6 +738,10 @@ void RulesDialog::accept()
KDialog::accept();
}
#ifdef __GNUC__
#warning KShortcutDialog is gone
#endif
#if 0
EditShortcut::EditShortcut( QWidget* parent )
: EditShortcutBase( parent )
{
@ -804,7 +813,7 @@ void ShortcutDialog::accept()
}
KShortcutDialog::accept();
}
#endif
} // namespace
#include "ruleswidget.moc"

View file

@ -22,7 +22,7 @@
#include <kdialog.h>
#include <kwin.h>
#include <kshortcutdialog.h>
//#include <kshortcutdialog.h>
#include "ruleswidgetbase.h"
#include "editshortcutbase.h"
@ -110,6 +110,10 @@ class RulesDialog
Rules* rules;
};
#ifdef __GNUC__
#warning KShortcutDialog is gone
#endif //__GNUC__
#if 0
class EditShortcut
: public EditShortcutBase
{
@ -142,7 +146,7 @@ class ShortcutDialog
ShortcutDialog( const KShortcut& cut, QWidget* parent = NULL );
virtual void accept();
};
#endif //0
} // namespace
#endif

View file

@ -14,6 +14,7 @@ License. See the file "COPYING" for the exact licensing terms.
#include <QString>
#include <netwm_def.h>
#include <QRect>
#include <kconfiggroup.h>
#include <kdebug.h>
#include "placement.h"

View file

@ -363,6 +363,10 @@ void Workspace::readShortcuts()
void Workspace::setupWindowShortcut( Client* c )
{
#ifdef __GNUC__
#warning ifdefed out, KShortcutDialog is 0xDEAD
#endif //__GNUC__
#if 0
assert( client_keys_dialog == NULL );
keys->setEnabled( false );
disable_shortcuts_keys->setEnabled( false );
@ -381,10 +385,12 @@ void Workspace::setupWindowShortcut( Client* c )
client_keys_dialog->show();
active_popup = client_keys_dialog;
active_popup_client = c;
#endif
}
void Workspace::setupWindowShortcutDone( bool ok )
{
#if 0 //see above
keys->setEnabled( true );
disable_shortcuts_keys->setEnabled( true );
client_keys->setEnabled( true );
@ -396,6 +402,7 @@ void Workspace::setupWindowShortcutDone( bool ok )
delete client_keys_dialog;
client_keys_dialog = NULL;
client_keys_client = NULL;
#endif
}
void Workspace::clientShortcutUpdated( Client* c )

187
utils.cpp
View file

@ -25,13 +25,11 @@ License. See the file "COPYING" for the exact licensing terms.
#include <assert.h>
#include <kdebug.h>
#include <kshortcut.h>
#include <kkeyserver.h>
#include <X11/Xlib.h>
#include <X11/extensions/shape.h>
#include <X11/Xatom.h>
#include <QX11Info>
#include <stdio.h>
#include "atoms.h"
@ -44,68 +42,19 @@ namespace KWinInternal
#ifndef KCMRULES
bool Extensions::has_shape = false;
int Extensions::shape_event_base = 0;
bool Extensions::has_randr = false;
int Extensions::randr_event_base = 0;
bool Extensions::has_damage = false;
int Extensions::damage_event_base = 0;
bool Extensions::has_composite = false;
bool Extensions::has_composite_overlay = false;
bool Extensions::has_fixes = false;
// used to store the return values of
// XShapeQueryExtension.
// Necessary since shaped window are an extension to X
int Shape::kwin_shape_version = 0;
int Shape::kwin_shape_event = 0;
void Extensions::init()
{
int dummy;
has_shape = XShapeQueryExtension( display(), &shape_event_base, &dummy);
#ifdef HAVE_XRANDR
has_randr = XRRQueryExtension( display(), &randr_event_base, &dummy );
if( has_randr )
{
int major, minor;
XRRQueryVersion( display(), &major, &minor );
has_randr = ( major > 1 || ( major == 1 && minor >= 1 ) );
}
#else
has_randr = false;
#endif
#ifdef HAVE_XDAMAGE
has_damage = XDamageQueryExtension( display(), &damage_event_base, &dummy );
#else
has_damage = false;
#endif
#ifdef HAVE_XCOMPOSITE
has_composite = XCompositeQueryExtension( display(), &dummy, &dummy );
if( has_composite )
{
int major, minor;
XCompositeQueryVersion( display(), &major, &minor );
has_composite = ( major > 0 || minor >= 2 );
has_composite_overlay = ( major > 0 || minor >= 3 );
}
#else
has_composite = false;
has_composite_overlay = false;
#endif
#ifdef HAVE_XFIXES
has_fixes = XFixesQueryExtension( display(), &dummy, &dummy );
#else
has_fixes = false;
#endif
}
int Extensions::shapeNotifyEvent()
{
return shape_event_base + ShapeNotify;
}
// does the window w need a shape combine mask around it?
bool Extensions::hasShape( Window w )
// does the window w need a shape combine mask around it?
bool Shape::hasShape( WId w)
{
int xws, yws, xbs, ybs;
unsigned int wws, hws, wbs, hbs;
int boundingShaped = 0, clipShaped = 0;
if( !Extensions::shapeAvailable())
if (!available())
return false;
XShapeQueryExtents(display(), w,
&boundingShaped, &xws, &yws, &wws, &hws,
@ -113,22 +62,21 @@ bool Extensions::hasShape( Window w )
return boundingShaped != 0;
}
int Extensions::randrNotifyEvent()
int Shape::shapeEvent()
{
#ifdef HAVE_XRANDR
return randr_event_base + RRScreenChangeNotify;
#else
return 0;
#endif
return kwin_shape_event;
}
int Extensions::damageNotifyEvent()
void Shape::init()
{
#ifdef HAVE_XDAMAGE
return damage_event_base + XDamageNotify;
#else
return 0;
#endif
kwin_shape_version = 0;
int dummy;
if( !XShapeQueryExtension( display(), &kwin_shape_event, &dummy ))
return;
int major, minor;
if( !XShapeQueryVersion( display(), &major, &minor ))
return;
kwin_shape_version = major * 0x10 + minor;
}
void Motif::readFlags( WId w, bool& noborder, bool& resize, bool& move,
@ -353,93 +301,6 @@ bool grabbedXServer()
return server_grab_count > 0;
}
// converting between X11 mouse/keyboard state mask and Qt button/keyboard states
int qtToX11Button( Qt::MouseButton button )
{
if( button == Qt::LeftButton )
return Button1;
else if( button == Qt::MidButton )
return Button2;
else if( button == Qt::RightButton )
return Button3;
return AnyButton; // 0
}
Qt::MouseButton x11ToQtMouseButton( int button )
{
if( button == Button1 )
return Qt::LeftButton;
if( button == Button2 )
return Qt::MidButton;
if( button == Button3 )
return Qt::RightButton;
return Qt::NoButton;
}
int qtToX11State( Qt::MouseButtons 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::MouseButtons x11ToQtMouseButtons( int state )
{
Qt::MouseButtons ret = 0;
if( state & Button1Mask )
ret |= Qt::LeftButton;
if( state & Button2Mask )
ret |= Qt::MidButton;
if( state & Button3Mask )
ret |= Qt::RightButton;
return ret;
}
Qt::KeyboardModifiers x11ToQtKeyboardModifiers( int state )
{
Qt::KeyboardModifiers ret = 0;
if( state & ShiftMask )
ret |= Qt::ShiftModifier;
if( state & ControlMask )
ret |= Qt::ControlModifier;
if( state & KKeyServer::modXAlt())
ret |= Qt::AltModifier;
if( state & KKeyServer::modXMeta())
ret |= Qt::MetaModifier;
return ret;
}
// Optimized version of QCursor::pos() that tries to avoid X roundtrips
// by updating the value only when the X timestamp changes.
static QPoint last_cursor_pos;
static Time last_cursor_timestamp = CurrentTime;
QPoint cursorPos()
{
last_cursor_timestamp = CurrentTime;
if( last_cursor_timestamp == CurrentTime
|| last_cursor_timestamp != QX11Info::appTime())
{
last_cursor_timestamp = QX11Info::appTime();
last_cursor_pos = QCursor::pos();
}
return last_cursor_pos;
}
#endif
bool isLocalMachine( const QByteArray& host )
@ -465,8 +326,12 @@ bool isLocalMachine( const QByteArray& host )
}
#ifndef KCMRULES
#ifdef __GNUC__
#warning KShortcutDialog is gone
#endif //__GNUC__
#if 0
ShortcutDialog::ShortcutDialog( const KShortcut& cut )
: KShortcutDialog( cut, false /*TODO???*/ )
: KShortcutDialog( cut, false /*TODO: ???*/ )
{
// make it a popup, so that it has the grab
XSetWindowAttributes attrs;
@ -502,7 +367,9 @@ void ShortcutDialog::accept()
}
KShortcutDialog::accept();
}
#endif
#endif //0
#endif //KCMRULES
} // namespace
#ifndef KCMRULES

10
utils.h
View file

@ -15,7 +15,7 @@ License. See the file "COPYING" for the exact licensing terms.
#include <QWidget>
#include <kmanagerselection.h>
#include <netwm_def.h>
#include <kshortcutdialog.h>
//#include <kshortcutdialog.h> //you really want to use KKeySequenceWidget
#include <limits.h>
#include <QX11Info>
@ -284,6 +284,11 @@ void checkNonExistentClients();
#ifndef KCMRULES
// Qt dialogs emit no signal when closed :(
// KShortcutDialog is gone, and K(Shortcut/KeySequence)Widget should replace it and be
// good enough to not need any further hacks here. If they aren't, CONTACT ME before
// you add hacks again. --ahartmetz
#if 0
class ShortcutDialog
: public KShortcutDialog
{
@ -296,7 +301,8 @@ class ShortcutDialog
protected:
virtual void done( int r ) { KShortcutDialog::done( r ); emit dialogDone( r == Accepted ); }
};
#endif
#endif //0
#endif //KCMRULES
} // namespace

View file

@ -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 <X11/extensions/shape.h>
#include <X11/keysym.h>
@ -80,6 +76,7 @@ Workspace::Workspace( bool restore )
active_popup_client( NULL ),
desktop_widget (0),
temporaryRulesMessages( "_KDE_NET_WM_TEMPORARY_RULES", NULL, false ),
rules_updates_disabled( false ),
active_client (0),
last_active_client (0),
most_recently_raised (0),
@ -98,12 +95,11 @@ Workspace::Workspace( bool restore )
popupinfo (0),
popup (0),
advanced_popup (0),
trans_popup (0),
desk_popup (0),
desk_popup_index (0),
keys (0),
client_keys ( NULL ),
client_keys_dialog ( NULL ),
// client_keys_dialog ( NULL ),
client_keys_client ( NULL ),
disable_shortcuts_keys ( NULL ),
global_shortcuts_disabled( false ),
@ -128,16 +124,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 +170,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 +279,7 @@ void Workspace::init()
NET::WM2ExtendedStrut |
NET::WM2KDETemporaryRules |
NET::WM2ShowingDesktop |
NET::WM2DesktopLayout |
0
,
NET::ActionMove |
@ -332,7 +323,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 +360,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 +422,6 @@ void Workspace::init()
Workspace::~Workspace()
{
finishCompositing();
blockStackingUpdates( true );
// TODO grabXServer();
// use stacking_order, so that kwin --replace keeps stacking order
@ -445,12 +431,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;
@ -471,7 +457,7 @@ Workspace::~Workspace()
delete topmenu_watcher;
delete topmenu_selection;
delete topmenu_space;
delete client_keys_dialog;
// delete client_keys_dialog;
while( !rules.isEmpty())
{
delete rules.front();
@ -494,28 +480,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,13 +520,7 @@ void Workspace::addClient( Client* c, allowed_t )
updateStackingOrder( true ); // propagate new client
if( c->isUtility() || c->isMenu() || c->isToolbar())
updateToolWindows( true );
if( tab_grab )
tab_box->reset( true );
}
void Workspace::addUnmanaged( Unmanaged* c, allowed_t )
{
unmanaged.append( c );
checkNonExistentClients();
}
/*
@ -583,12 +541,6 @@ void Workspace::removeClient( Client* c, allowed_t )
if( c->isNormalWindow())
Notify::raise( Notify::Delete );
if( tab_grab )
{
if( tab_box->currentClient() == c )
tab_box->nextPrev( true );
}
Q_ASSERT( clients.contains( c ) || desktops.contains( c ));
clients.removeAll( c );
desktops.removeAll( c );
@ -619,34 +571,12 @@ void Workspace::removeClient( Client* c, allowed_t )
updateStackingOrder( true );
if( tab_grab )
tab_box->reset( true );
if (tab_grab)
tab_box->repaint();
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
@ -672,7 +602,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
@ -692,7 +628,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 );
@ -709,7 +651,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,6 +875,11 @@ void Workspace::updateColormap()
}
}
void Workspace::slotReloadConfig()
{
reconfigure();
}
void Workspace::reconfigure()
{
reconfigureTimer.start( 200 );
@ -943,7 +896,7 @@ void Workspace::slotSettingsChanged(int category)
/*!
Reread settings
*/
KWIN_PROCEDURE( CheckBorderSizesProcedure, Client, cl->checkBorderSizes() );
KWIN_PROCEDURE( CheckBorderSizesProcedure, cl->checkBorderSizes() );
void Workspace::slotReconfigure()
{
@ -1000,11 +953,6 @@ void Workspace::slotReconfigure()
updateTopMenuGeometry();
updateCurrentTopMenu();
}
if( options->useTranslucency )
setupCompositing();
else
finishCompositing();
loadWindowRules();
for( ClientList::Iterator it = clients.begin();
@ -1287,15 +1235,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 <V.Schatz at thphys.uni-heidelberg.de>)
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();
@ -1317,10 +1266,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;
}
@ -1553,25 +1498,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;
}
@ -1703,7 +1649,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;
@ -1904,7 +1850,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 )
{
@ -2056,8 +2002,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);
@ -2449,7 +2394,7 @@ void Workspace::helperDialog( const QString& message, const Client* c )
{
KConfig cfg( "kwin_dialogsrc" );
KConfigGroup cg(&cfg, "Notification Messages" ); // this depends on KMessageBox
if( !cg.readEntry( type, QVariant(true )).toBool()) // has don't show again checked
if( !cg.readEntry( type, true )) // has don't show again checked
return; // save launching kdialog
proc << "--dontagain" << "kwin_dialogsrc:" + type;
}

View file

@ -18,8 +18,6 @@ License. See the file "COPYING" for the exact licensing terms.
#include <QCursor>
#include <netwm.h>
#include <kxmessages.h>
#include <qdatetime.h>
#include <kmanagerselection.h>
#include "utils.h"
#include "kdecoration.h"
@ -36,6 +34,7 @@ class KStartupInfoId;
class KStartupInfoData;
class QSlider;
class QPushButton;
class K3Process;
namespace KWinInternal
{
@ -78,7 +77,7 @@ class Workspace : public QObject, public KDecorationDefines
virtual ~Workspace();
static Workspace * self() { return _self; }
bool workspaceEvent( XEvent * );
KDecoration* createDecoration( KDecorationBridge* bridge );
@ -88,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;
@ -169,22 +165,12 @@ class Workspace : public QObject, public KDecorationDefines
QWidget* desktopWidget();
// for TabBox
Client* currentTabBoxClient() const;
ClientList currentTabBoxClientList() const;
int currentTabBoxDesktop() const;
QList< int > currentTabBoxDesktopList() const;
void setTabBoxClient(Client*);
void setTabBoxDesktop(int);
Client* nextClientFocusChain(Client*) const;
Client* previousClientFocusChain(Client*) const;
Client* nextClientStatic(Client*) const;
Client* previousClientStatic(Client*) const;
Client* nextFocusChainClient(Client*) const;
Client* previousFocusChainClient(Client*) const;
Client* nextStaticClient(Client*) const;
Client* previousStaticClient(Client*) const;
int nextDesktopFocusChain( int iDesktop ) const;
int previousDesktopFocusChain( int iDesktop ) const;
int nextDesktopStatic( int iDesktop ) const;
int previousDesktopStatic( int iDesktop ) const;
void refTabBox();
void unrefTabBox();
void closeTabBox();
/**
@ -195,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 );
@ -204,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.
@ -231,6 +213,8 @@ class Workspace : public QObject, public KDecorationDefines
WindowRules findWindowRules( const Client*, bool );
void rulesUpdated();
void discardUsedWindowRules( Client* c, bool withdraw );
void disableRulesUpdates( bool disable );
bool rulesUpdatesDisabled() const;
// dcop interface
void cascadeDesktop();
@ -242,7 +226,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;
@ -252,17 +236,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?
@ -298,19 +279,6 @@ class Workspace : public QObject, public KDecorationDefines
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:
void refresh();
// keybindings
@ -440,14 +408,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();
@ -491,8 +460,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 );
@ -534,9 +501,6 @@ class Workspace : public QObject, public KDecorationDefines
void closeActivePopup();
void updateClientArea( bool force );
void finishCompositing();
bool windowRepaintsPending() const;
SystemTrayWindowList systemTrayWins;
@ -557,6 +521,7 @@ class Workspace : public QObject, public KDecorationDefines
QList<Rules*> rules;
KXMessages temporaryRulesMessages;
QTimer rulesUpdatedTimer;
bool rules_updates_disabled;
static const char* windowTypeToTxt( NET::WindowType type );
static NET::WindowType txtToWindowType( const char* txt );
static bool sessionInfoWindowTypeMatch( Client* c, SessionInfo* info );
@ -573,12 +538,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;
@ -612,7 +575,6 @@ class Workspace : public QObject, public KDecorationDefines
QMenu *popup;
QMenu *advanced_popup;
QMenu *trans_popup;
QMenu *desk_popup;
int desk_popup_index;
@ -628,7 +590,7 @@ class Workspace : public QObject, public KDecorationDefines
QAction *mNoBorderOpAction;
QAction *mMinimizeOpAction;
QAction *mCloseOpAction;
ShortcutDialog* client_keys_dialog;
// ShortcutDialog* client_keys_dialog;
Client* client_keys_client;
KActionCollection *disable_shortcuts_keys;
bool global_shortcuts_disabled;
@ -696,14 +658,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)
@ -846,9 +806,10 @@ inline bool Workspace::globalShortcutsDisabled() const
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 >
@ -878,27 +839,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 ));