Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use BackgroundManager to get wallpaper #522

Merged
merged 2 commits into from
Feb 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions wingpanel-interface/Utils.vala
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,18 @@ namespace WingpanelInterface.Utils {

public async ColorInformation get_background_color_information (Gala.WindowManager wm, int monitor,
int reference_x, int reference_y, int reference_width, int reference_height) throws DBusError {
var background = wm.background_group.get_child_at_index (monitor);
var bg_manager = (Gala.BackgroundManagerInterface) wm.background_group.get_child_at_index (monitor);

if (background == null) {
if (bg_manager == null) {
throw new DBusError.INVALID_ARGS ("Invalid monitor requested: %i".printf (monitor));
}

var effect = new DummyOffscreenEffect ();
background.add_effect (effect);
unowned var newest_background_actor = bg_manager.newest_background_actor;
newest_background_actor.add_effect (effect);

var bg_actor_width = (int)background.width;
var bg_actor_height = (int)background.height;
var bg_actor_width = (int) newest_background_actor.width;
var bg_actor_height = (int) newest_background_actor.height;

// A commit in mutter added some padding to offscreen textures, so we
// need to avoid looking at the edges of the texture as it often has a
Expand Down Expand Up @@ -91,7 +92,7 @@ namespace WingpanelInterface.Utils {

paint_signal_handler = effect.done_painting.connect (() => {
SignalHandler.disconnect (effect, paint_signal_handler);
background.remove_effect (effect);
newest_background_actor.remove_effect (effect);

var texture = (Cogl.Texture)effect.get_texture ();
var texture_width = texture.get_width ();
Expand Down Expand Up @@ -211,7 +212,7 @@ namespace WingpanelInterface.Utils {
get_background_color_information.callback ();
});

background.queue_redraw ();
newest_background_actor.queue_redraw ();

yield;

Expand Down
Loading