Skip to content

Commit

Permalink
Merge branch 'master' into require-mutter-42
Browse files Browse the repository at this point in the history
  • Loading branch information
lenemter committed Feb 19, 2023
2 parents fc9980a + 37fea81 commit e7ff97d
Show file tree
Hide file tree
Showing 45 changed files with 426 additions and 419 deletions.
6 changes: 3 additions & 3 deletions daemon/Main.vala
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace Gala {
}

public class Daemon {
SessionClient? sclient = null;
private SessionClient? sclient = null;

public Daemon () {
register.begin ((o, res)=> {
Expand Down Expand Up @@ -109,7 +109,7 @@ namespace Gala {
return session_client;
}

async bool register () {
private async bool register () {
sclient = yield register_with_session ("org.pantheon.gala.daemon");

sclient.query_end_session.connect (() => end_session (false));
Expand All @@ -119,7 +119,7 @@ namespace Gala {
return true;
}

void end_session (bool quit) {
private void end_session (bool quit) {
if (quit) {
Gtk.main_quit ();
return;
Expand Down
48 changes: 24 additions & 24 deletions daemon/MenuDaemon.vala
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
//

namespace Gala {
const string DBUS_NAME = "org.pantheon.gala";
const string DBUS_OBJECT_PATH = "/org/pantheon/gala";
private const string DBUS_NAME = "org.pantheon.gala";
private const string DBUS_OBJECT_PATH = "/org/pantheon/gala";

const string DAEMON_DBUS_NAME = "org.pantheon.gala.daemon";
const string DAEMON_DBUS_OBJECT_PATH = "/org/pantheon/gala/daemon";
private const string DAEMON_DBUS_NAME = "org.pantheon.gala.daemon";
private const string DAEMON_DBUS_OBJECT_PATH = "/org/pantheon/gala/daemon";

[DBus (name = "org.pantheon.gala")]
public interface WMDBus : GLib.Object {
Expand All @@ -39,25 +39,25 @@ namespace Gala {
private Granite.AccelLabel on_visible_workspace_accellabel;
private Granite.AccelLabel resize_accellabel;
private Granite.AccelLabel screenshot_accellabel;
Gtk.Menu? window_menu = null;
Gtk.MenuItem hide;
Gtk.MenuItem maximize;
Gtk.MenuItem move;
Gtk.MenuItem resize;
Gtk.CheckMenuItem always_on_top;
Gtk.CheckMenuItem on_visible_workspace;
Gtk.MenuItem move_left;
Gtk.MenuItem move_right;
Gtk.MenuItem close;
Gtk.MenuItem screenshot;
private Gtk.Menu? window_menu = null;
private Gtk.MenuItem hide;
private Gtk.MenuItem maximize;
private Gtk.MenuItem move;
private Gtk.MenuItem resize;
private Gtk.CheckMenuItem always_on_top;
private Gtk.CheckMenuItem on_visible_workspace;
private Gtk.MenuItem move_left;
private Gtk.MenuItem move_right;
private Gtk.MenuItem close;
private Gtk.MenuItem screenshot;

// Desktop Menu
Gtk.Menu? desktop_menu = null;
private Gtk.Menu? desktop_menu = null;

WMDBus? wm_proxy = null;
private WMDBus? wm_proxy = null;

ulong always_on_top_sid = 0U;
ulong on_visible_workspace_sid = 0U;
private ulong always_on_top_sid = 0U;
private ulong on_visible_workspace_sid = 0U;

private static GLib.Settings keybind_settings;
private static GLib.Settings gala_keybind_settings;
Expand All @@ -75,33 +75,33 @@ namespace Gala {
Bus.watch_name (BusType.SESSION, DBUS_NAME, BusNameWatcherFlags.NONE, gala_appeared, lost_gala);
}

void on_gala_get (GLib.Object? o, GLib.AsyncResult? res) {
private void on_gala_get (GLib.Object? o, GLib.AsyncResult? res) {
try {
wm_proxy = Bus.get_proxy.end (res);
} catch (Error e) {
warning ("Failed to get Gala proxy: %s", e.message);
}
}

void lost_gala () {
private void lost_gala () {
wm_proxy = null;
}

void gala_appeared () {
private void gala_appeared () {
if (wm_proxy == null) {
Bus.get_proxy.begin<WMDBus> (BusType.SESSION, DBUS_NAME, DBUS_OBJECT_PATH, 0, null, on_gala_get);
}
}

void on_bus_acquired (DBusConnection conn) {
private void on_bus_acquired (DBusConnection conn) {
try {
conn.register_object (DAEMON_DBUS_OBJECT_PATH, this);
} catch (Error e) {
stderr.printf ("Error registering MenuDaemon: %s\n", e.message);
}
}

void perform_action (Gala.ActionType type) {
private void perform_action (Gala.ActionType type) {
if (wm_proxy != null) {
try {
wm_proxy.perform_action (type);
Expand Down
38 changes: 18 additions & 20 deletions lib/DragDropAction.vala
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ namespace Gala {
}

public class DragDropAction : Clutter.Action {
static Gee.HashMap<string,Gee.LinkedList<Actor>>? sources = null;
static Gee.HashMap<string,Gee.LinkedList<Actor>>? destinations = null;
private static Gee.HashMap<string,Gee.LinkedList<Actor>>? sources = null;
private static Gee.HashMap<string,Gee.LinkedList<Actor>>? destinations = null;

/**
* A drag has been started. You have to connect to this signal and
Expand Down Expand Up @@ -99,14 +99,14 @@ namespace Gala {

public Actor? hovered { private get; set; default = null; }

bool clicked = false;
float last_x;
float last_y;
private bool clicked = false;
private float last_x;
private float last_y;

Grab? grab = null;
static unowned Actor? grabbed_actor = null;
InputDevice? grabbed_device = null;
ulong on_event_id = 0;
private Grab? grab = null;
private static unowned Actor? grabbed_actor = null;
private InputDevice? grabbed_device = null;
private ulong on_event_id = 0;

/**
* Create a new DragDropAction
Expand Down Expand Up @@ -144,7 +144,7 @@ namespace Gala {
base.set_actor (new_actor);
}

void release_actor (Actor actor) {
private void release_actor (Actor actor) {
if (DragDropActionType.SOURCE in drag_type) {

var source_list = sources.@get (drag_id);
Expand All @@ -157,7 +157,7 @@ namespace Gala {
}
}

void connect_actor (Actor actor) {
private void connect_actor (Actor actor) {
if (DragDropActionType.SOURCE in drag_type) {

var source_list = sources.@get (drag_id);
Expand All @@ -180,7 +180,7 @@ namespace Gala {
}
}

void emit_crossed (Actor destination, bool is_hovered) {
private void emit_crossed (Actor destination, bool is_hovered) {
get_drag_drop_action (destination).crossed (actor, is_hovered);
destination_crossed (destination, is_hovered);
}
Expand Down Expand Up @@ -245,7 +245,7 @@ namespace Gala {
return base.handle_event (event);
}

void grab_actor (Actor actor, InputDevice device) {
private void grab_actor (Actor actor, InputDevice device) {
if (grabbed_actor != null) {
critical ("Tried to grab an actor with a grab already in progress");
}
Expand All @@ -256,7 +256,7 @@ namespace Gala {
on_event_id = actor.event.connect (on_event);
}

void ungrab_actor () {
private void ungrab_actor () {
if (on_event_id == 0 || grabbed_actor == null) {
return;
}
Expand All @@ -272,7 +272,7 @@ namespace Gala {
grabbed_actor = null;
}

bool on_event (Clutter.Event event) {
private bool on_event (Clutter.Event event) {
var device = event.get_device ();

if (grabbed_device != null &&
Expand Down Expand Up @@ -307,8 +307,6 @@ namespace Gala {
ungrab_actor ();
grab_actor (handle, event.get_device ());

handle.reactive = false;

var source_list = sources.@get (drag_id);
if (source_list != null) {
var dest_list = destinations[drag_id];
Expand Down Expand Up @@ -378,7 +376,7 @@ namespace Gala {
*
* @return the DragDropAction instance on this actor or NULL
*/
DragDropAction? get_drag_drop_action (Actor actor) {
private DragDropAction? get_drag_drop_action (Actor actor) {
DragDropAction? drop_action = null;

foreach (var action in actor.get_actions ()) {
Expand Down Expand Up @@ -422,7 +420,7 @@ namespace Gala {
}
}

void finish () {
private void finish () {
// make sure they reset the style or whatever they changed when hovered
emit_crossed (hovered, false);

Expand All @@ -431,7 +429,7 @@ namespace Gala {
drag_end (hovered);
}

void cleanup () {
private void cleanup () {
var source_list = sources.@get (drag_id);
if (source_list != null) {
foreach (var actor in source_list) {
Expand Down
14 changes: 7 additions & 7 deletions lib/Drawing/BufferSurface.vala
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,8 @@ namespace Gala.Drawing {
context.set_operator (Operator.OVER);
}

const int ALPHA_PRECISION = 16;
const int PARAM_PRECISION = 7;
private const int ALPHA_PRECISION = 16;
private const int PARAM_PRECISION = 7;

/**
* Performs a blur operation on the internal {@link Cairo.Surface}, using an
Expand Down Expand Up @@ -401,7 +401,7 @@ namespace Gala.Drawing {
context.set_operator (Operator.OVER);
}

void exponential_blur_columns (
private void exponential_blur_columns (
uint8* pixels,
int width,
int height,
Expand Down Expand Up @@ -432,7 +432,7 @@ namespace Gala.Drawing {
}
}

void exponential_blur_rows (
private void exponential_blur_rows (
uint8* pixels,
int width,
int height,
Expand Down Expand Up @@ -614,7 +614,7 @@ namespace Gala.Drawing {
context.set_operator (Operator.OVER);
}

void gaussian_blur_horizontal (
private void gaussian_blur_horizontal (
double* src,
double* dest,
double* kernel,
Expand Down Expand Up @@ -643,7 +643,7 @@ namespace Gala.Drawing {
}
}

void gaussian_blur_vertical (
private void gaussian_blur_vertical (
double* src,
double* dest,
double* kernel,
Expand Down Expand Up @@ -673,7 +673,7 @@ namespace Gala.Drawing {
}
}

static double[] build_gaussian_kernel (int gauss_width) requires (gauss_width % 2 == 1) {
private static double[] build_gaussian_kernel (int gauss_width) requires (gauss_width % 2 == 1) {
var kernel = new double[gauss_width];

// Maximum value of curve
Expand Down
4 changes: 2 additions & 2 deletions lib/Drawing/Color.vala
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ namespace Gala.Drawing {
return this;
}

void rgb_to_hsv (
private void rgb_to_hsv (
double r, double g, double b, out double h, out double s, out double v
) requires (r >= 0 && r <= 1) requires (g >= 0 && g <= 1) requires (b >= 0 && b <= 1) {
var min = double.min (r, double.min (g, b));
Expand Down Expand Up @@ -417,7 +417,7 @@ namespace Gala.Drawing {
}
}

void hsv_to_rgb (
private void hsv_to_rgb (
double h, double s, double v, out double r, out double g, out double b
) requires (h >= 0 && h <= 360) requires (s >= 0 && s <= 1) requires (v >= 0 && v <= 1) {
r = 0;
Expand Down
14 changes: 7 additions & 7 deletions lib/Utils.vala
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ namespace Gala {
public int scale;
}

static Gdk.Pixbuf? resize_pixbuf = null;
static Gdk.Pixbuf? close_pixbuf = null;
private static Gdk.Pixbuf? resize_pixbuf = null;
private static Gdk.Pixbuf? close_pixbuf = null;

static Gee.HashMultiMap<DesktopAppInfo, CachedIcon?> icon_cache;
static Gee.HashMap<Meta.Window, DesktopAppInfo> window_to_desktop_cache;
static Gee.ArrayList<CachedIcon?> unknown_icon_cache;
private static Gee.HashMultiMap<DesktopAppInfo, CachedIcon?> icon_cache;
private static Gee.HashMap<Meta.Window, DesktopAppInfo> window_to_desktop_cache;
private static Gee.ArrayList<CachedIcon?> unknown_icon_cache;

static AppCache app_cache;
private static AppCache app_cache;

static construct {
icon_cache = new Gee.HashMultiMap<DesktopAppInfo, CachedIcon?> ();
Expand Down Expand Up @@ -441,7 +441,7 @@ namespace Gala {
return texture;
}

static Gtk.CssProvider gala_css = null;
private static Gtk.CssProvider gala_css = null;
public static unowned Gtk.CssProvider? get_gala_css () {
if (gala_css == null) {
gala_css = new Gtk.CssProvider ();
Expand Down
4 changes: 2 additions & 2 deletions lib/WindowIcon.vala
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace Gala {
}
}

bool _destroy_on_unmanaged = false;
private bool _destroy_on_unmanaged = false;

/**
* Creates a new WindowIcon
Expand All @@ -70,7 +70,7 @@ namespace Gala {
update_texture (true);
}

void update_texture (bool initial) {
private void update_texture (bool initial) {
var pixbuf = Gala.Utils.get_icon_for_window (window, icon_size, scale);
try {
var image = new Clutter.Image ();
Expand Down
10 changes: 8 additions & 2 deletions plugins/pip/Main.vala
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class Gala.Plugins.PIP.Plugin : Gala.Plugin {
private Gala.WindowManager? wm = null;
private SelectionArea? selection_area;

static inline bool meta_rectangle_contains (Meta.Rectangle rect, int x, int y) {
private static inline bool meta_rectangle_contains (Meta.Rectangle rect, int x, int y) {
return x >= rect.x && x < rect.x + rect.width
&& y >= rect.y && y < rect.y + rect.height;
}
Expand Down Expand Up @@ -50,7 +50,7 @@ public class Gala.Plugins.PIP.Plugin : Gala.Plugin {
}

[CCode (instance_pos = -1)]
void on_initiate (Meta.Display display, Meta.Window? window, Clutter.KeyEvent event,
private void on_initiate (Meta.Display display, Meta.Window? window, Clutter.KeyEvent event,
Meta.KeyBinding binding) {
selection_area = new SelectionArea (wm);
selection_area.selected.connect (on_selection_actor_selected);
Expand Down Expand Up @@ -79,6 +79,12 @@ public class Gala.Plugins.PIP.Plugin : Gala.Plugin {
int point_x = x - (int)active.x;
int point_y = y - (int)active.y;

// Compensate for server-side window decorations
var input_rect = active.get_meta_window ().get_buffer_rect ();
var outer_rect = active.get_meta_window ().get_frame_rect ();
point_x -= outer_rect.x - input_rect.x;
point_y -= outer_rect.y - input_rect.y;

var rect = Graphene.Rect.alloc ();
rect.init (point_x, point_y, width, height);

Expand Down

0 comments on commit e7ff97d

Please sign in to comment.