Register as org.kde.kwin (in addition to kapplication registering us as kwin_$PID)

Not sure why this isn't a kuniqueapplication though (but klauncher is in the same situation anyway)

svn path=/trunk/KDE/kdebase/workspace/; revision=558891
This commit is contained in:
David Faure 2006-07-06 09:15:57 +00:00
parent 1719127d3f
commit a67e2c7f07

View file

@ -29,8 +29,6 @@ License. See the file "COPYING" for the exact licensing terms.
#include "atoms.h" #include "atoms.h"
#include "options.h" #include "options.h"
#include "sm.h" #include "sm.h"
#include "utils.h"
#include "effects.h"
#define INT8 _X11INT8 #define INT8 _X11INT8
#define INT32 _X11INT32 #define INT32 _X11INT32
@ -95,7 +93,7 @@ Application::Application( )
} }
if (screen_number == -1) if (screen_number == -1)
screen_number = DefaultScreen(display()); screen_number = DefaultScreen(QX11Info::display());
if( !owner.claim( args->isSet( "replace" ), true )) if( !owner.claim( args->isSet( "replace" ), true ))
{ {
@ -113,14 +111,11 @@ Application::Application( )
XSetErrorHandler( x11ErrorHandler ); XSetErrorHandler( x11ErrorHandler );
// check whether another windowmanager is running // check whether another windowmanager is running
XSelectInput(display(), rootWindow(), SubstructureRedirectMask ); XSelectInput(QX11Info::display(), QX11Info::appRootWindow(), SubstructureRedirectMask );
syncX(); // trigger error now syncX(); // trigger error now
options = new Options; options = new Options;
atoms = new Atoms; atoms = new Atoms;
effects = new EffectsHandler;
initting = false; // TODO
// create workspace. // create workspace.
(void) new Workspace( isSessionRestored() ); (void) new Workspace( isSessionRestored() );
@ -133,29 +128,27 @@ Application::Application( )
ksplash.call( "upAndRunning", QString( "wm started" )); ksplash.call( "upAndRunning", QString( "wm started" ));
XEvent e; XEvent e;
e.xclient.type = ClientMessage; e.xclient.type = ClientMessage;
e.xclient.message_type = XInternAtom( display(), "_KDE_SPLASH_PROGRESS", False ); e.xclient.message_type = XInternAtom( QX11Info::display(), "_KDE_SPLASH_PROGRESS", False );
e.xclient.display = display(); e.xclient.display = QX11Info::display();
e.xclient.window = rootWindow(); e.xclient.window = QX11Info::appRootWindow();
e.xclient.format = 8; e.xclient.format = 8;
strcpy( e.xclient.data.b, "wm started" ); strcpy( e.xclient.data.b, "wm started" );
XSendEvent( display(), rootWindow(), False, SubstructureNotifyMask, &e ); XSendEvent( QX11Info::display(), QX11Info::appRootWindow(), False, SubstructureNotifyMask, &e );
} }
Application::~Application() Application::~Application()
{ {
delete Workspace::self(); delete Workspace::self();
if( owner.ownerWindow() != None ) // if there was no --replace (no new WM) if( owner.ownerWindow() != None ) // if there was no --replace (no new WM)
XSetInputFocus( display(), PointerRoot, RevertToPointerRoot, xTime() ); XSetInputFocus( QX11Info::display(), PointerRoot, RevertToPointerRoot, QX11Info::appTime() );
delete options; delete options;
delete effects;
delete atoms;
} }
void Application::lostSelection() void Application::lostSelection()
{ {
delete Workspace::self(); delete Workspace::self();
// remove windowmanager privileges // remove windowmanager privileges
XSelectInput(display(), rootWindow(), PropertyChangeMask ); XSelectInput(QX11Info::display(), QX11Info::appRootWindow(), PropertyChangeMask );
quit(); quit();
} }
@ -279,13 +272,13 @@ KDE_EXPORT int kdemain( int argc, char * argv[] )
KWinInternal::SessionManaged weAreIndeed; KWinInternal::SessionManaged weAreIndeed;
KWinInternal::SessionSaveDoneHelper helper; KWinInternal::SessionSaveDoneHelper helper;
fcntl(XConnectionNumber(KWinInternal::display()), F_SETFD, 1); fcntl(ConnectionNumber(QX11Info::display()), F_SETFD, 1);
QString appname; QString appname;
if (KWinInternal::screen_number == 0) if (KWinInternal::screen_number == 0)
appname = "kwin"; appname = "org.kde.kwin";
else else
appname.sprintf("kwin-screen-%d", KWinInternal::screen_number); appname.sprintf("org.kde.kwin-screen-%d", KWinInternal::screen_number);
QDBus::sessionBus().interface()->registerService( appname, QDBusConnectionInterface::DontQueueService ); QDBus::sessionBus().interface()->registerService( appname, QDBusConnectionInterface::DontQueueService );