mirror of
https://github.com/elementary/gala.git
synced 2024-11-24 04:21:04 +03:00
Some minor clean up
This commit is contained in:
parent
3cb9dc60b2
commit
8e24266c28
@ -78,24 +78,29 @@ namespace Gala
|
||||
*/
|
||||
public class WindowIcon : GtkClutter.Texture
|
||||
{
|
||||
public uint32 xid { get; construct; }
|
||||
public int icon_size { get; construct; }
|
||||
public Meta.Window window { get; construct; }
|
||||
static Bamf.Matcher matcher;
|
||||
|
||||
static Bamf.Matcher? matcher = null;
|
||||
static construct
|
||||
{
|
||||
matcher = Bamf.Matcher.get_default ();
|
||||
}
|
||||
|
||||
public Meta.Window window { get; construct; }
|
||||
public int icon_size { get; construct; }
|
||||
|
||||
bool loaded = false;
|
||||
uint32 xid;
|
||||
|
||||
public WindowIcon (Meta.Window window, int icon_size)
|
||||
{
|
||||
var xid = (uint32)window.get_xwindow ();
|
||||
Object (window: window, xid: xid, icon_size: icon_size);
|
||||
Object (window: window, icon_size: icon_size);
|
||||
}
|
||||
|
||||
construct
|
||||
{
|
||||
width = icon_size;
|
||||
height = icon_size;
|
||||
|
||||
if (matcher == null)
|
||||
matcher = Bamf.Matcher.get_default ();
|
||||
xid = (uint32) window.get_xwindow ();
|
||||
|
||||
// new windows often reach mutter earlier than bamf, that's why
|
||||
// we have to wait until the next window opens and hope that it's
|
||||
|
@ -17,8 +17,6 @@
|
||||
|
||||
using Meta;
|
||||
|
||||
using Gala;
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
public class InternalUtils
|
||||
@ -36,11 +34,19 @@ namespace Gala
|
||||
{
|
||||
var actor = (WindowActor) window.get_compositor_private ();
|
||||
Object (window: window, source: actor);
|
||||
}
|
||||
|
||||
construct
|
||||
{
|
||||
if (source != null)
|
||||
window.unmanaged.connect (reset_source);
|
||||
}
|
||||
|
||||
~SafeWindowClone ()
|
||||
{
|
||||
window.unmanaged.disconnect (reset_source);
|
||||
}
|
||||
|
||||
void reset_source ()
|
||||
{
|
||||
// actually destroying the clone will be handled somewhere else, we just need
|
||||
@ -48,11 +54,6 @@ namespace Gala
|
||||
// has been destroyed
|
||||
source = null;
|
||||
}
|
||||
|
||||
~SafeWindowClone ()
|
||||
{
|
||||
window.unmanaged.disconnect (reset_source);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool workspaces_only_on_primary ()
|
||||
@ -182,9 +183,9 @@ namespace Gala
|
||||
**/
|
||||
|
||||
// constants, mainly for natural expo
|
||||
static const int GAPS = 10;
|
||||
static const int MAX_TRANSLATIONS = 100000;
|
||||
static const int ACCURACY = 20;
|
||||
const int GAPS = 10;
|
||||
const int MAX_TRANSLATIONS = 100000;
|
||||
const int ACCURACY = 20;
|
||||
|
||||
// some math utilities
|
||||
static int squared_distance (Gdk.Point a, Gdk.Point b)
|
||||
@ -345,7 +346,8 @@ namespace Gala
|
||||
return result;
|
||||
}
|
||||
|
||||
/*public List<Meta.Rectangle?> natural_placement (Meta.Rectangle area, List<Meta.Rectangle?> windows)
|
||||
/* TODO needs porting
|
||||
public List<Meta.Rectangle?> natural_placement (Meta.Rectangle area, List<Meta.Rectangle?> windows)
|
||||
{
|
||||
Meta.Rectangle bounds = {area.x, area.y, area.width, area.height};
|
||||
|
||||
|
@ -36,6 +36,11 @@ namespace Gala
|
||||
// so we keep a cache to avoid creating the same texture all over again.
|
||||
static Gee.HashMap<string,Shadow> shadow_cache;
|
||||
|
||||
static construct
|
||||
{
|
||||
shadow_cache = new Gee.HashMap<string,Shadow> ();
|
||||
}
|
||||
|
||||
public int shadow_size { get; construct; }
|
||||
public int shadow_spread { get; construct; }
|
||||
|
||||
@ -54,24 +59,20 @@ namespace Gala
|
||||
update_size (actor_width, actor_height);
|
||||
}
|
||||
|
||||
public void update_size (int actor_width, int actor_height)
|
||||
{
|
||||
var shadow = get_shadow (actor_width, actor_height, shadow_size, shadow_spread);
|
||||
material.set_layer (0, shadow);
|
||||
}
|
||||
|
||||
~ShadowEffect ()
|
||||
{
|
||||
if (current_key != null)
|
||||
decrement_shadow_users (current_key);
|
||||
}
|
||||
|
||||
Cogl.Texture get_shadow (int actor_width, int actor_height, int shadow_size, int shadow_spread)
|
||||
public void update_size (int actor_width, int actor_height)
|
||||
{
|
||||
if (shadow_cache == null) {
|
||||
shadow_cache = new Gee.HashMap<string,Shadow> ();
|
||||
var shadow = get_shadow (actor_width, actor_height, shadow_size, shadow_spread);
|
||||
material.set_layer (0, shadow);
|
||||
}
|
||||
|
||||
Cogl.Texture get_shadow (int actor_width, int actor_height, int shadow_size, int shadow_spread)
|
||||
{
|
||||
if (current_key != null) {
|
||||
decrement_shadow_users (current_key);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user