Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
6 changes: 3 additions & 3 deletions src/DBus.vala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* SPDX-License-Identifier: GPL-3.0-or-later
* SPDX-FileCopyrightText: 2024 elementary, Inc. (https://elementary.io)
* SPDX-FileCopyrightText: 2024-2025 elementary, Inc. (https://elementary.io)
* 2012-2014 Tom Beckmann
* 2012-2014 Jacob Parker
*/
Expand All @@ -11,7 +11,7 @@ public class Gala.DBus {
private static WindowManagerGala wm;

[DBus (visible = false)]
public static void init (WindowManagerGala _wm, ScreenshotManager screenshot_manager) {
public static void init (WindowManagerGala _wm, DBusAccelerator dbus_accelerator, ScreenshotManager screenshot_manager) {
wm = _wm;

Bus.own_name (BusType.SESSION, "org.pantheon.gala", BusNameOwnerFlags.NONE,
Expand All @@ -33,7 +33,7 @@ public class Gala.DBus {
Bus.own_name (BusType.SESSION, "org.gnome.Shell", BusNameOwnerFlags.NONE,
(connection) => {
try {
connection.register_object ("/org/gnome/Shell", DBusAccelerator.init (wm.get_display ()));
connection.register_object ("/org/gnome/Shell", dbus_accelerator);
connection.register_object ("/org/gnome/Shell/Screenshot", screenshot_manager);
} catch (Error e) { warning (e.message); }
},
Expand Down
14 changes: 2 additions & 12 deletions src/DBusAccelerator.vala
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//
// Copyright (C) 2015 Nicolas Bruguier, Corentin Noël
// 2025 elementary, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -72,23 +73,12 @@ namespace Gala {

[DBus (name="org.gnome.Shell")]
public class DBusAccelerator {
private static DBusAccelerator? instance;

[DBus (visible = false)]
public static unowned DBusAccelerator init (Meta.Display display) {
if (instance == null) {
instance = new DBusAccelerator (display);
}

return instance;
}

public signal void accelerator_activated (uint action, GLib.HashTable<string, Variant> parameters);

private Meta.Display display;
private GLib.HashTable<unowned string, GrabbedAccelerator> grabbed_accelerators;

private DBusAccelerator (Meta.Display _display) {
public DBusAccelerator (Meta.Display _display) {
display = _display;
grabbed_accelerators = new HashTable<unowned string, GrabbedAccelerator> (str_hash, str_equal);
display.accelerator_activated.connect (on_accelerator_activated);
Expand Down
6 changes: 4 additions & 2 deletions src/WindowManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ namespace Gala {

public WindowTracker? window_tracker { get; private set; }

private DBusAccelerator dbus_accelerator;

private ScreenshotManager screenshot_manager;

/**
Expand Down Expand Up @@ -191,8 +193,8 @@ namespace Gala {
unowned Meta.Display display = get_display ();

screenshot_manager = new ScreenshotManager (this);
DBus.init (this, screenshot_manager);
DBusAccelerator.init (display);
dbus_accelerator = new DBusAccelerator (display);
DBus.init (this, dbus_accelerator, screenshot_manager);
MediaFeedback.init ();

WindowListener.init (display);
Expand Down
Loading