Merge compile fixes from trunk to work with current SVN.

svn path=/branches/work/kwin_composite/; revision=586383
This commit is contained in:
Luboš Luňák 2006-09-19 12:20:19 +00:00
parent 0f0f8e5116
commit 626d2700c1
4 changed files with 102 additions and 53 deletions

View file

@ -62,6 +62,8 @@
#include <kdecoration_plugins_p.h>
#include <kdecorationfactory.h>
#include <kvbox.h>
#include "kwindecorationadaptor.h"
#include <QtDBus/QtDBus>
// KCModule plugin interface
// =========================
@ -73,6 +75,8 @@ KWinDecorationModule::KWinDecorationModule(QWidget* parent, const QStringList &)
kwinConfig("kwinrc"),
pluginObject(0)
{
new DecorationAdaptor(this);
QDBusConnection::sessionBus().registerObject("/KWinClientDecoration", this);
kwinConfig.setGroup("Style");
plugins = new KDecorationPreviewPlugins( &kwinConfig );

View file

@ -30,6 +30,7 @@ License. See the file "COPYING" for the exact licensing terms.
#include "options.h"
#include "sm.h"
#include "utils.h"
#include "effects.h"
#define INT8 _X11INT8
#define INT32 _X11INT32
@ -117,6 +118,8 @@ Application::Application( )
options = new Options;
atoms = new Atoms;
initting = false; // TODO
// create workspace.
(void) new Workspace( isSessionRestored() );
@ -143,6 +146,8 @@ Application::~Application()
if( owner.ownerWindow() != None ) // if there was no --replace (no new WM)
XSetInputFocus( display(), PointerRoot, RevertToPointerRoot, xTime() );
delete options;
delete effects;
delete atoms;
}
void Application::lostSelection()
@ -277,9 +282,9 @@ KDE_EXPORT int kdemain( int argc, char * argv[] )
QString appname;
if (KWinInternal::screen_number == 0)
appname = "org.kde.kwin";
appname = "kwin";
else
appname.sprintf("org.kde.kwin-screen-%d", KWinInternal::screen_number);
appname.sprintf("kwin-screen-%d", KWinInternal::screen_number);
QDBusConnection::sessionBus().interface()->registerService( appname, QDBusConnectionInterface::DontQueueService );

View file

