Commit 0a3e7a8c authored by Guido Gunther's avatar Guido Gunther

Add mutter-mock dbus mock

Just enough to make gsd-power start up
parent a26535f3
......@@ -26,9 +26,6 @@ using:
_build/run
If you want to test interaction with gnome-settings-daemon e.g. for brightness
start a session like:
gnome-session --session=gnome-dummy --disable-acceleration-check &
before running phosh.
This will make sure the gsettings schema is found, there's enough of a GNOME
session running an the some of the mutter DBus API is stubbed so
gnome-settings-manager can work.
#!/usr/bin/env python2
import dbus
import dbus.service
import dbus.mainloop.glib
import gobject
class Service(dbus.service.Object):
connector = 'HDMI-1'
resources = (1, # serial
[ # crtc
[
0, # serial
0, # winsys_id
0, 0, 768, 1024, # x, y, width, height
0, # current mode
0, # current transform (according to wayland proto
[0], # all possible transforms
{},
],
],
[ # outputs
[
0, # serial
0, # winsys_id
0, # current_crtc
[0], # possible_crtcs
connector, # connector
[1], # valid modes
[1], # valid clones
{'vendor': 'puri.sm'}, # properties
],
],
[ # modes
[
0, # serial
0, # XID
768, 1024, # width, height
60, # frequency
0, # flags
],
],
768, # max_width
10240, # max_height
)
def run(self):
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
bus_name = dbus.service.BusName("org.gnome.Mutter.DisplayConfig", dbus.SessionBus())
dbus.service.Object.__init__(self, bus_name, "/org/gnome/Mutter/DisplayConfig")
self._loop = gobject.MainLoop()
print("Mocking mutter DisplayConfig DBus API")
self._loop.run()
@dbus.service.method("org.gnome.Mutter.DisplayConfig",
in_signature='',
out_signature='ua(uxiiiiiuaua{sv})a(uxiausauaua{sv})a(uxuudu)ii')
def GetResources(self):
print("GetResouces called")
return self.resources
@dbus.service.method("org.freedesktop.DBus.Properties", in_signature='ssv', out_signature='')
def Set(self, s1, s2, v):
print("Set called with %s %s" % (s1, s2))
return
if __name__ == "__main__":
Service("This is the service").run()
#!/bin/bash
B=${1:-100}
dbus-send --session --type=method_call \
--dest="org.gnome.SettingsDaemon.Power" \
/org/gnome/SettingsDaemon/Power \
org.freedesktop.DBus.Properties.Set \
string:"org.gnome.SettingsDaemon.Power.Screen" \
string:"Brightness" \
variant:int32:${B}
#!/bin/sh
set -e
ABS_BUILDDIR='@ABS_BUILDDIR@'
# Start up gsd, etc.
if ! dbus-send --session --dest=org.freedesktop.DBus \
--type=method_call --print-reply /org/freedesktop/DBus \
org.freedesktop.DBus.ListNames \
| grep -qs '[o]rg\.gnome.Mutter\.DisplayConfig'; then
helpers/mutter-dbus-stub-mock.py &
fi
gnome-session --session=gnome-dummy --disable-acceleration-check &
export GSETTINGS_SCHEMA_DIR="${ABS_BUILDDIR}/data"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment