Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Librem5
virtboard
Commits
9389d0e2
Commit
9389d0e2
authored
Sep 13, 2018
by
Dorota Czaplejewicz
Browse files
Register in GNOME session manager
parent
e80f8789
Pipeline
#1067
passed with stage
in 1 minute and 40 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
9389d0e2
variables
:
DEPS
:
debhelper meson pkg-config libpixman-1-dev libpng-dev libxcb1-dev
DEPS
:
debhelper meson pkg-config
libglib2.0-dev
libpixman-1-dev libpng-dev libxcb1-dev
libxcb-xkb-dev libxkbcommon-dev libcairo2-dev libwayland-dev
wayland-protocols
...
...
clients/keyboard.c
View file @
9389d0e2
...
...
@@ -27,6 +27,7 @@
#include
"config.h"
#include
<gio/gio.h>
#include
<fcntl.h>
#include
<stdbool.h>
#include
<stdint.h>
...
...
@@ -308,6 +309,8 @@ struct size {
double
height
;
};
static
GDBusProxy
*
_proxy
;
static
void
__attribute__
((
format
(
printf
,
1
,
2
)))
dbg
(
const
char
*
fmt
,
...)
{
...
...
@@ -1123,6 +1126,35 @@ handle_output_changed(struct output *output, void *data)
}
}
void
session_register
()
{
char
*
autostart_id
=
getenv
(
"DESKTOP_AUTOSTART_ID"
);
if
(
!
autostart_id
)
{
dbg
(
"No autostart requested"
);
autostart_id
=
""
;
}
GError
*
error
=
NULL
;
_proxy
=
g_dbus_proxy_new_for_bus_sync
(
G_BUS_TYPE_SESSION
,
G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START
,
NULL
,
"org.gnome.SessionManager"
,
"/org/gnome/SessionManager"
,
"org.gnome.SessionManager"
,
NULL
,
&
error
);
if
(
error
)
{
fprintf
(
stderr
,
"Could not connect to session manager: %s"
,
error
->
message
);
g_clear_error
(
&
error
);
return
;
}
// No glib main loop, so synchronous call is *much* easier to use.
g_dbus_proxy_call_sync
(
_proxy
,
"RegisterClient"
,
g_variant_new
(
"(ss)"
,
"sm.puri.Virtboard"
,
autostart_id
),
G_DBUS_CALL_FLAGS_NONE
,
1000
,
NULL
,
&
error
);
if
(
error
)
{
fprintf
(
stderr
,
"Could not register to session manager: %s"
,
error
->
message
);
g_clear_error
(
&
error
);
return
;
}
}
int
main
(
int
argc
,
char
*
argv
[])
{
...
...
@@ -1168,6 +1200,8 @@ main(int argc, char *argv[])
make_virtual_keyboard
(
&
virtual_keyboard
);
keyboard_create
(
&
virtual_keyboard
);
session_register
();
display_run
(
virtual_keyboard
.
display
);
return
0
;
...
...
debian/control
View file @
9389d0e2
...
...
@@ -6,6 +6,7 @@ Build-Depends:
debhelper (>= 10),
meson (>=0.43.0),
pkg-config,
libglib2.0-dev,
libpixman-1-dev (>= 0.25.2),
libpng-dev,
libxcb1-dev,
...
...
meson.build
View file @
9389d0e2
...
...
@@ -20,6 +20,7 @@ cairo = dependency('cairo')
math = cc.find_library('m', required: false)
pixman = dependency('pixman-1')
png = dependency('libpng')
gio = dependency('gio-2.0')
wl_protocol_dir = wayland_protos.get_pkgconfig_variable('pkgdatadir')
...
...
@@ -85,7 +86,7 @@ add_global_arguments('-DLIBEXECDIR=""', language : 'c')
add_global_arguments('-DDATADIR=""', language : 'c')
executable(
'virtboard', sources, dependencies: [png, math, pixman, wayland_cursor, wayland_client, wayland_protos, xkbcommon, cairo], install: true,
'virtboard', sources, dependencies: [png, math, pixman, wayland_cursor, wayland_client, wayland_protos, xkbcommon, cairo
, gio
], install: true,
)
prefix = get_option('prefix')
...
...
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