more fixes; seeing as montel is playing around in kdebase i should get these in i suppose ;)

svn path=/trunk/KDE/kdebase/workspace/; revision=619144
This commit is contained in:
Aaron J. Seigo 2007-01-02 21:02:22 +00:00
parent 32504fd22c
commit 2bc3c12849
3 changed files with 15 additions and 39 deletions

View file

@ -14,6 +14,7 @@ License. See the file "COPYING" for the exact licensing terms.
#include "main.h" #include "main.h"
#include <kglobal.h>
#include <klocale.h> #include <klocale.h>
#include <stdlib.h> #include <stdlib.h>
#include <kcmdlineargs.h> #include <kcmdlineargs.h>
@ -25,13 +26,12 @@ License. See the file "COPYING" for the exact licensing terms.
#include <stdio.h> #include <stdio.h>
#include <fixx11h.h> #include <fixx11h.h>
#include <QtDBus/QtDBus> #include <QtDBus/QtDBus>
#include <kglobal.h> #include "ksplash_interface.h"
#include "atoms.h" #include "atoms.h"
#include "options.h" #include "options.h"
#include "sm.h" #include "sm.h"
#include "utils.h" #include "utils.h"
#include "effects.h"
#define INT8 _X11INT8 #define INT8 _X11INT8
#define INT32 _X11INT32 #define INT32 _X11INT32
@ -120,8 +120,6 @@ Application::Application( )
options = new Options; options = new Options;
atoms = new Atoms; atoms = new Atoms;
initting = false; // TODO
// create workspace. // create workspace.
(void) new Workspace( isSessionRestored() ); (void) new Workspace( isSessionRestored() );
@ -129,8 +127,9 @@ Application::Application( )
initting = false; // startup done, we are up and running now. initting = false; // startup done, we are up and running now.
QDBusInterface ksplash( "org.kde.ksplash", "/ksplash", "org.kde.KSplash" ); org::kde::KSplash ksplash("org.kde.ksplash", "/KSplash", QDBusConnection::sessionBus());
ksplash.call( "upAndRunning", QString( "wm started" )); ksplash.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( display(), "_KDE_SPLASH_PROGRESS", False );
@ -147,8 +146,6 @@ Application::~Application()
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( display(), PointerRoot, RevertToPointerRoot, xTime() );
delete options; delete options;
delete effects;
delete atoms;
} }
void Application::lostSelection() void Application::lostSelection()
@ -276,16 +273,16 @@ KDE_EXPORT int kdemain( int argc, char * argv[] )
// KApplication::disableAutoDcopRegistration(); // KApplication::disableAutoDcopRegistration();
#endif #endif
KWinInternal::Application a; KWinInternal::Application a;
KWinInternal::SessionManaged weAreIndeed; KWinInternal::SessionManager weAreIndeed;
KWinInternal::SessionSaveDoneHelper helper; KWinInternal::SessionSaveDoneHelper helper;
fcntl(XConnectionNumber(KWinInternal::display()), F_SETFD, 1); fcntl(XConnectionNumber(KWinInternal::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);
QDBusConnection::sessionBus().interface()->registerService( appname, QDBusConnectionInterface::DontQueueService ); QDBusConnection::sessionBus().interface()->registerService( appname, QDBusConnectionInterface::DontQueueService );

30
sm.cpp
View file

@ -11,6 +11,7 @@ License. See the file "COPYING" for the exact licensing terms.
#include "sm.h" #include "sm.h"
//#include <kdebug.h>
#include <unistd.h> #include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
#include <pwd.h> #include <pwd.h>
@ -22,12 +23,11 @@ License. See the file "COPYING" for the exact licensing terms.
#include "client.h" #include "client.h"
#include <QSocketNotifier> #include <QSocketNotifier>
#include <qsessionmanager.h> #include <qsessionmanager.h>
#include <kdebug.h>
namespace KWinInternal namespace KWinInternal
{ {
bool SessionManaged::saveState( QSessionManager& sm ) bool SessionManager::saveState( QSessionManager& sm )
{ {
// If the session manager is ksmserver, save stacking // If the session manager is ksmserver, save stacking
// order, active window, active desktop etc. in phase 1, // order, active window, active desktop etc. in phase 1,
@ -53,7 +53,7 @@ bool SessionManaged::saveState( QSessionManager& sm )
} }
// I bet this is broken, just like everywhere else in KDE // I bet this is broken, just like everywhere else in KDE
bool SessionManaged::commitData( QSessionManager& sm ) bool SessionManager::commitData( QSessionManager& sm )
{ {
if ( !sm.isPhase2() ) if ( !sm.isPhase2() )
Workspace::self()->sessionSaveStarted(); Workspace::self()->sessionSaveStarted();
@ -257,28 +257,6 @@ bool Workspace::sessionInfoWindowTypeMatch( Client* c, SessionInfo* info )
return info->windowType == c->windowType(); return info->windowType == c->windowType();
} }
// maybe needed later
#if 0
// KMainWindow's without name() given have WM_WINDOW_ROLE in the form
// of <appname>-mainwindow#<number>
// when comparing them for fake session info, it's probably better to check
// them without the trailing number
bool Workspace::windowRoleMatch( const QByteArray& role1, const QByteArray& role2 )
{
if( role1.isEmpty() && role2.isEmpty())
return true;
int pos1 = role1.find( '#' );
int pos2 = role2.find( '#' );
bool ret;
if( pos1 < 0 || pos2 < 0 || pos1 != pos2 )
ret = role1 == role2;
else
ret = qstrncmp( role1, role2, pos1 ) == 0;
kDebug() << "WR:" << role1 << ":" << pos1 << ":" << role2 << ":" << pos2 << ":::" << ret << endl;
return ret;
}
#endif
static const char* const window_type_names[] = static const char* const window_type_names[] =
{ {
"Unknown", "Normal" , "Desktop", "Dock", "Toolbar", "Menu", "Dialog", "Unknown", "Normal" , "Desktop", "Dock", "Toolbar", "Menu", "Dialog",
@ -312,7 +290,7 @@ NET::WindowType Workspace::txtToWindowType( const char* txt )
// KWin's focus stealing prevention causes problems with user interaction // KWin's focus stealing prevention causes problems with user interaction
// during session save, as it prevents possible dialogs from getting focus. // during session save, as it prevents possible dialogs from getting focus.
// Therefore it's temporarily disabled during session saving. Start of // Therefore it's temporarily disabled during session saving. Start of
// session saving can be detected in SessionManaged::saveState() above, // session saving can be detected in SessionManager::saveState() above,
// but Qt doesn't have API for saying when session saved finished (either // but Qt doesn't have API for saying when session saved finished (either
// successfully, or was canceled). Therefore, create another connection // successfully, or was canceled). Therefore, create another connection
// to session manager, that will provide this information. // to session manager, that will provide this information.

5
sm.h
View file

@ -15,6 +15,7 @@ License. See the file "COPYING" for the exact licensing terms.
#include <QDataStream> #include <QDataStream>
#include <X11/SM/SMlib.h> #include <X11/SM/SMlib.h>
#include <kapplication.h> #include <kapplication.h>
#include <ksessionmanager.h>
#include <netwm_def.h> #include <netwm_def.h>
class QSocketNotifier; class QSocketNotifier;
@ -77,8 +78,8 @@ class SessionSaveDoneHelper
}; };
class SessionManaged class SessionManager
: public KSessionManaged : public KSessionManager
{ {
public: public:
virtual bool saveState( QSessionManager& sm ); virtual bool saveState( QSessionManager& sm );