Remove some deprecations and fix compile warnings (#1544)

This commit is contained in:
Leo 2023-02-22 04:05:43 +09:00 committed by GitHub
parent d0abb9c0e7
commit 4e00b82dd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 49 additions and 40 deletions

View File

@ -21,7 +21,7 @@ You'll need the following dependencies:
* libgtk-3-dev (>= 3.10.0) * libgtk-3-dev (>= 3.10.0)
* libmutter-10-dev (>= 42.0) | libmutter-dev (>= 3.18.3) * libmutter-10-dev (>= 42.0) | libmutter-dev (>= 3.18.3)
* libxml2-utils * libxml2-utils
* valac (>= 0.28.0) * valac (>= 0.46.0)
Run `meson build` to configure the build environment. Change to the build directory and run `ninja` to build Run `meson build` to configure the build environment. Change to the build directory and run `ninja` to build

View File

@ -12,7 +12,7 @@ install_data(
i18n.merge_file( i18n.merge_file(
input: 'gala.appdata.xml.in', input: 'gala.appdata.xml.in',
output: meson.project_name() + '.appdata.xml', output: meson.project_name() + '.appdata.xml',
po_dir: join_paths(meson.source_root(), 'po'), po_dir: join_paths(meson.global_source_root(), 'po'),
type: 'xml', type: 'xml',
install: true, install: true,
install_dir: join_paths(get_option('datadir'), 'metainfo'), install_dir: join_paths(get_option('datadir'), 'metainfo'),
@ -21,7 +21,7 @@ i18n.merge_file(
i18n.merge_file( i18n.merge_file(
input: 'gala-multitaskingview.desktop.in', input: 'gala-multitaskingview.desktop.in',
output: 'gala-multitaskingview.desktop', output: 'gala-multitaskingview.desktop',
po_dir: join_paths(meson.source_root (), 'po'), po_dir: join_paths(meson.global_source_root (), 'po'),
type: 'desktop', type: 'desktop',
install: true, install: true,
install_dir: join_paths(data_dir, 'applications') install_dir: join_paths(data_dir, 'applications')
@ -30,7 +30,7 @@ i18n.merge_file(
i18n.merge_file( i18n.merge_file(
input: 'gala-other.desktop.in', input: 'gala-other.desktop.in',
output: 'gala-other.desktop', output: 'gala-other.desktop',
po_dir: join_paths(meson.source_root (), 'po'), po_dir: join_paths(meson.global_source_root (), 'po'),
type: 'desktop', type: 'desktop',
install: true, install: true,
install_dir: join_paths(data_dir, 'applications') install_dir: join_paths(data_dir, 'applications')
@ -42,7 +42,7 @@ if get_option('systemd')
dep_systemd = dependency('systemd', required: true) dep_systemd = dependency('systemd', required: true)
systemd_userunitdir = get_option('systemduserunitdir') systemd_userunitdir = get_option('systemduserunitdir')
if systemd_userunitdir == '' if systemd_userunitdir == ''
systemd_userunitdir = dep_systemd.get_pkgconfig_variable('systemduserunitdir', define_variable: ['prefix', get_option('prefix')]) systemd_userunitdir = dep_systemd.get_variable('systemduserunitdir', pkgconfig_define: ['prefix', get_option('prefix')])
endif endif
bindir = join_paths(get_option('prefix'), get_option('bindir')) bindir = join_paths(get_option('prefix'), get_option('bindir'))

View File

@ -23,7 +23,7 @@ basic_command = [
'--pkg', 'config', '--pkg', 'config',
vala_flags, vala_flags,
'--vapidir=' + join_paths(meson.build_root(), 'lib'), '--vapidir=' + join_paths(meson.build_root(), 'lib'),
'--vapidir=' + join_paths(meson.source_root(), 'vapi'), '--vapidir=' + join_paths(meson.global_source_root(), 'vapi'),
'--doclet=html', '--doclet=html',
'--use-svg-images' '--use-svg-images'
] ]

View File

@ -366,6 +366,8 @@ namespace Gala {
return true; return true;
} }
break;
default:
break; break;
} }

View File

@ -151,7 +151,7 @@ namespace Gala {
// Construct a new "application-default-icon" and store it in the cache // Construct a new "application-default-icon" and store it in the cache
try { try {
var icon = Gtk.IconTheme.get_default ().load_icon_for_scale ("application-default-icon", icon_size, scale, 0); var icon = Gtk.IconTheme.get_default ().load_icon_for_scale ("application-default-icon", icon_size, scale, 0);
unknown_icon_cache.add (new CachedIcon () { icon = icon, icon_size = icon_size, scale = scale }); unknown_icon_cache.add (CachedIcon () { icon = icon, icon_size = icon_size, scale = scale });
return icon; return icon;
} catch (Error e) { } catch (Error e) {
var icon = new Gdk.Pixbuf (Gdk.Colorspace.RGB, true, 8, icon_size * scale, icon_size * scale); var icon = new Gdk.Pixbuf (Gdk.Colorspace.RGB, true, 8, icon_size * scale, icon_size * scale);
@ -227,7 +227,7 @@ namespace Gala {
try { try {
var pixbuf = icon_info.load_icon (); var pixbuf = icon_info.load_icon ();
icon_cache.@set (desktop, new CachedIcon () { icon = pixbuf, icon_size = icon_size, scale = scale }); icon_cache.@set (desktop, CachedIcon () { icon = pixbuf, icon_size = icon_size, scale = scale });
return pixbuf; return pixbuf;
} catch (Error e) { } catch (Error e) {
return null; return null;
@ -237,7 +237,7 @@ namespace Gala {
var size_with_scale = icon_size * scale; var size_with_scale = icon_size * scale;
try { try {
var pixbuf = new Gdk.Pixbuf.from_stream_at_scale (file.read (), size_with_scale, size_with_scale, true); var pixbuf = new Gdk.Pixbuf.from_stream_at_scale (file.read (), size_with_scale, size_with_scale, true);
icon_cache.@set (desktop, new CachedIcon () { icon = pixbuf, icon_size = icon_size, scale = scale }); icon_cache.@set (desktop, CachedIcon () { icon = pixbuf, icon_size = icon_size, scale = scale });
return pixbuf; return pixbuf;
} catch (Error e) { } catch (Error e) {
return null; return null;

View File

@ -16,8 +16,8 @@ gala_lib_sources = files(
gala_resources = gnome.compile_resources( gala_resources = gnome.compile_resources(
'gala-resources', 'gala-resources',
join_paths(meson.source_root(), 'data', 'gala.gresource.xml'), join_paths(meson.global_source_root(), 'data', 'gala.gresource.xml'),
source_dir: join_paths(meson.source_root(), 'data'), source_dir: join_paths(meson.global_source_root(), 'data'),
c_name: 'gala', c_name: 'gala',
) )

View File

@ -1,7 +1,7 @@
project('gala', project('gala',
'c', 'vala', 'c', 'vala',
version: '7.0.0', version: '7.0.0',
meson_version: '>= 0.50.0', meson_version: '>= 0.58.0',
license: 'GPL3', license: 'GPL3',
) )
@ -14,7 +14,7 @@ cc = meson.get_compiler('c')
gala_version = meson.project_version() gala_version = meson.project_version()
vala_version_required = '0.28.0' vala_version_required = '0.46.0'
vala = meson.get_compiler('vala') vala = meson.get_compiler('vala')
if not vala.version().version_compare('>= @0@'.format(vala_version_required)) if not vala.version().version_compare('>= @0@'.format(vala_version_required))
error('Valac >= @0@ required!'.format(vala_version_required)) error('Valac >= @0@ required!'.format(vala_version_required))
@ -132,7 +132,7 @@ if mutter_dep.length() == 0
error ('No supported mutter library found!') error ('No supported mutter library found!')
endif endif
mutter_typelib_dir = libmutter_dep.get_pkgconfig_variable('typelibdir') mutter_typelib_dir = libmutter_dep.get_variable('typelibdir')
if get_option('systemd') if get_option('systemd')
vala_flags += ['--define', 'WITH_SYSTEMD'] vala_flags += ['--define', 'WITH_SYSTEMD']

View File

@ -146,12 +146,12 @@ public class Gala.AccentColorManager : Object {
path = Filename.from_uri (picture_uri); path = Filename.from_uri (picture_uri);
metadata = new GExiv2.Metadata (); metadata = new GExiv2.Metadata ();
metadata.open_path (path); metadata.open_path (path);
return metadata.try_get_tag_string (TAG_ACCENT_COLOR);
} catch (Error e) { } catch (Error e) {
warning ("Error parsing exif metadata of \"%s\": %s", path, e.message); warning ("Error parsing exif metadata of \"%s\": %s", path, e.message);
return null; return null;
} }
return metadata.get_tag_string (TAG_ACCENT_COLOR);
} }
private NamedColor? get_accent_color (ColorExtractor color_extractor) { private NamedColor? get_accent_color (ColorExtractor color_extractor) {

View File

@ -50,15 +50,15 @@ namespace Gala {
act.sa_mask = empty_mask; act.sa_mask = empty_mask;
act.sa_flags = 0; act.sa_flags = 0;
if (Posix.sigaction (Posix.SIGPIPE, act, null) < 0) { if (Posix.sigaction (Posix.Signal.PIPE, act, null) < 0) {
warning ("Failed to register SIGPIPE handler: %s", GLib.strerror (GLib.errno)); warning ("Failed to register SIGPIPE handler: %s", GLib.strerror (GLib.errno));
} }
if (Posix.sigaction (Posix.SIGXFSZ, act, null) < 0) { if (Posix.sigaction (Posix.Signal.XFSZ, act, null) < 0) {
warning ("Failed to register SIGXFSZ handler: %s", GLib.strerror (GLib.errno)); warning ("Failed to register SIGXFSZ handler: %s", GLib.strerror (GLib.errno));
} }
GLib.Unix.signal_add (Posix.SIGTERM, () => { GLib.Unix.signal_add (Posix.Signal.TERM, () => {
ctx.terminate (); ctx.terminate ();
return GLib.Source.REMOVE; return GLib.Source.REMOVE;
}); });

View File

@ -86,7 +86,7 @@ namespace Gala {
private bool load_module (string plugin_name) { private bool load_module (string plugin_name) {
var path = Module.build_path (plugin_dir.get_path (), plugin_name); var path = Module.build_path (plugin_dir.get_path (), plugin_name);
var module = Module.open (path, ModuleFlags.BIND_LOCAL); var module = Module.open (path, ModuleFlags.LOCAL);
if (module == null) { if (module == null) {
warning (Module.error ()); warning (Module.error ());
return false; return false;
@ -170,6 +170,8 @@ namespace Gala {
} }
window_switcher_provider = name; window_switcher_provider = name;
return true; return true;
default:
break;
} }
return true; return true;

View File

@ -353,24 +353,28 @@ namespace Gala {
paint_flags |= Clutter.PaintFlag.FORCE_CURSORS; paint_flags |= Clutter.PaintFlag.FORCE_CURSORS;
} }
if (GLib.ByteOrder.HOST == GLib.ByteOrder.LITTLE_ENDIAN) { try {
wm.stage.paint_to_buffer ( if (GLib.ByteOrder.HOST == GLib.ByteOrder.LITTLE_ENDIAN) {
{x, y, width, height}, wm.stage.paint_to_buffer (
scale, {x, y, width, height},
image.get_data (), scale,
image.get_stride (), image.get_data (),
Cogl.PixelFormat.BGRA_8888_PRE, image.get_stride (),
paint_flags Cogl.PixelFormat.BGRA_8888_PRE,
); paint_flags
} else { );
wm.stage.paint_to_buffer ( } else {
{x, y, width, height}, wm.stage.paint_to_buffer (
scale, {x, y, width, height},
image.get_data (), scale,
image.get_stride (), image.get_data (),
Cogl.PixelFormat.ARGB_8888_PRE, image.get_stride (),
paint_flags Cogl.PixelFormat.ARGB_8888_PRE,
); paint_flags
);
}
} catch (Error e) {
warning (e.message);
} }
return image; return image;
} }

View File

@ -277,6 +277,8 @@ namespace Gala {
closest = (WindowClone) window; closest = (WindowClone) window;
} }
break; break;
default:
break;
} }
} }

View File

@ -128,7 +128,7 @@ namespace Gala {
container.motion_event.connect (container_motion_event); container.motion_event.connect (container_motion_event);
var rgba = InternalUtils.get_theme_accent_color (); var rgba = InternalUtils.get_theme_accent_color ();
var accent_color = new Clutter.Color (); var accent_color = Clutter.Color ();
accent_color.init ( accent_color.init (
(uint8) (rgba.red * 255), (uint8) (rgba.red * 255),
(uint8) (rgba.green * 255), (uint8) (rgba.green * 255),

View File

@ -5,7 +5,6 @@
*/ */
public class Gala.WindowTracker : GLib.Object { public class Gala.WindowTracker : GLib.Object {
private Gala.App? focused_app = null;
private GLib.HashTable<unowned Meta.Window, Gala.App> window_to_app; private GLib.HashTable<unowned Meta.Window, Gala.App> window_to_app;
public signal void windows_changed (); public signal void windows_changed ();