Skip to content

Commit bdffe25

Browse files
committed
Add support for Mutter47
1 parent 4c11882 commit bdffe25

32 files changed

+1442
-760
lines changed

lib/App.vala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ public class Gala.App : GLib.Object {
158158
return windows.data;
159159
}
160160

161-
public GLib.SList<Posix.pid_t?> get_pids () {
162-
var results = new GLib.SList<Posix.pid_t?> ();
161+
public GLib.SList<pid_t?> get_pids () {
162+
var results = new GLib.SList<pid_t?> ();
163163
foreach (unowned var window in windows) {
164164
var pid = window.get_pid ();
165165
if (pid < 1) {

meson.build

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,17 @@ if mutter46_dep.found()
158158
vala_flags = ['--define', 'HAS_MUTTER43', '--define', 'HAS_MUTTER44', '--define', 'HAS_MUTTER45', '--define', 'HAS_MUTTER46']
159159
endif
160160

161+
mutter47_dep = dependency('libmutter-15', version: ['>= 47', '< 48'], required: false)
162+
if mutter47_dep.found()
163+
libmutter_dep = dependency('libmutter-15', version: '>= 47')
164+
mutter_dep = [
165+
libmutter_dep,
166+
dependency('mutter-mtk-15'), dependency('mutter-cogl-15'),
167+
dependency('mutter-cogl-pango-15'), dependency('mutter-clutter-15')
168+
]
169+
vala_flags = ['--define', 'HAS_MUTTER43', '--define', 'HAS_MUTTER44', '--define', 'HAS_MUTTER45', '--define', 'HAS_MUTTER46', '--define', 'HAS_MUTTER47']
170+
endif
171+
161172
if mutter_dep.length() == 0
162173
error ('No supported mutter library found!')
163174
endif

src/Background/Background.vala

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,38 @@ namespace Gala {
108108
var settings = background_source.gnome_background_settings;
109109

110110
color_string = settings.get_string ("primary-color");
111+
#if HAS_MUTTER47
112+
var color = Cogl.Color.from_string (color_string);
113+
#else
111114
var color = Clutter.Color.from_string (color_string);
115+
#endif
116+
if (color == null) {
117+
#if HAS_MUTTER47
118+
color = Cogl.Color.from_string ("black");
119+
#else
120+
color = Clutter.Color.from_string ("black");
121+
#endif
122+
}
112123

113124
var shading_type = settings.get_enum ("color-shading-type");
114125

115126
if (shading_type == GDesktop.BackgroundShading.SOLID) {
116127
background.set_color (color);
117128
} else {
118129
color_string = settings.get_string ("secondary-color");
130+
#if HAS_MUTTER47
131+
var second_color = Cogl.Color.from_string (color_string);
132+
#else
119133
var second_color = Clutter.Color.from_string (color_string);
134+
#endif
135+
if (second_color == null) {
136+
#if HAS_MUTTER47
137+
second_color = Cogl.Color.from_string ("black");
138+
#else
139+
second_color = Clutter.Color.from_string ("black");
140+
#endif
141+
}
142+
120143
background.set_gradient ((GDesktop.BackgroundShading) shading_type, color, second_color);
121144
}
122145
}

src/Background/BackgroundContainer.vala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ namespace Gala {
4949
}
5050

5151
public void set_black_background (bool black) {
52+
#if HAS_MUTTER47
53+
set_background_color (black ? Cogl.Color.from_string ("Black") : null);
54+
#else
5255
set_background_color (black ? Clutter.Color.from_string ("Black") : null);
56+
#endif
5357
}
5458

5559
private void update () {

src/InternalUtils.vala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,12 @@ namespace Gala {
7171
}
7272

7373
unowned Meta.X11Display x11display = display.get_x11_display ();
74+
#if HAS_MUTTER47
75+
x11display.set_stage_input_region (rects);
76+
#else
7477
var xregion = X.Fixes.create_region (x11display.get_xdisplay (), rects);
7578
x11display.set_stage_input_region (xregion);
79+
#endif
7680
}
7781

7882
/**

src/ScreenshotManager.vala

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ namespace Gala {
6565
var flash_actor = new Clutter.Actor ();
6666
flash_actor.set_size (width, height);
6767
flash_actor.set_position (x, y);
68-
#if HAS_MUTTER46
68+
#if HAS_MUTTER47
69+
flash_actor.set_background_color (Cogl.Color.from_string ("white"));
70+
#elif HAS_MUTTER46
6971
flash_actor.set_background_color (Clutter.Color.from_pixel (0xffffffffu));
7072
#else
7173
flash_actor.set_background_color (Clutter.Color.get_static (Clutter.StaticColor.WHITE));
@@ -151,8 +153,12 @@ namespace Gala {
151153
window_actor.get_position (out actor_x, out actor_y);
152154

153155
var rect = window.get_frame_rect ();
156+
#if HAS_MUTTER45
157+
if (!include_frame) {
158+
#if else
154159
if ((include_frame && window.is_client_decorated ()) ||
155160
(!include_frame && !window.is_client_decorated ())) {
161+
#endif
156162
rect = window.frame_rect_to_client_rect (rect);
157163
}
158164

src/Widgets/IconGroup.vala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ namespace Gala {
114114
var height = InternalUtils.scale_to_int (WorkspaceClone.BOTTOM_OFFSET, scale_factor);
115115
var backdrop_opacity_int = (uint8) (BACKDROP_ABSOLUTE_OPACITY * backdrop_opacity);
116116

117+
#if HAS_MUTTER47
118+
//FIXME: TODO!
119+
#else
117120
Cogl.VertexP2T2C4 vertices[4];
118121
vertices[0] = { x, y + height, 0, 1, backdrop_opacity_int, backdrop_opacity_int, backdrop_opacity_int, backdrop_opacity_int };
119122
vertices[1] = { x, y, 0, 0, 0, 0, 0, 0 };
@@ -123,6 +126,7 @@ namespace Gala {
123126
var primitive = new Cogl.Primitive.p2t2c4 (context.get_framebuffer ().get_context (), Cogl.VerticesMode.TRIANGLE_STRIP, vertices);
124127
var pipeline = new Cogl.Pipeline (context.get_framebuffer ().get_context ());
125128
primitive.draw (context.get_framebuffer (), pipeline);
129+
#endif
126130
base.paint (context);
127131
}
128132

src/Widgets/ScreenShield.vala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,11 @@ namespace Gala {
133133
return Clutter.EVENT_STOP;
134134
});
135135

136+
#if HAS_MUTTER47
137+
background_color = Cogl.Color.from_string ("black");
138+
#else
136139
background_color = Clutter.Color.from_string ("black");
140+
#endif
137141

138142
expand_to_screen_size ();
139143

src/Widgets/Tooltip.vala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ public class Gala.Tooltip : CanvasActor {
2222
construct {
2323
max_width = 200;
2424

25+
#if HAS_MUTTER47
26+
Cogl.Color text_color = {
27+
#else
2528
Clutter.Color text_color = {
29+
#endif
2630
(uint8) Drawing.Color.TOOLTIP_TEXT_COLOR.red * uint8.MAX,
2731
(uint8) Drawing.Color.TOOLTIP_TEXT_COLOR.green * uint8.MAX,
2832
(uint8) Drawing.Color.TOOLTIP_TEXT_COLOR.blue * uint8.MAX,

src/Widgets/WindowSwitcher/WindowSwitcher.vala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,11 @@ public class Gala.WindowSwitcher : CanvasActor {
161161

162162
var stroke_width = scaling_factor;
163163

164+
#if HAS_MUTTER47
165+
caption.color = Cogl.Color.from_string (caption_color);
166+
#else
164167
caption.color = Clutter.Color.from_string (caption_color);
168+
#endif
165169

166170
ctx.save ();
167171
ctx.set_operator (Cairo.Operator.CLEAR);

0 commit comments

Comments
 (0)