Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Unmaintained
KDE Workspace
Commits
59d1104d
Commit
59d1104d
authored
Dec 30, 2012
by
Thomas Lübking
Browse files
fix dbus service registration/invocation
REVIEW: 108016
parent
7ab26e35
Changes
3
Hide whitespace changes
Inline
Side-by-side
kwin/dbusinterface.cpp
View file @
59d1104d
...
...
@@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// own
#include
"dbusinterface.h"
// kwin
// TODO: remove together with deprecated methods
#include
"client.h"
...
...
@@ -28,6 +29,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include
"kwinadaptor.h"
#include
"workspace.h"
// Qt
#include
<QDBusServiceWatcher>
namespace
KWin
{
...
...
@@ -38,7 +42,10 @@ DBusInterface::DBusInterface(QObject *parent)
QDBusConnection
dbus
=
QDBusConnection
::
sessionBus
();
dbus
.
registerObject
(
"/KWin"
,
this
);
dbus
.
registerService
(
"org.kde.KWin"
);
if
(
!
dbus
.
registerService
(
"org.kde.KWin"
))
{
QDBusServiceWatcher
*
dog
=
new
QDBusServiceWatcher
(
"org.kde.KWin"
,
dbus
,
QDBusServiceWatcher
::
WatchForUnregistration
,
this
);
connect
(
dog
,
SIGNAL
(
serviceUnregistered
(
const
QString
&
)),
SLOT
(
becomeKWinService
(
const
QString
&
)));
}
connect
(
Compositor
::
self
(),
SIGNAL
(
compositingToggled
(
bool
)),
SIGNAL
(
compositingToggled
(
bool
)));
dbus
.
connect
(
QString
(),
"/KWin"
,
"org.kde.KWin"
,
"reloadConfig"
,
Workspace
::
self
(),
SLOT
(
slotReloadConfig
()));
...
...
@@ -46,8 +53,20 @@ DBusInterface::DBusInterface(QObject *parent)
Compositor
::
self
(),
SLOT
(
slotReinitialize
()));
}
void
DBusInterface
::
becomeKWinService
(
const
QString
&
service
)
{
// TODO: this watchdog exists to make really safe that we at some point get the service
// but it's probably no longer needed since we explicitly unregister the service with the deconstructor
if
(
service
==
"org.kde.KWin"
&&
QDBusConnection
::
sessionBus
().
registerService
(
"org.kde.KWin"
)
&&
sender
())
{
sender
()
->
deleteLater
();
// bye doggy :'(
}
}
DBusInterface
::~
DBusInterface
()
{
QDBusConnection
::
sessionBus
().
unregisterService
(
"org.kde.KWin"
);
// this is the long standing legal service
// KApplication automatically also grabs org.kde.kwin, so it's often been used externally - ensure to free it as well
QDBusConnection
::
sessionBus
().
unregisterService
(
"org.kde.kwin"
);
}
void
DBusInterface
::
circulateDesktopApplications
()
...
...
kwin/dbusinterface.h
View file @
59d1104d
...
...
@@ -147,6 +147,8 @@ Q_SIGNALS: // SIGNALS
* @deprecated
**/
void
compositingToggled
(
bool
active
);
private
Q_SLOTS
:
void
becomeKWinService
(
const
QString
&
service
);
};
}
// namespace
...
...
kwin/kcmkwin/kwincompositing/main.cpp
View file @
59d1104d
...
...
@@ -196,7 +196,7 @@ void KWinCompositingConfig::showConfirmDialog(bool reinitCompositing)
bool
revert
=
false
;
// Feel free to extend this to support several kwin instances (multihead) if you
// think it makes sense.
OrgKdeKWinInterface
kwin
(
"org.kde.
kw
in"
,
"/KWin"
,
QDBusConnection
::
sessionBus
());
OrgKdeKWinInterface
kwin
(
"org.kde.
KW
in"
,
"/KWin"
,
QDBusConnection
::
sessionBus
());
if
(
reinitCompositing
?
!
kwin
.
compositingActive
().
value
()
:
!
kwin
.
waitForCompositingSetup
().
value
())
{
KMessageBox
::
sorry
(
this
,
i18n
(
"Failed to activate desktop effects using the given "
...
...
@@ -399,7 +399,7 @@ void KWinCompositingConfig::updateStatusUI(bool compositingIsPossible)
ui
.
rearmGlSupport
->
hide
();
}
else
{
OrgKdeKWinInterface
kwin
(
"org.kde.
kw
in"
,
"/KWin"
,
QDBusConnection
::
sessionBus
());
OrgKdeKWinInterface
kwin
(
"org.kde.
KW
in"
,
"/KWin"
,
QDBusConnection
::
sessionBus
());
ui
.
compositingOptionsContainer
->
hide
();
QString
text
=
i18n
(
"Desktop effects are not available on this system due to the following technical issues:"
);
text
+=
"<hr>"
;
...
...
@@ -416,7 +416,7 @@ void KWinCompositingConfig::load()
{
initEffectSelector
();
mKWinConfig
->
reparseConfiguration
();
QDBusMessage
msg
=
QDBusMessage
::
createMethodCall
(
"org.kde.
kw
in"
,
"/KWin"
,
"org.kde.KWin"
,
"compositingPossible"
);
QDBusMessage
msg
=
QDBusMessage
::
createMethodCall
(
"org.kde.
KW
in"
,
"/KWin"
,
"org.kde.KWin"
,
"compositingPossible"
);
QDBusConnection
::
sessionBus
().
callWithCallback
(
msg
,
this
,
SLOT
(
updateStatusUI
(
bool
)));
// Copy Plugins group to temp config file
...
...
@@ -527,7 +527,7 @@ bool KWinCompositingConfig::saveAdvancedTab()
void
KWinCompositingConfig
::
save
()
{
OrgKdeKWinInterface
kwin
(
"org.kde.
kw
in"
,
"/KWin"
,
QDBusConnection
::
sessionBus
());
OrgKdeKWinInterface
kwin
(
"org.kde.
KW
in"
,
"/KWin"
,
QDBusConnection
::
sessionBus
());
if
(
ui
.
compositingType
->
currentIndex
()
==
OPENGL_INDEX
&&
kwin
.
openGLIsBroken
()
&&
!
ui
.
rearmGlSupport
->
isVisible
())
{
...
...
@@ -595,7 +595,7 @@ void KWinCompositingConfig::checkLoadedEffects()
{
// check for effects not supported by Backend or hardware
// such effects are enabled but not returned by DBus method loadedEffects
OrgKdeKWinInterface
kwin
(
"org.kde.
kw
in"
,
"/KWin"
,
QDBusConnection
::
sessionBus
());
OrgKdeKWinInterface
kwin
(
"org.kde.
KW
in"
,
"/KWin"
,
QDBusConnection
::
sessionBus
());
KConfigGroup
effectConfig
=
KConfigGroup
(
mKWinConfig
,
"Compositing"
);
bool
enabledAfter
=
effectConfig
.
readEntry
(
"Enabled"
,
true
);
...
...
@@ -626,7 +626,7 @@ void KWinCompositingConfig::checkLoadedEffects()
void
KWinCompositingConfig
::
showDetailedEffectLoadingInformation
()
{
QStringList
disabledEffects
=
m_showDetailedErrors
->
data
().
toStringList
();
OrgKdeKWinInterface
kwin
(
"org.kde.
kw
in"
,
"/KWin"
,
QDBusConnection
::
sessionBus
());
OrgKdeKWinInterface
kwin
(
"org.kde.
KW
in"
,
"/KWin"
,
QDBusConnection
::
sessionBus
());
QDBusPendingReply
<
QString
>
pendingCompositingType
=
kwin
.
compositingType
();
QString
compositingType
=
pendingCompositingType
.
isError
()
?
"none"
:
pendingCompositingType
.
value
();
KServiceTypeTrader
*
trader
=
KServiceTypeTrader
::
self
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment