Commit 21ea2b5a authored by Georges Basile Stavracas Neto's avatar Georges Basile Stavracas Neto
Browse files

Initial commit

Copied from xdg-desktop-portal-gtk and stripped out of
everything not strictly GNOME specific.
parents
INSTALL
**/Makefile
Makefile.in
config.*
configure
configure~
depcomp
install-sh
libtool
ltmain.sh
m4
missing
stamp-h1
.deps
*.o
/aclocal.m4
autom4te.cache
compile
*.service
xdg-desktop-portal-gnome
.dirstamp
xdg-desktop-portal-dbus.[ch]
/ABOUT-NLS
/po/*.gmo
/po/*.header
/po/*.pot
/po/Makefile.in.in
/po/Makevars.template
/po/POTFILES
/po/Rules-quot
/po/boldquot.sed
/po/insert-header.sin
/po/quot.sed
/po/remove-potcdate.sed
/po/remove-potcdate.sin
/po/stamp-po
/src/resources.c
/src/shell-dbus.[ch]
/testappchooser
/xdg-desktop-portal-*.tar.xz
/xdg-desktop-portal-*/
/xdg-desktop-portal-gnome.desktop
This diff is collapsed.
SUBDIRS = po
BUILT_SOURCES =
CLEANFILES =
EXTRA_DIST =
include src/Makefile.am.inc
include data/Makefile.am.inc
Changes in 41.alpha
================
- Initial release
# xdg-desktop-portal-gnome
A backend implementation for [xdg-desktop-portal](http://github.com/flatpak/xdg-desktop-portal)
that is using GTK and various pieces of GNOME infrastructure, such as the
org.gnome.Shell.Screenshot or org.gnome.SessionManager D-Bus interfaces.
## Building xdg-desktop-portal-gnome
xdg-desktop-portal-gnome depends on xdg-desktop-portal and xdg-desktop-portal-gtk.
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
test -n "$srcdir" || srcdir=`dirname "$0"`
test -n "$srcdir" || srcdir=.
olddir=`pwd`
cd "$srcdir"
AUTORECONF=`which autoreconf`
if test -z $AUTORECONF; then
echo "*** No autoreconf found, please install it ***"
exit 1
fi
# INSTALL are required by automake, but may be deleted by clean
# up rules. to get automake to work, simply touch these here, they will be
# regenerated from their corresponding *.in files by ./configure anyway.
touch INSTALL
autoreconf --force --install --verbose || exit $?
cd "$olddir"
test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"
AC_PREREQ([2.63])
AC_INIT([xdg-desktop-portal-gnome],[41.alpha])
AC_PROG_CC
AM_PROG_CC_C_O
AC_DISABLE_STATIC
LT_PREREQ([2.2.6])
LT_INIT([disable-static])
AC_CONFIG_SRCDIR([src/xdg-desktop-portal-gnome.c])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([1.11 no-define no-dist-gzip dist-xz tar-ustar foreign subdir-objects])
AC_PROG_SED
# Enable silent rules is available
AM_SILENT_RULES([yes])
AM_MAINTAINER_MODE([enable])
if test "x$GCC" = "xyes"; then
case " $CFLAGS " in
*[[\ \ ]]-Wall[[\ \ ]]*) ;;
*) CFLAGS="$CFLAGS -Wall" ;;
esac
fi
# i18n stuff
GETTEXT_PACKAGE=xdg-desktop-portal-gnome
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",
[The prefix for our gettext translation domains.])
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION(0.18.3)
PKG_PROG_PKG_CONFIG([0.24])
AC_ARG_WITH(dbus_service_dir,
AS_HELP_STRING([--with-dbus-service-dir=PATH],[choose directory for dbus service files, [default=PREFIX/share/dbus-1/services]]),
with_dbus_service_dir="$withval", with_dbus_service_dir=$datadir/dbus-1/services)
DBUS_SERVICE_DIR=$with_dbus_service_dir
AC_SUBST(DBUS_SERVICE_DIR)
AC_ARG_WITH([systemduserunitdir],
[AS_HELP_STRING([--with-systemduserunitdir=DIR],
[Directory for systemd user service files (default=PREFIX/lib/systemd/user)])],
[],
dnl This is deliberately not ${libdir}: systemd units always go in
dnl .../lib, never .../lib64 or .../lib/x86_64-linux-gnu
[with_systemduserunitdir='${prefix}/lib/systemd/user'])
AC_SUBST([systemduserunitdir], [$with_systemduserunitdir])
AC_SUBST([DESKTOP_PORTAL_INTERFACES_DIR], [`$PKG_CONFIG --variable=interfaces_dir xdg-desktop-portal`])
AC_SUBST([DBUS_INTERFACES_DIR], [`$PKG_CONFIG --variable=interfaces_dir dbus-1`])
AC_SUBST([GDBUS_CODEGEN], [`$PKG_CONFIG --variable gdbus_codegen gio-2.0`])
AC_SUBST([GLIB_COMPILE_RESOURCES], [`$PKG_CONFIG --variable glib_compile_resources gio-2.0`])
PKG_CHECK_MODULES(GTK, [xdg-desktop-portal >= 1.5 glib-2.0 >= 2.44 gio-unix-2.0 gtk+-3.0 >= 3.14 gtk+-unix-print-3.0 fontconfig gnome-desktop-3.0 gsettings-desktop-schemas])
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)
PKG_CHECK_MODULES(GTK_X11, gtk+-x11-3.0,
have_gtk_x11=yes, have_gtk_x11=no)
if test "$have_gtk_x11" = "yes"; then
AC_DEFINE(HAVE_GTK_X11, 1, [define if we we have gtk+-x11])
AC_SUBST(GTK_X11_CFLAGS)
AC_SUBST(GTK_X11_LIBS)
fi
AM_CONDITIONAL([HAVE_GTK_X11], [test "$have_gtk_x11" = "yes"])
PKG_CHECK_MODULES(GTK_WAYLAND, gtk+-wayland-3.0 >= 3.21.5,
have_gtk_wayland=yes, have_gtk_wayland=no)
if test "$have_gtk_wayland" = "yes"; then
AC_DEFINE(HAVE_GTK_WAYLAND, 1, [define if we we have gtk+-wayland])
AC_SUBST(GTK_WAYLAND_CFLAGS)
AC_SUBST(GTK_WAYLAND_LIBS)
fi
AM_CONDITIONAL([HAVE_GTK_WAYLAND], [test "$have_gtk_wayland" = "yes"])
AC_CONFIG_FILES([
Makefile
po/Makefile.in
])
AC_OUTPUT
portaldir = $(datadir)/xdg-desktop-portal/portals
dist_portal_DATA = data/gnome.portal
%.service: data/%.service.in config.log
$(AM_V_GEN) $(SED) -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@
dbus_servicedir = $(DBUS_SERVICE_DIR)
dbus_service_in_files = data/org.freedesktop.impl.portal.desktop.gnome.service.in
dbus_service_DATA = org.freedesktop.impl.portal.desktop.gnome.service
CLEANFILES += $(dbus_service_DATA)
systemduserunit_in_files = data/xdg-desktop-portal-gnome.service.in
systemduserunit_DATA = xdg-desktop-portal-gnome.service
CLEANFILES += $(systemduserunit_DATA)
%.desktop.in: data/%.desktop.in.in
$(AM_V_GEN) msgfmt --desktop -d po --template $< -o $@
%.desktop: %.desktop.in
$(AM_V_GEN) $(SED) -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@
desktopdir = $(datadir)/applications
desktop_in_in_files = data/xdg-desktop-portal-gnome.desktop.in.in
desktop_in_files = xdg-desktop-portal-gnome.desktop.in
desktop_DATA = xdg-desktop-portal-gnome.desktop
CLEANFILES += \
$(desktop_in_files) \
$(desktop_DATA) \
$(NULL)
EXTRA_DIST += \
$(dbus_service_in_files) \
$(systemduserunit_in_files) \
$(desktop_in_in_files) \
data/org.gnome.Mutter.DisplayConfig.xml \
data/org.gnome.Mutter.ScreenCast.xml \
data/org.gnome.Mutter.RemoteDesktop.xml \
data/org.gnome.Shell.Introspect.xml \
data/org.gnome.Shell.Screenshot.xml \
$(NULL)
[portal]
DBusName=org.freedesktop.impl.portal.desktop.gnome
Interfaces=org.freedesktop.impl.portal.AppChooser;org.freedesktop.impl.portal.Screenshot;org.freedesktop.impl.portal.ScreenCast;org.freedesktop.impl.portal.RemoteDesktop;org.freedesktop.impl.portal.Lockdown;org.freedesktop.impl.portal.Background;org.freedesktop.impl.portal.Settings;org.freedesktop.impl.portal.Wallpaper;
UseIn=gnome
[D-BUS Service]
Name=org.freedesktop.impl.portal.desktop.gnome
Exec=@libexecdir@/xdg-desktop-portal-gnome
SystemdService=xdg-desktop-portal-gnome.service
<!DOCTYPE node PUBLIC
'-//freedesktop//DTD D-BUS Object Introspection 1.0//EN'
'http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd'>
<node>
<!--
org.gnome.Mutter.DisplayConfig:
@short_description: display configuration interface
This interface is used by mutter and gnome-settings-daemon
to apply multiple monitor configuration.
-->
<interface name="org.gnome.Mutter.DisplayConfig">
<!--
GetResources:
@serial: configuration serial
@crtcs: available CRTCs
@outputs: available outputs
@modes: available modes
@max_screen_width:
@max_screen_height:
Retrieves the current layout of the hardware.
@serial is an unique identifier representing the current state
of the screen. It must be passed back to ApplyConfiguration()
and will be increased for every configuration change (so that
mutter can detect that the new configuration is based on old
state).
A CRTC (CRT controller) is a logical monitor, ie a portion
of the compositor coordinate space. It might correspond
to multiple monitors, when in clone mode, but not that
it is possible to implement clone mode also by setting different
CRTCs to the same coordinates.
The number of CRTCs represent the maximum number of monitors
that can be set to expand and it is a HW constraint; if more
monitors are connected, then necessarily some will clone. This
is complementary to the concept of the encoder (not exposed in
the API), which groups outputs that necessarily will show the
same image (again a HW constraint).
A CRTC is represented by a DBus structure with the following
layout:
* u ID: the ID in the API of this CRTC
* x winsys_id: the low-level ID of this CRTC (which might
be a XID, a KMS handle or something entirely
different)
* i x, y, width, height: the geometry of this CRTC
(might be invalid if the CRTC is not in
use)
* i current_mode: the current mode of the CRTC, or -1 if this
CRTC is not used
Note: the size of the mode will always correspond
to the width and height of the CRTC
* u current_transform: the current transform (espressed according
to the wayland protocol)
* au transforms: all possible transforms
* a{sv} properties: other high-level properties that affect this
CRTC; they are not necessarily reflected in
the hardware.
No property is specified in this version of the API.
Note: all geometry information refers to the untransformed
display.
An output represents a physical screen, connected somewhere to
the computer. Floating connectors are not exposed in the API.
An output is a DBus struct with the following fields:
* u ID: the ID in the API
* x winsys_id: the low-level ID of this output (XID or KMS handle)
* i current_crtc: the CRTC that is currently driving this output,
or -1 if the output is disabled
* au possible_crtcs: all CRTCs that can control this output
* s name: the name of the connector to which the output is attached
(like VGA1 or HDMI)
* au modes: valid modes for this output
* au clones: valid clones for this output, ie other outputs that
can be assigned the same CRTC as this one; if you
want to mirror two outputs that don't have each other
in the clone list, you must configure two different
CRTCs for the same geometry
* a{sv} properties: other high-level properties that affect this
output; they are not necessarily reflected in
the hardware.
Known properties:
- "vendor" (s): (readonly) the human readable name
of the manufacturer
- "product" (s): (readonly) the human readable name
of the display model
- "serial" (s): (readonly) the serial number of this
particular hardware part
- "display-name" (s): (readonly) a human readable name
of this output, to be shown in the UI
- "backlight" (i): (readonly, use the specific interface)
the backlight value as a percentage
(-1 if not supported)
- "primary" (b): whether this output is primary
or not
- "presentation" (b): whether this output is
for presentation only
Note: properties might be ignored if not consistenly
applied to all outputs in the same clone group. In
general, it's expected that presentation or primary
outputs will not be cloned.
A mode represents a set of parameters that are applied to
each output, such as resolution and refresh rate. It is a separate
object so that it can be referenced by CRTCs and outputs.
Multiple outputs in the same CRTCs must all have the same mode.
A mode is exposed as:
* u ID: the ID in the API
* x winsys_id: the low-level ID of this mode
* u width, height: the resolution
* d frequency: refresh rate
* u flags: mode flags as defined in xf86drmMode.h and randr.h
Output and modes are read-only objects (except for output properties),
they can change only in accordance to HW changes (such as hotplugging
a monitor), while CRTCs can be changed with ApplyConfiguration().
XXX: actually, if you insist enough, you can add new modes
through xrandr command line or the KMS API, overriding what the
kernel driver and the EDID say.
Usually, it only matters with old cards with broken drivers, or
old monitors with broken EDIDs, but it happens more often with
projectors (if for example the kernel driver doesn't add the
640x480 - 800x600 - 1024x768 default modes). Probably something
that we need to handle in mutter anyway.
-->
<method name="GetResources">
<arg name="serial" direction="out" type="u" />
<arg name="crtcs" direction="out" type="a(uxiiiiiuaua{sv})" />
<arg name="outputs" direction="out" type="a(uxiausauaua{sv})" />
<arg name="modes" direction="out" type="a(uxuudu)" />
<arg name="max_screen_width" direction="out" type="i" />
<arg name="max_screen_height" direction="out" type="i" />
</method>
<!--
ApplyConfiguration:
@serial: configuration serial
@persistent: whether this configuration should be saved on disk
@crtcs: new data for CRTCs
@outputs: new data for outputs
Applies the requested configuration changes.
@serial must match the serial from the last GetResources() call,
or org.freedesktop.DBus.AccessDenied will be generated.
If @persistent is true, mutter will attempt to replicate this
configuration the next time this HW layout appears.
@crtcs represents the new logical configuration, as a list
of structures containing:
- u ID: the API ID from the corresponding GetResources() call
- i new_mode: the API ID of the new mode to configure the CRTC
with, or -1 if the CRTC should be disabled
- i x, y: the new coordinates of the top left corner
the geometry will be completed with the size information
from @new_mode
- u transform: the desired transform
- au outputs: the API ID of outputs that should be assigned to
this CRTC
- a{sv} properties: properties whose value should be changed
Note: CRTCs not referenced in the array will be disabled.
@outputs represent the output property changes as:
- u ID: the API ID of the output to change
- a{sv} properties: properties whose value should be changed
Note: both for CRTCs and outputs, properties not included in
the dictionary will not be changed.
Note: unrecognized properties will have no effect, but if the
configuration change succeeds the property will be reported
by the next GetResources() call, and if @persistent is true,
it will also be saved to disk.
If the configuration is invalid according to the previous
GetResources() call, for example because a CRTC references
an output it cannot drive, or not all outputs support the
chosen mode, the error org.freedesktop.DBus.InvalidArgs will
be generated.
If the configuration cannot be applied for any other reason
(eg. the screen size would exceed texture limits), the error
org.freedesktop.DBus.Error.LimitsExceeded will be generated.
-->
<method name="ApplyConfiguration">
<arg name="serial" direction="in" type="u" />
<arg name="persistent" direction="in" type="b" />
<arg name="crtcs" direction="in" type="a(uiiiuaua{sv})" />
<arg name="outputs" direction="in" type="a(ua{sv})" />
</method>
<!--
ChangeBacklight:
@serial: configuration serial
@output: the API id of the output
@value: the new backlight value
Changes the backlight of @output to @value, which is
expressed as a percentage and rounded to the HW limits.
Returns the new value after rounding.
-->
<method name="ChangeBacklight">
<arg name="serial" direction="in" type="u" />
<arg name="output" direction="in" type="u" />
<arg name="value" direction="in" type="i" />
<arg name="new_value" direction="out" type="i" />
</method>
<!--
GetCrtcGamma:
@serial: configuration serial
@crtc: API id of the crtc
@red: red gamma ramp
@green: green gamma ramp
@blue: blue gamma ramp
Requests the current gamma ramps of @crtc.
-->
<method name="GetCrtcGamma">
<arg name="serial" direction="in" type="u" />
<arg name="crtc" direction="in" type="u" />
<arg name="red" direction="out" type="aq" />
<arg name="green" direction="out" type="aq" />
<arg name="blue" direction="out" type="aq" />
</method>
<!--
SetCrtcGamma:
@serial: configuration serial
@crtc: API id of the crtc
@red: red gamma ramp
@green: green gamma ramp
@blue: blue gamma ramp
Changes the gamma ramps of @crtc.
-->
<method name="SetCrtcGamma">
<arg name="serial" direction="in" type="u" />
<arg name="crtc" direction="in" type="u" />
<arg name="red" direction="in" type="aq" />
<arg name="green" direction="in" type="aq" />
<arg name="blue" direction="in" type="aq" />
</method>
<!--
PowerSaveMode:
Contains the current power saving mode for the screen, and
allows changing it.
Possible values:
- 0: on
- 1: standby
- 2: suspend
- 3: off
- -1: unknown (unsupported)
A client should not attempt to change the powersave mode
from -1 (unknown) to any other value, and viceversa.
Note that the actual effects of the different values
depend on the hardware and the kernel driver in use, and
it's perfectly possible that all values different than on
have the same effect.
Also, setting the PowerSaveMode to 3 (off) may or may
not have the same effect as disabling all outputs by
setting no CRTC on them with ApplyConfiguration(), and
may or may not cause a configuration change.
Also note that this property might become out of date
if changed through different means (for example using the
XRandR interface directly).
-->
<property name="PowerSaveMode" type="i" access="readwrite" />
<!--
MonitorsChanged:
The signal is emitted every time the screen configuration
changes.
The client should then call GetResources() to read the new layout.
-->
<signal name="MonitorsChanged" />
<!--
GetCurrentState:
@serial: configuration serial
@monitors: available monitors
@logical_monitors: current logical monitor configuration
@properties: display configuration properties
@monitors represent connected physical monitors
* s connector: connector name (e.g. HDMI-1, DP-1, etc)
* s vendor: vendor name
* s product: product name
* s serial: product serial
* a(siiddada{sv}) modes: available modes
* s id: mode ID
* i width: width in physical pixels
* i height: height in physical pixels
* d refresh rate: refresh rate
* d preferred scale: scale preferred as per calculations
* ad supported scales: scales supported by this mode
* a{sv} properties: optional properties, including:
- "is-current" (b): the mode is currently active mode
- "is-preferred" (b): the mode is the preferred mode
- "is-interlaced" (b): the mode is an interlaced mode
* a{sv} properties: optional properties, including:
- "width-mm" (i): physical width of monitor in millimeters
- "height-mm" (i): physical height of monitor in millimeters
- "is-underscanning" (b): whether underscanning is enabled
(absence of this means underscanning
not being supported)
- "max-screen-size" (ii): the maximum size a screen may have
(absence of this means unlimited screen
size)
- "is-builtin" (b): whether the monitor is built in, e.g. a
laptop panel (absence of this means it is
not built in)
- "display-name" (s): a human readable display name of the monitor
Possible mode flags:
1 : preferred mode
2 : current mode
@logical_monitors represent current logical monitor configuration
* i x: x position
* i y: y position
* d scale: scale
* u transform: transform (see below)
* b primary: true if this is the primary logical monitor
* a(sss) monitors: monitors displaying this logical monitor
* connector: name of the connector (e.g. DP-1, eDP-1 etc)
* vendor: vendor name
* product: product name
* serial: product serial
* a{sv} properties: possibly other properties
Posisble transform values:
0: normal
1: 90°
2: 180°
3: 270°
4: flipped
5: 90° flipped
6: 180° flipped
7: 270° flipped
@layout_mode current layout mode represents the way logical monitors
are layed out on the screen. Possible modes include:
1 : physical
2 : logical
With physical layout mode, each logical monitor has the same dimensions
an the monitor modes of the associated monitors assigned to it, no
matter what scale is in use.
With logical mode, the dimension of a logical monitor is the dimension
of the monitor mode, divided by the logical monitor scale.
Possible @properties are:
* "supports-mirroring" (b): FALSE if mirroring not supported; TRUE or not
present if mirroring is supported.
* "layout-mode" (u): Represents in what way logical monitors are laid
out on the screen. The layout mode can be either
of the ones listed below. Absence of this property
means the layout mode cannot be changed, and that
"logical" mode is assumed to be used.
* 1 : logical - the dimension of a logical monitor is derived from
the monitor modes associated with it, then scaled
using the logical monitor scale.
* 2 : physical - the dimension of a logical monitor is derived from
the monitor modes associated with it.
* "supports-changing-layout-mode" (b): True if the layout mode can be
changed. Absence of this means the
layout mode cannot be changed.
* "global-scale-required" (b): True if all the logical monitors must