@ -42,6 +42,7 @@ License. See the file "COPYING" for the exact licensing terms.
#include "group.h"
#include "rules.h"
#include "kwinadaptor.h"
#include "unmanaged.h"
#include <X11/extensions/shape.h>
#include <X11/keysym.h>
@ -122,7 +123,8 @@ Workspace::Workspace( bool restore )
topmenu_space( NULL ),
set_active_client_recursion( 0 ),
block_stacking_updates( 0 ),
forced_global_mouse_grab( false )
forced_global_mouse_grab( false ),
damage_region( None )
{
new KWinAdaptor( "org.kde.kwin", "/KWin", QDBusConnection::sessionBus(), this );
@ -166,10 +168,12 @@ Workspace::Workspace( bool restore )
ColormapChangeMask |
SubstructureRedirectMask |
SubstructureNotifyMask |
FocusChangeMask // for NotifyDetailNone
FocusChangeMask | // for NotifyDetailNone
ExposureMask
);
Shape::init();
Extensions::init();
setupCompositing();
// compatibility
long data = 1;
@ -318,6 +322,7 @@ void Workspace::init()
connect(&reconfigureTimer, SIGNAL(timeout()), this,
SLOT(slotReconfigure()));
connect( &updateToolWindowsTimer, SIGNAL( timeout()), this, SLOT( slotUpdateToolWindows()));
connect( &compositeTimer, SIGNAL( timeout()), SLOT( compositeTimeout()));
connect(KGlobalSettings::self(), SIGNAL(appearanceChanged()), this,
SLOT(slotReconfigure()));
@ -355,7 +360,11 @@ void Workspace::init()
XWindowAttributes attr;
XGetWindowAttributes(display(), wins[i], &attr);
if (attr.override_redirect )
{
if( attr.map_state != IsUnmapped && attr.c_class != InputOnly && compositing())
createUnmanaged( wins[ i ] );
continue;
}
if( topmenu_space && topmenu_space->winId() == wins[ i ] )
continue;
if (attr.map_state != IsUnmapped)
@ -418,6 +427,7 @@ void Workspace::init()
Workspace::~Workspace()
{
finishCompositing();
blockStackingUpdates( true );
// TODO grabXServer();
// use stacking_order, so that kwin --replace keeps stacking order
@ -429,6 +439,10 @@ Workspace::~Workspace()
(*it)->releaseWindow( true );
// no removeClient() is called !
}
for( UnmanagedList::ConstIterator it = unmanaged.begin();
it != unmanaged.end();
++it )
(*it)->release();
delete desktop_widget;
delete tab_box;
delete popupinfo;
@ -475,6 +489,18 @@ Client* Workspace::createClient( Window w, bool is_mapped )
return c;
}
Unmanaged* Workspace::createUnmanaged( Window w )
{
Unmanaged* c = new Unmanaged( this );
if( !c->track( w ))
{
Unmanaged::deleteUnmanaged( c, Allowed );
return NULL;
}
addUnmanaged( c, Allowed );
return c;
}
void Workspace::addClient( Client* c, allowed_t )
{
Group* grp = findGroup( c->window());
@ -514,6 +540,11 @@ void Workspace::addClient( Client* c, allowed_t )
updateToolWindows( true );
}
void Workspace::addUnmanaged( Unmanaged* c, allowed_t )
{
unmanaged.append( c );
}
/*
Destroys the client \a c
*/
@ -568,6 +599,12 @@ void Workspace::removeClient( Client* c, allowed_t )
updateClientArea();
}
void Workspace::removeUnmanaged( Unmanaged* c, allowed_t )
{
assert( unmanaged.contains( c ));
unmanaged.removeAll( c );
}
void Workspace::updateFocusChains( Client* c, FocusChainChange change )
{
if( !c->wantsTabFocus()) // doesn't want tab focus, remove
@ -864,7 +901,7 @@ void Workspace::slotSettingsChanged(int category)
/*!
Reread settings
*/
KWIN_PROCEDURE( CheckBorderSizesProcedure, cl->checkBorderSizes() );
KWIN_PROCEDURE( CheckBorderSizesProcedure, Client, cl->checkBorderSizes() );
void Workspace::slotReconfigure()
{
@ -921,6 +958,11 @@ void Workspace::slotReconfigure()
updateTopMenuGeometry();
updateCurrentTopMenu();
}
if( options->useTranslucency )
setupCompositing();
else
finishCompositing();
loadWindowRules();
for( ClientList::Iterator it = clients.begin();
@ -1622,7 +1664,7 @@ void Workspace::slotGrabWindow()
QPixmap snapshot = QPixmap::grabWindow( active_client->frameId() );
//No XShape - no work.
if( Shape::available())
if( Extensions::shapeAvailable())
{
//As the first step, get the mask from XShape.
int count, order;

View file

@ -77,7 +77,7 @@ class Workspace : public QObject, public KDecorationDefines
virtual ~Workspace();
static Workspace * self() { return _self; }
bool workspaceEvent( XEvent * );
KDecoration* createDecoration( KDecorationBridge* bridge );
@ -87,6 +87,9 @@ 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;
@ -242,6 +245,9 @@ class Workspace : public QObject, public KDecorationDefines
void removeGroup( Group* group, allowed_t );
Group* findClientLeaderGroup( const Client* c ) const;
// only called from Unmanaged::release()
void removeUnmanaged( Unmanaged*, allowed_t );
bool checkStartupNotification( Window w, KStartupInfoId& id, KStartupInfoData& data );
void focusToNull(); // SELI public?
@ -276,6 +282,13 @@ class Workspace : public QObject, public KDecorationDefines
void requestDelayFocus( Client* );
void toggleTopDockShadows(bool on);
void addDamage( const QRect& r );
void addDamage( int x, int y, int w, int h );
void addDamage( XserverRegion r, bool destroy );
void addDamage( Toplevel* c, const QRect& r );
void addDamage( Toplevel* c, int x, int y, int w, int h );
void addDamage( Toplevel* c, XserverRegion r, bool destroy );
public slots:
void refresh();
@ -288,48 +301,8 @@ class Workspace : public QObject, public KDecorationDefines
void slotSwitchDesktopDown();
void slotSwitchToDesktop( int );
void slotSwitchToDesktop1() { return slotSwitchToDesktop( 1 ); }
void slotSwitchToDesktop2() { return slotSwitchToDesktop( 2 ); }
void slotSwitchToDesktop3() { return slotSwitchToDesktop( 3 ); }
void slotSwitchToDesktop4() { return slotSwitchToDesktop( 4 ); }
void slotSwitchToDesktop5() { return slotSwitchToDesktop( 5 ); }
void slotSwitchToDesktop6() { return slotSwitchToDesktop( 6 ); }
void slotSwitchToDesktop7() { return slotSwitchToDesktop( 7 ); }
void slotSwitchToDesktop8() { return slotSwitchToDesktop( 8 ); }
void slotSwitchToDesktop9() { return slotSwitchToDesktop( 9 ); }
void slotSwitchToDesktop10() { return slotSwitchToDesktop( 10 ); }
void slotSwitchToDesktop11() { return slotSwitchToDesktop( 11 ); }
void slotSwitchToDesktop12() { return slotSwitchToDesktop( 12 ); }
void slotSwitchToDesktop13() { return slotSwitchToDesktop( 13 ); }
void slotSwitchToDesktop14() { return slotSwitchToDesktop( 14 ); }
void slotSwitchToDesktop15() { return slotSwitchToDesktop( 15 ); }
void slotSwitchToDesktop16() { return slotSwitchToDesktop( 16 ); }
void slotSwitchToDesktop17() { return slotSwitchToDesktop( 17 ); }
void slotSwitchToDesktop18() { return slotSwitchToDesktop( 18 ); }
void slotSwitchToDesktop19() { return slotSwitchToDesktop( 19 ); }
void slotSwitchToDesktop20() { return slotSwitchToDesktop( 20 ); }
//void slotSwitchToWindow( int );
void slotWindowToDesktop( int );
void slotWindowToDesktop1() { return slotWindowToDesktop( 1 ); }
void slotWindowToDesktop2() { return slotWindowToDesktop( 2 ); }
void slotWindowToDesktop3() { return slotWindowToDesktop( 3 ); }
void slotWindowToDesktop4() { return slotWindowToDesktop( 4 ); }
void slotWindowToDesktop5() { return slotWindowToDesktop( 5 ); }
void slotWindowToDesktop6() { return slotWindowToDesktop( 6 ); }
void slotWindowToDesktop7() { return slotWindowToDesktop( 7 ); }
void slotWindowToDesktop8() { return slotWindowToDesktop( 8 ); }
void slotWindowToDesktop9() { return slotWindowToDesktop( 9 ); }
void slotWindowToDesktop10() { return slotWindowToDesktop( 10 ); }
void slotWindowToDesktop11() { return slotWindowToDesktop( 11 ); }
void slotWindowToDesktop12() { return slotWindowToDesktop( 12 ); }
void slotWindowToDesktop13() { return slotWindowToDesktop( 13 ); }
void slotWindowToDesktop14() { return slotWindowToDesktop( 14 ); }
void slotWindowToDesktop15() { return slotWindowToDesktop( 15 ); }
void slotWindowToDesktop16() { return slotWindowToDesktop( 16 ); }
void slotWindowToDesktop17() { return slotWindowToDesktop( 17 ); }
void slotWindowToDesktop18() { return slotWindowToDesktop( 18 ); }
void slotWindowToDesktop19() { return slotWindowToDesktop( 19 ); }
void slotWindowToDesktop20() { return slotWindowToDesktop( 20 ); }
//void slotWindowToListPosition( int );
void slotWindowMaximize();
@ -406,11 +379,10 @@ class Workspace : public QObject, public KDecorationDefines
void cleanupTemporaryRules();
void writeWindowRules();
void slotBlockShortcuts(int data);
// kompmgr
void setPopupClientOpacity(int v);
void resetClientOpacity();
void setTransButtonText(int value);
// end
void compositeTimeout();
protected:
bool keyPressMouseEmulation( XKeyEvent& ev );
@ -458,6 +430,8 @@ 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 );
@ -499,6 +473,9 @@ class Workspace : public QObject, public KDecorationDefines
void closeActivePopup();
void updateClientArea( bool force );
void setupCompositing();
void finishCompositing();
SystemTrayWindowList systemTrayWins;
@ -535,6 +512,7 @@ class Workspace : public QObject, public KDecorationDefines
ClientList clients;
ClientList desktops;
UnmanagedList unmanaged;
ClientList unconstrained_stacking_order;
ClientList stacking_order;
@ -654,8 +632,8 @@ class Workspace : public QObject, public KDecorationDefines
Window null_focus_window;
bool forced_global_mouse_grab;
friend class StackingUpdatesBlocker;
//kompmgr
QTimer compositeTimer;
XserverRegion damage_region;
QSlider *transSlider;
QPushButton *transButton;
};
@ -827,7 +805,27 @@ inline void Workspace::forEachClient( T procedure )
return forEachClient( procedure, TruePredicate());
}
KWIN_COMPARE_PREDICATE( ClientMatchPredicate, const Client*, cl == value );
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 );
inline bool Workspace::hasClient( const Client* c )
{
return findClient( ClientMatchPredicate( c ));