Adapt to mutter 3.33 (#566)

This commit is contained in:
Corentin Noël 2019-10-31 22:22:38 +01:00 committed by Adam Bieńkowski
parent 4a07494ad6
commit 0f0724c97a
67 changed files with 1939 additions and 45 deletions

View File

@ -186,8 +186,12 @@ namespace Gala {
* @param backward Whether to get the previous one instead
*/
public static Meta.Window get_next_window (Meta.Workspace workspace, bool backward = false) {
#if HAS_MUTTER330
var display = workspace.get_display ();
#else
var screen = workspace.get_screen ();
var display = screen.get_display ();
#endif
var window = display.get_tab_next (Meta.TabList.NORMAL,
workspace, null, backward);
@ -264,6 +268,21 @@ namespace Gala {
return container;
}
#if HAS_MUTTER330
/**
* Ring the system bell, will most likely emit a <beep> error sound or, if the
* audible bell is disabled, flash the display
*
* @param display The display to flash, if necessary
*/
public static void bell (Meta.Display display)
{
if (Meta.Prefs.bell_is_audible ())
Gdk.beep ();
else
display.get_compositor ().flash_display (display);
}
#else
/**
* Ring the system bell, will most likely emit a <beep> error sound or, if the
* audible bell is disabled, flash the screen
@ -276,6 +295,7 @@ namespace Gala {
else
screen.get_display ().get_compositor ().flash_screen (screen);
}
#endif
public static int get_ui_scaling_factor () {
#if HAS_MUTTER326

View File

@ -226,27 +226,90 @@ if mutter328_dep.found()
'-DCOGL_ENABLE_EXPERIMENTAL_API', '-DCOGL_ENABLE_EXPERIMENTAL_2_0_API'], language: 'c')
endif
mutter330_dep = dependency('libmutter-2', version: ['>= 3.29.2', '< 3.31'], required: false)
mutter330_dep = dependency('libmutter-3', version: ['>= 3.29.4', '< 3.31'], required: false)
if mutter330_dep.found()
mutter_packages_command = [
'--pkg', 'libmutter-2',
'--pkg', 'mutter-cogl-2',
'--pkg', 'mutter-cogl-pango-2',
'--pkg', 'mutter-cogl-path-2',
'--pkg', 'mutter-clutter-2'
'--pkg', 'libmutter-3',
'--pkg', 'mutter-cogl-3',
'--pkg', 'mutter-cogl-pango-3',
'--pkg', 'mutter-cogl-path-3',
'--pkg', 'mutter-clutter-3'
]
libmutter_dep = dependency('libmutter-2', version: '>= 3.29.2')
pkgconf.set('MUTTER_PKGS', 'libmutter-2 >= 3.29.2')
libmutter_dep = dependency('libmutter-3', version: '>= 3.29.4')
pkgconf.set('MUTTER_PKGS', 'libmutter-3 >= 3.29.4')
mutter_dep = [
libmutter_dep,
dependency('mutter-cogl-2'), dependency('mutter-cogl-pango-2'),
dependency('mutter-cogl-path-2'), dependency('mutter-clutter-2')
dependency('mutter-cogl-3'), dependency('mutter-cogl-pango-3'),
dependency('mutter-cogl-path-3'), dependency('mutter-clutter-3')
]
vala_flags += ['--define', 'HAS_MUTTER320', '--define', 'HAS_MUTTER322', '--define', 'HAS_MUTTER324', '--define', 'HAS_MUTTER326', '--define', 'HAS_MUTTER328', '--define', 'HAS_MUTTER330']
add_project_arguments(['-DCLUTTER_ENABLE_COMPOSITOR_API', '-DCLUTTER_ENABLE_EXPERIMENTAL_API',
'-DCOGL_ENABLE_EXPERIMENTAL_API', '-DCOGL_ENABLE_EXPERIMENTAL_2_0_API'], language: 'c')
endif
mutter332_dep = dependency('libmutter-4', version: ['>= 3.31.2', '< 3.34'], required: false)
if mutter332_dep.found()
mutter_packages_command = [
'--pkg', 'libmutter-4',
'--pkg', 'mutter-cogl-4',
'--pkg', 'mutter-cogl-pango-4',
'--pkg', 'mutter-cogl-path-4',
'--pkg', 'mutter-clutter-4'
]
libmutter_dep = dependency('libmutter-4', version: '>= 3.31.2')
pkgconf.set('MUTTER_PKGS', 'libmutter-4 >= 3.31.2')
mutter_dep = [
libmutter_dep,
dependency('mutter-cogl-4'), dependency('mutter-cogl-pango-4'),
dependency('mutter-cogl-path-4'), dependency('mutter-clutter-4')
]
vala_flags += ['--define', 'HAS_MUTTER320', '--define', 'HAS_MUTTER322', '--define', 'HAS_MUTTER324', '--define', 'HAS_MUTTER326', '--define', 'HAS_MUTTER328', '--define', 'HAS_MUTTER330', '--define', 'HAS_MUTTER332']
add_project_arguments(['-DCLUTTER_ENABLE_COMPOSITOR_API', '-DCLUTTER_ENABLE_EXPERIMENTAL_API',
'-DCOGL_ENABLE_EXPERIMENTAL_API', '-DCOGL_ENABLE_EXPERIMENTAL_2_0_API'], language: 'c')
endif
mutter334_dep = dependency('libmutter-5', version: ['>= 3.34', '< 3.35.1'], required: false)
if mutter334_dep.found()
mutter_packages_command = [
'--pkg', 'libmutter-5',
'--pkg', 'mutter-cogl-5',
'--pkg', 'mutter-cogl-pango-5',
'--pkg', 'mutter-cogl-path-5',
'--pkg', 'mutter-clutter-5'
]
libmutter_dep = dependency('libmutter-5', version: '>= 3.34')
pkgconf.set('MUTTER_PKGS', 'libmutter-5 >= 3.34')
mutter_dep = [
libmutter_dep,
dependency('mutter-cogl-5'), dependency('mutter-cogl-pango-5'),
dependency('mutter-cogl-path-5'), dependency('mutter-clutter-5')
]
vala_flags += ['--define', 'HAS_MUTTER320', '--define', 'HAS_MUTTER322', '--define', 'HAS_MUTTER324', '--define', 'HAS_MUTTER326', '--define', 'HAS_MUTTER328', '--define', 'HAS_MUTTER330', '--define', 'HAS_MUTTER332', '--define', 'HAS_MUTTER334']
add_project_arguments(['-DCLUTTER_ENABLE_COMPOSITOR_API', '-DCLUTTER_ENABLE_EXPERIMENTAL_API',
'-DCOGL_ENABLE_EXPERIMENTAL_API', '-DCOGL_ENABLE_EXPERIMENTAL_2_0_API'], language: 'c')
endif
mutter336_dep = dependency('libmutter-6', version: ['>= 3.35.1', '< 3.38'], required: false)
if mutter336_dep.found()
mutter_packages_command = [
'--pkg', 'libmutter-6',
'--pkg', 'mutter-cogl-6',
'--pkg', 'mutter-cogl-pango-6',
'--pkg', 'mutter-cogl-path-6',
'--pkg', 'mutter-clutter-6'
]
libmutter_dep = dependency('libmutter-6', version: '>= 3.35.1')
pkgconf.set('MUTTER_PKGS', 'libmutter-6 >= 3.35.1')
mutter_dep = [
libmutter_dep,
dependency('mutter-cogl-6'), dependency('mutter-cogl-pango-6'),
dependency('mutter-cogl-path-6'), dependency('mutter-clutter-6')
]
vala_flags += ['--define', 'HAS_MUTTER320', '--define', 'HAS_MUTTER322', '--define', 'HAS_MUTTER324', '--define', 'HAS_MUTTER326', '--define', 'HAS_MUTTER328', '--define', 'HAS_MUTTER330', '--define', 'HAS_MUTTER332', '--define', 'HAS_MUTTER334', '--define', 'HAS_MUTTER336']
add_project_arguments(['-DCLUTTER_ENABLE_COMPOSITOR_API', '-DCLUTTER_ENABLE_EXPERIMENTAL_API',
'-DCOGL_ENABLE_EXPERIMENTAL_API', '-DCOGL_ENABLE_EXPERIMENTAL_2_0_API'], language: 'c')
endif
if mutter_dep.length() == 0
error ('No supported mutter library found!')
endif

View File

@ -23,7 +23,11 @@ namespace Gala.Plugins.MaskCorners
public class Main : Gala.Plugin
{
Gala.WindowManager? wm = null;
#if HAS_MUTTER330
Display display;
#else
Screen screen;
#endif
Settings settings;
List<Actor>[] cornermasks;
@ -32,7 +36,11 @@ namespace Gala.Plugins.MaskCorners
public override void initialize (Gala.WindowManager wm)
{
this.wm = wm;
#if HAS_MUTTER330
display = wm.get_display ();
#else
screen = wm.get_screen ();
#endif
settings = Settings.get_default ();
setup_cornermasks ();
@ -52,17 +60,34 @@ namespace Gala.Plugins.MaskCorners
var scale = Utils.get_ui_scaling_factor ();
#if HAS_MUTTER330
int n_monitors = display.get_n_monitors ();
#else
int n_monitors = screen.get_n_monitors ();
#endif
cornermasks = new List<Actor>[n_monitors];
corner_radius = settings.corner_radius * scale;
if (settings.only_on_primary) {
#if HAS_MUTTER330
add_cornermasks (display.get_primary_monitor ());
#else
add_cornermasks (screen.get_primary_monitor ());
#endif
} else {
for (int m = 0; m < n_monitors; m++)
add_cornermasks (m);
}
#if HAS_MUTTER330
if (settings.disable_on_fullscreen)
display.in_fullscreen_changed.connect (fullscreen_changed);
unowned Meta.MonitorManager monitor_manager = Meta.MonitorManager.@get ();
monitor_manager.monitors_changed.connect (resetup_cornermasks);
display.gl_video_memory_purged.connect (resetup_cornermasks);
#else
if (settings.disable_on_fullscreen)
screen.in_fullscreen_changed.connect (fullscreen_changed);
@ -70,17 +95,26 @@ namespace Gala.Plugins.MaskCorners
#if HAS_MUTTER322
screen.get_display ().gl_video_memory_purged.connect (resetup_cornermasks);
#endif
#endif
}
void destroy_cornermasks ()
{
#if HAS_MUTTER322
#if HAS_MUTTER330
display.gl_video_memory_purged.disconnect (resetup_cornermasks);
#elif HAS_MUTTER322
screen.get_display ().gl_video_memory_purged.disconnect (resetup_cornermasks);
#endif
#if HAS_MUTTER330
unowned Meta.MonitorManager monitor_manager = Meta.MonitorManager.@get ();
monitor_manager.monitors_changed.disconnect (resetup_cornermasks);
display.in_fullscreen_changed.disconnect (fullscreen_changed);
#else
screen.monitors_changed.disconnect (resetup_cornermasks);
screen.in_fullscreen_changed.disconnect (fullscreen_changed);
#endif
foreach (unowned List<Actor> list in cornermasks) {
foreach (Actor actor in list)
@ -96,6 +130,16 @@ namespace Gala.Plugins.MaskCorners
void fullscreen_changed ()
{
#if HAS_MUTTER330
for (int i = 0; i < display.get_n_monitors (); i++) {
foreach (Actor actor in cornermasks[i]) {
if (display.get_monitor_in_fullscreen (i))
actor.hide ();
else
actor.show ();
}
}
#else
for (int i = 0; i < screen.get_n_monitors (); i++) {
foreach (Actor actor in cornermasks[i]) {
if (screen.get_monitor_in_fullscreen (i))
@ -104,11 +148,16 @@ namespace Gala.Plugins.MaskCorners
actor.show ();
}
}
#endif
}
void add_cornermasks (int monitor_no)
{
#if HAS_MUTTER330
var monitor_geometry = display.get_monitor_geometry (monitor_no);
#else
var monitor_geometry = screen.get_monitor_geometry (monitor_no);
#endif
Canvas canvas = new Canvas ();
canvas.set_size (corner_radius, corner_radius);

View File

@ -30,9 +30,17 @@ namespace Gala.Plugins.Notify
public override void initialize (Gala.WindowManager wm)
{
this.wm = wm;
#if HAS_MUTTER330
unowned Meta.Display display = wm.get_display ();
#else
var screen = wm.get_screen ();
#endif
stack = new NotificationStack (wm.get_screen ());
#if HAS_MUTTER330
stack = new NotificationStack (display);
#else
stack = new NotificationStack (screen);
#endif
wm.ui_group.add_child (stack);
track_actor (stack);
@ -43,8 +51,14 @@ namespace Gala.Plugins.Notify
server = new NotifyServer (stack);
update_position ();
#if HAS_MUTTER330
unowned Meta.MonitorManager monitor_manager = Meta.MonitorManager.@get ();
monitor_manager.monitors_changed.connect (update_position);
display.workareas_changed.connect (update_position);
#else
screen.monitors_changed.connect (update_position);
screen.workareas_changed.connect (update_position);
#endif
Bus.own_name (BusType.SESSION, "org.freedesktop.Notifications", BusNameOwnerFlags.NONE,
(connection) => {
@ -64,9 +78,15 @@ namespace Gala.Plugins.Notify
void update_position ()
{
#if HAS_MUTTER330
unowned Meta.Display display = wm.get_display ();
var primary = display.get_primary_monitor ();
var area = display.get_workspace_manager ().get_active_workspace ().get_work_area_for_monitor (primary);
#else
var screen = wm.get_screen ();
var primary = screen.get_primary_monitor ();
var area = screen.get_active_workspace ().get_work_area_for_monitor (primary);
#endif
stack.x = area.x + area.width - stack.width;
stack.y = area.y;

View File

@ -173,12 +173,33 @@ namespace Gala.Plugins.Notify
public string body { get; construct set; }
public uint32 sender_pid { get; construct; }
public string[] notification_actions { get; construct set; }
#if HAS_MUTTER330
public Meta.Display display { get; construct; }
#else
public Screen screen { get; construct; }
#endif
Actor content_container;
NormalNotificationContent notification_content;
NormalNotificationContent? old_notification_content = null;
#if HAS_MUTTER330
public NormalNotification (Meta.Display display, uint32 id, string summary, string body, Gdk.Pixbuf? icon,
NotificationUrgency urgency, int32 expire_timeout, uint32 pid, string[] actions)
{
Object (
id: id,
icon: icon,
urgency: urgency,
expire_timeout: expire_timeout,
display: display,
summary: summary,
body: body,
sender_pid: pid,
notification_actions: actions
);
}
#else
public NormalNotification (Screen screen, uint32 id, string summary, string body, Gdk.Pixbuf? icon,
NotificationUrgency urgency, int32 expire_timeout, uint32 pid, string[] actions)
{
@ -194,6 +215,7 @@ namespace Gala.Plugins.Notify
notification_actions: actions
);
}
#endif
construct
{
@ -295,12 +317,21 @@ namespace Gala.Plugins.Notify
unowned Meta.Window? window = get_window ();
if (window != null) {
unowned Meta.Workspace workspace = window.get_workspace ();
#if HAS_MUTTER330
var time = display.get_current_time ();
if (workspace != display.get_workspace_manager ().get_active_workspace ())
workspace.activate_with_focus (window, time);
else
window.activate (time);
#else
var time = screen.get_display ().get_current_time ();
if (workspace != screen.get_active_workspace ())
workspace.activate_with_focus (window, time);
else
window.activate (time);
#endif
dismiss ();
}
@ -311,7 +342,12 @@ namespace Gala.Plugins.Notify
if (sender_pid == 0)
return null;
foreach (unowned Meta.WindowActor actor in Meta.Compositor.get_window_actors (screen)) {
#if HAS_MUTTER330
unowned GLib.List<weak Meta.WindowActor>? actors = Meta.Compositor.get_window_actors (display);
#else
unowned GLib.List<weak Meta.WindowActor>? actors = Meta.Compositor.get_window_actors (screen);
#endif
foreach (unowned Meta.WindowActor actor in actors) {
if (actor.is_destroyed ())
continue;

View File

@ -29,6 +29,14 @@ namespace Gala.Plugins.Notify
public signal void animations_changed (bool running);
#if HAS_MUTTER330
public Meta.Display display { get; construct; }
public NotificationStack (Meta.Display display)
{
Object (display: display);
}
#else
public Screen screen { get; construct; }
public new float width
@ -44,6 +52,7 @@ namespace Gala.Plugins.Notify
{
Object (screen: screen);
}
#endif
construct
{

View File

@ -286,8 +286,13 @@ namespace Gala.Plugins.Notify
progress ? hints.@get ("value").get_int32 () : -1,
hints.@get (X_CANONICAL_PRIVATE_SYNCHRONOUS).get_string ());
else
#if HAS_MUTTER330
notification = new NormalNotification (stack.display, id, summary, body, pixbuf,
urgency, timeout, pid, actions);
#else
notification = new NormalNotification (stack.screen, id, summary, body, pixbuf,
urgency, timeout, pid, actions);
#endif
notification.action_invoked.connect (notification_action_invoked_callback);
notification.closed.connect (notification_closed_callback);

View File

@ -37,7 +37,11 @@ public class Gala.Plugins.PIP.Plugin : Gala.Plugin
public override void initialize (Gala.WindowManager wm)
{
this.wm = wm;
#if HAS_MUTTER330
var display = wm.get_display ();
#else
var display = wm.get_screen ().get_display ();
#endif
var settings = new GLib.Settings (Config.SCHEMA + ".keybindings");
display.add_keybinding ("pip", settings, Meta.KeyBindingFlags.NONE, (Meta.KeyHandlerFunc) on_initiate);
@ -55,8 +59,13 @@ public class Gala.Plugins.PIP.Plugin : Gala.Plugin
}
[CCode (instance_pos = -1)]
#if HAS_MUTTER330
void on_initiate (Meta.Display display, Meta.Window? window, Clutter.KeyEvent event,
Meta.KeyBinding binding)
#else
void on_initiate (Meta.Display display, Meta.Screen screen,
Meta.Window? window, Clutter.KeyEvent event, Meta.KeyBinding binding)
#endif
{
selection_area = new SelectionArea (wm);
selection_area.selected.connect (on_selection_actor_selected);
@ -134,8 +143,13 @@ public class Gala.Plugins.PIP.Plugin : Gala.Plugin
private Meta.WindowActor? get_window_actor_at (int x, int y)
{
#if HAS_MUTTER330
unowned Meta.Display display = wm.get_display ();
unowned List<weak Meta.WindowActor> actors = Meta.Compositor.get_window_actors (display);
#else
var screen = wm.get_screen ();
unowned List<weak Meta.WindowActor> actors = Meta.Compositor.get_window_actors (screen);
#endif
var copy = actors.copy ();
copy.reverse ();
@ -159,8 +173,13 @@ public class Gala.Plugins.PIP.Plugin : Gala.Plugin
private Meta.WindowActor? get_active_window_actor ()
{
#if HAS_MUTTER330
unowned Meta.Display display = wm.get_display ();
unowned List<weak Meta.WindowActor> actors = Meta.Compositor.get_window_actors (display);
#else
var screen = wm.get_screen ();
unowned List<weak Meta.WindowActor> actors = Meta.Compositor.get_window_actors (screen);
#endif
var copy = actors.copy ();
copy.reverse ();

View File

@ -310,7 +310,11 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor
private void update_window_focus ()
{
#if HAS_MUTTER330
unowned Meta.Window focus_window = wm.get_display ().get_focus_window ();
#else
unowned Meta.Window focus_window = wm.get_screen ().get_display ().get_focus_window ();
#endif
if ((focus_window != null && !get_window_is_normal (focus_window))
|| (previous_focus != null && !get_window_is_normal (previous_focus))) {
previous_focus = focus_window;
@ -431,8 +435,13 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor
private void get_current_monitor_rect (out Meta.Rectangle rect)
{
#if HAS_MUTTER330
var display = wm.get_display ();
rect = display.get_monitor_geometry (display.get_current_monitor ());
#else
var screen = wm.get_screen ();
rect = screen.get_monitor_geometry (screen.get_current_monitor ());
#endif
}
private void get_target_window_size (out float width, out float height)

View File

@ -42,7 +42,11 @@ public class Gala.Plugins.PIP.SelectionArea : Clutter.Actor
reactive = true;
int screen_width, screen_height;
#if HAS_MUTTER330
wm.get_display ().get_size (out screen_width, out screen_height);
#else
wm.get_screen ().get_size (out screen_width, out screen_height);
#endif
width = screen_width;
height = screen_height;
@ -126,7 +130,11 @@ public class Gala.Plugins.PIP.SelectionArea : Clutter.Actor
public void close ()
{
#if HAS_MUTTER330
wm.get_display ().set_cursor (Meta.Cursor.DEFAULT);
#else
wm.get_screen ().set_cursor (Meta.Cursor.DEFAULT);
#endif
if (modal_proxy != null) {
wm.pop_modal (modal_proxy);
@ -135,7 +143,11 @@ public class Gala.Plugins.PIP.SelectionArea : Clutter.Actor
public void start_selection ()
{
#if HAS_MUTTER330
wm.get_display ().set_cursor (Meta.Cursor.CROSSHAIR);
#else
wm.get_screen ().set_cursor (Meta.Cursor.CROSSHAIR);
#endif
grab_key_focus ();
modal_proxy = wm.push_modal ();

View File

@ -49,8 +49,13 @@ namespace Gala.Plugins.Template
// we want to place it in the lower right of the primary monitor with a bit
// of padding. refer to vapi/libmutter.vapi in gala's source for something
// remotely similar to a documentation
#if HAS_MUTTER330
var display = wm.get_display ();
var rect = display.get_monitor_geometry (display.get_primary_monitor ());
#else
var screen = wm.get_screen ();
var rect = screen.get_monitor_geometry (screen.get_primary_monitor ());
#endif
red_box.x = rect.x + rect.width - red_box.width - PADDING;
red_box.y = rect.y + rect.height - red_box.height - PADDING;

View File

@ -30,7 +30,11 @@ namespace Gala.Plugins.Zoom
public override void initialize (Gala.WindowManager wm)
{
this.wm = wm;
#if HAS_MUTTER330
var display = wm.get_display ();
#else
var display = wm.get_screen ().get_display ();
#endif
var schema = new GLib.Settings (Config.SCHEMA + ".keybindings");
display.add_keybinding ("zoom-in", schema, 0, (Meta.KeyHandlerFunc) zoom_in);
@ -42,7 +46,11 @@ namespace Gala.Plugins.Zoom
if (wm == null)
return;
#if HAS_MUTTER330
var display = wm.get_display ();
#else
var display = wm.get_screen ().get_display ();
#endif
display.remove_keybinding ("zoom-in");
display.remove_keybinding ("zoom-out");
@ -53,15 +61,25 @@ namespace Gala.Plugins.Zoom
}
[CCode (instance_pos = -1)]
#if HAS_MUTTER330
void zoom_in (Meta.Display display, Meta.Window? window,
Clutter.KeyEvent event, Meta.KeyBinding binding)
#else
void zoom_in (Meta.Display display, Meta.Screen screen,
Meta.Window? window, Clutter.KeyEvent event, Meta.KeyBinding binding)
#endif
{
zoom (true);
}
[CCode (instance_pos = -1)]
#if HAS_MUTTER330
void zoom_out (Meta.Display display, Meta.Window? window,
Clutter.KeyEvent event, Meta.KeyBinding binding)
#else
void zoom_out (Meta.Display display, Meta.Screen screen,
Meta.Window? window, Clutter.KeyEvent event, Meta.KeyBinding binding)
#endif
{
zoom (false);
}

View File

@ -25,7 +25,11 @@ namespace Gala
public signal void changed ();
public signal void loaded ();
#if HAS_MUTTER330
public Meta.Display display { get; construct; }
#else
public Meta.Screen screen { get; construct; }
#endif
public int monitor_index { get; construct; }
public BackgroundSource background_source { get; construct; }
public bool is_loaded { get; private set; default = false; }
@ -38,6 +42,17 @@ namespace Gala
Cancellable cancellable;
uint update_animation_timeout_id = 0;
#if HAS_MUTTER330
public Background (Meta.Display display, int monitor_index, string? filename,
BackgroundSource background_source, GDesktop.BackgroundStyle style)
{
Object (display: display,
monitor_index: monitor_index,
background_source: background_source,
style: style,
filename: filename);
}
#else
public Background (Meta.Screen screen, int monitor_index, string? filename,
BackgroundSource background_source, GDesktop.BackgroundStyle style)
{
@ -47,10 +62,15 @@ namespace Gala
style: style,
filename: filename);
}
#endif
construct
{
#if HAS_MUTTER330
background = new Meta.Background (display);
#else
background = new Meta.Background (screen);
#endif
background.set_data<unowned Background> ("delegate", this);
file_watches = new Gee.HashMap<string,ulong> ();
@ -145,7 +165,11 @@ namespace Gala
{
update_animation_timeout_id = 0;
#if HAS_MUTTER330
animation.update (display.get_monitor_geometry (monitor_index));
#else
animation.update (screen.get_monitor_geometry (monitor_index));
#endif
var files = animation.key_frame_files;
Clutter.Callback finish = () => {

View File

@ -91,11 +91,19 @@ namespace Gala
return animation;
}
#if HAS_MUTTER330
public BackgroundSource get_background_source (Meta.Display display, string settings_schema)
#else
public BackgroundSource get_background_source (Meta.Screen screen, string settings_schema)
#endif
{
var background_source = background_sources[settings_schema];
if (background_source == null) {
#if HAS_MUTTER330
background_source = new BackgroundSource (display, settings_schema);
#else
background_source = new BackgroundSource (screen, settings_schema);
#endif
background_source.use_count = 1;
background_sources[settings_schema] = background_source;
} else

View File

@ -21,6 +21,26 @@ namespace Gala
{
public signal void changed ();
#if HAS_MUTTER330
public Meta.Display display { get; construct; }
public BackgroundContainer (Meta.Display display)
{
Object (display: display);
}
construct
{
Meta.MonitorManager.@get ().monitors_changed.connect (update);
update ();
}
~BackgroundContainer ()
{
Meta.MonitorManager.@get ().monitors_changed.disconnect (update);
}
#else
public Meta.Screen screen { get; construct; }
public BackgroundContainer (Meta.Screen screen)
@ -39,6 +59,7 @@ namespace Gala
{
screen.monitors_changed.disconnect (update);
}
#endif
void update ()
{
@ -48,8 +69,13 @@ namespace Gala
destroy_all_children ();
#if HAS_MUTTER330
for (var i = 0; i < display.get_n_monitors (); i++) {
var background = new BackgroundManager (display, i);
#else
for (var i = 0; i < screen.get_n_monitors (); i++) {
var background = new BackgroundManager (screen, i);
#endif
add_child (background);

View File

@ -24,7 +24,11 @@ namespace Gala
public signal void changed ();
#if HAS_MUTTER330
public Meta.Display display { get; construct; }
#else
public Meta.Screen screen { get; construct; }
#endif
public int monitor_index { get; construct; }
public bool control_position { get; construct; }
@ -32,14 +36,25 @@ namespace Gala
Meta.BackgroundActor background_actor;
Meta.BackgroundActor? new_background_actor = null;
#if HAS_MUTTER330
public BackgroundManager (Meta.Display display, int monitor_index, bool control_position = true)
{
Object (display: display, monitor_index: monitor_index, control_position: control_position);
}
#else
public BackgroundManager (Meta.Screen screen, int monitor_index, bool control_position = true)
{
Object (screen: screen, monitor_index: monitor_index, control_position: control_position);
}
#endif
construct
{
#if HAS_MUTTER330
background_source = BackgroundCache.get_default ().get_background_source (display, BACKGROUND_SCHEMA);
#else
background_source = BackgroundCache.get_default ().get_background_source (screen, BACKGROUND_SCHEMA);
#endif
background_actor = create_background_actor ();
@ -125,13 +140,21 @@ namespace Gala
Meta.BackgroundActor create_background_actor ()
{
var background = background_source.get_background (monitor_index);
#if HAS_MUTTER330
var background_actor = new Meta.BackgroundActor (display, monitor_index);
#else
var background_actor = new Meta.BackgroundActor (screen, monitor_index);
#endif
background_actor.background = background.background;
insert_child_below (background_actor, null);
#if HAS_MUTTER330
var monitor = display.get_monitor_geometry (monitor_index);
#else
var monitor = screen.get_monitor_geometry (monitor_index);
#endif
background_actor.set_size (monitor.width, monitor.height);

View File

@ -21,23 +21,38 @@ namespace Gala
{
public signal void changed ();
#if HAS_MUTTER330
public Meta.Display display { get; construct; }
#else
public Meta.Screen screen { get; construct; }
#endif
public Settings settings { get; construct; }
internal int use_count { get; set; default = 0; }
Gee.HashMap<int,Background> backgrounds;
#if HAS_MUTTER330
public BackgroundSource (Meta.Display display, string settings_schema)
{
Object (display: display, settings: new Settings (settings_schema));
}
#else
public BackgroundSource (Meta.Screen screen, string settings_schema)
{
Object (screen: screen, settings: new Settings (settings_schema));
}
#endif
construct
{
backgrounds = new Gee.HashMap<int,Background> ();
#if HAS_MUTTER330
Meta.MonitorManager.@get ().monitors_changed.connect (monitors_changed);
#else
screen.monitors_changed.connect (monitors_changed);
#endif
settings_hash_cache = get_current_settings_hash_cache ();
settings.changed.connect (settings_changed);
@ -45,7 +60,11 @@ namespace Gala
void monitors_changed ()
{
#if HAS_MUTTER330
var n = display.get_n_monitors ();
#else
var n = screen.get_n_monitors ();
#endif
var i = 0;
foreach (var background in backgrounds.values) {
@ -82,7 +101,11 @@ namespace Gala
monitor_index = 0;
if (!backgrounds.has_key (monitor_index)) {
#if HAS_MUTTER330
var background = new Background (display, monitor_index, filename, this, (GDesktop.BackgroundStyle) style);
#else
var background = new Background (screen, monitor_index, filename, this, (GDesktop.BackgroundStyle) style);
#endif
background.changed.connect (background_changed);
backgrounds[monitor_index] = background;
}
@ -99,7 +122,11 @@ namespace Gala
public void destroy ()
{
#if HAS_MUTTER330
Meta.MonitorManager.@get ().monitors_changed.disconnect (monitors_changed);
#else
screen.monitors_changed.disconnect (monitors_changed);
#endif
foreach (var background in backgrounds) {
background.changed.disconnect (background_changed);

View File

@ -17,18 +17,36 @@
namespace Gala
{
#if HAS_MUTTER334
public class SystemBackground : GLib.Object
#else
public class SystemBackground : Meta.BackgroundActor
#endif
{
const Clutter.Color DEFAULT_BACKGROUND_COLOR = { 0x2e, 0x34, 0x36, 0xff };
static Meta.Background? system_background = null;
#if HAS_MUTTER334
public Meta.BackgroundActor background_actor { get; construct; }
#endif
public signal void loaded ();
#if HAS_MUTTER330
public SystemBackground (Meta.Display display)
{
#if HAS_MUTTER334
Object (background_actor: new Meta.BackgroundActor (display, 0));
#else
Object (meta_display: display, monitor: 0);
#endif
}
#else
public SystemBackground (Meta.Screen screen)
{
Object (meta_screen: screen, monitor: 0);
}
#endif
construct
{
@ -39,12 +57,22 @@ namespace Gala
}
if (system_background == null) {
#if HAS_MUTTER334
system_background = new Meta.Background (background_actor.meta_display);
#elif HAS_MUTTER330
system_background = new Meta.Background (meta_display);
#else
system_background = new Meta.Background (meta_screen);
#endif
system_background.set_color (DEFAULT_BACKGROUND_COLOR);
system_background.set_file (background_file, GDesktop.BackgroundStyle.WALLPAPER);
}
#if HAS_MUTTER334
background_actor.background = system_background;
#else
background = system_background;
#endif
var cache = Meta.BackgroundImageCache.get_default ();
var image = cache.load (background_file);

View File

@ -20,7 +20,7 @@ namespace Gala
public struct Accelerator
{
public string name;
public uint flags;
public Meta.KeyBindingFlags flags;
}
[DBus (name="org.gnome.Shell")]
@ -45,9 +45,13 @@ namespace Gala
DBusAccelerator (WindowManager _wm)
{
wm = _wm;
grabbed_accelerators = new HashTable<string, uint> (str_hash, str_equal);
grabbed_accelerators = new HashTable<string, uint?> (str_hash, str_equal);
#if HAS_MUTTER330
wm.get_display ().accelerator_activated.connect (on_accelerator_activated);
#else
wm.get_screen ().get_display ().accelerator_activated.connect (on_accelerator_activated);
#endif
}
void on_accelerator_activated (uint action, uint device_id, uint timestamp)
@ -68,7 +72,13 @@ namespace Gala
uint? action = grabbed_accelerators[accelerator];
if (action == null) {
#if HAS_MUTTER332
action = wm.get_display ().grab_accelerator (accelerator, (Meta.KeyBindingFlags)flags);
#elif HAS_MUTTER330
action = wm.get_display ().grab_accelerator (accelerator);
#else
action = wm.get_screen ().get_display ().grab_accelerator (accelerator);
#endif
if (action > 0) {
grabbed_accelerators[accelerator] = action;
}
@ -94,7 +104,11 @@ namespace Gala
foreach (unowned string accelerator in grabbed_accelerators.get_keys ()) {
if (grabbed_accelerators[accelerator] == action) {
#if HAS_MUTTER330
ret = wm.get_display ().ungrab_accelerator (action);
#else
ret = wm.get_screen ().get_display ().ungrab_accelerator (action);
#endif
grabbed_accelerators.remove (accelerator);
break;
}

View File

@ -71,6 +71,63 @@ namespace Gala
/**
* set the area where clutter can receive events
**/
#if HAS_MUTTER330
public static void set_input_area (Display display, InputArea area)
{
X.Xrectangle[] rects = {};
int width, height;
display.get_size (out width, out height);
var geometry = display.get_monitor_geometry (display.get_primary_monitor ());
switch (area) {
case InputArea.FULLSCREEN:
X.Xrectangle rect = {0, 0, (ushort)width, (ushort)height};
rects = {rect};
break;
case InputArea.DEFAULT:
var schema = BehaviorSettings.get_default ().schema;
// if ActionType is NONE make it 0 sized
ushort tl_size = (schema.get_enum ("hotcorner-topleft") != ActionType.NONE ? 1 : 0);
ushort tr_size = (schema.get_enum ("hotcorner-topright") != ActionType.NONE ? 1 : 0);
ushort bl_size = (schema.get_enum ("hotcorner-bottomleft") != ActionType.NONE ? 1 : 0);
ushort br_size = (schema.get_enum ("hotcorner-bottomright") != ActionType.NONE ? 1 : 0);
X.Xrectangle topleft = {(short)geometry.x, (short)geometry.y, tl_size, tl_size};
X.Xrectangle topright = {(short)(geometry.x + geometry.width - 1), (short)geometry.y, tr_size, tr_size};
X.Xrectangle bottomleft = {(short)geometry.x, (short)(geometry.y + geometry.height - 1), bl_size, bl_size};
X.Xrectangle bottomright = {(short)(geometry.x + geometry.width - 1), (short)(geometry.y + geometry.height - 1), br_size, br_size};
rects = {topleft, topright, bottomleft, bottomright};
// add plugin's requested areas
if (area == InputArea.FULLSCREEN || area == InputArea.DEFAULT) {
foreach (var rect in PluginManager.get_default ().regions) {
rects += rect;
}
}
break;
case InputArea.NONE:
default:
#if HAS_MUTTER334
unowned Meta.X11Display x11display = display.get_x11_display ();
x11display.clear_stage_input_region ();
#else
Util.empty_stage_input_region (display);
#endif
return;
}
#if HAS_MUTTER334
unowned Meta.X11Display x11display = display.get_x11_display ();
var xregion = X.Fixes.create_region (x11display.get_xdisplay (), rects);
x11display.set_stage_input_region (xregion);
#else
var xregion = X.Fixes.create_region (display.get_x11_display ().get_xdisplay (), rects);
Util.set_stage_input_region (display, xregion);
#endif
}
#else
public static void set_input_area (Screen screen, InputArea area)
{
var display = screen.get_display ();
@ -117,6 +174,7 @@ namespace Gala
var xregion = X.Fixes.create_region (display.get_xdisplay (), rects);
Util.set_stage_input_region (screen, xregion);
}
#endif
/**
* Inserts a workspace at the given index. To ensure the workspace is not immediately
@ -132,7 +190,11 @@ namespace Gala
new_window.change_workspace_by_index (index, false);
#if HAS_MUTTER330
unowned List<unowned WindowActor> actors = Compositor.get_window_actors (new_window.get_display ());
#else
unowned List<unowned WindowActor> actors = Compositor.get_window_actors (new_window.get_screen ());
#endif
foreach (unowned Meta.WindowActor actor in actors) {
if (actor.is_destroyed ())
continue;

View File

@ -74,7 +74,11 @@ namespace Gala
debug ("Taking screenshot");
int width, height;
#if HAS_MUTTER330
wm.get_display ().get_size (out width, out height);
#else
wm.get_screen ().get_size (out width, out height);
#endif
var image = take_screenshot (0, 0, width, height, include_cursor);
@ -106,7 +110,11 @@ namespace Gala
{
debug ("Taking window screenshot");
#if HAS_MUTTER330
var window = wm.get_display ().get_focus_window ();
#else
var window = wm.get_screen ().get_display ().get_focus_window ();
#endif
var window_actor = (Meta.WindowActor) window.get_compositor_private ();
unowned Meta.ShapedTexture window_texture = (Meta.ShapedTexture) window_actor.get_texture ();
@ -261,7 +269,11 @@ namespace Gala
Cairo.ImageSurface composite_stage_cursor (Cairo.ImageSurface image, Cairo.RectangleInt image_rect)
{
#if HAS_MUTTER330
unowned Meta.CursorTracker cursor_tracker = Meta.CursorTracker.get_for_display (wm.get_display ());
#else
unowned Meta.CursorTracker cursor_tracker = Meta.CursorTracker.get_for_screen (wm.get_screen ());
#endif
int x, y;
cursor_tracker.get_pointer (out x, out y, null);

View File

@ -333,7 +333,11 @@ namespace Gala
*/
void close ()
{
#if HAS_MUTTER330
var time = workspace.get_display ().get_current_time ();
#else
var time = workspace.get_screen ().get_display ().get_current_time ();
#endif
foreach (var window in workspace.list_windows ()) {
var type = window.window_type;
if (!window.is_on_all_workspaces () && (type == WindowType.NORMAL
@ -406,13 +410,30 @@ namespace Gala
// it's not safe to to call meta_workspace_index() here, we may be still animating something
// while the workspace is already gone, which would result in a crash.
#if HAS_MUTTER330
unowned Meta.WorkspaceManager manager = workspace.get_display ().get_workspace_manager ();
int workspace_index = 0;
for (int i = 0; i < manager.get_n_workspaces (); i++) {
if (manager.get_workspace_by_index (i) == workspace) {
workspace_index = i;
break;
}
}
#else
var screen = workspace.get_screen ();
var workspace_index = screen.get_workspaces ().index (workspace);
#endif
if (n_windows < 1) {
#if HAS_MUTTER330
if (!Prefs.get_dynamic_workspaces ()
|| workspace_index != manager.get_n_workspaces () - 1)
return false;
#else
if (!Prefs.get_dynamic_workspaces ()
|| workspace_index != screen.get_n_workspaces () - 1)
return false;
#endif
var buffer = new Granite.Drawing.BufferSurface (SIZE * scale, SIZE * scale);
var offset = (SIZE * scale) / 2 - (PLUS_WIDTH * scale) / 2;
@ -507,12 +528,21 @@ namespace Gala
Actor drag_begin (float click_x, float click_y)
{
#if HAS_MUTTER330
unowned Meta.WorkspaceManager manager = workspace.get_display ().get_workspace_manager ();
if (icon_container.get_n_children () < 1 &&
Prefs.get_dynamic_workspaces () &&
workspace.index () == manager.get_n_workspaces () - 1) {
return null;
}
#else
unowned Screen screen = workspace.get_screen ();
if (icon_container.get_n_children () < 1 &&
Prefs.get_dynamic_workspaces () &&
workspace.index () == screen.get_n_workspaces () - 1) {
return null;
}
#endif
float abs_x, abs_y;
float prev_parent_x, prev_parent_y;
@ -545,7 +575,12 @@ namespace Gala
get_parent ().remove_child (this);
unowned WorkspaceInsertThumb inserter = (WorkspaceInsertThumb) destination;
#if HAS_MUTTER330
unowned Meta.WorkspaceManager manager = workspace.get_display ().get_workspace_manager ();
manager.reorder_workspace (workspace, inserter.workspace_index);
#else
workspace.get_screen ().reorder_workspace (workspace, inserter.workspace_index);
#endif
restore_group ();
} else {

View File

@ -32,14 +32,27 @@ namespace Gala
public signal void request_reposition (bool animate);
#if HAS_MUTTER330
public Meta.Display display { get; construct; }
#else
public Screen screen { get; construct; }
#endif
#if HAS_MUTTER330
public IconGroupContainer (Meta.Display display)
{
Object (display: display);
layout_manager = new BoxLayout ();
}
#else
public IconGroupContainer (Screen screen)
{
Object (screen: screen);
layout_manager = new BoxLayout ();
}
#endif
public void add_group (IconGroup group)
{

View File

@ -31,32 +31,59 @@ namespace Gala
{
public signal void window_selected (Window window);
#if HAS_MUTTER330
public Meta.Display display { get; construct; }
#else
public Screen screen { get; construct; }
#endif
public int monitor { get; construct; }
WindowCloneContainer window_container;
BackgroundManager background;
#if HAS_MUTTER330
public MonitorClone (Meta.Display display, int monitor)
{
Object (display: display, monitor: monitor);
}
#else
public MonitorClone (Screen screen, int monitor)
{
Object (screen: screen, monitor: monitor);
}
#endif
construct
{
reactive = true;
#if HAS_MUTTER330
background = new BackgroundManager (display, monitor, false);
#else
background = new BackgroundManager (screen, monitor, false);
#endif
background.set_easing_duration (MultitaskingView.ANIMATION_DURATION);
window_container = new WindowCloneContainer ();
window_container.window_selected.connect ((w) => { window_selected (w); });
#if HAS_MUTTER330
display.restacked.connect (window_container.restack_windows);
display.window_entered_monitor.connect (window_entered);
display.window_left_monitor.connect (window_left);
#else
screen.restacked.connect (window_container.restack_windows);
screen.window_entered_monitor.connect (window_entered);
screen.window_left_monitor.connect (window_left);
#endif
foreach (unowned Meta.WindowActor window_actor in Meta.Compositor.get_window_actors (screen)) {
#if HAS_MUTTER330
unowned GLib.List<weak Meta.WindowActor>? window_actors = Meta.Compositor.get_window_actors (display);
#else
unowned GLib.List<weak Meta.WindowActor>? window_actors = Meta.Compositor.get_window_actors (screen);
#endif
foreach (unowned Meta.WindowActor window_actor in window_actors) {
if (window_actor.is_destroyed ())
continue;
@ -77,9 +104,15 @@ namespace Gala
~MonitorClone ()
{
#if HAS_MUTTER330
display.window_entered_monitor.disconnect (window_entered);
display.window_left_monitor.disconnect (window_left);
display.restacked.disconnect (window_container.restack_windows);
#else
screen.window_entered_monitor.disconnect (window_entered);
screen.window_left_monitor.disconnect (window_left);
screen.restacked.disconnect (window_container.restack_windows);
#endif
}
/**
@ -87,7 +120,11 @@ namespace Gala
*/
public void update_allocation ()
{
#if HAS_MUTTER330
var monitor_geometry = display.get_monitor_geometry (monitor);
#else
var monitor_geometry = screen.get_monitor_geometry (monitor);
#endif
set_position (monitor_geometry.x, monitor_geometry.y);
set_size (monitor_geometry.width, monitor_geometry.height);

View File

@ -33,7 +33,11 @@ namespace Gala
public WindowManager wm { get; construct; }
#if HAS_MUTTER330
Meta.Display display;
#else
Meta.Screen screen;
#endif
ModalProxy modal_proxy;
bool opened = false;
bool animating = false;
@ -58,13 +62,21 @@ namespace Gala
clip_to_allocation = true;
opened = false;
#if HAS_MUTTER330
display = wm.get_display ();
#else
screen = wm.get_screen ();
#endif
workspaces = new Actor ();
workspaces.set_easing_mode (AnimationMode.EASE_OUT_QUAD);
#if HAS_MUTTER330
icon_groups = new IconGroupContainer (display);
#else
icon_groups = new IconGroupContainer (screen);
icon_groups.request_reposition.connect ((animate) => reposition_icon_groups (animate));
#endif
dock_clones = new Actor ();
@ -72,6 +84,18 @@ namespace Gala
add_child (workspaces);
add_child (dock_clones);
#if HAS_MUTTER330
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
for (int i = 0; i < manager.get_n_workspaces (); i++) {
add_workspace (i);
}
manager.workspace_added.connect (add_workspace);
manager.workspace_removed.connect (remove_workspace);
manager.workspace_switched.connect_after ((from, to, direction) => {
update_positions (opened);
});
#else
foreach (var workspace in screen.get_workspaces ())
add_workspace (workspace.index ());
@ -81,10 +105,15 @@ namespace Gala
screen.workspace_switched.connect_after ((from, to, direction) => {
update_positions (opened);
});
#endif
window_containers_monitors = new List<MonitorClone> ();
update_monitors ();
#if HAS_MUTTER330
Meta.MonitorManager.@get ().monitors_changed.connect (update_monitors);
#else
screen.monitors_changed.connect (update_monitors);
#endif
Prefs.add_listener ((pref) => {
if (pref == Preference.WORKSPACES_ONLY_ON_PRIMARY) {
@ -97,6 +126,24 @@ namespace Gala
return;
Idle.add (() => {
#if HAS_MUTTER330
unowned List<Workspace> existing_workspaces = null;
for (int i = 0; i < manager.get_n_workspaces (); i++) {
existing_workspaces.append (manager.get_workspace_by_index (i));
}
foreach (var child in workspaces.get_children ()) {
unowned WorkspaceClone workspace_clone = (WorkspaceClone) child;
if (existing_workspaces.index (workspace_clone.workspace) < 0) {
workspace_clone.window_selected.disconnect (window_selected);
workspace_clone.selected.disconnect (activate_workspace);
icon_groups.remove_group (workspace_clone.icon_group);
workspace_clone.destroy ();
}
}
#else
unowned List<Workspace> existing_workspaces = screen.get_workspaces ();
foreach (var child in workspaces.get_children ()) {
@ -110,6 +157,7 @@ namespace Gala
workspace_clone.destroy ();
}
}
#endif
update_monitors ();
update_positions (false);
@ -128,6 +176,25 @@ namespace Gala
foreach (var monitor_clone in window_containers_monitors)
monitor_clone.destroy ();
#if HAS_MUTTER330
var primary = display.get_primary_monitor ();
if (InternalUtils.workspaces_only_on_primary ()) {
for (var monitor = 0; monitor < display.get_n_monitors (); monitor++) {
if (monitor == primary)
continue;
var monitor_clone = new MonitorClone (display, monitor);
monitor_clone.window_selected.connect (window_selected);
monitor_clone.visible = opened;
window_containers_monitors.append (monitor_clone);
wm.ui_group.add_child (monitor_clone);
}
}
var primary_geometry = display.get_monitor_geometry (primary);
#else
var primary = screen.get_primary_monitor ();
if (InternalUtils.workspaces_only_on_primary ()) {
@ -145,6 +212,7 @@ namespace Gala
}
var primary_geometry = screen.get_monitor_geometry (primary);
#endif
set_position (primary_geometry.x, primary_geometry.y);
set_size (primary_geometry.width, primary_geometry.height);
@ -206,11 +274,20 @@ namespace Gala
// smooth scroll delay still active
return false;
#if HAS_MUTTER330
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
var active_workspace = manager.get_active_workspace ();
var new_workspace = active_workspace.get_neighbor (direction);
if (active_workspace != new_workspace)
new_workspace.activate (display.get_current_time ());
#else
var active_workspace = screen.get_active_workspace ();
var new_workspace = active_workspace.get_neighbor (direction);
if (active_workspace != new_workspace)
new_workspace.activate (screen.get_display ().get_current_time ());
#endif
return false;
}
@ -225,7 +302,12 @@ namespace Gala
void update_positions (bool animate)
{
var scale = InternalUtils.get_ui_scaling_factor ();
#if HAS_MUTTER330
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
var active_index = manager.get_active_workspace ().index ();
#else
var active_index = screen.get_active_workspace ().index ();
#endif
var active_x = 0.0f;
foreach (var child in workspaces.get_children ()) {
@ -254,7 +336,12 @@ namespace Gala
void reposition_icon_groups (bool animate)
{
#if HAS_MUTTER330
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
var active_index = manager.get_active_workspace ().index ();
#else
var active_index = screen.get_active_workspace ().index ();
#endif
if (animate) {
icon_groups.save_easing_state ();
@ -277,7 +364,12 @@ namespace Gala
void add_workspace (int num)
{
#if HAS_MUTTER330
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
var workspace = new WorkspaceClone (manager.get_workspace_by_index (num));
#else
var workspace = new WorkspaceClone (screen.get_workspace_by_index (num));
#endif
workspace.window_selected.connect (window_selected);
workspace.selected.connect (activate_workspace);
@ -295,14 +387,31 @@ namespace Gala
WorkspaceClone? workspace = null;
// FIXME is there a better way to get the removed workspace?
#if HAS_MUTTER330
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
#else
unowned List<Meta.Workspace> existing_workspaces = screen.get_workspaces ();
#endif
foreach (var child in workspaces.get_children ()) {
unowned WorkspaceClone clone = (WorkspaceClone) child;
#if HAS_MUTTER330
for (int i = 0; i < manager.get_n_workspaces (); i++) {
if (manager.get_workspace_by_index (i) == clone.workspace) {
workspace = clone;
break;
}
}
if (workspace != null) {
break;
}
#else
if (existing_workspaces.index (clone.workspace) < 0) {
workspace = clone;
break;
}
#endif
}
if (workspace == null)
@ -330,9 +439,16 @@ namespace Gala
*/
void activate_workspace (WorkspaceClone clone, bool close_view)
{
#if HAS_MUTTER330
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
close_view = close_view && manager.get_active_workspace () == clone.workspace;
clone.workspace.activate (display.get_current_time ());
#else
close_view = close_view && screen.get_active_workspace () == clone.workspace;
clone.workspace.activate (screen.get_display ().get_current_time ());
#endif
if (close_view)
toggle ();
@ -393,18 +509,40 @@ namespace Gala
*/
WorkspaceClone get_active_workspace_clone ()
{
#if HAS_MUTTER330
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
foreach (var child in workspaces.get_children ()) {
unowned WorkspaceClone workspace_clone = (WorkspaceClone) child;
if (workspace_clone.workspace == manager.get_active_workspace ()) {
return workspace_clone;
}
}
#else
foreach (var child in workspaces.get_children ()) {
unowned WorkspaceClone workspace_clone = (WorkspaceClone) child;
if (workspace_clone.workspace == screen.get_active_workspace ()) {
return workspace_clone;
}
}
#endif
assert_not_reached ();
}
void window_selected (Meta.Window window)
{
#if HAS_MUTTER330
var time = display.get_current_time ();
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
var workspace = window.get_workspace ();
if (workspace != manager.get_active_workspace ())
workspace.activate (time);
else {
window.activate (time);
toggle ();
}
#else
var time = screen.get_display ().get_current_time ();
var workspace = window.get_workspace ();
@ -414,6 +552,7 @@ namespace Gala
window.activate (time);
toggle ();
}
#endif
}
/**
@ -487,7 +626,12 @@ namespace Gala
// find active workspace clone and raise it, so there are no overlaps while transitioning
WorkspaceClone? active_workspace = null;
#if HAS_MUTTER330
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
var active = manager.get_active_workspace ();
#else
var active = screen.get_active_workspace ();
#endif
foreach (var child in workspaces.get_children ()) {
unowned WorkspaceClone workspace = (WorkspaceClone) child;
if (workspace.workspace == active) {
@ -517,7 +661,12 @@ namespace Gala
dock_clones.get_transformed_position (out clone_offset_x, out clone_offset_y);
if (opening) {
foreach (unowned Meta.WindowActor actor in Meta.Compositor.get_window_actors (screen)) {
#if HAS_MUTTER330
unowned GLib.List<weak Meta.WindowActor>? window_actors = Meta.Compositor.get_window_actors (display);
#else
unowned GLib.List<weak Meta.WindowActor>? window_actors = Meta.Compositor.get_window_actors (screen);
#endif
foreach (unowned Meta.WindowActor actor in window_actors) {
const int MAX_OFFSET = 100;
if (actor.is_destroyed ())
@ -529,10 +678,17 @@ namespace Gala
if (window.window_type != WindowType.DOCK)
continue;
#if HAS_MUTTER330
if (display.get_monitor_in_fullscreen (monitor))
continue;
var monitor_geom = display.get_monitor_geometry (monitor);
#else
if (screen.get_monitor_in_fullscreen (monitor))
continue;
var monitor_geom = screen.get_monitor_geometry (monitor);
#endif
var window_geom = window.get_frame_rect ();
var top = monitor_geom.y + MAX_OFFSET > window_geom.y;

View File

@ -44,7 +44,11 @@ namespace Gala
reactive = true;
int screen_width, screen_height;
#if HAS_MUTTER330
wm.get_display ().get_size (out screen_width, out screen_height);
#else
wm.get_screen ().get_size (out screen_width, out screen_height);
#endif
width = screen_width;
height = screen_height;
@ -125,7 +129,11 @@ namespace Gala
public void close ()
{
#if HAS_MUTTER330
wm.get_display ().set_cursor (Meta.Cursor.DEFAULT);
#else
wm.get_screen ().set_cursor (Meta.Cursor.DEFAULT);
#endif
if (modal_proxy != null) {
wm.pop_modal (modal_proxy);
@ -134,7 +142,11 @@ namespace Gala
public void start_selection ()
{
#if HAS_MUTTER330
wm.get_display ().set_cursor (Meta.Cursor.CROSSHAIR);
#else
wm.get_screen ().set_cursor (Meta.Cursor.CROSSHAIR);
#endif
grab_key_focus ();
modal_proxy = wm.push_modal ();

View File

@ -269,8 +269,13 @@ namespace Gala
*/
bool should_fade ()
{
#if HAS_MUTTER330
return (overview_mode
&& window.get_workspace () != window.get_display ().get_workspace_manager ().get_active_workspace ()) || window.minimized;
#else
return (overview_mode
&& window.get_workspace () != window.get_screen ().get_active_workspace ()) || window.minimized;
#endif
}
void on_all_workspaces_changed ()
@ -289,7 +294,11 @@ namespace Gala
{
var outer_rect = window.get_frame_rect ();
#if HAS_MUTTER330
var monitor_geom = window.get_display ().get_monitor_geometry (window.get_monitor ());
#else
var monitor_geom = window.get_screen ().get_monitor_geometry (window.get_monitor ());
#endif
var offset_x = monitor_geom.x;
var offset_y = monitor_geom.y;
@ -458,10 +467,17 @@ namespace Gala
*/
void close_window ()
{
#if HAS_MUTTER330
unowned Meta.Display display = window.get_display ();
check_confirm_dialog_cb = display.window_entered_monitor.connect (check_confirm_dialog);
window.@delete (display.get_current_time ());
#else
var screen = window.get_screen ();
check_confirm_dialog_cb = screen.window_entered_monitor.connect (check_confirm_dialog);
window.@delete (screen.get_display ().get_current_time ());
#endif
}
void check_confirm_dialog (int monitor, Meta.Window new_window)
@ -472,7 +488,11 @@ namespace Gala
return false;
});
#if HAS_MUTTER330
SignalHandler.disconnect (window.get_display (), check_confirm_dialog_cb);
#else
SignalHandler.disconnect (window.get_screen (), check_confirm_dialog_cb);
#endif
check_confirm_dialog_cb = 0;
}
}
@ -491,7 +511,11 @@ namespace Gala
clone.destroy ();
if (check_confirm_dialog_cb != 0) {
#if HAS_MUTTER330
SignalHandler.disconnect (window.get_display (), check_confirm_dialog_cb);
#else
SignalHandler.disconnect (window.get_screen (), check_confirm_dialog_cb);
#endif
check_confirm_dialog_cb = 0;
}
@ -583,10 +607,17 @@ namespace Gala
return;
// for an icon group, we only do animations if there is an actual movement possible
#if HAS_MUTTER330
if (icon_group != null
&& icon_group.workspace == window.get_workspace ()
&& window.get_monitor () == window.get_display ().get_primary_monitor ())
return;
#else
if (icon_group != null
&& icon_group.workspace == window.get_workspace ()
&& window.get_monitor () == window.get_screen ().get_primary_monitor ())
return;
#endif
var scale = hovered ? 0.4 : 1.0;
var opacity = hovered ? 0 : 255;
@ -621,7 +652,11 @@ namespace Gala
void drag_end (Actor destination)
{
Meta.Workspace workspace = null;
#if HAS_MUTTER330
var primary = window.get_display ().get_primary_monitor ();
#else
var primary = window.get_screen ().get_primary_monitor ();
#endif
active_shape.show ();

View File

@ -144,6 +144,33 @@ namespace Gala
* Sort the windows z-order by their actual stacking to make intersections
* during animations correct.
*/
#if HAS_MUTTER330
public void restack_windows (Meta.Display display)
{
var children = get_children ();
GLib.SList<Meta.Window> windows = new GLib.SList<Meta.Window> ();
foreach (unowned Actor child in children) {
unowned WindowClone tw = (WindowClone) child;
windows.prepend (tw.window);
}
var windows_ordered = display.sort_windows_by_stacking (windows);
windows_ordered.reverse ();
foreach (unowned Meta.Window window in windows_ordered) {
var i = 0;
foreach (unowned Actor child in children) {
if (((WindowClone) child).window == window) {
set_child_at_index (child, i);
children.remove (child);
i++;
break;
}
}
}
}
#else
public void restack_windows (Screen screen)
{
unowned Meta.Display display = screen.get_display ();
@ -170,6 +197,7 @@ namespace Gala
}
}
}
#endif
/**
* Recalculate the tiling positions of the windows and animate them to

View File

@ -37,7 +37,11 @@ namespace Gala
public WindowManager wm { get; construct; }
#if HAS_MUTTER330
Meta.Display display;
#else
Meta.Screen screen;
#endif
ModalProxy modal_proxy;
bool ready;
@ -52,10 +56,17 @@ namespace Gala
construct
{
#if HAS_MUTTER330
display = wm.get_display ();
display.get_workspace_manager ().workspace_switched.connect (close);
display.restacked.connect (restack_windows);
#else
screen = wm.get_screen ();
screen.workspace_switched.connect (close);
screen.restacked.connect (restack_windows);
#endif
visible = false;
ready = true;
@ -64,7 +75,11 @@ namespace Gala
~WindowOverview ()
{
#if HAS_MUTTER330
display.restacked.disconnect (restack_windows);
#else
screen.restacked.disconnect (restack_windows);
#endif
}
public override bool key_press_event (Clutter.KeyEvent event)
@ -120,12 +135,23 @@ namespace Gala
workspaces = new List<Workspace> ();
#if HAS_MUTTER330
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
if (all_windows) {
for (int i = 0; i < manager.get_n_workspaces (); i++) {
workspaces.append (manager.get_workspace_by_index (i));
}
} else {
workspaces.append (manager.get_active_workspace ());
}
#else
if (all_windows) {
foreach (var workspace in screen.get_workspaces ())
workspaces.append (workspace);
} else {
workspaces.append (screen.get_active_workspace ());
}
#endif
foreach (var workspace in workspaces) {
foreach (var window in workspace.list_windows ()) {
@ -161,10 +187,17 @@ namespace Gala
workspace.window_removed.connect (remove_window);
}
#if HAS_MUTTER330
display.window_left_monitor.connect (window_left_monitor);
// sort windows by stacking order
var windows = display.sort_windows_by_stacking (used_windows);
#else
screen.window_left_monitor.connect (window_left_monitor);
// sort windows by stacking order
var windows = screen.get_display ().sort_windows_by_stacking (used_windows);
#endif
grab_key_focus ();
@ -173,8 +206,13 @@ namespace Gala
visible = true;
#if HAS_MUTTER330
for (var i = 0; i < display.get_n_monitors (); i++) {
var geometry = display.get_monitor_geometry (i);
#else
for (var i = 0; i < screen.get_n_monitors (); i++) {
var geometry = screen.get_monitor_geometry (i);
#endif
var container = new WindowCloneContainer (true);
container.padding_top = TOP_GAP;
@ -211,11 +249,19 @@ namespace Gala
return (name != "expose-windows" && name != "expose-all-windows");
}
#if HAS_MUTTER330
void restack_windows (Display display)
{
foreach (var child in get_children ())
((WindowCloneContainer) child).restack_windows (display);
}
#else
void restack_windows (Screen screen)
{
foreach (var child in get_children ())
((WindowCloneContainer) child).restack_windows (screen);
}
#endif
void window_left_monitor (int num, Window window)
{
@ -258,6 +304,22 @@ namespace Gala
container.remove_window (window);
}
#if HAS_MUTTER330
void thumb_selected (Window window)
{
if (window.get_workspace () == display.get_workspace_manager ().get_active_workspace ()) {
window.activate (display.get_current_time ());
close ();
} else {
close ();
//wait for the animation to finish before switching
Timeout.add (400, () => {
window.get_workspace ().activate_with_focus (window, display.get_current_time ());
return false;
});
}
}
#else
void thumb_selected (Window window)
{
if (window.get_workspace () == screen.get_active_workspace ()) {
@ -272,6 +334,7 @@ namespace Gala
});
}
}
#endif
/**
* {@inheritDoc}
@ -285,7 +348,11 @@ namespace Gala
workspace.window_added.disconnect (add_window);
workspace.window_removed.disconnect (remove_window);
}
#if HAS_MUTTER330
display.window_left_monitor.disconnect (window_left_monitor);
#else
screen.window_left_monitor.disconnect (window_left_monitor);
#endif
ready = false;
@ -307,7 +374,11 @@ namespace Gala
ready = true;
visible = false;
#if HAS_MUTTER330
foreach (var window in display.get_workspace_manager ().get_active_workspace ().list_windows ())
#else
foreach (var window in screen.get_active_workspace ().list_windows ())
#endif
if (window.showing_on_its_workspace ())
((Actor) window.get_compositor_private ()).show ();

View File

@ -104,7 +104,11 @@ namespace Gala
add_child (window_clones);
add_child (dock);
#if HAS_MUTTER330
Meta.MonitorManager.@get ().monitors_changed.connect (update_actors);
#else
wm.get_screen ().monitors_changed.connect (update_actors);
#endif
visible = false;
}
@ -114,7 +118,12 @@ namespace Gala
if (monitor != null)
monitor.cancel ();
#if HAS_MUTTER330
Meta.MonitorManager.@get ().monitors_changed.disconnect (update_actors);
#else
wm.get_screen ().monitors_changed.disconnect (update_actors);
#endif
}
void load_dock_theme ()
@ -136,8 +145,13 @@ namespace Gala
{
ui_scale_factor = InternalUtils.get_ui_scaling_factor ();
#if HAS_MUTTER330
unowned Meta.Display display = wm.get_display ();
var geometry = display.get_monitor_geometry (display.get_primary_monitor ());
#else
var screen = wm.get_screen ();
var geometry = screen.get_monitor_geometry (screen.get_primary_monitor ());
#endif
var layout = (BoxLayout) dock.layout_manager;
var position = dock_settings.Position;
@ -190,7 +204,11 @@ namespace Gala
void update_background ()
{
int width = 0, height = 0;
#if HAS_MUTTER330
wm.get_display ().get_size (out width, out height);
#else
wm.get_screen ().get_size (out width, out height);
#endif
background.set_size (width, height);
}
@ -336,7 +354,11 @@ namespace Gala
// wait for the dimming to finish
Timeout.add (250, () => {
#if HAS_MUTTER330
close (wm.get_display ().get_current_time ());
#else
close (wm.get_screen ().get_display ().get_current_time ());
#endif
return false;
});
} else
@ -353,7 +375,11 @@ namespace Gala
void icon_removed (Actor actor)
{
if (dock.get_n_children () == 1) {
#if HAS_MUTTER330
close (wm.get_display ().get_current_time ());
#else
close (wm.get_screen ().get_display ().get_current_time ());
#endif
return;
}
@ -378,12 +404,21 @@ namespace Gala
public override void key_focus_out ()
{
#if HAS_MUTTER330
close (wm.get_display ().get_current_time ());
#else
close (wm.get_screen ().get_display ().get_current_time ());
#endif
}
[CCode (instance_pos = -1)]
#if HAS_MUTTER330
public void handle_switch_windows (Display display, Window? window, Clutter.KeyEvent event,
KeyBinding binding)
#else
public void handle_switch_windows (Display display, Screen screen, Window? window,
Clutter.KeyEvent event, KeyBinding binding)
#endif
{
var now = get_monotonic_time () / 1000;
if (now - last_switch < MIN_DELTA)
@ -397,7 +432,11 @@ namespace Gala
last_switch = now;
#if HAS_MUTTER330
var workspace = display.get_workspace_manager ().get_active_workspace ();
#else
var workspace = screen.get_active_workspace ();
#endif
var binding_name = binding.get_name ();
var backward = binding_name.has_suffix ("-backward");
@ -442,14 +481,24 @@ namespace Gala
dim_windows ();
grab_key_focus ();
#if HAS_MUTTER330
if ((get_current_modifiers () & modifier_mask) == 0)
close (wm.get_display ().get_current_time ());
#else
if ((get_current_modifiers () & modifier_mask) == 0)
close (wm.get_screen ().get_display ().get_current_time ());
#endif
}
void close_cleanup ()
{
#if HAS_MUTTER330
var display = wm.get_display ();
var workspace = display.get_workspace_manager ().get_active_workspace ();
#else
var screen = wm.get_screen ();
var workspace = screen.get_active_workspace ();
#endif
dock.destroy_all_children ();
@ -460,7 +509,12 @@ namespace Gala
window_clones.destroy_all_children ();
// need to go through all the windows because of hidden dialogs
foreach (unowned Meta.WindowActor actor in Meta.Compositor.get_window_actors (screen)) {
#if HAS_MUTTER330
unowned GLib.List<weak Meta.WindowActor>? window_actors = Meta.Compositor.get_window_actors (display);
#else
unowned GLib.List<weak Meta.WindowActor>? window_actors = Meta.Compositor.get_window_actors (screen);
#endif
foreach (unowned Meta.WindowActor actor in window_actors) {
if (actor.is_destroyed ())
continue;
@ -625,8 +679,12 @@ namespace Gala
*/
bool collect_windows (Workspace workspace)
{
#if HAS_MUTTER330
var display = workspace.get_display ();
#else
var screen = workspace.get_screen ();
var display = screen.get_display ();
#endif
var windows = display.get_tab_list (TabList.NORMAL, workspace);
var current = display.get_tab_current (TabList.NORMAL, workspace);
@ -639,7 +697,11 @@ namespace Gala
if (window.minimized)
window.unminimize ();
else
#if HAS_MUTTER330
Utils.bell (display);
#else
Utils.bell (screen);
#endif
window.activate (display.get_current_time ());
@ -658,7 +720,12 @@ namespace Gala
current_window = (WindowIcon) dock.get_child_at_index (0);
// hide the others
foreach (unowned Meta.WindowActor actor in Meta.Compositor.get_window_actors (screen)) {
#if HAS_MUTTER330
unowned GLib.List<weak Meta.WindowActor>? window_actors = Meta.Compositor.get_window_actors (display);
#else
unowned GLib.List<weak Meta.WindowActor>? window_actors = Meta.Compositor.get_window_actors (screen);
#endif
foreach (unowned Meta.WindowActor actor in window_actors) {
if (actor.is_destroyed ())
continue;

View File

@ -25,15 +25,28 @@ namespace Gala
*/
class FramedBackground : BackgroundManager
{
#if HAS_MUTTER330
public FramedBackground (Display display)
{
Object (display: display, monitor_index: display.get_primary_monitor (), control_position: false);
}
#else
public FramedBackground (Screen screen)
{
Object (screen: screen, monitor_index: screen.get_primary_monitor (), control_position: false);
}
#endif
construct
{
#if HAS_MUTTER330
var primary = display.get_primary_monitor ();
var monitor_geom = display.get_monitor_geometry (primary);
#else
var primary = screen.get_primary_monitor ();
var monitor_geom = screen.get_monitor_geometry (primary);
#endif
var effect = new ShadowEffect (40, 5);
effect.css_class = "workspace";
@ -137,10 +150,19 @@ namespace Gala
{
opened = false;
#if HAS_MUTTER330
unowned Display display = workspace.get_display ();
var monitor_geometry = display.get_monitor_geometry (display.get_primary_monitor ());
#else
unowned Screen screen = workspace.get_screen ();
var monitor_geometry = screen.get_monitor_geometry (screen.get_primary_monitor ());
#endif
background = new FramedBackground (workspace.get_screen ());
#if HAS_MUTTER330
background = new FramedBackground (display);
#else
background = new FramedBackground (screen);
#endif
background.reactive = true;
background.button_press_event.connect (() => {
selected (true);
@ -150,14 +172,25 @@ namespace Gala
window_container = new WindowCloneContainer ();
window_container.window_selected.connect ((w) => { window_selected (w); });
window_container.set_size (monitor_geometry.width, monitor_geometry.height);
#if HAS_MUTTER330
display.restacked.connect (window_container.restack_windows);
#else
screen.restacked.connect (window_container.restack_windows);
#endif
icon_group = new IconGroup (workspace);
icon_group.selected.connect (() => {
#if HAS_MUTTER330
if (workspace == display.get_workspace_manager ().get_active_workspace ())
Utils.bell (display);
else
selected (false);
#else
if (workspace == screen.get_active_workspace ())
Utils.bell (screen);
else
selected (false);
#endif
});
var icons_drop_action = new DragDropAction (DragDropActionType.DESTINATION, "multitaskingview-window");
@ -181,8 +214,13 @@ namespace Gala
}
});
#if HAS_MUTTER330
display.window_entered_monitor.connect (window_entered_monitor);
display.window_left_monitor.connect (window_left_monitor);
#else
screen.window_entered_monitor.connect (window_entered_monitor);
screen.window_left_monitor.connect (window_left_monitor);
#endif
workspace.window_added.connect (add_window);
workspace.window_removed.connect (remove_window);
@ -192,12 +230,21 @@ namespace Gala
// add existing windows
var windows = workspace.list_windows ();
foreach (var window in windows) {
#if HAS_MUTTER330
if (window.window_type == WindowType.NORMAL
&& !window.on_all_workspaces
&& window.get_monitor () == display.get_primary_monitor ()) {
window_container.add_window (window);
icon_group.add_window (window, true);
}
#else
if (window.window_type == WindowType.NORMAL
&& !window.on_all_workspaces
&& window.get_monitor () == screen.get_primary_monitor ()) {
window_container.add_window (window);
icon_group.add_window (window, true);
}
#endif
}
var listener = WindowListener.get_default ();
@ -206,12 +253,21 @@ namespace Gala
~WorkspaceClone ()
{
#if HAS_MUTTER330
unowned Meta.Display display = workspace.get_display ();
display.restacked.disconnect (window_container.restack_windows);
display.window_entered_monitor.disconnect (window_entered_monitor);
display.window_left_monitor.disconnect (window_left_monitor);
#else
unowned Screen screen = workspace.get_screen ();
screen.restacked.disconnect (window_container.restack_windows);
screen.window_entered_monitor.disconnect (window_entered_monitor);
screen.window_left_monitor.disconnect (window_left_monitor);
#endif
workspace.window_added.disconnect (add_window);
workspace.window_removed.disconnect (remove_window);
@ -227,11 +283,19 @@ namespace Gala
*/
void add_window (Window window)
{
#if HAS_MUTTER330
if (window.window_type != WindowType.NORMAL
|| window.get_workspace () != workspace
|| window.on_all_workspaces
|| window.get_monitor () != window.get_display ().get_primary_monitor ())
return;
#else
if (window.window_type != WindowType.NORMAL
|| window.get_workspace () != workspace
|| window.on_all_workspaces
|| window.get_monitor () != window.get_screen ().get_primary_monitor ())
return;
#endif
foreach (var child in window_container.get_children ())
if (((WindowClone) child).window == window)
@ -250,6 +314,18 @@ namespace Gala
icon_group.remove_window (window, opened);
}
#if HAS_MUTTER330
void window_entered_monitor (Display display, int monitor, Window window)
{
add_window (window);
}
void window_left_monitor (Display display, int monitor, Window window)
{
if (monitor == display.get_primary_monitor ())
remove_window (window);
}
#else
void window_entered_monitor (Screen screen, int monitor, Window window)
{
add_window (window);
@ -260,6 +336,7 @@ namespace Gala
if (monitor == screen.get_primary_monitor ())
remove_window (window);
}
#endif
void update_size (Meta.Rectangle monitor_geometry)
{
@ -296,12 +373,17 @@ namespace Gala
opened = true;
var scale_factor = InternalUtils.get_ui_scaling_factor ();
#if HAS_MUTTER330
var display = workspace.get_display ();
var monitor = display.get_monitor_geometry (display.get_primary_monitor ());
#else
var screen = workspace.get_screen ();
var display = screen.get_display ();
var scale_factor = InternalUtils.get_ui_scaling_factor ();
var monitor = screen.get_monitor_geometry (screen.get_primary_monitor ());
#endif
var scale = (float)(monitor.height - TOP_OFFSET * scale_factor - BOTTOM_OFFSET * scale_factor) / monitor.height;
var pivotY = TOP_OFFSET * scale_factor / (monitor.height - monitor.height * scale);
@ -330,7 +412,11 @@ namespace Gala
icon_group.redraw ();
#if HAS_MUTTER330
window_container.open (display.get_workspace_manager ().get_active_workspace () == workspace ? display.get_focus_window () : null);
#else
window_container.open (screen.get_active_workspace () == workspace ? display.get_focus_window () : null);
#endif
}
/**

View File

@ -29,6 +29,29 @@ namespace Gala
{
static WindowListener? instance = null;
#if HAS_MUTTER330
public static void init (Meta.Display display)
{
if (instance != null)
return;
instance = new WindowListener ();
foreach (unowned Meta.WindowActor actor in Meta.Compositor.get_window_actors (display)) {
if (actor.is_destroyed ())
continue;
unowned Meta.Window window = actor.get_meta_window ();
if (window.window_type == WindowType.NORMAL)
instance.monitor_window (window);
}
display.window_created.connect ((window) => {
if (window.window_type == WindowType.NORMAL)
instance.monitor_window (window);
});
}
#else
public static void init (Screen screen)
{
if (instance != null)
@ -50,6 +73,7 @@ namespace Gala
instance.monitor_window (window);
});
}
#endif
public static unowned WindowListener get_default ()
requires (instance != null)

View File

@ -95,12 +95,16 @@ namespace Gala
info = Meta.PluginInfo () {name = "Gala", version = Config.VERSION, author = "Gala Developers",
license = "GPLv3", description = "A nice elementary window manager"};
#if !HAS_MUTTER332
Prefs.set_ignore_request_hide_titlebar (true);
#endif
#if !HAS_MUTTER330
Prefs.override_preference_schema ("dynamic-workspaces", Config.SCHEMA + ".behavior");
Prefs.override_preference_schema ("attach-modal-dialogs", Config.SCHEMA + ".appearance");
Prefs.override_preference_schema ("button-layout", Config.SCHEMA + ".appearance");
Prefs.override_preference_schema ("edge-tiling", Config.SCHEMA + ".behavior");
Prefs.override_preference_schema ("enable-animations", Config.SCHEMA + ".animations");
#endif
}
construct {
@ -115,8 +119,13 @@ namespace Gala
Bus.watch_name (BusType.SESSION, DAEMON_DBUS_NAME, BusNameWatcherFlags.NONE, daemon_appeared, lost_daemon);
#if HAS_MUTTER330
unowned Meta.Display display = get_display ();
#elif HAS_MUTTER322
unowned Meta.Display display = get_screen ().get_display ();
#endif
#if HAS_MUTTER322
get_screen ().get_display ().gl_video_memory_purged.connect (() => {
display.gl_video_memory_purged.connect (() => {
Meta.Background.refresh_all ();
SystemBackground.refresh ();
});
@ -146,13 +155,21 @@ namespace Gala
bool show_stage ()
{
#if HAS_MUTTER330
unowned Meta.Display display = get_display ();
#else
var screen = get_screen ();
var display = screen.get_display ();
#endif
DBus.init (this);
DBusAccelerator.init (this);
MediaFeedback.init ();
#if HAS_MUTTER330
WindowListener.init (display);
#else
WindowListener.init (screen);
#endif
KeyboardManager.init (display);
// Due to a bug which enables access to the stage when using multiple monitors
@ -167,7 +184,11 @@ namespace Gala
warning (e.message);
}
#if HAS_MUTTER330
stage = Compositor.get_stage_for_display (display) as Clutter.Stage;
#else
stage = Compositor.get_stage_for_screen (screen) as Clutter.Stage;
#endif
var color = BackgroundSettings.get_default ().primary_color;
stage.background_color = Clutter.Color.from_string (color);
@ -184,24 +205,47 @@ namespace Gala
* +-- top window group
*/
#if HAS_MUTTER330
var system_background = new SystemBackground (display);
#else
var system_background = new SystemBackground (screen);
#endif
#if HAS_MUTTER334
system_background.background_actor.add_constraint (new Clutter.BindConstraint (stage,
Clutter.BindCoordinate.ALL, 0));
stage.insert_child_below (system_background.background_actor, null);
#else
system_background.add_constraint (new Clutter.BindConstraint (stage,
Clutter.BindCoordinate.ALL, 0));
stage.insert_child_below (system_background, null);
#endif
ui_group = new Clutter.Actor ();
ui_group.reactive = true;
stage.add_child (ui_group);
#if HAS_MUTTER330
window_group = Compositor.get_window_group_for_display (display);
#else
window_group = Compositor.get_window_group_for_screen (screen);
#endif
stage.remove_child (window_group);
ui_group.add_child (window_group);
#if HAS_MUTTER330
background_group = new BackgroundContainer (display);
#else
background_group = new BackgroundContainer (screen);
#endif
window_group.add_child (background_group);
window_group.set_child_below_sibling (background_group, null);
#if HAS_MUTTER330
top_window_group = Compositor.get_top_window_group_for_display (display);
#else
top_window_group = Compositor.get_top_window_group_for_screen (screen);
#endif
stage.remove_child (top_window_group);
ui_group.add_child (top_window_group);
@ -256,7 +300,11 @@ namespace Gala
/*hot corner, getting enum values from GraniteServicesSettings did not work, so we use GSettings directly*/
configure_hotcorners ();
#if HAS_MUTTER330
Meta.MonitorManager.@get ().monitors_changed.connect (configure_hotcorners);
#else
screen.monitors_changed.connect (configure_hotcorners);
#endif
BehaviorSettings.get_default ().schema.changed.connect (configure_hotcorners);
@ -327,7 +375,12 @@ namespace Gala
void configure_hotcorners ()
{
#if HAS_MUTTER330
unowned Meta.Display display = get_display ();
var geometry = display.get_monitor_geometry (display.get_primary_monitor ());
#else
var geometry = get_screen ().get_monitor_geometry (get_screen ().get_primary_monitor ());
#endif
add_hotcorner (geometry.x, geometry.y, "hotcorner-topleft");
add_hotcorner (geometry.x + geometry.width - 1, geometry.y, "hotcorner-topright");
@ -339,7 +392,11 @@ namespace Gala
void add_hotcorner (float x, float y, string key)
{
#if HAS_MUTTER330
unowned Clutter.Actor? stage = Compositor.get_stage_for_display (get_display ());
#else
unowned Clutter.Actor? stage = Compositor.get_stage_for_screen (get_screen ());
#endif
return_if_fail (stage != null);
var action = (ActionType) BehaviorSettings.get_default ().schema.get_enum (key);
@ -373,6 +430,67 @@ namespace Gala
hot_corner.y = y;
}
#if HAS_MUTTER330
[CCode (instance_pos = -1)]
void handle_cycle_workspaces (Meta.Display display, Meta.Window? window, Clutter.KeyEvent event,
Meta.KeyBinding binding)
{
var direction = (binding.get_name () == "cycle-workspaces-next" ? 1 : -1);
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
var index = manager.get_active_workspace_index () + direction;
int dynamic_offset = Prefs.get_dynamic_workspaces () ? 1 : 0;
if (index < 0)
index = manager.get_n_workspaces () - 1 - dynamic_offset;
else if (index > manager.get_n_workspaces () - 1 - dynamic_offset)
index = 0;
manager.get_workspace_by_index (index).activate (display.get_current_time ());
}
[CCode (instance_pos = -1)]
void handle_move_to_workspace (Meta.Display display, Meta.Window? window,
Clutter.KeyEvent event, Meta.KeyBinding binding)
{
if (window == null)
return;
var direction = (binding.get_name () == "move-to-workspace-left" ? MotionDirection.LEFT : MotionDirection.RIGHT);
move_window (window, direction);
}
[CCode (instance_pos = -1)]
void handle_move_to_workspace_end (Meta.Display display, Meta.Window? window,
Clutter.KeyEvent event, Meta.KeyBinding binding)
{
if (window == null)
return;
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
var index = (binding.get_name () == "move-to-workspace-first" ? 0 : manager.get_n_workspaces () - 1);
var workspace = manager.get_workspace_by_index (index);
window.change_workspace (workspace);
workspace.activate_with_focus (window, display.get_current_time ());
}
[CCode (instance_pos = -1)]
void handle_switch_to_workspace (Meta.Display display, Meta.Window? window,
Clutter.KeyEvent event, Meta.KeyBinding binding)
{
var direction = (binding.get_name () == "switch-to-workspace-left" ? MotionDirection.LEFT : MotionDirection.RIGHT);
switch_to_next_workspace (direction);
}
[CCode (instance_pos = -1)]
void handle_switch_to_workspace_end (Meta.Display display, Meta.Window? window,
Clutter.KeyEvent event, Meta.KeyBinding binding)
{
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
var index = (binding.get_name () == "switch-to-workspace-first" ? 0 : manager.n_workspaces - 1);
manager.get_workspace_by_index (index).activate (display.get_current_time ());
}
#else
[CCode (instance_pos = -1)]
void handle_cycle_workspaces (Meta.Display display, Meta.Screen screen, Meta.Window? window,
Clutter.KeyEvent event, Meta.KeyBinding binding)
@ -429,15 +547,21 @@ namespace Gala
var index = (binding.get_name () == "switch-to-workspace-first" ? 0 : screen.n_workspaces - 1);
screen.get_workspace_by_index (index).activate (display.get_current_time ());
}
#endif
/**
* {@inheritDoc}
*/
public void switch_to_next_workspace (MotionDirection direction)
{
#if HAS_MUTTER330
unowned Meta.Display display = get_display ();
var active_workspace = display.get_workspace_manager ().get_active_workspace ();
#else
var screen = get_screen ();
var display = screen.get_display ();
var active_workspace = screen.get_active_workspace ();
#endif
var neighbor = active_workspace.get_neighbor (direction);
if (neighbor != active_workspace) {
@ -466,6 +590,31 @@ namespace Gala
ui_group.add_transition ("nudge", nudge);
}
#if HAS_MUTTER330
void update_input_area ()
{
unowned Meta.Display display = get_display ();
if (screensaver != null) {
try {
if (screensaver.get_active ()) {
InternalUtils.set_input_area (display, InputArea.NONE);
return;
}
} catch (Error e) {
// the screensaver object apparently won't be null even though
// it is unavailable. This error will be thrown however, so we
// can just ignore it, because if it is thrown, the screensaver
// is unavailable.
}
}
if (is_modal ())
InternalUtils.set_input_area (display, InputArea.FULLSCREEN);
else
InternalUtils.set_input_area (display, InputArea.DEFAULT);
}
#else
void update_input_area ()
{
var screen = get_screen ();
@ -489,6 +638,7 @@ namespace Gala
else
InternalUtils.set_input_area (screen, InputArea.DEFAULT);
}
#endif
void show_bottom_stack_window (Meta.Window bottom_window)
{
@ -565,10 +715,20 @@ namespace Gala
{
var list = new Gee.ArrayList<uint32> ();
foreach (var workspace in get_screen ().get_workspaces ()) {
#if HAS_MUTTER330
unowned Meta.Display display = get_display ();
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
for (int i = 0; i < manager.get_n_workspaces (); i++) {
foreach (var window in manager.get_workspace_by_index (i).list_windows ())
list.add ((uint32)window.get_xwindow ());
}
#else
unowned GLib.List<Meta.Workspace> workspaces = get_screen ().get_workspaces ();
foreach (var workspace in workspaces) {
foreach (var window in workspace.list_windows ())
list.add ((uint32)window.get_xwindow ());
}
#endif
return list.to_array ();
}
@ -581,6 +741,19 @@ namespace Gala
if (window == null)
return;
#if HAS_MUTTER330
unowned Meta.Display display = get_display ();
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
var active = manager.get_active_workspace ();
var next = active.get_neighbor (direction);
//dont allow empty workspaces to be created by moving, if we have dynamic workspaces
if (Prefs.get_dynamic_workspaces () && Utils.get_n_windows (active) == 1 && next.index () == manager.n_workspaces - 1) {
Utils.bell (display);
return;
}
#else
var screen = get_screen ();
var display = screen.get_display ();
@ -593,6 +766,7 @@ namespace Gala
Utils.bell (screen);
return;
}
#endif
moving = window;
@ -615,13 +789,22 @@ namespace Gala
if (modal_stack.size >= 2)
return proxy;
#if HAS_MUTTER330
unowned Meta.Display display = get_display ();
var time = display.get_current_time ();
#else
var screen = get_screen ();
var time = screen.get_display ().get_current_time ();
#endif
update_input_area ();
begin_modal (0, time);
#if HAS_MUTTER330
Meta.Util.disable_unredirect_for_display (display);
#else
Meta.Util.disable_unredirect_for_screen (screen);
#endif
return proxy;
}
@ -641,10 +824,17 @@ namespace Gala
update_input_area ();
#if HAS_MUTTER330
unowned Meta.Display display = get_display ();
end_modal (display.get_current_time ());
Meta.Util.enable_unredirect_for_display (display);
#else
var screen = get_screen ();
end_modal (screen.get_display ().get_current_time ());
Meta.Util.enable_unredirect_for_screen (screen);
#endif
}
/**
@ -686,9 +876,14 @@ namespace Gala
*/
public void perform_action (ActionType type)
{
#if HAS_MUTTER330
unowned Meta.Display display = get_display ();
var current = display.get_focus_window ();
#else
var screen = get_screen ();
var display = screen.get_display ();
var current = display.get_focus_window ();
#endif
switch (type) {
case ActionType.SHOW_WORKSPACE_VIEW:
@ -814,7 +1009,12 @@ namespace Gala
}
break;
case ActionType.SWITCH_TO_WORKSPACE_LAST:
#if HAS_MUTTER330
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
var workspace = manager.get_workspace_by_index (manager.get_n_workspaces () - 1);
#else
var workspace = screen.get_workspace_by_index (screen.get_n_workspaces () - 1);
#endif
workspace.activate (display.get_current_time ());
break;
default:
@ -940,6 +1140,39 @@ namespace Gala
if (!Prefs.get_dynamic_workspaces ())
return;
#if HAS_MUTTER330
unowned Meta.Display display = get_display ();
var time = display.get_current_time ();
unowned Meta.Workspace win_ws = window.get_workspace ();
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
if (which_change == Meta.SizeChange.FULLSCREEN) {
// Do nothing if the current workspace would be empty
if (Utils.get_n_windows (win_ws) <= 1)
return;
var old_ws_index = win_ws.index ();
var new_ws_index = old_ws_index + 1;
InternalUtils.insert_workspace_with_window (new_ws_index, window);
var new_ws_obj = manager.get_workspace_by_index (new_ws_index);
window.change_workspace (new_ws_obj);
new_ws_obj.activate_with_focus (window, time);
ws_assoc.insert (window, old_ws_index);
} else if (ws_assoc.contains (window)) {
var old_ws_index = ws_assoc.get (window);
var new_ws_index = win_ws.index ();
if (new_ws_index != old_ws_index && old_ws_index < manager.get_n_workspaces ()) {
var old_ws_obj = manager.get_workspace_by_index (old_ws_index);
window.change_workspace (old_ws_obj);
old_ws_obj.activate_with_focus (window, time);
}
ws_assoc.remove (window);
}
#else
unowned Meta.Screen screen = get_screen ();
var time = screen.get_display ().get_current_time ();
unowned Meta.Workspace win_ws = window.get_workspace ();
@ -961,6 +1194,7 @@ namespace Gala
} else {
move_window_to_old_ws (window);
}
#endif
}
// must wait for size_changed to get updated frame_rect
@ -1025,7 +1259,11 @@ namespace Gala
minimizing.add (actor);
int width, height;
#if HAS_MUTTER330
get_display ().get_size (out width, out height);
#else
get_screen ().get_size (out width, out height);
#endif
Rectangle icon = {};
if (actor.get_meta_window ().get_icon_geometry (out icon)) {
@ -1530,7 +1768,6 @@ namespace Gala
void move_window_to_next_ws (Window window)
{
unowned Screen screen = get_screen ();
unowned Workspace win_ws = window.get_workspace ();
// Do nothing if the current workspace would be empty
@ -1542,16 +1779,23 @@ namespace Gala
var new_ws_index = old_ws_index + 1;
InternalUtils.insert_workspace_with_window (new_ws_index, window);
#if HAS_MUTTER330
unowned Meta.Display display = get_display ();
var time = display.get_current_time ();
var new_ws_obj = display.get_workspace_manager ().get_workspace_by_index (new_ws_index);
#else
unowned Meta.Screen screen = get_screen ();
var time = get_screen ().get_display ().get_current_time ();
var new_ws_obj = screen.get_workspace_by_index (new_ws_index);
#endif
window.change_workspace (new_ws_obj);
new_ws_obj.activate_with_focus (window, screen.get_display ().get_current_time ());
new_ws_obj.activate_with_focus (window, time);
ws_assoc.insert (window, old_ws_index);
}
void move_window_to_old_ws (Window window)
{
unowned Screen screen = get_screen ();
unowned Workspace win_ws = window.get_workspace ();
// Do nothing if the current workspace is populated with other windows
@ -1566,10 +1810,18 @@ namespace Gala
var old_ws_index = ws_assoc.get (window);
var new_ws_index = win_ws.index ();
#if HAS_MUTTER330
unowned Meta.Display display = get_display ();
unowned Meta.WorkspaceManager workspace_manager = display.get_workspace_manager ();
if (new_ws_index != old_ws_index && old_ws_index < workspace_manager.get_n_workspaces ()) {
uint time = display.get_current_time ();
var old_ws_obj = workspace_manager.get_workspace_by_index (old_ws_index);
#else
unowned Meta.Screen screen = get_screen ();
if (new_ws_index != old_ws_index && old_ws_index < screen.get_n_workspaces ()) {
uint time = screen.get_display ().get_current_time ();
var old_ws_obj = screen.get_workspace_by_index (old_ws_index);
#endif
window.change_workspace (old_ws_obj);
old_ws_obj.activate_with_focus (window, time);
}
@ -1630,6 +1882,20 @@ namespace Gala
}
float screen_width, screen_height;
#if HAS_MUTTER330
unowned Meta.Display display = get_display ();
var primary = display.get_primary_monitor ();
var move_primary_only = InternalUtils.workspaces_only_on_primary ();
var monitor_geom = display.get_monitor_geometry (primary);
var clone_offset_x = move_primary_only ? monitor_geom.x : 0.0f;
var clone_offset_y = move_primary_only ? monitor_geom.y : 0.0f;
display.get_size (out screen_width, out screen_height);
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
unowned Meta.Workspace workspace_from = manager.get_workspace_by_index (from);
unowned Meta.Workspace workspace_to = manager.get_workspace_by_index (to);
#else
var screen = get_screen ();
var primary = screen.get_primary_monitor ();
var move_primary_only = InternalUtils.workspaces_only_on_primary ();
@ -1641,6 +1907,7 @@ namespace Gala
unowned Meta.Workspace workspace_from = screen.get_workspace_by_index (from);
unowned Meta.Workspace workspace_to = screen.get_workspace_by_index (to);
#endif
var main_container = new Clutter.Actor ();
var static_windows = new Clutter.Actor ();
@ -1695,7 +1962,11 @@ namespace Gala
var docks = new List<WindowActor> ();
// collect all windows and put them in the appropriate containers
#if HAS_MUTTER330
foreach (unowned Meta.WindowActor actor in Meta.Compositor.get_window_actors (display)) {
#else
foreach (unowned Meta.WindowActor actor in Meta.Compositor.get_window_actors (screen)) {
#endif
if (actor.is_destroyed ())
continue;
@ -1829,8 +2100,13 @@ namespace Gala
if (windows == null || parents == null)
return;
#if HAS_MUTTER330
unowned Meta.Display display = get_display ();
var active_workspace = display.get_workspace_manager ().get_active_workspace ();
#else
var screen = get_screen ();
var active_workspace = screen.get_active_workspace ();
#endif
for (var i = 0; i < windows.length (); i++) {
var actor = windows.nth_data (i);

View File

@ -47,9 +47,31 @@ namespace Gala
construct
{
unowned Screen screen = wm.get_screen ();
workspaces_marked_removed = new Gee.LinkedList<Workspace> ();
#if HAS_MUTTER330
unowned Meta.Display display = wm.get_display ();
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
if (Prefs.get_dynamic_workspaces ())
manager.override_workspace_layout (DisplayCorner.TOPLEFT, false, 1, -1);
for (var i = 0; i < manager.get_n_workspaces (); i++)
workspace_added (manager, i);
Prefs.add_listener (prefs_listener);
manager.workspace_switched.connect_after (workspace_switched);
manager.workspace_added.connect (workspace_added);
manager.workspace_removed.connect_after (workspace_removed);
display.window_entered_monitor.connect (window_entered_monitor);
display.window_left_monitor.connect (window_left_monitor);
// make sure the last workspace has no windows on it
if (Prefs.get_dynamic_workspaces ()
&& Utils.get_n_windows (manager.get_workspace_by_index (manager.get_n_workspaces () - 1)) > 0)
append_workspace ();
#else
unowned Screen screen = wm.get_screen ();
if (Prefs.get_dynamic_workspaces ())
screen.override_workspace_layout (ScreenCorner.TOPLEFT, false, 1, -1);
@ -69,6 +91,7 @@ namespace Gala
if (Prefs.get_dynamic_workspaces ()
&& Utils.get_n_windows (screen.get_workspace_by_index (screen.get_n_workspaces () - 1)) > 0)
append_workspace ();
#endif
// There are some empty workspace at startup
cleanup ();
@ -76,17 +99,60 @@ namespace Gala
~WorkspaceManager ()
{
unowned Screen screen = wm.get_screen ();
Prefs.remove_listener (prefs_listener);
#if HAS_MUTTER330
unowned Meta.Display display = wm.get_display ();
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
manager.workspace_added.disconnect (workspace_added);
manager.workspace_switched.disconnect (workspace_switched);
manager.workspace_removed.disconnect (workspace_removed);
display.window_entered_monitor.disconnect (window_entered_monitor);
display.window_left_monitor.disconnect (window_left_monitor);
#else
unowned Screen screen = wm.get_screen ();
screen.workspace_added.disconnect (workspace_added);
screen.workspace_switched.disconnect (workspace_switched);
screen.workspace_removed.disconnect (workspace_removed);
screen.window_entered_monitor.disconnect (window_entered_monitor);
screen.window_left_monitor.disconnect (window_left_monitor);
#endif
}
#if HAS_MUTTER330
void workspace_added (Meta.WorkspaceManager manager, int index)
{
var workspace = manager.get_workspace_by_index (index);
if (workspace == null)
return;
workspace.window_added.connect (window_added);
workspace.window_removed.connect (window_removed);
}
void workspace_removed (Meta.WorkspaceManager manager, int index)
{
var it = workspaces_marked_removed.iterator ();
while (it.next ()) {
var workspace = it.@get ();
if (workspace.index () < 0)
it.remove ();
}
}
void workspace_switched (Meta.WorkspaceManager manager, int from, int to, MotionDirection direction)
{
if (!Prefs.get_dynamic_workspaces ())
return;
// remove empty workspaces after we switched away from them unless it's the last one
var prev_workspace = manager.get_workspace_by_index (from);
if (Utils.get_n_windows (prev_workspace) < 1
&& from != manager.get_n_workspaces () - 1) {
remove_workspace (prev_workspace);
}
}
#else
void workspace_added (Screen screen, int index)
{
var workspace = screen.get_workspace_by_index (index);
@ -120,6 +186,7 @@ namespace Gala
remove_workspace (prev_workspace);
}
}
#endif
void window_added (Workspace? workspace, Window window)
{
@ -127,12 +194,18 @@ namespace Gala
|| window.on_all_workspaces)
return;
#if HAS_MUTTER330
unowned Meta.WorkspaceManager manager = workspace.get_display ().get_workspace_manager ();
int last_workspace = manager.get_n_workspaces () - 1;
#else
unowned Screen screen = workspace.get_screen ();
int last_workspace = screen.get_n_workspaces () - 1;
#endif
if ((window.window_type == WindowType.NORMAL
|| window.window_type == WindowType.DIALOG
|| window.window_type == WindowType.MODAL_DIALOG)
&& workspace.index () == screen.get_n_workspaces () - 1)
&& workspace.index () == last_workspace)
append_workspace ();
}
@ -141,30 +214,52 @@ namespace Gala
if (workspace == null || !Prefs.get_dynamic_workspaces () || window.on_all_workspaces)
return;
#if HAS_MUTTER330
unowned Meta.WorkspaceManager manager = workspace.get_display ().get_workspace_manager ();
var index = workspace.index ();
bool is_active_workspace = workspace == manager.get_active_workspace ();
int last_workspace = manager.get_n_workspaces () - 1;
#else
unowned Screen screen = workspace.get_screen ();
var index = screen.get_workspaces ().index (workspace);
bool is_active_workspace = workspace == screen.get_active_workspace ();
int last_workspace = screen.get_n_workspaces () - 1;
#endif
if (window.window_type != WindowType.NORMAL
&& window.window_type != WindowType.DIALOG
&& window.window_type != WindowType.MODAL_DIALOG)
return;
var index = screen.get_workspaces ().index (workspace);
// has already been removed
if (index < 0)
return;
var is_active_workspace = workspace == screen.get_active_workspace ();
// remove it right away if it was the active workspace and it's not the very last
// or we are in modal-mode
if ((!is_active_workspace || wm.is_modal ())
&& remove_freeze_count < 1
&& Utils.get_n_windows (workspace) < 1
&& index != screen.get_n_workspaces () - 1) {
&& index != last_workspace) {
remove_workspace (workspace);
}
}
#if HAS_MUTTER330
void window_entered_monitor (Meta.Display display, int monitor, Window window)
{
if (InternalUtils.workspaces_only_on_primary ()
&& monitor == display.get_primary_monitor ())
window_added (window.get_workspace (), window);
}
void window_left_monitor (Meta.Display display, int monitor, Window window)
{
if (InternalUtils.workspaces_only_on_primary ()
&& monitor == display.get_primary_monitor ())
window_removed (window.get_workspace (), window);
}
#else
void window_entered_monitor (Screen screen, int monitor, Window window)
{
if (InternalUtils.workspaces_only_on_primary ()
@ -178,9 +273,19 @@ namespace Gala
&& monitor == screen.get_primary_monitor ())
window_removed (window.get_workspace (), window);
}
#endif
void prefs_listener (Meta.Preference pref)
{
#if HAS_MUTTER330
unowned Meta.WorkspaceManager manager = wm.get_display ().get_workspace_manager ();
if (pref == Preference.DYNAMIC_WORKSPACES && Prefs.get_dynamic_workspaces ()) {
// if the last workspace has a window, we need to append a new workspace
if (Utils.get_n_windows (manager.get_workspace_by_index (manager.get_n_workspaces () - 1)) > 0)
append_workspace ();
}
#else
unowned Screen screen = wm.get_screen ();
if (pref == Preference.DYNAMIC_WORKSPACES && Prefs.get_dynamic_workspaces ()) {
@ -188,13 +293,21 @@ namespace Gala
if (Utils.get_n_windows (screen.get_workspace_by_index (screen.get_n_workspaces () - 1)) > 0)
append_workspace ();
}
#endif
}
void append_workspace ()
{
#if HAS_MUTTER330
unowned Meta.Display display = wm.get_display ();
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
manager.append_new_workspace (false, display.get_current_time ());
#else
unowned Screen screen = wm.get_screen ();
screen.append_new_workspace (false, screen.get_display ().get_current_time ());
#endif
}
/**
@ -204,11 +317,19 @@ namespace Gala
*/
void remove_workspace (Workspace workspace)
{
#if HAS_MUTTER330
unowned Meta.Display display = workspace.get_display ();
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
var time = display.get_current_time ();
unowned Meta.Workspace active_workspace = manager.get_active_workspace ();
#else
unowned Screen screen = workspace.get_screen ();
var time = screen.get_display ().get_current_time ();
unowned Meta.Workspace active_workspace = screen.get_active_workspace ();
#endif
if (workspace == screen.get_active_workspace ()) {
if (workspace == active_workspace) {
Workspace? next = null;
next = workspace.get_neighbor (MotionDirection.LEFT);
@ -230,7 +351,11 @@ namespace Gala
workspaces_marked_removed.add (workspace);
#if HAS_MUTTER330
manager.remove_workspace (workspace, time);
#else
screen.remove_workspace (workspace, time);
#endif
}
/**
@ -261,15 +386,29 @@ namespace Gala
if (!Prefs.get_dynamic_workspaces ())
return;
var screen = wm.get_screen ();
var last_index = screen.get_n_workspaces () - 1;
foreach (var workspace in screen.get_workspaces ()) {
#if HAS_MUTTER330
unowned Meta.Display display = wm.get_display ();
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
var last_index = manager.get_n_workspaces () - 1;
for (int i = 0; i < manager.get_n_workspaces (); i++) {
unowned Meta.Workspace workspace = manager.get_workspace_by_index (i);
if (Utils.get_n_windows (workspace) < 1
&& workspace.index () != last_index) {
remove_workspace (workspace);
}
}
#else
var screen = wm.get_screen ();
var last_index = screen.get_n_workspaces () - 1;
unowned GLib.List<Meta.Workspace> workspaces = screen.get_workspaces ();
foreach (var workspace in workspaces) {
if (Utils.get_n_windows (workspace) < 1
&& workspace.index () != last_index) {
remove_workspace (workspace);
}
}
#endif
}
}
}

1
vapi/libmutter-3.deps Symbolic link
View File

@ -0,0 +1 @@
libmutter-2.deps

1
vapi/libmutter-3.vapi Symbolic link
View File

@ -0,0 +1 @@
libmutter-2.vapi

1
vapi/libmutter-4.deps Symbolic link
View File

@ -0,0 +1 @@
libmutter.deps

1
vapi/libmutter-4.vapi Symbolic link
View File

@ -0,0 +1 @@
libmutter.vapi

1
vapi/libmutter-5.deps Symbolic link
View File

@ -0,0 +1 @@
libmutter-4.deps

1
vapi/libmutter-5.vapi Symbolic link
View File

@ -0,0 +1 @@
libmutter-4.vapi

1
vapi/libmutter-6.deps Symbolic link
View File

@ -0,0 +1 @@
libmutter-5.deps

1
vapi/libmutter-6.vapi Symbolic link
View File

@ -0,0 +1 @@
libmutter-5.vapi

View File

@ -55,8 +55,10 @@ namespace Meta {
public static bool get_gnome_accessibility ();
[CCode (cheader_filename = "meta/prefs.h")]
public static bool get_gnome_animations ();
#if !HAS_MUTTER332
[CCode (cheader_filename = "meta/prefs.h")]
public static bool get_ignore_request_hide_titlebar ();
#endif
[CCode (cheader_filename = "meta/prefs.h")]
public static Meta.KeyBindingAction get_keybinding_action (string name);
[CCode (cheader_filename = "meta/prefs.h")]
@ -83,16 +85,24 @@ namespace Meta {
public static bool get_workspaces_only_on_primary ();
[CCode (cheader_filename = "meta/prefs.h")]
public static void init ();
#if !HAS_MUTTER330
[CCode (cheader_filename = "meta/prefs.h")]
public static void override_preference_schema (string key, string schema);
#endif
[CCode (cheader_filename = "meta/prefs.h")]
public static void remove_listener (Meta.PrefsChangedFunc func);
[CCode (cheader_filename = "meta/prefs.h")]
public static void set_force_fullscreen (bool whether);
#if !HAS_MUTTER332
[CCode (cheader_filename = "meta/prefs.h")]
public static void set_ignore_request_hide_titlebar (bool whether);
#endif
[CCode (cheader_filename = "meta/prefs.h")]
public static void set_num_workspaces (int n_workspaces);
#if HAS_MUTTER330
[CCode (cheader_filename = "meta/prefs.h")]
public static void set_show_fallback_app_menu (bool whether);
#endif
}
namespace Util {
[CCode (cheader_filename = "meta/main.h", cname = "meta_add_verbose_topic")]
@ -101,6 +111,14 @@ namespace Meta {
public static void bug (string format, ...);
[CCode (cheader_filename = "meta/main.h", cname = "meta_debug_spew_real")]
public static void debug_spew_real (string format, ...);
#if HAS_MUTTER330
[CCode (cheader_filename = "meta/main.h", cname = "meta_disable_unredirect_for_display")]
public static void disable_unredirect_for_display (Meta.Display display);
[CCode (cheader_filename = "meta/compositor-mutter.h", cname = "meta_empty_stage_input_region")]
public static void empty_stage_input_region (Meta.Display display);
[CCode (cheader_filename = "meta/main.h", cname = "meta_enable_unredirect_for_display")]
public static void enable_unredirect_for_display (Meta.Display display);
#else
[CCode (cheader_filename = "meta/main.h", cname = "meta_disable_unredirect_for_screen")]
public static void disable_unredirect_for_screen (Meta.Screen screen);
[CCode (cheader_filename = "meta/compositor-mutter.h", cname = "meta_empty_stage_input_region")]
@ -113,6 +131,7 @@ namespace Meta {
public static int error_trap_pop_with_return (Meta.Display display);
[CCode (cheader_filename = "meta/main.h", cname = "meta_error_trap_push")]
public static void error_trap_push (Meta.Display display);
#endif
[CCode (cheader_filename = "meta/main.h", cname = "meta_external_binding_name_for_action")]
public static string external_binding_name_for_action (uint keybinding_action);
[CCode (cheader_filename = "meta/main.h", cname = "meta_fatal")]
@ -124,7 +143,11 @@ namespace Meta {
[CCode (cheader_filename = "meta/main.h", cname = "meta_get_locale_direction")]
public static Meta.LocaleDirection get_locale_direction ();
[CCode (cheader_filename = "meta/main.h", cname = "meta_get_overlay_window")]
#if HAS_MUTTER330
public static X.Window get_overlay_window (Meta.Display display);
#else
public static X.Window get_overlay_window (Meta.Screen screen);
#endif
[CCode (cheader_filename = "meta/main.h", cname = "meta_gravity_to_string")]
public static unowned string gravity_to_string (int gravity);
[CCode (cheader_filename = "meta/main.h", cname = "meta_is_debugging")]
@ -148,7 +171,11 @@ namespace Meta {
[CCode (cheader_filename = "meta/main.h", cname = "meta_remove_verbose_topic")]
public static void remove_verbose_topic (Meta.DebugTopic topic);
[CCode (cheader_filename = "meta/compositor-mutter.h", cname = "meta_set_stage_input_region")]
#if HAS_MUTTER330
public static void set_stage_input_region (Meta.Display display, X.XserverRegion region);
#else
public static void set_stage_input_region (Meta.Screen screen, X.XserverRegion region);
#endif
[CCode (cheader_filename = "meta/main.h", cname = "meta_show_dialog")]
public static GLib.Pid show_dialog (string type, string message, string? timeout = null, string? display = null, string? ok_text = null, string? cancel_text = null, string? icon_name = null, int transient_for = 0, GLib.SList<string>? columns = null, GLib.SList<string>? entries = null);
[CCode (cheader_filename = "meta/main.h", cname = "meta_topic_real")]
@ -161,6 +188,16 @@ namespace Meta {
public static void verbose_real (string format, ...);
[CCode (cheader_filename = "meta/main.h", cname = "meta_warning")]
public static void warning (string format, ...);
#if HAS_MUTTER330
[CCode (cheader_filename = "meta/main.h", cname = "meta_x11_error_trap_pop")]
public static void x11_error_trap_pop (Meta.X11Display x11_display);
[CCode (cheader_filename = "meta/main.h", cname = "meta_x11_error_trap_pop_with_return")]
public static int x11_error_trap_pop_with_return (Meta.X11Display x11_display);
[CCode (cheader_filename = "meta/main.h", cname = "meta_x11_error_trap_push")]
public static void x11_error_trap_push (Meta.X11Display x11_display);
[CCode (cheader_filename = "meta/main.h", cname = "meta_x11_init_gdk_display")]
public static bool x11_init_gdk_display () throws GLib.Error;
#endif
}
[CCode (cheader_filename = "meta/main.h", type_id = "meta_backend_get_type ()")]
#if HAS_MUTTER322
@ -175,6 +212,9 @@ namespace Meta {
#if HAS_MUTTER324
public unowned Meta.Dnd get_dnd ();
#endif
#if HAS_MUTTER330
public unowned Meta.RemoteAccessController get_remote_access_controller ();
#endif
#if HAS_MUTTER326
public unowned Meta.Settings get_settings ();
#endif
@ -187,24 +227,39 @@ namespace Meta {
public signal void keymap_changed ();
public signal void keymap_layout_group_changed (uint object);
public signal void last_device_changed (int object);
#if HAS_MUTTER330
public signal void lid_is_closed_changed (bool object);
#endif
}
[CCode (cheader_filename = "meta/meta-background.h", type_id = "meta_background_get_type ()")]
public class Background : GLib.Object {
[CCode (has_construct_function = false)]
#if HAS_MUTTER330
public Background (Meta.Display display);
#else
public Background (Meta.Screen screen);
#endif
public static void refresh_all ();
public void set_blend (GLib.File file1, GLib.File file2, double blend_factor, GDesktop.BackgroundStyle style);
public void set_color (Clutter.Color color);
public void set_file (GLib.File file, GDesktop.BackgroundStyle style);
public void set_gradient (GDesktop.BackgroundShading shading_direction, Clutter.Color color, Clutter.Color second_color);
[NoAccessorMethod]
#if HAS_MUTTER330
public Meta.Display meta_display { owned get; construct; }
#else
public Meta.Screen meta_screen { owned get; construct; }
#endif
public signal void changed ();
}
[CCode (cheader_filename = "meta/meta-background-actor.h", type_id = "meta_background_actor_get_type ()")]
public class BackgroundActor : Clutter.Actor, Atk.Implementor, Clutter.Animatable, Clutter.Container, Clutter.Scriptable {
[CCode (has_construct_function = false, type = "ClutterActor*")]
#if HAS_MUTTER330
public BackgroundActor (Meta.Display display, int monitor);
#else
public BackgroundActor (Meta.Screen screen, int monitor);
#endif
public void set_background (Meta.Background background);
#if HAS_MUTTER326
public void set_gradient (bool enabled, int height, double tone_start);
@ -224,7 +279,11 @@ namespace Meta {
public double gradient_max_darkness { get; set; }
#endif
[NoAccessorMethod]
#if HAS_MUTTER330
public Meta.Display meta_display { owned get; construct; }
#else
public Meta.Screen meta_screen { owned get; construct; }
#endif
[NoAccessorMethod]
public int monitor { get; construct; }
[NoAccessorMethod]
@ -295,6 +354,21 @@ namespace Meta {
public void add_window (Meta.Window window);
public void destroy ();
public bool filter_keybinding (Meta.KeyBinding binding);
#if HAS_MUTTER330
public void flash_display (Meta.Display display);
[CCode (cheader_filename = "meta/compositor-mutter.h", cname = "meta_focus_stage_window")]
public static void focus_stage_window (Meta.Display display, uint32 timestamp);
[CCode (cheader_filename = "meta/compositor-mutter.h", cname = "meta_get_feedback_group_for_display")]
public static unowned Clutter.Actor get_feedback_group_for_display (Meta.Display display);
[CCode (cheader_filename = "meta/compositor-mutter.h", cname = "meta_get_stage_for_display")]
public static unowned Clutter.Actor? get_stage_for_display (Meta.Display display);
[CCode (cheader_filename = "meta/compositor-mutter.h", cname = "meta_get_top_window_group_for_display")]
public static unowned Clutter.Actor? get_top_window_group_for_display (Meta.Display display);
[CCode (cheader_filename = "meta/compositor-mutter.h", cname = "meta_get_window_actors")]
public static unowned GLib.List<weak Meta.WindowActor>? get_window_actors (Meta.Display display);
[CCode (cheader_filename = "meta/compositor-mutter.h", cname = "meta_get_window_group_for_display")]
public static unowned Clutter.Actor? get_window_group_for_display (Meta.Display display);
#else
public void flash_screen (Meta.Screen screen);
[CCode (cheader_filename = "meta/compositor-mutter.h", cname = "meta_focus_stage_window")]
public static void focus_stage_window (Meta.Screen screen, uint32 timestamp);
@ -308,6 +382,7 @@ namespace Meta {
public static unowned GLib.List<weak Meta.WindowActor>? get_window_actors (Meta.Screen screen);
[CCode (cheader_filename = "meta/compositor-mutter.h", cname = "meta_get_window_group_for_screen")]
public static unowned Clutter.Actor? get_window_group_for_screen (Meta.Screen screen);
#endif
public void hide_tile_preview ();
public void hide_window (Meta.Window window, Meta.CompEffect effect);
public void manage ();
@ -337,14 +412,27 @@ namespace Meta {
public class CursorTracker : GLib.Object {
[CCode (has_construct_function = false)]
protected CursorTracker ();
#if HAS_MUTTER330
public static unowned Meta.CursorTracker get_for_display (Meta.Display display);
#else
public static unowned Meta.CursorTracker get_for_screen (Meta.Screen screen);
#endif
public void get_hot (out int x, out int y);
public void get_pointer (out int x, out int y, out Clutter.ModifierType mods);
#if HAS_MUTTER334
public bool get_pointer_visible ();
#endif
public unowned Cogl.Texture get_sprite ();
public void set_pointer_visible (bool visible);
public signal void cursor_changed ();
#if HAS_MUTTER332
public signal void cursor_moved (float object, float p0);
#endif
#if HAS_MUTTER334
public signal void visibility_changed ();
#endif
}
#if HAS_MUTTER328
#if HAS_MUTTER328 && !HAS_MUTTER332
[CCode (cheader_filename = "meta/main.h", type_id = "meta_dbus_display_config_skeleton_get_type ()")]
public class DBusDisplayConfigSkeleton : GLib.DBusInterfaceSkeleton, GLib.DBusInterface {
[CCode (has_construct_function = false)]
@ -357,55 +445,125 @@ namespace Meta {
protected Display ();
public void add_ignored_crossing_serial (ulong serial);
public uint add_keybinding (string name, GLib.Settings settings, Meta.KeyBindingFlags flags, owned Meta.KeyHandlerFunc handler);
#if HAS_MUTTER330
public bool begin_grab_op (Meta.Window window, Meta.GrabOp op, bool pointer_already_grabbed, bool frame_action, int button, ulong modmask, uint32 timestamp, int root_x, int root_y);
#else
public bool begin_grab_op (Meta.Screen screen, Meta.Window window, Meta.GrabOp op, bool pointer_already_grabbed, bool frame_action, int button, ulong modmask, uint32 timestamp, int root_x, int root_y);
#endif
public void clear_mouse_mode ();
#if HAS_MUTTER330
public void close (uint32 timestamp);
#endif
public void end_grab_op (uint32 timestamp);
#if HAS_MUTTER330
public void focus_default_window (uint32 timestamp);
#else
public void focus_the_no_focus_window (Meta.Screen screen, uint32 timestamp);
#endif
public void freeze_keyboard (uint32 timestamp);
public unowned Meta.Compositor get_compositor ();
#if HAS_MUTTER330
public int get_current_monitor ();
#endif
public uint32 get_current_time ();
public uint32 get_current_time_roundtrip ();
#if !HAS_MUTTER330
public int get_damage_event_base ();
#endif
public unowned Meta.Window get_focus_window ();
public Meta.GrabOp get_grab_op ();
public uint get_keybinding_action (uint keycode, ulong mask);
public uint32 get_last_user_time ();
#if HAS_MUTTER330
public Meta.Rectangle get_monitor_geometry (int monitor);
public bool get_monitor_in_fullscreen (int monitor);
public int get_monitor_index_for_rect (Meta.Rectangle rect);
public int get_monitor_neighbor_index (int which_monitor, Meta.DisplayDirection dir);
#if HAS_MUTTER332
public float get_monitor_scale (int monitor);
#endif
public int get_n_monitors ();
#endif
#if HAS_MUTTER322
public string get_pad_action_label (Clutter.InputDevice pad, Meta.PadActionType action_type, uint action_number);
#endif
#if HAS_MUTTER330
public int get_primary_monitor ();
public void get_size (out int width, out int height);
#if HAS_MUTTER332
public unowned Meta.SoundPlayer get_sound_player ();
public unowned Meta.StartupNotification get_startup_notification ();
#else
public unowned GLib.SList<void*> get_startup_sequences ();
#endif
#else
public int get_shape_event_base ();
#endif
public unowned Meta.Window get_tab_current (Meta.TabList type, Meta.Workspace workspace);
public GLib.List<weak Meta.Window> get_tab_list (Meta.TabList type, Meta.Workspace? workspace);
public unowned Meta.Window get_tab_next (Meta.TabList type, Meta.Workspace workspace, Meta.Window? window, bool backward);
#if HAS_MUTTER330
public unowned Meta.WorkspaceManager get_workspace_manager ();
public unowned Meta.X11Display get_x11_display ();
#else
public unowned X.Display get_xdisplay ();
public int get_xinput_opcode ();
#endif
#if HAS_MUTTER332
public uint grab_accelerator (string accelerator, Meta.KeyBindingFlags flags);
#else
public uint grab_accelerator (string accelerator);
#endif
#if !HAS_MUTTER330
public bool has_shape ();
#endif
public bool is_pointer_emulating_sequence (Clutter.EventSequence? sequence);
#if !HAS_MUTTER330
public unowned Meta.Group lookup_group (X.Window group_leader);
#endif
public bool remove_keybinding (string name);
#if HAS_MUTTER322
public void request_pad_osd (Clutter.InputDevice pad, bool edition_mode);
#endif
#if HAS_MUTTER330
public void set_cursor (Meta.Cursor cursor);
#else
public void set_input_focus_window (Meta.Window window, bool focus_frame, uint32 timestamp);
#endif
public GLib.SList<weak Meta.Window> sort_windows_by_stacking (GLib.SList<Meta.Window> windows);
public bool supports_extended_barriers ();
public void unfreeze_keyboard (uint32 timestamp);
public bool ungrab_accelerator (uint action_id);
public void ungrab_keyboard (uint32 timestamp);
#if !HAS_MUTTER330
public void unmanage_screen (Meta.Screen screen, uint32 timestamp);
#endif
public bool xserver_time_is_before (uint32 time1, uint32 time2);
#if !HAS_MUTTER330
public bool xwindow_is_a_no_focus_window (X.Window xwindow);
#endif
public signal void accelerator_activated (uint object, uint p0, uint p1);
#if HAS_MUTTER330
public signal void cursor_updated ();
#endif
#if HAS_MUTTER322
public signal void gl_video_memory_purged ();
#endif
#if HAS_MUTTER330
public signal void grab_op_begin (Meta.Display object, Meta.Window p0, Meta.GrabOp p1);
public signal void grab_op_end (Meta.Display object, Meta.Window p0, Meta.GrabOp p1);
public signal void in_fullscreen_changed ();
#else
public signal void grab_op_begin (Meta.Screen object, Meta.Window p0, Meta.GrabOp p1);
public signal void grab_op_end (Meta.Screen object, Meta.Window p0, Meta.GrabOp p1);
#endif
public signal bool modifiers_accelerator_activated ();
public signal void overlay_key ();
#if HAS_MUTTER324
public signal void pad_mode_switch (Clutter.InputDevice object, uint p0, uint p1);
#endif
#if HAS_MUTTER330
public signal void restacked ();
#endif
public signal bool restart ();
#if HAS_MUTTER324
@ -416,9 +574,24 @@ namespace Meta {
#endif
public signal bool show_resize_popup (bool object, Meta.Rectangle p0, int p1, int p2);
public signal bool show_restart_message (string? message);
#if HAS_MUTTER330
public signal void showing_desktop_changed ();
#if !HAS_MUTTER332
public signal void startup_sequence_changed (void* object);
#endif
#endif
public signal void window_created (Meta.Window object);
public signal void window_demands_attention (Meta.Window object);
#if HAS_MUTTER330
public signal void window_entered_monitor (int object, Meta.Window p0);
public signal void window_left_monitor (int object, Meta.Window p0);
#endif
public signal void window_marked_urgent (Meta.Window object);
#if HAS_MUTTER330
public signal void workareas_changed ();
public signal void x11_display_closing ();
public signal void x11_display_opened ();
#endif
}
#if HAS_MUTTER324
[CCode (cheader_filename = "meta/meta-dnd.h", type_id = "meta_dnd_get_type ()")]
@ -467,8 +640,25 @@ namespace Meta {
[CCode (cheader_filename = "meta/keybindings.h", cname = "meta_keybindings_set_custom_handler")]
public static bool set_custom_handler (string name, owned Meta.KeyHandlerFunc? handler);
}
#if HAS_MUTTER332
[CCode (cheader_filename = "meta/main.h", type_id = "meta_launch_context_get_type ()")]
public class LaunchContext : GLib.AppLaunchContext {
[CCode (has_construct_function = false)]
protected LaunchContext ();
public void set_timestamp (uint32 timestamp);
public void set_workspace (Meta.Workspace workspace);
[NoAccessorMethod]
public Meta.Display display { owned get; construct; }
[NoAccessorMethod]
public uint timestamp { get; set; }
[NoAccessorMethod]
public Meta.Workspace workspace { owned get; set; }
}
#endif
[CCode (cheader_filename = "meta/meta-monitor-manager.h", type_id = "meta_monitor_manager_get_type ()")]
#if HAS_MUTTER328
#if HAS_MUTTER332
public class MonitorManager : GLib.Object {
#elif HAS_MUTTER328
public abstract class MonitorManager : Meta.DBusDisplayConfigSkeleton, GLib.DBusInterface {
#else
public abstract class MonitorManager : GLib.DBusInterfaceSkeleton, GLib.DBusInterface {
@ -499,7 +689,13 @@ namespace Meta {
#if HAS_MUTTER328
[NoAccessorMethod]
public Meta.Backend backend { owned get; construct; }
#if HAS_MUTTER332
public signal void monitors_changed ();
#endif
public signal void monitors_changed_internal ();
#if HAS_MUTTER332
public signal void power_save_mode_changed ();
#endif
#endif
#if HAS_MUTTER324 && !HAS_MUTTER326
public signal void lid_is_closed_changed ();
@ -524,7 +720,11 @@ namespace Meta {
public void destroy_completed (Meta.WindowActor actor);
public void end_modal (uint32 timestamp);
public unowned Meta.PluginInfo? get_info ();
#if HAS_MUTTER330
public unowned Meta.Display get_display ();
#else
public unowned Meta.Screen get_screen ();
#endif
[NoWrapper]
public virtual void hide_tile_preview ();
[NoWrapper]
@ -566,6 +766,21 @@ namespace Meta {
[NoWrapper]
public virtual bool xevent_filter (X.Event event);
}
#if HAS_MUTTER330
[CCode (cheader_filename = "meta/main.h", type_id = "meta_remote_access_controller_get_type ()")]
public class RemoteAccessController : GLib.Object {
[CCode (has_construct_function = false)]
protected RemoteAccessController ();
public signal void new_handle (Meta.RemoteAccessHandle object);
}
[CCode (cheader_filename = "meta/main.h", type_id = "meta_remote_access_handle_get_type ()")]
public class RemoteAccessHandle : GLib.Object {
[CCode (has_construct_function = false)]
protected RemoteAccessHandle ();
public virtual void stop ();
public signal void stopped ();
}
#else
[CCode (cheader_filename = "meta/screen.h", type_id = "meta_screen_get_type ()")]
public class Screen : GLib.Object {
[CCode (has_construct_function = false)]
@ -609,6 +824,7 @@ namespace Meta {
public signal void workspace_switched (int object, int p0, Meta.MotionDirection p1);
public signal void workspaces_reordered ();
}
#endif
#if HAS_MUTTER326
[CCode (cheader_filename = "meta/meta-settings.h", has_type_id = false)]
[Compact]
@ -621,7 +837,11 @@ namespace Meta {
[Compact]
public class Shadow {
public void get_bounds (int window_x, int window_y, int window_width, int window_height, Cairo.RectangleInt bounds);
#if HAS_MUTTER332
public void paint (Cogl.Framebuffer framebuffer, int window_x, int window_y, int window_width, int window_height, uint8 opacity, Cairo.Region? clip, bool clip_strictly);
#else
public void paint (int window_x, int window_y, int window_width, int window_height, uint8 opacity, Cairo.Region? clip, bool clip_strictly);
#endif
public Meta.Shadow @ref ();
public void unref ();
}
@ -647,12 +867,61 @@ namespace Meta {
public bool update_area (int x, int y, int width, int height);
public signal void size_changed ();
}
#if HAS_MUTTER332
[CCode (cheader_filename = "meta/main.h", type_id = "meta_sound_player_get_type ()")]
public class SoundPlayer : GLib.Object {
[CCode (has_construct_function = false)]
protected SoundPlayer ();
public void play_from_file (GLib.File file, string description, GLib.Cancellable? cancellable = null);
public void play_from_theme (string name, string description, GLib.Cancellable? cancellable = null);
}
#endif
#if HAS_MUTTER328
[CCode (cheader_filename = "meta/main.h", type_id = "meta_stage_get_type ()")]
public class Stage : Clutter.Stage, Atk.Implementor, Clutter.Animatable, Clutter.Container, Clutter.Scriptable {
[CCode (has_construct_function = false)]
protected Stage ();
#if HAS_MUTTER330
public static bool is_focused (Meta.Display display);
#else
public static bool is_focused (Meta.Screen screen);
#endif
#if HAS_MUTTER332
public signal void actors_painted ();
#endif
}
#endif
#if HAS_MUTTER332
[CCode (cheader_filename = "meta/main.h", type_id = "meta_startup_notification_get_type ()")]
public class StartupNotification : GLib.Object {
[CCode (has_construct_function = false)]
protected StartupNotification ();
public Meta.LaunchContext create_launcher ();
[NoAccessorMethod]
public Meta.Display display { owned get; construct; }
public signal void changed (void* object);
}
[CCode (cheader_filename = "meta/main.h", type_id = "meta_startup_sequence_get_type ()")]
public class StartupSequence : GLib.Object {
[CCode (has_construct_function = false)]
protected StartupSequence ();
public unowned string get_application_id ();
public bool get_completed ();
public unowned string get_icon_name ();
public unowned string get_id ();
public unowned string get_name ();
public uint64 get_timestamp ();
public unowned string get_wmclass ();
public int get_workspace ();
public string application_id { get; construct; }
public string icon_name { get; construct; }
public string id { get; construct; }
public string name { get; construct; }
public uint64 timestamp { get; construct; }
public string wmclass { get; construct; }
public int workspace { get; construct; }
[HasEmitter]
public signal void complete ();
}
#endif
[CCode (cheader_filename = "meta/theme.h", has_type_id = false)]
@ -694,6 +963,9 @@ namespace Meta {
#endif
public Meta.Rectangle get_buffer_rect ();
public unowned string get_client_machine ();
#if HAS_MUTTER332
public Meta.WindowClientType get_client_type ();
#endif
public unowned GLib.Object get_compositor_private ();
public unowned string get_description ();
public unowned Meta.Display get_display ();
@ -713,6 +985,9 @@ namespace Meta {
public unowned string get_gtk_unique_bus_name ();
public unowned string get_gtk_window_object_path ();
public bool get_icon_geometry (out Meta.Rectangle rect);
#if HAS_MUTTER332
public uint64 get_id ();
#endif
public Meta.StackLayer get_layer ();
public Meta.MaximizeFlags get_maximized ();
public int get_monitor ();
@ -722,7 +997,9 @@ namespace Meta {
#if HAS_MUTTER328
public unowned string get_sandboxed_app_id ();
#endif
#if !HAS_MUTTER330
public unowned Meta.Screen get_screen ();
#endif
public uint get_stable_sequence ();
public unowned string get_startup_id ();
public unowned Meta.Window? get_tile_match ();
@ -826,17 +1103,26 @@ namespace Meta {
public signal void focused ();
public signal void position_changed ();
public signal void raised ();
#if HAS_MUTTER330
public signal void shown ();
#endif
public signal void size_changed ();
public signal void unmanaged ();
public signal void workspace_changed ();
}
[CCode (cheader_filename = "meta/meta-window-actor.h", type_id = "meta_window_actor_get_type ()")]
#if HAS_MUTTER332
public abstract class WindowActor : Clutter.Actor, Atk.Implementor, Clutter.Animatable, Clutter.Container, Clutter.Scriptable {
#else
public class WindowActor : Clutter.Actor, Atk.Implementor, Clutter.Animatable, Clutter.Container, Clutter.Scriptable {
#endif
[CCode (has_construct_function = false)]
protected WindowActor ();
public unowned Meta.Window get_meta_window ();
public unowned Clutter.Actor get_texture ();
#if !HAS_MUTTER332
public X.Window get_x_window ();
#endif
public bool is_destroyed ();
#if HAS_MUTTER322
public void sync_visibility ();
@ -876,12 +1162,16 @@ namespace Meta {
public void activate (uint32 timestamp);
public void activate_with_focus (Meta.Window focus_this, uint32 timestamp);
public unowned Meta.Workspace get_neighbor (Meta.MotionDirection direction);
#if HAS_MUTTER330
public unowned Meta.Display get_display ();
#else
public unowned Meta.Screen get_screen ();
#endif
public Meta.Rectangle get_work_area_all_monitors ();
public Meta.Rectangle get_work_area_for_monitor (int which_monitor);
public int index ();
public GLib.List<weak Meta.Window> list_windows ();
public void set_builtin_struts (GLib.SList<Meta.Strut> struts);
public void set_builtin_struts (GLib.SList<Meta.Strut?> struts);
[NoAccessorMethod]
public uint n_windows { get; }
[NoAccessorMethod]
@ -889,6 +1179,55 @@ namespace Meta {
public signal void window_added (Meta.Window object);
public signal void window_removed (Meta.Window object);
}
#if HAS_MUTTER330
[CCode (cheader_filename = "meta/main.h", type_id = "meta_workspace_manager_get_type ()")]
public class WorkspaceManager : GLib.Object {
[CCode (has_construct_function = false)]
protected WorkspaceManager ();
public unowned Meta.Workspace append_new_workspace (bool activate, uint32 timestamp);
public unowned Meta.Workspace get_active_workspace ();
public int get_active_workspace_index ();
public int get_n_workspaces ();
public unowned Meta.Workspace get_workspace_by_index (int index);
public void override_workspace_layout (Meta.DisplayCorner starting_corner, bool vertical_layout, int n_rows, int n_columns);
public void remove_workspace (Meta.Workspace workspace, uint32 timestamp);
#if HAS_MUTTER334
public void reorder_workspace (Meta.Workspace workspace, int new_index);
#endif
public int n_workspaces { get; }
public signal void active_workspace_changed ();
public signal void showing_desktop_changed ();
public signal void workspace_added (int object);
public signal void workspace_removed (int object);
public signal void workspace_switched (int object, int p0, Meta.MotionDirection p1);
#if HAS_MUTTER334
public signal void workspaces_reordered ();
#endif
}
[CCode (cheader_filename = "meta/main.h", type_id = "meta_x11_display_get_type ()")]
public class X11Display : GLib.Object {
[CCode (has_construct_function = false)]
protected X11Display ();
#if HAS_MUTTER334
public void clear_stage_input_region ();
public void set_stage_input_region (X.XserverRegion region);
#endif
#if !HAS_MUTTER334
public void focus_the_no_focus_window (uint32 timestamp);
#endif
public int get_damage_event_base ();
public int get_screen_number ();
public int get_shape_event_base ();
public unowned X.Display get_xdisplay ();
public unowned X.Window get_xroot ();
public bool has_shape ();
public void set_cm_selection ();
#if !HAS_MUTTER334
public void set_input_focus_window (Meta.Window window, bool focus_frame, uint32 timestamp);
#endif
public bool xwindow_is_a_no_focus_window (X.Window xwindow);
}
#endif
#if HAS_MUTTER326
[CCode (cheader_filename = "meta/main.h", type_cname = "MetaInhibitShortcutsDialogInterface", type_id = "meta_inhibit_shortcuts_dialog_get_type ()")]
public interface InhibitShortcutsDialog : GLib.Object {
@ -913,6 +1252,16 @@ namespace Meta {
#endif
[CCode (cheader_filename = "meta/common.h", has_type_id = false)]
public struct ButtonLayout {
#if HAS_MUTTER332
[CCode (array_length = false)]
public weak Meta.ButtonFunction left_buttons[4];
[CCode (array_length = false)]
public weak bool left_buttons_has_spacer[4];
[CCode (array_length = false)]
public weak Meta.ButtonFunction right_buttons[4];
[CCode (array_length = false)]
public weak bool right_buttons_has_spacer[4];
#else
[CCode (array_length = false)]
public weak Meta.ButtonFunction left_buttons[5];
[CCode (array_length = false)]
@ -921,6 +1270,7 @@ namespace Meta {
public weak Meta.ButtonFunction right_buttons[5];
[CCode (array_length = false)]
public weak bool right_buttons_has_spacer[5];
#endif
}
[CCode (cheader_filename = "meta/boxes.h", has_type_id = false)]
public struct Edge {
@ -1001,7 +1351,9 @@ namespace Meta {
UNABOVE,
UNSTICK,
#endif
#if !HAS_MUTTER332
APPMENU,
#endif
LAST
}
#if HAS_MUTTER326
@ -1082,6 +1434,22 @@ namespace Meta {
HORIZONTAL,
VERTICAL
}
#if HAS_MUTTER330
[CCode (cheader_filename = "meta/main.h", cprefix = "META_DISPLAY_", type_id = "meta_display_corner_get_type ()")]
public enum DisplayCorner {
TOPLEFT,
TOPRIGHT,
BOTTOMLEFT,
BOTTOMRIGHT
}
[CCode (cheader_filename = "meta/main.h", cprefix = "META_DISPLAY_", type_id = "meta_display_direction_get_type ()")]
public enum DisplayDirection {
UP,
DOWN,
LEFT,
RIGHT
}
#endif
[CCode (cheader_filename = "meta/boxes.h", cprefix = "META_EDGE_", type_id = "meta_edge_type_get_type ()")]
public enum EdgeType {
WINDOW,
@ -1098,7 +1466,9 @@ namespace Meta {
public enum FrameFlags {
ALLOWS_DELETE,
ALLOWS_MENU,
#if !HAS_MUTTER332
ALLOWS_APPMENU,
#endif
ALLOWS_MINIMIZE,
ALLOWS_MAXIMIZE,
ALLOWS_VERTICAL_RESIZE,
@ -1110,7 +1480,9 @@ namespace Meta {
ALLOWS_SHADE,
ALLOWS_MOVE,
FULLSCREEN,
#if !HAS_MUTTER332
IS_FLASHING,
#endif
ABOVE,
TILED_LEFT,
TILED_RIGHT
@ -1267,6 +1639,9 @@ namespace Meta {
BUILTIN,
#if HAS_MUTTER326
NON_MASKABLE,
#endif
#if HAS_MUTTER330
IGNORE_AUTOREPEAT,
#endif
IS_REVERSED
}
@ -1364,6 +1739,7 @@ namespace Meta {
[CCode (cheader_filename = "meta/main.h")]
public unowned string to_string ();
}
#if !HAS_MUTTER330
[CCode (cheader_filename = "meta/screen.h", cprefix = "META_SCREEN_", type_id = "meta_screen_corner_get_type ()")]
public enum ScreenCorner {
TOPLEFT,
@ -1378,6 +1754,7 @@ namespace Meta {
LEFT,
RIGHT
}
#endif
[CCode (cheader_filename = "meta/meta-enum-types.h", cprefix = "META_SHADOW_MODE_", type_id = "meta_shadow_mode_get_type ()")]
public enum ShadowMode {
AUTO,
@ -1471,12 +1848,21 @@ namespace Meta {
}
[CCode (cheader_filename = "meta/meta-idle-monitor.h", instance_pos = 2.9)]
public delegate void IdleMonitorWatchFunc (Meta.IdleMonitor monitor, uint watch_id);
#if HAS_MUTTER330
[CCode (cheader_filename = "meta/prefs.h", instance_pos = 4.9)]
public delegate void KeyHandlerFunc (Meta.Display display, Meta.Window? window, Clutter.KeyEvent? event, Meta.KeyBinding binding);
#else
[CCode (cheader_filename = "meta/prefs.h", instance_pos = 5.9)]
public delegate void KeyHandlerFunc (Meta.Display display, Meta.Screen screen, Meta.Window? window, Clutter.KeyEvent? event, Meta.KeyBinding binding);
#endif
[CCode (cheader_filename = "meta/prefs.h", instance_pos = 1.9)]
public delegate void PrefsChangedFunc (Meta.Preference pref);
[CCode (cheader_filename = "meta/window.h", instance_pos = 1.9)]
public delegate bool WindowForeachFunc (Meta.Window window);
#if HAS_MUTTER330
[CCode (cheader_filename = "meta/main.h", cname = "META_CURRENT_TIME")]
public const int CURRENT_TIME;
#endif
[CCode (cheader_filename = "meta/main.h", cname = "META_DEFAULT_ICON_NAME")]
public const string DEFAULT_ICON_NAME;
[CCode (cheader_filename = "meta/main.h", cname = "META_ICON_HEIGHT")]

View File

@ -0,0 +1,5 @@
atk
cairo
pango
json-glib-1.0
mutter-cogl-3

1
vapi/mutter-clutter-3.vapi Symbolic link
View File

@ -0,0 +1 @@
mutter-clutter-2.vapi

View File

@ -0,0 +1,5 @@
atk
cairo
pango
json-glib-1.0
mutter-cogl-4

1
vapi/mutter-clutter-4.vapi Symbolic link
View File

@ -0,0 +1 @@
mutter-clutter-3.vapi

View File

@ -0,0 +1,5 @@
atk
cairo
pango
json-glib-1.0
mutter-cogl-5

1
vapi/mutter-clutter-5.vapi Symbolic link
View File

@ -0,0 +1 @@
mutter-clutter-4.vapi

View File

@ -0,0 +1,5 @@
atk
cairo
pango
json-glib-1.0
mutter-cogl-6

1
vapi/mutter-clutter-6.vapi Symbolic link
View File

@ -0,0 +1 @@
mutter-clutter-5.vapi

1
vapi/mutter-cogl-3.deps Symbolic link
View File

@ -0,0 +1 @@
mutter-cogl-2.deps

1
vapi/mutter-cogl-3.vapi Symbolic link
View File

@ -0,0 +1 @@
mutter-cogl-2.vapi

1
vapi/mutter-cogl-4.deps Symbolic link
View File

@ -0,0 +1 @@
mutter-cogl-3.deps

1
vapi/mutter-cogl-4.vapi Symbolic link
View File

@ -0,0 +1 @@
mutter-cogl-3.vapi

1
vapi/mutter-cogl-5.deps Symbolic link
View File

@ -0,0 +1 @@
mutter-cogl-4.deps

1
vapi/mutter-cogl-5.vapi Symbolic link
View File

@ -0,0 +1 @@
mutter-cogl-4.vapi

1
vapi/mutter-cogl-6.deps Symbolic link
View File

@ -0,0 +1 @@
mutter-cogl-5.deps

1
vapi/mutter-cogl-6.vapi Symbolic link
View File

@ -0,0 +1 @@
mutter-cogl-5.vapi

View File

View File

View File

View File

View File

View File

View File

View File