diff --git a/kwin/CMakeLists.txt b/kwin/CMakeLists.txt
index c366eb68..f0340a68 100644
--- a/kwin/CMakeLists.txt
+++ b/kwin/CMakeLists.txt
@@ -142,8 +142,6 @@ target_link_libraries(kwin
KDE4::kdeui
${X11_X11_LIB}
${X11_Xext_LIB}
- ${X11_ICE_LIB}
- ${X11_SM_LIB}
${X11_Xcursor_LIB}
${X11_Xrandr_LIB}
${X11_Xdamage_LIB}
diff --git a/kwin/sm.cpp b/kwin/sm.cpp
index ad423c63..e04566a8 100644
--- a/kwin/sm.cpp
+++ b/kwin/sm.cpp
@@ -30,7 +30,7 @@ along with this program. If not, see .
#include "workspace.h"
#include "client.h"
-#include
+#include
#include
namespace KWin
diff --git a/kwin/sm.h b/kwin/sm.h
index 6fdfc38e..d01f1062 100644
--- a/kwin/sm.h
+++ b/kwin/sm.h
@@ -22,16 +22,11 @@ along with this program. If not, see .
#ifndef KWIN_SM_H
#define KWIN_SM_H
-#include
-#include
#include
+#include
+#include
#include
-#include
-#include
-
-#include
-
namespace KWin
{
diff --git a/kwin/workspace.cpp b/kwin/workspace.cpp
index 0c720de9..c832746c 100644
--- a/kwin/workspace.cpp
+++ b/kwin/workspace.cpp
@@ -56,8 +56,9 @@ along with this program. If not, see .
#include
#include
#include
-// Qt
-#include
+#include
+// Katie
+#include
namespace KWin
{
diff --git a/libs/kworkspace/CMakeLists.txt b/libs/kworkspace/CMakeLists.txt
index c278c051..52ad72f2 100644
--- a/libs/kworkspace/CMakeLists.txt
+++ b/libs/kworkspace/CMakeLists.txt
@@ -17,12 +17,6 @@ qt4_add_dbus_interface(kworkspace_LIB_SRCS ${kwin_xml} kwin_interface)
add_library(kworkspace SHARED ${kworkspace_LIB_SRCS})
-target_link_libraries(kworkspace PRIVATE
- ${X11_Xau_LIB}
- ${X11_SM_LIB}
- ${X11_ICE_LIB}
-)
-
target_link_libraries(kworkspace PUBLIC
KDE4::kdeui
KDE4::plasma
diff --git a/libs/kworkspace/ktaskmanager.cpp b/libs/kworkspace/ktaskmanager.cpp
index caae00ac..d2499939 100644
--- a/libs/kworkspace/ktaskmanager.cpp
+++ b/libs/kworkspace/ktaskmanager.cpp
@@ -19,7 +19,6 @@
#include "ktaskmanager.h"
#include
-#include
#include
#include
#include
diff --git a/libs/kworkspace/kworkspace.cpp b/libs/kworkspace/kworkspace.cpp
index 4671ba8c..6b4b9022 100644
--- a/libs/kworkspace/kworkspace.cpp
+++ b/libs/kworkspace/kworkspace.cpp
@@ -21,174 +21,20 @@
#include "kdisplaymanager.h"
#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-
-#include // getenv()
-#include
-
-#ifdef Q_WS_X11
-#include
-#include
-#include
-#include
-#include
-#endif
-
-#ifdef Q_WS_X11
-#define DISPLAY "DISPLAY"
-#elif defined(Q_WS_QWS)
-#define DISPLAY "QWS_DISPLAY"
-#endif
-
-#include "kworkspace_p.h"
+#include "plasma_interface.h"
+#include "kworkspace.h"
namespace KWorkSpace
{
-#ifdef Q_WS_X11
-static void save_yourself_callback( SmcConn conn_P, SmPointer, int, Bool , int, Bool )
- {
- SmcSaveYourselfDone( conn_P, True );
- }
-
-static void dummy_callback( SmcConn, SmPointer )
- {
- }
-#endif
-KRequestShutdownHelper::KRequestShutdownHelper()
- {
-#ifdef Q_WS_X11
- SmcCallbacks calls;
- calls.save_yourself.callback = save_yourself_callback;
- calls.die.callback = dummy_callback;
- calls.save_complete.callback = dummy_callback;
- calls.shutdown_cancelled.callback = dummy_callback;
- char* id = NULL;
- char err[ 11 ];
- conn = SmcOpenConnection( NULL, NULL, 1, 0,
- SmcSaveYourselfProcMask | SmcDieProcMask | SmcSaveCompleteProcMask
- | SmcShutdownCancelledProcMask, &calls, NULL, &id, 10, err );
- if( id != NULL )
- free( id );
- if( conn == NULL )
- return; // no SM
- // set the required properties, mostly dummy values
- SmPropValue propvalue[ 5 ];
- SmProp props[ 5 ];
- propvalue[ 0 ].length = sizeof( unsigned char );
- unsigned char value0 = SmRestartNever; // so that this extra SM connection doesn't interfere
- propvalue[ 0 ].value = &value0;
- props[ 0 ].name = const_cast< char* >( SmRestartStyleHint );
- props[ 0 ].type = const_cast< char* >( SmCARD8 );
- props[ 0 ].num_vals = 1;
- props[ 0 ].vals = &propvalue[ 0 ];
- QByteArray username = KUser(KUser::UseEffectiveUID).loginName().toLocal8Bit();
- propvalue[ 1 ].length = username.size();
- propvalue[ 1 ].value = (SmPointer)( username.isEmpty() ? "" : username.data() );
- props[ 1 ].name = const_cast< char* >( SmUserID );
- props[ 1 ].type = const_cast< char* >( SmARRAY8 );
- props[ 1 ].num_vals = 1;
- props[ 1 ].vals = &propvalue[ 1 ];
- propvalue[ 2 ].length = 0;
- propvalue[ 2 ].value = (SmPointer)( "" );
- props[ 2 ].name = const_cast< char* >( SmRestartCommand );
- props[ 2 ].type = const_cast< char* >( SmLISTofARRAY8 );
- props[ 2 ].num_vals = 1;
- props[ 2 ].vals = &propvalue[ 2 ];
- propvalue[ 3 ].length = strlen( "requestshutdownhelper" );
- propvalue[ 3 ].value = (SmPointer)"requestshutdownhelper";
- props[ 3 ].name = const_cast< char* >( SmProgram );
- props[ 3 ].type = const_cast< char* >( SmARRAY8 );
- props[ 3 ].num_vals = 1;
- props[ 3 ].vals = &propvalue[ 3 ];
- propvalue[ 4 ].length = 0;
- propvalue[ 4 ].value = (SmPointer)( "" );
- props[ 4 ].name = const_cast< char* >( SmCloneCommand );
- props[ 4 ].type = const_cast< char* >( SmLISTofARRAY8 );
- props[ 4 ].num_vals = 1;
- props[ 4 ].vals = &propvalue[ 4 ];
- SmProp* p[ 5 ] = { &props[ 0 ], &props[ 1 ], &props[ 2 ], &props[ 3 ], &props[ 4 ] };
- SmcSetProperties( conn, 5, p );
- notifier = new QSocketNotifier( IceConnectionNumber( SmcGetIceConnection( conn )),
- QSocketNotifier::Read, this );
- connect( notifier, SIGNAL(activated(int)), SLOT(processData()));
-#endif
- }
-
-KRequestShutdownHelper::~KRequestShutdownHelper()
- {
-#ifdef Q_WS_X11
- if( conn != NULL )
- {
- delete notifier;
- SmcCloseConnection( conn, 0, NULL );
- }
-#endif
- }
-
-void KRequestShutdownHelper::processData()
- {
-#ifdef Q_WS_X11
- if( conn != NULL )
- IceProcessMessages( SmcGetIceConnection( conn ), 0, 0 );
-#endif
- }
-
-bool KRequestShutdownHelper::requestShutdown( ShutdownConfirm confirm )
- {
-#ifdef Q_WS_X11
- if( conn == NULL )
- return false;
- SmcRequestSaveYourself( conn, SmSaveBoth, True, SmInteractStyleAny,
- confirm == ShutdownConfirmNo, True );
- // flush the request
- IceFlush(SmcGetIceConnection(conn));
-#endif
- return true;
- }
-#ifdef Q_WS_X11
-static KRequestShutdownHelper* helper = NULL;
-
-static void cleanup_sm()
-{
- delete helper;
-}
-#endif
void requestShutDown(ShutdownConfirm confirm, ShutdownType sdtype)
{
-#ifdef Q_WS_X11
- /* use plasma's dcop interface if necessary */
- if ( confirm == ShutdownConfirmYes ||
- sdtype != ShutdownTypeDefault )
- {
- local::PlasmaApp plasma("org.kde.plasma-desktop", "/App", QDBusConnection::sessionBus());
- plasma.logout((int)confirm, (int)sdtype);
- return;
- }
-
- if( helper == NULL )
- {
- helper = new KRequestShutdownHelper();
- qAddPostRoutine(cleanup_sm);
- }
- helper->requestShutdown( confirm );
-#endif
+ local::PlasmaApp plasma("org.kde.plasma-desktop", "/App", QDBusConnection::sessionBus());
+ plasma.logout((int)confirm, (int)sdtype);
}
bool canShutDown( ShutdownConfirm confirm, ShutdownType sdtype )
{
-#ifdef Q_WS_X11
if ( confirm == ShutdownConfirmYes ||
sdtype != ShutdownTypeDefault )
{
@@ -196,11 +42,6 @@ bool canShutDown( ShutdownConfirm confirm, ShutdownType sdtype )
}
return true;
-#else
- return false;
-#endif
}
} // end namespace
-
-#include "moc_kworkspace_p.cpp"
diff --git a/libs/kworkspace/kworkspace_p.h b/libs/kworkspace/kworkspace_p.h
deleted file mode 100644
index 016a8b43..00000000
--- a/libs/kworkspace/kworkspace_p.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* This file is part of the KDE libraries
- Copyright (C) 2007 Lubos Lunak
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef KWORKSPACE_P_H
-#define KWORKSPACE_P_H
-
-
-#include "kworkspace.h"
-
-#include
-
-namespace KWorkSpace
-{
-
-// A class that creates another connection to plasma and handles it properly.
-class KRequestShutdownHelper
- : public QObject
- {
- Q_OBJECT
- public:
- KRequestShutdownHelper();
- virtual ~KRequestShutdownHelper();
- bool requestShutdown( ShutdownConfirm confirm );
- private slots:
- void processData();
- private:
-#ifdef Q_WS_X11
- SmcConn connection() const { return conn; }
- SmcConn conn;
-#endif
- QSocketNotifier* notifier;
- };
-
-}
-
-
-#endif