mirror of
https://github.com/elementary/gala.git
synced 2024-11-25 03:06:14 +01:00
Merge branch 'master' into revert-1819-no-idea-what-im-doing
This commit is contained in:
commit
1181571c90
@ -62,3 +62,18 @@
|
||||
0 3px 14px 2px alpha(#000, 0.12),
|
||||
0 5px 5px -3px alpha(#000, 0.4);
|
||||
}
|
||||
|
||||
.workspace-switcher.decoration {
|
||||
border-radius: 6px;
|
||||
box-shadow:
|
||||
0 3px 4px alpha(#000, 0.25),
|
||||
0 3px 3px -3px alpha(#000, 0.45);
|
||||
}
|
||||
|
||||
.workspace-switcher-dnd.decoration {
|
||||
border-radius: 6px;
|
||||
box-shadow:
|
||||
0 8px 10px 1px alpha(#000, 0.14),
|
||||
0 3px 14px 2px alpha(#000, 0.12),
|
||||
0 5px 5px -3px alpha(#000, 0.4);
|
||||
}
|
||||
|
@ -198,3 +198,4 @@ aa
|
||||
ab
|
||||
gn
|
||||
an
|
||||
id_ID
|
||||
|
243
po/id_ID.po
Normal file
243
po/id_ID.po
Normal file
@ -0,0 +1,243 @@
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR The Gala Developers
|
||||
# This file is distributed under the same license as the gala package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: gala 7.1.2\n"
|
||||
"Report-Msgid-Bugs-To: https://github.com/elementary/gala/issues\n"
|
||||
"POT-Creation-Date: 2023-11-07 19:57+0000\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: Automatically generated\n"
|
||||
"Language-Team: none\n"
|
||||
"Language: id_ID\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
|
||||
#: src/Dialogs.vala:152
|
||||
#, c-format
|
||||
msgid "“%s” is not responding"
|
||||
msgstr ""
|
||||
|
||||
#: src/Dialogs.vala:154
|
||||
msgid "Application is not responding"
|
||||
msgstr ""
|
||||
|
||||
#: src/Dialogs.vala:157
|
||||
msgid ""
|
||||
"You may choose to wait a short while for the application to continue, or "
|
||||
"force it to quit entirely."
|
||||
msgstr ""
|
||||
|
||||
#: src/Dialogs.vala:158
|
||||
msgid "Force Quit"
|
||||
msgstr ""
|
||||
|
||||
#: src/Dialogs.vala:159
|
||||
msgid "Wait"
|
||||
msgstr ""
|
||||
|
||||
#: src/ScreenshotManager.vala:281
|
||||
msgid "Screenshots"
|
||||
msgstr ""
|
||||
|
||||
#: src/ScreenshotManager.vala:360
|
||||
msgid "Screenshot taken"
|
||||
msgstr ""
|
||||
|
||||
#: src/WindowManager.vala:2251
|
||||
#, c-format
|
||||
msgid "Changes will automatically revert after %i second."
|
||||
msgid_plural "Changes will automatically revert after %i seconds."
|
||||
msgstr[0] ""
|
||||
msgstr[1] ""
|
||||
|
||||
#: src/WindowManager.vala:2258
|
||||
msgid "Keep new display settings?"
|
||||
msgstr ""
|
||||
|
||||
#: src/WindowManager.vala:2262
|
||||
msgid "Keep Settings"
|
||||
msgstr ""
|
||||
|
||||
#: src/WindowManager.vala:2263
|
||||
msgid "Use Previous Settings"
|
||||
msgstr ""
|
||||
|
||||
#. / TRANSLATORS: %s represents a timestamp here
|
||||
#: src/WindowManager.vala:2305
|
||||
#, c-format
|
||||
msgid "Screenshot from %s"
|
||||
msgstr ""
|
||||
|
||||
#: daemon/MenuDaemon.vala:115
|
||||
msgid "Hide"
|
||||
msgstr ""
|
||||
|
||||
#: daemon/MenuDaemon.vala:128
|
||||
msgid "Move"
|
||||
msgstr ""
|
||||
|
||||
#: daemon/MenuDaemon.vala:136
|
||||
msgid "Resize"
|
||||
msgstr ""
|
||||
|
||||
#: daemon/MenuDaemon.vala:144
|
||||
msgid "Always on Top"
|
||||
msgstr ""
|
||||
|
||||
#: daemon/MenuDaemon.vala:152
|
||||
msgid "Always on Visible Workspace"
|
||||
msgstr ""
|
||||
|
||||
#: daemon/MenuDaemon.vala:160
|
||||
msgid "Move to Workspace Left"
|
||||
msgstr ""
|
||||
|
||||
#: daemon/MenuDaemon.vala:168
|
||||
msgid "Move to Workspace Right"
|
||||
msgstr ""
|
||||
|
||||
#: daemon/MenuDaemon.vala:176
|
||||
msgid "Take Screenshot"
|
||||
msgstr ""
|
||||
|
||||
#: daemon/MenuDaemon.vala:184
|
||||
msgid "Close"
|
||||
msgstr ""
|
||||
|
||||
#: daemon/MenuDaemon.vala:223
|
||||
msgid "Untile"
|
||||
msgstr ""
|
||||
|
||||
#: daemon/MenuDaemon.vala:223
|
||||
msgid "Unmaximize"
|
||||
msgstr ""
|
||||
|
||||
#: daemon/MenuDaemon.vala:225
|
||||
msgid "Maximize"
|
||||
msgstr ""
|
||||
|
||||
#: daemon/MenuDaemon.vala:298
|
||||
msgid "Change Wallpaper…"
|
||||
msgstr ""
|
||||
|
||||
#: daemon/MenuDaemon.vala:315
|
||||
msgid "Display Settings…"
|
||||
msgstr ""
|
||||
|
||||
#: daemon/MenuDaemon.vala:332
|
||||
msgid "System Settings…"
|
||||
msgstr ""
|
||||
|
||||
#: data/gala.metainfo.xml.in:11
|
||||
msgid "Multitasking & Window Management"
|
||||
msgstr ""
|
||||
|
||||
#: data/gala.metainfo.xml.in:12
|
||||
msgid "A window & compositing manager for Pantheon"
|
||||
msgstr ""
|
||||
|
||||
#: data/gala.metainfo.xml.in:14
|
||||
msgid ""
|
||||
"A window & compositing manager based on libmutter and designed by "
|
||||
"elementary for use with Pantheon."
|
||||
msgstr ""
|
||||
|
||||
#: data/gala.metainfo.xml.in:23
|
||||
msgid "elementary, Inc."
|
||||
msgstr ""
|
||||
|
||||
#: data/gala.metainfo.xml.in:30 data/gala.metainfo.xml.in:55
|
||||
#: data/gala.metainfo.xml.in:71 data/gala.metainfo.xml.in:86
|
||||
#: data/gala.metainfo.xml.in:98 data/gala.metainfo.xml.in:123
|
||||
msgid "Improvements:"
|
||||
msgstr ""
|
||||
|
||||
#: data/gala.metainfo.xml.in:32
|
||||
msgid ""
|
||||
"Changing the wallpaper or going to sleep respects the \"Reduce Motion\" "
|
||||
"option"
|
||||
msgstr ""
|
||||
|
||||
#: data/gala.metainfo.xml.in:33
|
||||
msgid "Use appropriate drag-and-drop pointers when moving windows"
|
||||
msgstr ""
|
||||
|
||||
#: data/gala.metainfo.xml.in:34
|
||||
msgid "Fix the issue when gestures in the multitasking view might stop working"
|
||||
msgstr ""
|
||||
|
||||
#: data/gala.metainfo.xml.in:35
|
||||
msgid "Improve dynamic workspaces behaviour with multiple monitors"
|
||||
msgstr ""
|
||||
|
||||
#: data/gala.metainfo.xml.in:36 data/gala.metainfo.xml.in:58
|
||||
#: data/gala.metainfo.xml.in:73 data/gala.metainfo.xml.in:88
|
||||
#: data/gala.metainfo.xml.in:106 data/gala.metainfo.xml.in:128
|
||||
msgid "Updated translations"
|
||||
msgstr ""
|
||||
|
||||
#: data/gala.metainfo.xml.in:57
|
||||
msgid "Improve handling of move-to-workspace shortcut"
|
||||
msgstr ""
|
||||
|
||||
#: data/gala.metainfo.xml.in:100
|
||||
msgid ""
|
||||
"Set the keyboard layout correctly at startup so that the indicator matches "
|
||||
"the selected layout"
|
||||
msgstr ""
|
||||
|
||||
#: data/gala.metainfo.xml.in:101
|
||||
msgid "Fix screenshot keyboard shortcuts while in Multitasking View"
|
||||
msgstr ""
|
||||
|
||||
#: data/gala.metainfo.xml.in:102
|
||||
msgid ""
|
||||
"Correctly set the active workspace highlight when entering Multitasking View "
|
||||
"and animate 1:1 with multitouch gestures"
|
||||
msgstr ""
|
||||
|
||||
#: data/gala.metainfo.xml.in:103
|
||||
msgid "Update panel color after dimming the wallpaper"
|
||||
msgstr ""
|
||||
|
||||
#: data/gala.metainfo.xml.in:104
|
||||
msgid "Scale rounded corners per-display"
|
||||
msgstr ""
|
||||
|
||||
#: data/gala.metainfo.xml.in:105
|
||||
msgid "Support fractional scaling"
|
||||
msgstr ""
|
||||
|
||||
#: data/gala.metainfo.xml.in:125
|
||||
msgid "Performance improvements"
|
||||
msgstr ""
|
||||
|
||||
#: data/gala.metainfo.xml.in:126
|
||||
msgid "Remove texture from Multitasking View"
|
||||
msgstr ""
|
||||
|
||||
#: data/gala.metainfo.xml.in:127
|
||||
msgid "Avoid accidentally selecting windows in the window switcher"
|
||||
msgstr ""
|
||||
|
||||
#: data/gala-multitaskingview.desktop.in:4
|
||||
#: data/gala-multitaskingview.desktop.in:6
|
||||
msgid "Multitasking View"
|
||||
msgstr ""
|
||||
|
||||
#: data/gala-multitaskingview.desktop.in:5
|
||||
msgid "View all open windows and workspaces"
|
||||
msgstr ""
|
||||
|
||||
#: data/gala-other.desktop.in:4
|
||||
msgid "Other"
|
||||
msgstr ""
|
||||
|
||||
#: data/gala-other.desktop.in:5
|
||||
msgid "Fallback desktop file for notifications from outdated applications."
|
||||
msgstr ""
|
292
src/Background/BlurEffect.vala
Normal file
292
src/Background/BlurEffect.vala
Normal file
@ -0,0 +1,292 @@
|
||||
/*
|
||||
* Copyright 2023 elementary, Inc. <https://elementary.io>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
public class Gala.BlurEffect : Clutter.Effect {
|
||||
private const float MIN_DOWNSCALE_SIZE = 256.0f;
|
||||
private const float MAX_RADIUS = 12.0f;
|
||||
|
||||
public new Clutter.Actor actor { get; construct; }
|
||||
public float radius { get; construct; }
|
||||
|
||||
private bool actor_painted = false;
|
||||
private bool blur_applied = false;
|
||||
private int texture_width;
|
||||
private int texture_height;
|
||||
private float downscale_factor;
|
||||
|
||||
private Cogl.Framebuffer actor_framebuffer;
|
||||
private Cogl.Pipeline actor_pipeline;
|
||||
private Cogl.Texture actor_texture;
|
||||
|
||||
private Cogl.Framebuffer framebuffer;
|
||||
private Cogl.Pipeline pipeline;
|
||||
private Cogl.Texture texture;
|
||||
|
||||
public BlurEffect (Clutter.Actor actor, float radius) {
|
||||
Object (actor: actor, radius: radius);
|
||||
}
|
||||
|
||||
construct {
|
||||
unowned var ctx = Clutter.get_default_backend ().get_cogl_context ();
|
||||
|
||||
actor_pipeline = new Cogl.Pipeline (ctx);
|
||||
actor_pipeline.set_layer_null_texture (0);
|
||||
actor_pipeline.set_layer_filters (0, Cogl.PipelineFilter.LINEAR, Cogl.PipelineFilter.LINEAR);
|
||||
actor_pipeline.set_layer_wrap_mode (0, Cogl.PipelineWrapMode.CLAMP_TO_EDGE);
|
||||
|
||||
pipeline = new Cogl.Pipeline (ctx);
|
||||
pipeline.set_layer_null_texture (0);
|
||||
pipeline.set_layer_filters (0, Cogl.PipelineFilter.LINEAR, Cogl.PipelineFilter.LINEAR);
|
||||
pipeline.set_layer_wrap_mode (0, Cogl.PipelineWrapMode.CLAMP_TO_EDGE);
|
||||
}
|
||||
|
||||
private bool needs_repaint (Clutter.EffectPaintFlags flags) {
|
||||
var actor_dirty = (flags & Clutter.EffectPaintFlags.ACTOR_DIRTY) != 0;
|
||||
|
||||
return actor_dirty || !blur_applied || !actor_painted;
|
||||
}
|
||||
|
||||
private Clutter.ActorBox update_actor_box (Clutter.PaintContext paint_context) {
|
||||
var actor_allocation_box = actor.get_allocation_box ();
|
||||
Clutter.ActorBox.clamp_to_pixel (ref actor_allocation_box);
|
||||
|
||||
return actor_allocation_box;
|
||||
}
|
||||
|
||||
private float calculate_downscale_factor (float width, float height, float radius) {
|
||||
float downscale_factor = 1.0f;
|
||||
float scaled_width = width;
|
||||
float scaled_height = height;
|
||||
float scaled_radius = radius;
|
||||
|
||||
/* This is the algorithm used by Firefox; keep downscaling until either the
|
||||
* blur radius is lower than the threshold, or the downscaled texture is too
|
||||
* small.
|
||||
*/
|
||||
while (
|
||||
scaled_radius > MAX_RADIUS &&
|
||||
scaled_width > MIN_DOWNSCALE_SIZE &&
|
||||
scaled_height > MIN_DOWNSCALE_SIZE
|
||||
) {
|
||||
downscale_factor *= 2.0f;
|
||||
|
||||
scaled_width = width / downscale_factor;
|
||||
scaled_height = height / downscale_factor;
|
||||
scaled_radius = radius / downscale_factor;
|
||||
}
|
||||
|
||||
return downscale_factor;
|
||||
}
|
||||
|
||||
private void setup_projection_matrix (Cogl.Framebuffer framebuffer, float width, float height) {
|
||||
Graphene.Matrix projection = {};
|
||||
projection.init_translate ({ -width / 2.0f, -height / 2.0f, 0.0f });
|
||||
projection.scale (2.0f / width, -2.0f / height, 1.0f);
|
||||
|
||||
framebuffer.set_projection_matrix (projection);
|
||||
}
|
||||
|
||||
private bool update_general_fbo (int width, int height, float downscale_factor) {
|
||||
if (
|
||||
texture_width == width &&
|
||||
texture_height == height &&
|
||||
this.downscale_factor == downscale_factor &&
|
||||
framebuffer != null
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
unowned var ctx = Clutter.get_default_backend ().get_cogl_context ();
|
||||
|
||||
framebuffer = null;
|
||||
texture = null;
|
||||
|
||||
var new_width = (int) Math.floorf (width / downscale_factor);
|
||||
var new_height = (int) Math.floorf (height / downscale_factor);
|
||||
|
||||
var surface = new Cairo.ImageSurface (Cairo.Format.ARGB32, new_width, new_height);
|
||||
|
||||
try {
|
||||
texture = new Cogl.Texture2D.from_data (ctx, new_width, new_height, Cogl.PixelFormat.BGRA_8888_PRE, surface.get_stride (), surface.get_data ());
|
||||
} catch (GLib.Error e) {
|
||||
warning (e.message);
|
||||
return false;
|
||||
}
|
||||
|
||||
pipeline.set_layer_texture (0, texture);
|
||||
|
||||
framebuffer = new Cogl.Offscreen.with_texture (texture);
|
||||
|
||||
setup_projection_matrix (framebuffer, new_width, new_height);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool update_actor_fbo (int width, int height, float downscale_factor) {
|
||||
if (
|
||||
texture_width == width &&
|
||||
texture_height == height &&
|
||||
this.downscale_factor == downscale_factor &&
|
||||
actor_framebuffer != null
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
actor_painted = false;
|
||||
|
||||
unowned var ctx = Clutter.get_default_backend ().get_cogl_context ();
|
||||
|
||||
actor_framebuffer = null;
|
||||
actor_texture = null;
|
||||
|
||||
var new_width = (int) Math.floorf (width / downscale_factor);
|
||||
var new_height = (int) Math.floorf (height / downscale_factor);
|
||||
|
||||
var surface = new Cairo.ImageSurface (Cairo.Format.ARGB32, new_width, new_height);
|
||||
|
||||
try {
|
||||
actor_texture = new Cogl.Texture2D.from_data (ctx, new_width, new_height, Cogl.PixelFormat.BGRA_8888_PRE, surface.get_stride (), surface.get_data ());
|
||||
} catch (GLib.Error e) {
|
||||
warning (e.message);
|
||||
return false;
|
||||
}
|
||||
|
||||
actor_pipeline.set_layer_texture (0, actor_texture);
|
||||
|
||||
actor_framebuffer = (Cogl.Framebuffer) new Cogl.Offscreen.with_texture (actor_texture);
|
||||
|
||||
setup_projection_matrix (actor_framebuffer, new_width, new_height);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool update_framebuffers (Clutter.PaintContext paint_context, Clutter.ActorBox actor_box) {
|
||||
var width = (int) actor_box.get_width ();
|
||||
var height = (int) actor_box.get_height ();
|
||||
|
||||
var downscale_factor = calculate_downscale_factor (width, height, radius);
|
||||
|
||||
var updated = update_actor_fbo (width, height, downscale_factor) && update_general_fbo (width, height, downscale_factor);
|
||||
|
||||
texture_width = width;
|
||||
texture_height = height;
|
||||
this.downscale_factor = downscale_factor;
|
||||
|
||||
return updated;
|
||||
}
|
||||
|
||||
private Clutter.PaintNode create_blur_nodes (Clutter.PaintNode node) {
|
||||
float width, height;
|
||||
actor.get_size (out width, out height);
|
||||
|
||||
var general_node = new Clutter.LayerNode.to_framebuffer (framebuffer, pipeline);
|
||||
node.add_child (general_node);
|
||||
general_node.add_rectangle ({ 0.0f, 0.0f, width, height });
|
||||
|
||||
var blur_node = new Clutter.BlurNode (
|
||||
(uint) (texture_width / downscale_factor),
|
||||
(uint) (texture_height / downscale_factor),
|
||||
radius / downscale_factor
|
||||
);
|
||||
general_node.add_child (blur_node);
|
||||
blur_node.add_rectangle ({
|
||||
0.0f,
|
||||
0.0f,
|
||||
texture.get_width (),
|
||||
texture.get_height ()
|
||||
});
|
||||
|
||||
blur_applied = true;
|
||||
|
||||
return blur_node;
|
||||
}
|
||||
|
||||
private void paint_actor_offscreen (Clutter.PaintNode node, Clutter.EffectPaintFlags flags) {
|
||||
var actor_dirty = (flags & Clutter.EffectPaintFlags.ACTOR_DIRTY) != 0;
|
||||
|
||||
/* The actor offscreen framebuffer is updated already */
|
||||
if (actor_dirty || !actor_painted) {
|
||||
/* Layer node */
|
||||
var layer_node = new Clutter.LayerNode.to_framebuffer (actor_framebuffer, actor_pipeline);
|
||||
node.add_child (layer_node);
|
||||
layer_node.add_rectangle ({
|
||||
0.0f,
|
||||
0.0f,
|
||||
texture_width / downscale_factor,
|
||||
texture_height / downscale_factor
|
||||
});
|
||||
|
||||
/* Transform node */
|
||||
Graphene.Matrix transform = {};
|
||||
transform.init_scale (
|
||||
1.0f / downscale_factor,
|
||||
1.0f / downscale_factor,
|
||||
1.0f
|
||||
);
|
||||
var transform_node = new Clutter.TransformNode (transform);
|
||||
layer_node.add_child (transform_node);
|
||||
|
||||
/* Actor node */
|
||||
add_actor_node (transform_node);
|
||||
|
||||
actor_painted = true;
|
||||
} else {
|
||||
Clutter.PaintNode pipeline_node = null;
|
||||
|
||||
pipeline_node = new Clutter.PipelineNode (actor_pipeline);
|
||||
node.add_child (pipeline_node);
|
||||
pipeline_node.add_rectangle ({
|
||||
0.0f,
|
||||
0.0f,
|
||||
texture_width / downscale_factor,
|
||||
texture_height / downscale_factor,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void add_actor_node (Clutter.PaintNode node) {
|
||||
var actor_node = new Clutter.ActorNode (actor, 255);
|
||||
node.add_child (actor_node);
|
||||
}
|
||||
|
||||
private void add_blurred_pipeline (Clutter.PaintNode node) {
|
||||
Clutter.PaintNode pipeline_node = null;
|
||||
float width, height;
|
||||
|
||||
/* Use the untransformed actor size here, since the framebuffer itself already
|
||||
* has the actor transform matrix applied.
|
||||
*/
|
||||
actor.get_size (out width, out height);
|
||||
|
||||
pipeline_node = new Clutter.PipelineNode (pipeline);
|
||||
node.add_child (pipeline_node);
|
||||
|
||||
pipeline_node.add_rectangle ({ 0.0f, 0.0f, width, height });
|
||||
}
|
||||
|
||||
public override void paint_node (Clutter.PaintNode node, Clutter.PaintContext paint_context, Clutter.EffectPaintFlags flags) {
|
||||
if (radius <= 0) {
|
||||
// fallback to drawing actor
|
||||
add_actor_node (node);
|
||||
return;
|
||||
}
|
||||
|
||||
if (needs_repaint (flags)) {
|
||||
var actor_box = update_actor_box (paint_context);
|
||||
|
||||
if (!update_framebuffers (paint_context, actor_box)) {
|
||||
// fallback to drawing actor
|
||||
add_actor_node (node);
|
||||
return;
|
||||
}
|
||||
|
||||
var blur_node = create_blur_nodes (node);
|
||||
paint_actor_offscreen (blur_node, flags);
|
||||
} else {
|
||||
/* Use the cached pipeline if no repaint is needed */
|
||||
add_blurred_pipeline (node);
|
||||
}
|
||||
}
|
||||
}
|
@ -13,8 +13,8 @@ namespace Gala {
|
||||
public class IconGroup : Clutter.Actor {
|
||||
public const int SIZE = 64;
|
||||
|
||||
private const int PLUS_SIZE = 8;
|
||||
private const int PLUS_WIDTH = 24;
|
||||
private const int PLUS_SIZE = 6;
|
||||
private const int PLUS_WIDTH = 26;
|
||||
private const int BACKDROP_ABSOLUTE_OPACITY = 40;
|
||||
|
||||
/**
|
||||
@ -216,6 +216,7 @@ namespace Gala {
|
||||
* by relayouting in the same function, as it's only ever called when we invalidate it.
|
||||
*/
|
||||
private bool draw (Cairo.Context cr) {
|
||||
clear_effects ();
|
||||
cr.set_operator (Cairo.Operator.CLEAR);
|
||||
cr.paint ();
|
||||
cr.set_operator (Cairo.Operator.OVER);
|
||||
@ -233,43 +234,45 @@ namespace Gala {
|
||||
// more than one => we need a folder
|
||||
Drawing.Utilities.cairo_rounded_rectangle (
|
||||
cr,
|
||||
0.5 * scale_factor,
|
||||
0.5 * scale_factor,
|
||||
(int) width - InternalUtils.scale_to_int (1, scale_factor),
|
||||
(int) height - InternalUtils.scale_to_int (1, scale_factor),
|
||||
0,
|
||||
0,
|
||||
(int) width,
|
||||
(int) height,
|
||||
InternalUtils.scale_to_int (5, scale_factor)
|
||||
);
|
||||
|
||||
if (drag_action.dragging) {
|
||||
const double BG_COLOR = 53.0 / 255.0;
|
||||
cr.set_source_rgba (BG_COLOR, BG_COLOR, BG_COLOR, 0.7);
|
||||
var shadow_effect = new ShadowEffect (40) {
|
||||
scale_factor = scale_factor
|
||||
};
|
||||
|
||||
var granite_settings = Granite.Settings.get_default ();
|
||||
|
||||
if (granite_settings.prefers_color_scheme == DARK) {
|
||||
const double BG_COLOR = 35.0 / 255.0;
|
||||
if (drag_action.dragging) {
|
||||
cr.set_source_rgba (BG_COLOR, BG_COLOR, BG_COLOR, 0.8);
|
||||
} else {
|
||||
cr.set_source_rgba (BG_COLOR , BG_COLOR , BG_COLOR , 0.5);
|
||||
shadow_effect.shadow_opacity = 200;
|
||||
}
|
||||
} else {
|
||||
cr.set_source_rgba (0, 0, 0, 0.1);
|
||||
if (drag_action.dragging) {
|
||||
cr.set_source_rgba (255, 255, 255, 0.8);
|
||||
} else {
|
||||
cr.set_source_rgba (255, 255, 255, 0.3);
|
||||
shadow_effect.shadow_opacity = 100;
|
||||
}
|
||||
}
|
||||
|
||||
if (drag_action.dragging) {
|
||||
shadow_effect.css_class = "workspace-switcher-dnd";
|
||||
} else {
|
||||
shadow_effect.css_class = "workspace-switcher";
|
||||
}
|
||||
|
||||
add_effect (shadow_effect);
|
||||
cr.fill_preserve ();
|
||||
|
||||
cr.set_line_width (InternalUtils.scale_to_int (1, scale_factor));
|
||||
|
||||
var grad = new Cairo.Pattern.linear (0, 0, 0, height);
|
||||
grad.add_color_stop_rgba (0.8, 0, 0, 0, 0);
|
||||
grad.add_color_stop_rgba (1.0, 1, 1, 1, 0.1);
|
||||
|
||||
cr.set_source (grad);
|
||||
cr.stroke ();
|
||||
|
||||
Drawing.Utilities.cairo_rounded_rectangle (
|
||||
cr,
|
||||
1.5 * scale_factor,
|
||||
1.5 * scale_factor,
|
||||
(int) width - InternalUtils.scale_to_int (3, scale_factor),
|
||||
(int) height - InternalUtils.scale_to_int (3, scale_factor),
|
||||
InternalUtils.scale_to_int (5, scale_factor)
|
||||
);
|
||||
|
||||
cr.set_source_rgba (0, 0, 0, 0.3);
|
||||
cr.stroke ();
|
||||
|
||||
// it's not safe to to call meta_workspace_index() here, we may be still animating something
|
||||
// while the workspace is already gone, which would result in a crash.
|
||||
unowned Meta.WorkspaceManager manager = workspace.get_display ().get_workspace_manager ();
|
||||
@ -292,27 +295,36 @@ namespace Gala {
|
||||
var offset = scaled_size / 2 - InternalUtils.scale_to_int (PLUS_WIDTH, scale_factor) / 2;
|
||||
|
||||
buffer.context.rectangle (
|
||||
InternalUtils.scale_to_int (PLUS_WIDTH / 2, scale_factor) - InternalUtils.scale_to_int (PLUS_SIZE / 2, scale_factor) + 0.5 + offset,
|
||||
0.5 + offset,
|
||||
InternalUtils.scale_to_int (PLUS_SIZE, scale_factor) - 1,
|
||||
InternalUtils.scale_to_int (PLUS_WIDTH, scale_factor) - 1
|
||||
InternalUtils.scale_to_int (PLUS_WIDTH / 2, scale_factor) - InternalUtils.scale_to_int (PLUS_SIZE / 2, scale_factor) + offset,
|
||||
offset,
|
||||
InternalUtils.scale_to_int (PLUS_SIZE, scale_factor),
|
||||
InternalUtils.scale_to_int (PLUS_WIDTH, scale_factor)
|
||||
);
|
||||
|
||||
buffer.context.rectangle (0.5 + offset,
|
||||
InternalUtils.scale_to_int (PLUS_WIDTH / 2, scale_factor) - InternalUtils.scale_to_int (PLUS_SIZE / 2, scale_factor) + 0.5 + offset,
|
||||
InternalUtils.scale_to_int (PLUS_WIDTH, scale_factor) - 1,
|
||||
InternalUtils.scale_to_int (PLUS_SIZE, scale_factor) - 1
|
||||
buffer.context.rectangle (offset,
|
||||
InternalUtils.scale_to_int (PLUS_WIDTH / 2, scale_factor) - InternalUtils.scale_to_int (PLUS_SIZE / 2, scale_factor) + offset,
|
||||
InternalUtils.scale_to_int (PLUS_WIDTH, scale_factor),
|
||||
InternalUtils.scale_to_int (PLUS_SIZE, scale_factor)
|
||||
);
|
||||
|
||||
buffer.context.set_source_rgb (0, 0, 0);
|
||||
buffer.context.fill_preserve ();
|
||||
buffer.exponential_blur (5);
|
||||
if (granite_settings.prefers_color_scheme == DARK) {
|
||||
buffer.context.move_to (0, 1 * scale_factor);
|
||||
buffer.context.set_source_rgb (0, 0, 0);
|
||||
buffer.context.fill_preserve ();
|
||||
buffer.exponential_blur (2);
|
||||
|
||||
buffer.context.set_source_rgb (1, 1, 1);
|
||||
buffer.context.set_line_width (1);
|
||||
buffer.context.stroke_preserve ();
|
||||
buffer.context.move_to (0, 0);
|
||||
buffer.context.set_source_rgba (1, 1, 1, 0.95);
|
||||
} else {
|
||||
buffer.context.move_to (0, 1 * scale_factor);
|
||||
buffer.context.set_source_rgba (1, 1, 1, 0.4);
|
||||
buffer.context.fill_preserve ();
|
||||
buffer.exponential_blur (1);
|
||||
|
||||
buffer.context.move_to (0, 0);
|
||||
buffer.context.set_source_rgba (0, 0, 0, 0.7);
|
||||
}
|
||||
|
||||
buffer.context.set_source_rgb (0.8, 0.8, 0.8);
|
||||
buffer.context.fill ();
|
||||
|
||||
cr.set_source_surface (buffer.surface, 0, 0);
|
||||
|
@ -41,8 +41,10 @@ namespace Gala {
|
||||
private Clutter.Actor workspaces;
|
||||
private Clutter.Actor dock_clones;
|
||||
private Clutter.Actor primary_monitor_container;
|
||||
private Clutter.BrightnessContrastEffect brightness_effect;
|
||||
|
||||
private GLib.Settings gala_behavior_settings;
|
||||
private Granite.Settings granite_settings;
|
||||
|
||||
private bool switching_workspace_with_gesture = false;
|
||||
private bool switching_workspace_in_progress {
|
||||
@ -57,6 +59,7 @@ namespace Gala {
|
||||
|
||||
construct {
|
||||
gala_behavior_settings = new GLib.Settings ("org.pantheon.desktop.gala.behavior");
|
||||
granite_settings = Granite.Settings.get_default ();
|
||||
|
||||
visible = false;
|
||||
reactive = true;
|
||||
@ -80,6 +83,15 @@ namespace Gala {
|
||||
|
||||
dock_clones = new Clutter.Actor ();
|
||||
|
||||
brightness_effect = new Clutter.BrightnessContrastEffect ();
|
||||
update_brightness_effect ();
|
||||
|
||||
var blurred_bg = new BackgroundManager (wm, display.get_primary_monitor ());
|
||||
blurred_bg.add_effect (new BlurEffect (blurred_bg, 18));
|
||||
blurred_bg.add_effect (brightness_effect);
|
||||
|
||||
add_child (blurred_bg);
|
||||
|
||||
// Create a child container that will be sized to fit the primary monitor, to contain the "main"
|
||||
// multitasking view UI. The Clutter.Actor of this class has to be allowed to grow to the size of the
|
||||
// stage as it contains MonitorClones for each monitor.
|
||||
@ -137,6 +149,16 @@ namespace Gala {
|
||||
return Source.REMOVE;
|
||||
});
|
||||
});
|
||||
|
||||
granite_settings.notify["prefers-color-scheme"].connect (update_brightness_effect);
|
||||
}
|
||||
|
||||
private void update_brightness_effect () {
|
||||
if (granite_settings.prefers_color_scheme == DARK) {
|
||||
brightness_effect.set_brightness (-0.4f);
|
||||
} else {
|
||||
brightness_effect.set_brightness (0.4f);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -155,7 +155,6 @@ public class Gala.WindowSwitcher : Clutter.Actor {
|
||||
};
|
||||
|
||||
container.button_release_event.connect (container_mouse_release);
|
||||
container.motion_event.connect (container_motion_event);
|
||||
|
||||
var caption_color = "#2e2e31";
|
||||
|
||||
@ -292,7 +291,7 @@ public class Gala.WindowSwitcher : Clutter.Actor {
|
||||
current_icon = icon;
|
||||
}
|
||||
|
||||
container.add_child (icon);
|
||||
add_icon (icon);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -322,13 +321,25 @@ public class Gala.WindowSwitcher : Clutter.Actor {
|
||||
current_icon = icon;
|
||||
}
|
||||
|
||||
container.add_child (icon);
|
||||
add_icon (icon);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void add_icon (WindowSwitcherIcon icon) {
|
||||
container.add_child (icon);
|
||||
|
||||
icon.motion_event.connect (() => {
|
||||
if (current_icon != icon && !handling_gesture) {
|
||||
current_icon = icon;
|
||||
}
|
||||
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
});
|
||||
}
|
||||
|
||||
private void open_switcher () {
|
||||
if (container.get_n_children () == 0) {
|
||||
Clutter.get_default_backend ().get_default_seat ().bell_notify ();
|
||||
@ -484,34 +495,6 @@ public class Gala.WindowSwitcher : Clutter.Actor {
|
||||
}
|
||||
}
|
||||
|
||||
#if HAS_MUTTER45
|
||||
private bool container_motion_event (Clutter.Event event) {
|
||||
#else
|
||||
private bool container_motion_event (Clutter.MotionEvent event) {
|
||||
#endif
|
||||
if (handling_gesture) {
|
||||
return Clutter.EVENT_STOP;
|
||||
}
|
||||
|
||||
float x, y;
|
||||
event.get_coords (out x, out y);
|
||||
var actor = container.get_stage ().get_actor_at_pos (Clutter.PickMode.ALL, (int)x, (int)y);
|
||||
if (actor == null) {
|
||||
return Clutter.EVENT_STOP;
|
||||
}
|
||||
|
||||
var selected = actor as WindowSwitcherIcon;
|
||||
if (selected == null) {
|
||||
return Clutter.EVENT_STOP;
|
||||
}
|
||||
|
||||
if (current_icon != selected) {
|
||||
current_icon = selected;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#if HAS_MUTTER45
|
||||
private bool container_mouse_release (Clutter.Event event) {
|
||||
#else
|
||||
|
@ -47,6 +47,8 @@ public class Gala.WindowSwitcherIcon : Clutter.Actor {
|
||||
canvas.draw.connect (draw_background);
|
||||
set_content (canvas);
|
||||
|
||||
reactive = true;
|
||||
|
||||
this.scale_factor = scale_factor;
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@ gala_bin_sources = files(
|
||||
'Background/BackgroundContainer.vala',
|
||||
'Background/BackgroundManager.vala',
|
||||
'Background/BackgroundSource.vala',
|
||||
'Background/BlurEffect.vala',
|
||||
'Background/SystemBackground.vala',
|
||||
'ColorFilters/ColorblindnessCorrectionEffect.vala',
|
||||
'ColorFilters/FilterManager.vala',
|
||||
|
Loading…
Reference in New Issue
Block a user