Skip to content

Commit 2781c11

Browse files
author
Corentin Noël
authored
Add initial support for Mutter 41 (#562)
1 parent e55cfad commit 2781c11

20 files changed

+819
-30
lines changed

compositor/WindowManager.vala

+9-2
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,15 @@ namespace GreeterCompositor {
148148

149149
stage.show ();
150150

151-
// let the session manager move to the next phase
152-
Meta.register_with_session ();
151+
Idle.add (() => {
152+
// let the session manager move to the next phase
153+
#if HAS_MUTTER41
154+
display.get_context ().notify_ready ();
155+
#else
156+
Meta.register_with_session ();
157+
#endif
158+
return GLib.Source.REMOVE;
159+
});
153160
}
154161

155162
public uint32[] get_all_xids () {

compositor/main.vala

+42
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,19 @@ namespace GreeterCompositor {
2828
}
2929

3030
public static int main (string[] args) {
31+
32+
#if HAS_MUTTER41
33+
var ctx = new Meta.Context ("Mutter(GreeterCompositor)");
34+
ctx.add_option_entries (GreeterCompositor.OPTIONS, Constants.GETTEXT_PACKAGE);
35+
try {
36+
ctx.configure (ref args);
37+
} catch (Error e) {
38+
stderr.printf ("Error initializing: %s\n", e.message);
39+
return Posix.EXIT_FAILURE;
40+
}
41+
42+
ctx.set_plugin_gtype (typeof (GreeterCompositor.WindowManager));
43+
#else
3144
unowned OptionContext ctx = Meta.get_option_context ();
3245
ctx.add_main_entries (GreeterCompositor.OPTIONS, null);
3346
try {
@@ -40,7 +53,17 @@ namespace GreeterCompositor {
4053
Meta.Plugin.manager_set_plugin_type (typeof (GreeterCompositor.WindowManager));
4154

4255
Meta.Util.set_wm_name ("Mutter(GreeterCompositor)");
56+
#endif
57+
4358

59+
#if HAS_MUTTER41
60+
try {
61+
ctx.setup ();
62+
} catch (Error e) {
63+
stderr.printf ("Failed to setup: %s\n", e.message);
64+
return Posix.EXIT_FAILURE;
65+
}
66+
#else
4467
/**
4568
* Prevent Meta.init () from causing gtk to load gail and at-bridge
4669
* Taken from Gnome-Shell main.c
@@ -50,8 +73,27 @@ namespace GreeterCompositor {
5073
Meta.init ();
5174
GLib.Environment.unset_variable ("NO_GAIL");
5275
GLib.Environment.unset_variable ("NO_AT_BRIDGE");
76+
#endif
5377

5478
typeof (GreeterCompositor.Utils).class_ref ();
79+
#if HAS_MUTTER41
80+
try {
81+
ctx.start ();
82+
} catch (Error e) {
83+
stderr.printf ("Failed to start: %s\n", e.message);
84+
return Posix.EXIT_FAILURE;
85+
}
86+
87+
try {
88+
ctx.run_main_loop ();
89+
} catch (Error e) {
90+
stderr.printf ("Greeter Compositor terminated with a failure: %s\n", e.message);
91+
return Posix.EXIT_FAILURE;
92+
}
93+
94+
return Posix.EXIT_SUCCESS;
95+
#else
5596
return Meta.run ();
97+
#endif
5698
}
5799
}

compositor/meson.build

+13-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ glib_dep = [dependency('gio-2.0'), dependency('gio-unix-2.0'), dependency('gmodu
44
gtk_dep = [dependency('gtk+-3.0'), dependency('gdk-x11-3.0')]
55
gee_dep = dependency('gee-0.8')
66
m_dep = meson.get_compiler('c').find_library('m', required: false)
7+
posix_dep = meson.get_compiler('vala').find_library('posix', required: false)
78

89
# Mutter is a complicated library with many API changes, copied from Gala.
910
mutter_dep = []
@@ -46,6 +47,17 @@ if mutter40_dep.found()
4647
vala_flags = ['--define', 'HAS_MUTTER338', '--define', 'HAS_MUTTER40']
4748
endif
4849

50+
mutter41_dep = dependency('libmutter-9', version: ['>= 41', '< 42'], required: false)
51+
if mutter41_dep.found()
52+
libmutter_dep = dependency('libmutter-9', version: '>= 41')
53+
mutter_dep = [
54+
libmutter_dep,
55+
dependency('mutter-cogl-9'), dependency('mutter-cogl-pango-9'),
56+
dependency('mutter-clutter-9')
57+
]
58+
vala_flags = ['--define', 'HAS_MUTTER338', '--define', 'HAS_MUTTER40', '--define', 'HAS_MUTTER41']
59+
endif
60+
4961
if mutter_dep.length() == 0
5062
error ('No supported mutter library found!')
5163
endif
@@ -69,7 +81,7 @@ executable(
6981
compositor_files,
7082
compositor_resources,
7183
config_header,
72-
dependencies: [glib_dep, gtk_dep, gee_dep, m_dep, mutter_dep],
84+
dependencies: [glib_dep, gtk_dep, gee_dep, m_dep, posix_dep, mutter_dep],
7385
vala_args: vala_flags,
7486
c_args: compositor_c_args,
7587
build_rpath: mutter_typelib_dir,

src/config.vala.in config.vala.in

File renamed without changes.

meson.build

+20
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,26 @@ project(
88
gnome = import('gnome')
99
i18n = import('i18n')
1010

11+
conf_data = configuration_data()
12+
conf_data.set('CONF_DIR', join_paths(get_option('sysconfdir'), 'lightdm'))
13+
conf_data.set('GETTEXT_PACKAGE', meson.project_name())
14+
conf_data.set('LOCALE_DIR', join_paths(get_option('prefix'), get_option('localedir')))
15+
16+
gsd_dir = get_option('gsd-dir')
17+
18+
if gsd_dir == ''
19+
gsd_dir = join_paths(get_option('prefix'), get_option('libexecdir') + '/')
20+
endif
21+
22+
message('Path to gnome-settings-daemon: ' + gsd_dir)
23+
24+
conf_data.set('GSD_DIR', gsd_dir)
25+
conf_data.set('VERSION', meson.project_version())
26+
config_header = configure_file (
27+
input: 'config.vala.in',
28+
output: 'config.vala',
29+
configuration: conf_data
30+
)
1131

1232
add_project_arguments(['--vapidir', join_paths(meson.current_source_dir(), 'vapi')], language: 'vala')
1333

src/meson.build

-21
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,6 @@ lightdm_dep = dependency('liblightdm-gobject-1')
88

99
install_path = join_paths(get_option('prefix'), get_option('sbindir'))
1010

11-
conf_data = configuration_data()
12-
conf_data.set('CONF_DIR', join_paths(get_option('sysconfdir'), 'lightdm'))
13-
conf_data.set('GETTEXT_PACKAGE', meson.project_name())
14-
conf_data.set('LOCALE_DIR', join_paths(get_option('prefix'), get_option('localedir')))
15-
16-
gsd_dir = get_option('gsd-dir')
17-
18-
if gsd_dir == ''
19-
gsd_dir = join_paths(get_option('prefix'), get_option('libexecdir') + '/')
20-
endif
21-
22-
message('Path to gnome-settings-daemon: ' + gsd_dir)
23-
24-
conf_data.set('GSD_DIR', gsd_dir)
25-
conf_data.set('VERSION', meson.project_version())
26-
config_header = configure_file (
27-
input: 'config.vala.in',
28-
output: 'config.vala',
29-
configuration: conf_data
30-
)
31-
3211
executable(
3312
meson.project_name(),
3413
greeter_resources,

vapi/Clutter-9-custom.vala

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
namespace Clutter {
2+
public interface Container : GLib.Object {
3+
public void add (params Clutter.Actor[] actors);
4+
[CCode (cname = "clutter_container_class_find_child_property")]
5+
public class unowned GLib.ParamSpec find_child_property (string property_name);
6+
[CCode (cname = "clutter_container_class_list_child_properties")]
7+
public class unowned GLib.ParamSpec[] list_child_properties ();
8+
}
9+
10+
public struct Units {
11+
[CCode (cname = "clutter_units_from_cm")]
12+
public Units.from_cm (float cm);
13+
[CCode (cname = "clutter_units_from_em")]
14+
public Units.from_em (float em);
15+
[CCode (cname = "clutter_units_from_em_for_font")]
16+
public Units.from_em_for_font (string font_name, float em);
17+
[CCode (cname = "clutter_units_from_mm")]
18+
public Units.from_mm (float mm);
19+
[CCode (cname = "clutter_units_from_pixels")]
20+
public Units.from_pixels (int px);
21+
[CCode (cname = "clutter_units_from_pt")]
22+
public Units.from_pt (float pt);
23+
[CCode (cname = "clutter_units_from_string")]
24+
public Units.from_string (string str);
25+
}
26+
27+
[CCode (cheader_filename = "clutter/clutter.h", has_copy_function = false, has_destroy_function = false, has_type_id = false)]
28+
public struct Capture {
29+
}
30+
}

vapi/Clutter-9.metadata

+187
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
// Non mini-object
2+
ActorBox struct
3+
Color struct
4+
Knot struct
5+
Margin struct
6+
PaintVolume struct
7+
PathNode struct
8+
Perspective struct
9+
Units struct
10+
11+
*.ref unowned
12+
13+
init.argv unowned
14+
Actor
15+
.apply_transform.matrix ref
16+
.get_abs_allocation_vertices.verts out=false
17+
Canvas
18+
.new symbol_type="constructor"
19+
Event.type#method name="get_type"
20+
Image
21+
.new symbol_type="constructor"
22+
23+
// ???
24+
Actor.has_pointer#method name="get_has_pointer"
25+
InitError errordomain=false
26+
ScriptError errordomain
27+
ImageError errordomain
28+
29+
// Not all backing symbols are deprecated
30+
Actor.pick deprecated=false
31+
32+
// Nullable return values
33+
Actor
34+
.get_parent nullable
35+
value_get_color nullable
36+
37+
// method/virtual-method/signal don't match
38+
Actor
39+
.event#method name="emit_event"
40+
.get_paint_volume#virtual_method name="get_paint_volume_vfunc"
41+
.get_paint_volume#virtual_method.volume out
42+
Container
43+
.add_actor skip=false
44+
.class_* skip
45+
Text
46+
.activate#method name="try_activate"
47+
.insert_text#signal skip
48+
TextBuffer.get_text#virtual_method name="get_text_with_length"
49+
50+
// virtual/abstract distinction
51+
Container
52+
.lower virtual
53+
.raise virtual
54+
.*_child_meta#virtual_method virtual
55+
56+
// Default values
57+
Container
58+
.lower.sibling nullable default=null
59+
.raise.sibling nullable default=null
60+
Stage.read_pixels
61+
.width default=-1
62+
.height default=-1
63+
Stage.paint_to_buffer
64+
.data type="uint8[]"
65+
Text
66+
.position_to_coords.line_height default=null
67+
68+
// Reparented funcs methods can't be instance methods
69+
feature_available skip
70+
feature_get_all skip
71+
72+
// Skipped by g-i for unknown reasons
73+
LayoutManager
74+
.create_child_meta skip=false
75+
76+
// Variadic arguments
77+
Backend
78+
.get_cogl_context skip=false
79+
Container
80+
.child_get skip=false
81+
.child_set skip=false
82+
.remove skip=false
83+
Interval
84+
.new skip=false
85+
.get_interval skip=false
86+
.set_final skip=false
87+
.set_initial skip=false
88+
.set_interval skip=false
89+
LayoutManager
90+
.child_get skip=false
91+
.child_set skip=false
92+
Script
93+
.get_objects skip=false
94+
95+
// Skipped upstream for unknown reasons
96+
Interval.register_progress_func skip=false
97+
get_option_group skip=false
98+
get_option_group_without_init skip=false
99+
threads_add_idle skip=false
100+
threads_add_idle_full skip=false
101+
threads_add_timeout skip=false
102+
threads_add_timeout_full skip=false
103+
104+
// struct/class confusion
105+
ActorBox
106+
.new skip
107+
.from_vertices skip
108+
Units.from_* skip
109+
Color
110+
.new skip
111+
Margin
112+
.new skip
113+
114+
// Class methods
115+
container_class_find_child_property skip
116+
container_class_list_child_properties skip
117+
118+
// Move symbols
119+
color_from_* skip
120+
units_from_* skip
121+
122+
// Struct return values
123+
color_get_static nullable
124+
125+
// Upstream
126+
Event
127+
.get_position.position out
128+
129+
FrameListenerIface skip
130+
FrameClock.new skip
131+
132+
// Remove for clutter-2.0
133+
/////////////////////////
134+
135+
StageView.layout skip
136+
137+
Stage
138+
.event name="emit_event"
139+
.paint_view.redraw_clip type="Cairo.Region"
140+
141+
Capture
142+
.image type="Cairo.ImageSurface"
143+
144+
// *Event should be compact classes derived from Clutter.Event
145+
Event.type skip=false
146+
AnyEvent struct=false base_type="Clutter.Event"
147+
ButtonEvent struct=false base_type="Clutter.Event"
148+
CrossingEvent struct=false base_type="Clutter.Event"
149+
DeviceEvent struct=false base_type="Clutter.Event"
150+
IMEvent struct=false base_type="Clutter.Event"
151+
KeyEvent struct=false base_type="Clutter.Event"
152+
MotionEvent struct=false base_type="Clutter.Event"
153+
ScrollEvent struct=false base_type="Clutter.Event"
154+
TouchEvent struct=false base_type="Clutter.Event"
155+
TouchpadPinchEvent struct=false base_type="Clutter.Event"
156+
TouchpadSwipeEvent struct=false base_type="Clutter.Event"
157+
ProximityEvent struct=false base_type="Clutter.Event"
158+
PadButtonEvent struct=false base_type="Clutter.Event"
159+
PadRingEvent struct=false base_type="Clutter.Event"
160+
PadStripEvent struct=false base_type="Clutter.Event"
161+
162+
// Keysyms used to be CLUTTER_X instead of CLUTTER_KEY_X
163+
*#constant skip
164+
COGL skip=false
165+
CURRENT_TIME skip=false
166+
FLAVOUR skip=false
167+
PATH_RELATIVE skip=false
168+
PRIORITY_REDRAW skip=false
169+
170+
// Clutter devs don't like us creating nested namespaces
171+
value_* name="value_(.+)" parent="Clutter.Value"
172+
threads_* name="threads_(.+)" parent="Clutter.Threads"
173+
threads_add_idle name="add" parent="Clutter.Threads.Idle"
174+
threads_add_idle_full name="add_full" parent="Clutter.Threads.Idle"
175+
threads_add_timeout name="add" parent="Clutter.Threads.Timeout"
176+
threads_add_timeout_full name="add_full" parent="Clutter.Threads.Timeout"
177+
178+
// Backwards compatibility
179+
Color.alloc symbol_type="function"
180+
181+
BinAlignment deprecated=false deprecated_since=null
182+
BinAlignment.* deprecated
183+
BinAlignment.start deprecated=false
184+
BinLayout.new.*_align default=Clutter.BinAlignment.START
185+
186+
// Possibly keep
187+
KEY_* skip=false name="KEY_(.+)" type="uint" parent="Clutter.Key"

0 commit comments

Comments
 (0)