Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Install Dependencies
run: |
apt update
apt install -y gettext gsettings-desktop-schemas-dev libatk-bridge2.0-dev libclutter-1.0-dev libgee-0.8-dev libglib2.0-dev libgnome-desktop-3-dev libgranite-dev libgtk-3-dev ${{ matrix.mutter_pkg }} libsqlite3-dev meson valac valadoc
apt install -y gettext gsettings-desktop-schemas-dev libatk-bridge2.0-dev libclutter-1.0-dev libgee-0.8-dev libglib2.0-dev libgnome-desktop-4-dev libgnome-bg-4-dev libgranite-dev libgtk-3-dev ${{ matrix.mutter_pkg }} libsqlite3-dev meson valac valadoc
- name: Build
env:
DESTDIR: out
Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:
run: |
zypper addrepo https://download.opensuse.org/repositories/X11:Pantheon/15.6/X11:Pantheon.repo
zypper --gpg-auto-import-keys refresh
zypper --non-interactive install tar git desktop-file-utils gsettings-desktop-schemas-devel libatk-1_0-0 clutter-devel libgee-devel glib2-devel libgnome-desktop-3-devel granite6-devel granite-devel gtk3-devel gtk4-devel libhandy-devel mutter-devel sqlite3-devel meson vala valadoc gcc
zypper --non-interactive install tar git desktop-file-utils gsettings-desktop-schemas-devel libatk-1_0-0 clutter-devel libgee-devel glib2-devel libgnome-desktop-4-devel granite6-devel granite-devel gtk3-devel gtk4-devel libhandy-devel mutter-devel sqlite3-devel meson vala valadoc gcc
- uses: actions/checkout@v5
- name: Build
env:
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ You'll need the following dependencies:
* libclutter-1.0-dev (>= 1.12.0)
* libgee-0.8-dev
* libglib2.0-dev (>= 2.74)
* libgnome-desktop-3-dev
* libgnome-desktop-4-dev
* libgnome-bg-4-dev
* libgranite-dev (>= 5.4.0)
* libgtk-3-dev (>= 3.10.0)
* libgranite-7-dev
* libgtk-3-dev
* libgtk-4-dev
* libmutter-10-dev (>= 42.0) | libmutter-dev (>= 3.18.3)
* meson (>= 0.59.0)
* valac (>= 0.46.0)
Expand Down
7 changes: 3 additions & 4 deletions docs/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ basic_command = [
'--package-name','gala',
'--package-version', meson.project_version(),
mutter_packages_command,
'--pkg', 'gtk+-3.0',
'--pkg', 'gtk4',
'--pkg', 'gee-0.8',
'--pkg', 'gio-unix-2.0',
'--pkg', 'gmodule-2.0',
Expand Down Expand Up @@ -41,10 +41,9 @@ all_doc_target = custom_target(
'--internal',
'--pkg', 'sqlite3',
'--pkg', 'atk-bridge-2.0',
'--pkg', 'gnome-desktop-3.0',
'--pkg', 'gnome-bg-4',
'--pkg', 'gnome-desktop-4',
'--pkg', 'libsystemd',
'--pkg', 'gnome-desktop-3.0',
'--pkg', 'gmodule-2.0',
'--pkg', 'wayland-server',
'--pkg', 'pantheon-desktop-shell',
'--vapidir=' + join_paths(meson.global_source_root(), 'protocol'),
Expand Down
6 changes: 3 additions & 3 deletions lib/Drawing/Color.vala
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ namespace Gala.Drawing {
public class Color : GLib.Object {
public const Gdk.RGBA LIGHT_BACKGROUND = { (250f / 255f), (250f / 255f), (250f / 255f), 1};
public const Gdk.RGBA DARK_BACKGROUND = { (51 / 255f), (51 / 255f), (51 / 255f), 1};
public const Gdk.RGBA LIGHT_BORDER = { 0, 0, 0, 0.2};
public const Gdk.RGBA DARK_BORDER = { 0, 0, 0, 0.75};
public const Gdk.RGBA LIGHT_BORDER = { 0, 0, 0, 0.2f};
public const Gdk.RGBA DARK_BORDER = { 0, 0, 0, 0.75f};
public const Gdk.RGBA LIGHT_HIGHLIGHT = { 255, 255, 255, 1};
public const Gdk.RGBA DARK_HIGHLIGHT = { 255, 255, 255, 0.05};
public const Gdk.RGBA DARK_HIGHLIGHT = { 255, 255, 255, 0.05f};
public const Gdk.RGBA TOOLTIP_BACKGROUND = { 0, 0, 0, 1};
public const Gdk.RGBA TOOLTIP_TEXT_COLOR = { 1, 1, 1, 1};

Expand Down
8 changes: 4 additions & 4 deletions lib/Drawing/StyleManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class Gala.Drawing.StyleManager : Object {
private const string FDO_ACCOUNTS_NAME = "org.freedesktop.Accounts";
private const string FDO_ACCOUNTS_PATH = "/org/freedesktop/Accounts";

private const double ACCENT_COLOR_ALPHA = 0.25;
private const float ACCENT_COLOR_ALPHA = 0.25f;
private const Gdk.RGBA DEFAULT_ACCENT_COLOR = { 0, 0, 0, ACCENT_COLOR_ALPHA };

private static GLib.Once<StyleManager> instance;
Expand Down Expand Up @@ -94,9 +94,9 @@ public class Gala.Drawing.StyleManager : Object {
private void update_color (int color) {
var rgb = get_color (color);

double r = ((rgb >> 16) & 255) / 255.0;
double g = ((rgb >> 8) & 255) / 255.0;
double b = (rgb & 255) / 255.0;
var r = ((rgb >> 16) & 255) / 255.0f;
var g = ((rgb >> 8) & 255) / 255.0f;
var b = (rgb & 255) / 255.0f;

theme_accent_color = {
r,
Expand Down
33 changes: 25 additions & 8 deletions lib/Utils.vala
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ namespace Gala {
private static Gtk.IconTheme icon_theme;

static construct {
icon_theme = new Gtk.IconTheme ();
icon_theme.set_custom_theme ("elementary");
icon_theme = new Gtk.IconTheme () {
theme_name = "elementary"
};

icon_cache = new Gee.HashMultiMap<DesktopAppInfo, CachedIcon?> ();
window_to_desktop_cache = new Gee.HashMap<Meta.Window, DesktopAppInfo> ();
unknown_icon_cache = new Gee.ArrayList<CachedIcon?> ();
Expand Down Expand Up @@ -159,9 +161,19 @@ namespace Gala {

// Construct a new "application-default-icon" and store it in the cache
try {
var icon = icon_theme.load_icon_for_scale ("application-default-icon", icon_size, scale, 0);
unknown_icon_cache.add (CachedIcon () { icon = icon, icon_size = icon_size, scale = scale });
return icon;
var icon_paintable = icon_theme.lookup_icon (
"application-default-icon",
null,
icon_size,
scale,
Gtk.TextDirection.NONE,
0
);

var pixbuf = new Gdk.Pixbuf.from_file (icon_paintable.get_file ().get_path ());

unknown_icon_cache.add (CachedIcon () { icon = pixbuf, icon_size = icon_size, scale = scale });
return pixbuf;
} catch (Error e) {
var icon = new Gdk.Pixbuf (Gdk.Colorspace.RGB, true, 8, icon_size * scale, icon_size * scale);
icon.fill (0x00000000);
Expand Down Expand Up @@ -228,14 +240,19 @@ namespace Gala {

if (icon is GLib.ThemedIcon) {
var icon_names = ((GLib.ThemedIcon)icon).get_names ();
var icon_info = icon_theme.choose_icon_for_scale (icon_names, icon_size, scale, 0);
if (icon_names.length == 0) {
return null;
}

var icon_paintable = icon_theme.lookup_icon (icon_names[0], icon_names[1:], icon_size, scale, NONE, 0);

if (icon_info == null) {
var path = icon_paintable.get_file ()?.get_path ();
if (path == null) {
return null;
}

try {
var pixbuf = icon_info.load_icon ();
var pixbuf = new Gdk.Pixbuf.from_file (path);
icon_cache.@set (desktop, CachedIcon () { icon = pixbuf, icon_size = icon_size, scale = scale });
return pixbuf;
} catch (Error e) {
Expand Down
8 changes: 5 additions & 3 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,16 @@ add_project_arguments([
glib_version_required = '2.74.0'

atk_bridge_dep = dependency('atk-bridge-2.0')
gdk_pixbuf_def = dependency ('gdk-pixbuf-2.0')
gtk4_dep = dependency('gtk4')
glib_dep = dependency('glib-2.0', version: '>= @0@'.format(glib_version_required))
gobject_dep = dependency('gobject-2.0', version: '>= @0@'.format(glib_version_required))
gio_dep = dependency('gio-2.0', version: '>= @0@'.format(glib_version_required))
gio_unix_dep = dependency('gio-unix-2.0', version: '>= @0@'.format(glib_version_required))
gmodule_dep = dependency('gmodule-2.0')
gtk3_dep = dependency('gtk+-3.0')
gee_dep = dependency('gee-0.8')
gnome_desktop_dep = dependency('gnome-desktop-3.0')
gnome_desktop_dep = dependency('gnome-desktop-4')
gnome_bg_dep = dependency('gnome-bg-4')
m_dep = cc.find_library('m', required: false)
posix_dep = vala.find_library('posix', required: false)
sqlite3_dep = dependency('sqlite3')
Expand Down Expand Up @@ -149,7 +151,7 @@ endif
add_project_arguments(vala_flags, language: 'vala')
add_project_link_arguments(['-Wl,-rpath,@0@'.format(mutter_typelib_dir)], language: 'c')

gala_base_dep = [atk_bridge_dep, glib_dep, gobject_dep, gio_dep, gio_unix_dep, gmodule_dep, gee_dep, gtk3_dep, mutter_dep, gnome_desktop_dep, m_dep, posix_dep, sqlite3_dep, xext_dep]
gala_base_dep = [atk_bridge_dep, gdk_pixbuf_def, gtk4_dep, glib_dep, gobject_dep, gio_dep, gio_unix_dep, gmodule_dep, gee_dep, mutter_dep, gnome_desktop_dep, gnome_bg_dep, m_dep, posix_dep, sqlite3_dep, xext_dep]

if get_option('systemd')
gala_base_dep += systemd_dep
Expand Down
2 changes: 1 addition & 1 deletion src/Widgets/WindowSwitcher/WindowSwitcher.vala
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public class Gala.WindowSwitcher : CanvasActor, GestureTarget, RootTarget {
highlight_color = Drawing.Color.DARK_HIGHLIGHT;
}

background_color.alpha = 0.6;
background_color.alpha = 0.6f;

#if HAS_MUTTER47
caption.color = Cogl.Color.from_string (caption_color);
Expand Down
47 changes: 47 additions & 0 deletions vapi/gnome-bg-4.vapi
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/* gnome-bg-4.vapi generated by vapigen, do not modify. */

[CCode (cprefix = "Gnome", gir_namespace = "GnomeBG", gir_version = "4.0", lower_case_cprefix = "gnome_")]
namespace Gnome {
[CCode (cheader_filename = "gnome-bg/gnome-bg.h", type_id = "gnome_bg_get_type ()")]
public class BG : GLib.Object {
[CCode (has_construct_function = false)]
public BG ();
public bool changes_with_time ();
public Gdk.Pixbuf create_frame_thumbnail (Gnome.DesktopThumbnailFactory factory, Cairo.RectangleInt screen_area, int dest_width, int dest_height, int frame_num);
public Cairo.Surface create_surface (Gdk.Surface window, int width, int height);
public Gdk.Pixbuf create_thumbnail (Gnome.DesktopThumbnailFactory factory, Cairo.RectangleInt screen_area, int dest_width, int dest_height);
public void draw (Gdk.Pixbuf dest);
public unowned string get_filename ();
public bool get_image_size (Gnome.DesktopThumbnailFactory factory, int best_width, int best_height, out int width, out int height);
public GDesktop.BackgroundStyle get_placement ();
public void get_rgba (out GDesktop.BackgroundShading type, out Gdk.RGBA primary, out Gdk.RGBA secondary);
public bool has_multiple_sizes ();
public bool is_dark (int dest_width, int dest_height);
public void load_from_preferences (GLib.Settings settings);
public void save_to_preferences (GLib.Settings settings);
public void set_filename (string filename);
public void set_placement (GDesktop.BackgroundStyle placement);
public void set_rgba (GDesktop.BackgroundShading type, Gdk.RGBA primary, Gdk.RGBA secondary);
public signal void changed ();
public signal void transitioned ();
}
[CCode (cheader_filename = "gnome-bg/gnome-bg-slide-show.h", type_id = "gnome_bg_slide_show_get_type ()")]
public class BGSlideShow : GLib.Object {
[CCode (has_construct_function = false)]
public BGSlideShow (string filename);
public void get_current_slide (int width, int height, out double progress, out double duration, out bool is_fixed, out unowned string file1, out unowned string file2);
public bool get_has_multiple_sizes ();
public int get_num_slides ();
public bool get_slide (int frame_number, int width, int height, out double progress, out double duration, out bool is_fixed, out unowned string file1, out unowned string file2);
public double get_start_time ();
public double get_total_duration ();
public bool load () throws GLib.Error;
public void load_async (GLib.Cancellable? cancellable, GLib.AsyncReadyCallback callback);
[NoAccessorMethod]
[Version (since = "3.34")]
public GLib.File file { owned get; construct; }
public bool has_multiple_sizes { get; }
public double start_time { get; }
public double total_duration { get; }
}
}
Loading