mirror of
https://github.com/elementary/gala.git
synced 2024-09-11 07:05:30 +03:00
Reduce the number of warnings
No functional change.
This commit is contained in:
parent
87d51c50fb
commit
4aec79ae0d
@ -36,7 +36,7 @@ namespace Gala {
|
|||||||
* @param y The global y coordinate where the action was activated
|
* @param y The global y coordinate where the action was activated
|
||||||
* @return A ClutterActor that serves as handle
|
* @return A ClutterActor that serves as handle
|
||||||
*/
|
*/
|
||||||
public signal Actor drag_begin (float x, float y);
|
public signal Actor? drag_begin (float x, float y);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A drag has been canceled. You may want to consider cleaning up
|
* A drag has been canceled. You may want to consider cleaning up
|
||||||
|
@ -91,12 +91,16 @@ namespace Gala.Plugins.PIP {
|
|||||||
cr.set_source_surface (buffer.surface, 0, 0);
|
cr.set_source_surface (buffer.surface, 0, 0);
|
||||||
cr.paint ();
|
cr.paint ();
|
||||||
|
|
||||||
var texture = new Cogl.Texture2D.from_data (context, width, height, Cogl.PixelFormat.BGRA_8888_PRE,
|
try {
|
||||||
surface.get_stride (), surface.get_data ());
|
var texture = new Cogl.Texture2D.from_data (context, width, height, Cogl.PixelFormat.BGRA_8888_PRE,
|
||||||
|
surface.get_stride (), surface.get_data ());
|
||||||
|
|
||||||
shadow_cache.@set (current_key, new Shadow (texture));
|
shadow_cache.@set (current_key, new Shadow (texture));
|
||||||
|
return texture;
|
||||||
return texture;
|
} catch (GLib.Error e) {
|
||||||
|
debug (e.message);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void decrement_shadow_users (string key) {
|
void decrement_shadow_users (string key) {
|
||||||
|
@ -131,25 +131,25 @@ namespace Gala {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void finish_animation (string[] files) {
|
||||||
|
set_loaded ();
|
||||||
|
|
||||||
|
if (files.length > 1)
|
||||||
|
background.set_blend (File.new_for_path (files[0]), File.new_for_path (files[1]), animation.transition_progress, style);
|
||||||
|
else if (files.length > 0)
|
||||||
|
background.set_file (File.new_for_path (files[0]), style);
|
||||||
|
else
|
||||||
|
background.set_file (null, style);
|
||||||
|
|
||||||
|
queue_update_animation ();
|
||||||
|
}
|
||||||
|
|
||||||
void update_animation () {
|
void update_animation () {
|
||||||
update_animation_timeout_id = 0;
|
update_animation_timeout_id = 0;
|
||||||
|
|
||||||
animation.update (display.get_monitor_geometry (monitor_index));
|
animation.update (display.get_monitor_geometry (monitor_index));
|
||||||
var files = animation.key_frame_files;
|
var files = animation.key_frame_files;
|
||||||
|
|
||||||
Clutter.Callback finish = () => {
|
|
||||||
set_loaded ();
|
|
||||||
|
|
||||||
if (files.length > 1)
|
|
||||||
background.set_blend (File.new_for_path (files[0]), File.new_for_path (files[1]), animation.transition_progress, style);
|
|
||||||
else if (files.length > 0)
|
|
||||||
background.set_file (File.new_for_path (files[0]), style);
|
|
||||||
else
|
|
||||||
background.set_file (null, style);
|
|
||||||
|
|
||||||
queue_update_animation ();
|
|
||||||
};
|
|
||||||
|
|
||||||
var cache = Meta.BackgroundImageCache.get_default ();
|
var cache = Meta.BackgroundImageCache.get_default ();
|
||||||
var num_pending_images = files.length;
|
var num_pending_images = files.length;
|
||||||
for (var i = 0; i < files.length; i++) {
|
for (var i = 0; i < files.length; i++) {
|
||||||
@ -159,14 +159,16 @@ namespace Gala {
|
|||||||
|
|
||||||
if (image.is_loaded ()) {
|
if (image.is_loaded ()) {
|
||||||
num_pending_images--;
|
num_pending_images--;
|
||||||
if (num_pending_images == 0)
|
if (num_pending_images == 0) {
|
||||||
finish (null);
|
finish_animation (files);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ulong handler = 0;
|
ulong handler = 0;
|
||||||
handler = image.loaded.connect (() => {
|
handler = image.loaded.connect (() => {
|
||||||
SignalHandler.disconnect (image, handler);
|
SignalHandler.disconnect (image, handler);
|
||||||
if (--num_pending_images == 0)
|
if (--num_pending_images == 0) {
|
||||||
finish (null);
|
finish_animation (files);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,16 @@
|
|||||||
|
|
||||||
namespace Gala {
|
namespace Gala {
|
||||||
public class BackgroundSource : Object {
|
public class BackgroundSource : Object {
|
||||||
|
// list of keys that are actually relevant for us
|
||||||
|
const string[] OPTIONS = {
|
||||||
|
"color-shading-type",
|
||||||
|
"picture-opacity",
|
||||||
|
"picture-options",
|
||||||
|
"picture-uri",
|
||||||
|
"primary-color",
|
||||||
|
"secondary-color"
|
||||||
|
};
|
||||||
|
|
||||||
public signal void changed ();
|
public signal void changed ();
|
||||||
|
|
||||||
public Meta.Display display { get; construct; }
|
public Meta.Display display { get; construct; }
|
||||||
@ -25,6 +35,7 @@ namespace Gala {
|
|||||||
internal int use_count { get; set; default = 0; }
|
internal int use_count { get; set; default = 0; }
|
||||||
|
|
||||||
Gee.HashMap<int,Background> backgrounds;
|
Gee.HashMap<int,Background> backgrounds;
|
||||||
|
uint[] hash_cache;
|
||||||
|
|
||||||
public BackgroundSource (Meta.Display display, string settings_schema) {
|
public BackgroundSource (Meta.Display display, string settings_schema) {
|
||||||
Object (display: display, settings: new Settings (settings_schema));
|
Object (display: display, settings: new Settings (settings_schema));
|
||||||
@ -32,11 +43,23 @@ namespace Gala {
|
|||||||
|
|
||||||
construct {
|
construct {
|
||||||
backgrounds = new Gee.HashMap<int,Background> ();
|
backgrounds = new Gee.HashMap<int,Background> ();
|
||||||
|
hash_cache = new uint[OPTIONS.length];
|
||||||
|
|
||||||
Meta.MonitorManager.@get ().monitors_changed.connect (monitors_changed);
|
Meta.MonitorManager.@get ().monitors_changed.connect (monitors_changed);
|
||||||
|
|
||||||
settings_hash_cache = get_current_settings_hash_cache ();
|
// unfortunately the settings sometimes tend to fire random changes even though
|
||||||
settings.changed.connect (settings_changed);
|
// nothing actually happend. The code below is used to prevent us from spamming
|
||||||
|
// new actors all the time, which lead to some problems in other areas of the code
|
||||||
|
for (int i = 0; i < OPTIONS.length; i++) {
|
||||||
|
hash_cache[i] = settings.get_value (OPTIONS[i]).hash ();
|
||||||
|
settings.changed[OPTIONS[i]].connect (() => {
|
||||||
|
uint new_hash = settings.get_value (OPTIONS[i]).hash ();
|
||||||
|
if (new_hash != hash_cache[i]) {
|
||||||
|
hash_cache[i] = new_hash;
|
||||||
|
changed ();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void monitors_changed () {
|
void monitors_changed () {
|
||||||
@ -98,51 +121,5 @@ namespace Gala {
|
|||||||
background.destroy ();
|
background.destroy ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// unfortunately the settings sometimes tend to fire random changes even though
|
|
||||||
// nothing actually happend. The code below is used to prevent us from spamming
|
|
||||||
// new actors all the time, which lead to some problems in other areas of the code
|
|
||||||
|
|
||||||
// helper struct which stores the hash values generated by g_variant_hash
|
|
||||||
struct SettingsHashCache {
|
|
||||||
uint color_shading_type;
|
|
||||||
uint picture_opacity;
|
|
||||||
uint picture_options;
|
|
||||||
uint picture_uri;
|
|
||||||
uint primar_color;
|
|
||||||
uint secondary_color;
|
|
||||||
}
|
|
||||||
|
|
||||||
SettingsHashCache settings_hash_cache;
|
|
||||||
|
|
||||||
// list of keys that are actually relevant for us
|
|
||||||
const string[] OPTIONS = { "color-shading-type", "picture-opacity",
|
|
||||||
"picture-options", "picture-uri", "primary-color", "secondary-color" };
|
|
||||||
|
|
||||||
void settings_changed (string key) {
|
|
||||||
if (!(key in OPTIONS))
|
|
||||||
return;
|
|
||||||
|
|
||||||
var current = get_current_settings_hash_cache ();
|
|
||||||
|
|
||||||
if (Memory.cmp (&settings_hash_cache, ¤t, sizeof (SettingsHashCache)) == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Memory.copy (&settings_hash_cache, ¤t, sizeof (SettingsHashCache));
|
|
||||||
|
|
||||||
changed ();
|
|
||||||
}
|
|
||||||
|
|
||||||
SettingsHashCache get_current_settings_hash_cache () {
|
|
||||||
return {
|
|
||||||
settings.get_value ("color-shading-type").hash (),
|
|
||||||
settings.get_value ("picture-opacity").hash (),
|
|
||||||
settings.get_value ("picture-options").hash (),
|
|
||||||
settings.get_value ("picture-uri").hash (),
|
|
||||||
settings.get_value ("primary-color").hash (),
|
|
||||||
settings.get_value ("secondary-color").hash ()
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ namespace Gala {
|
|||||||
|
|
||||||
private DBus () {
|
private DBus () {
|
||||||
if (wm.background_group != null)
|
if (wm.background_group != null)
|
||||||
(wm.background_group as BackgroundContainer).changed.connect (() => background_changed ());
|
((BackgroundContainer) wm.background_group).changed.connect (() => background_changed ());
|
||||||
else
|
else
|
||||||
assert_not_reached ();
|
assert_not_reached ();
|
||||||
}
|
}
|
||||||
|
@ -104,11 +104,16 @@ namespace Gala {
|
|||||||
|
|
||||||
cr.paint ();
|
cr.paint ();
|
||||||
|
|
||||||
var texture = new Cogl.Texture2D.from_data (context, width, height, Cogl.PixelFormat.BGRA_8888_PRE,
|
try {
|
||||||
surface.get_stride (), surface.get_data ());
|
var texture = new Cogl.Texture2D.from_data (context, width, height, Cogl.PixelFormat.BGRA_8888_PRE,
|
||||||
shadow_cache.@set (current_key, new Shadow (texture));
|
surface.get_stride (), surface.get_data ());
|
||||||
|
shadow_cache.@set (current_key, new Shadow (texture));
|
||||||
|
|
||||||
return texture;
|
return texture;
|
||||||
|
} catch (Error e) {
|
||||||
|
debug (e.message);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void decrement_shadow_users (string key) {
|
void decrement_shadow_users (string key) {
|
||||||
|
@ -505,7 +505,7 @@ namespace Gala {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Actor drag_begin (float click_x, float click_y) {
|
Actor? drag_begin (float click_x, float click_y) {
|
||||||
unowned Meta.WorkspaceManager manager = workspace.get_display ().get_workspace_manager ();
|
unowned Meta.WorkspaceManager manager = workspace.get_display ().get_workspace_manager ();
|
||||||
if (icon_container.get_n_children () < 1 &&
|
if (icon_container.get_n_children () < 1 &&
|
||||||
Prefs.get_dynamic_workspaces () &&
|
Prefs.get_dynamic_workspaces () &&
|
||||||
|
@ -49,7 +49,7 @@ namespace Gala {
|
|||||||
private Clutter.Canvas background_canvas;
|
private Clutter.Canvas background_canvas;
|
||||||
private static int border_radius;
|
private static int border_radius;
|
||||||
private static Gdk.RGBA color;
|
private static Gdk.RGBA color;
|
||||||
private static const double COLOR_OPACITY = 0.8;
|
private const double COLOR_OPACITY = 0.8;
|
||||||
|
|
||||||
static construct {
|
static construct {
|
||||||
var label_widget_path = new Gtk.WidgetPath ();
|
var label_widget_path = new Gtk.WidgetPath ();
|
||||||
|
@ -146,21 +146,19 @@ namespace Gala {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_menu_get (GLib.Object? o, GLib.AsyncResult? res) {
|
|
||||||
try {
|
|
||||||
daemon_proxy = Bus.get_proxy.end (res);
|
|
||||||
} catch (Error e) {
|
|
||||||
warning ("Failed to get Menu proxy: %s", e.message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void lost_daemon () {
|
void lost_daemon () {
|
||||||
daemon_proxy = null;
|
daemon_proxy = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
void daemon_appeared () {
|
void daemon_appeared () {
|
||||||
if (daemon_proxy == null) {
|
if (daemon_proxy == null) {
|
||||||
Bus.get_proxy.begin<Daemon> (BusType.SESSION, DAEMON_DBUS_NAME, DAEMON_DBUS_OBJECT_PATH, 0, null, on_menu_get);
|
Bus.get_proxy.begin<Daemon> (BusType.SESSION, DAEMON_DBUS_NAME, DAEMON_DBUS_OBJECT_PATH, 0, null, (obj, res) => {
|
||||||
|
try {
|
||||||
|
daemon_proxy = Bus.get_proxy.end (res);
|
||||||
|
} catch (Error e) {
|
||||||
|
warning ("Failed to get Menu proxy: %s", e.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -366,11 +364,13 @@ namespace Gala {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
daemon_proxy.show_desktop_menu.begin (x, y, (obj, res) => {
|
||||||
daemon_proxy.show_desktop_menu.begin (x, y);
|
try {
|
||||||
} catch (Error e) {
|
((Daemon) obj).show_desktop_menu.end (res);
|
||||||
message ("Error invoking MenuManager: %s", e.message);
|
} catch (Error e) {
|
||||||
}
|
message ("Error invoking MenuManager: %s", e.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_monitors_changed () {
|
void on_monitors_changed () {
|
||||||
@ -913,7 +913,7 @@ namespace Gala {
|
|||||||
workspace.activate (display.get_current_time ());
|
workspace.activate (display.get_current_time ());
|
||||||
break;
|
break;
|
||||||
case ActionType.SCREENSHOT_CURRENT:
|
case ActionType.SCREENSHOT_CURRENT:
|
||||||
screenshot_current_window ();
|
screenshot_current_window.begin ();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
warning ("Trying to run unknown action");
|
warning ("Trying to run unknown action");
|
||||||
@ -959,11 +959,13 @@ namespace Gala {
|
|||||||
if (window.can_close ())
|
if (window.can_close ())
|
||||||
flags |= WindowFlags.CAN_CLOSE;
|
flags |= WindowFlags.CAN_CLOSE;
|
||||||
|
|
||||||
try {
|
daemon_proxy.show_window_menu.begin (flags, x, y, (obj, res) => {
|
||||||
daemon_proxy.show_window_menu.begin (flags, x, y);
|
try {
|
||||||
} catch (Error e) {
|
((Daemon) obj).show_window_menu.end (res);
|
||||||
message ("Error invoking MenuManager: %s", e.message);
|
} catch (Error e) {
|
||||||
}
|
message ("Error invoking MenuManager: %s", e.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
case Meta.WindowMenuType.APP:
|
case Meta.WindowMenuType.APP:
|
||||||
// FIXME we don't have any sort of app menus
|
// FIXME we don't have any sort of app menus
|
||||||
|
Loading…
Reference in New Issue
Block a user