improvements for multimonitor handling, cleanup previous commit

This commit is contained in:
Tom Beckmann 2014-06-17 17:19:42 +02:00
parent 15bc1b33ef
commit 32bb21243b
3 changed files with 24 additions and 19 deletions

View File

@ -78,22 +78,23 @@ namespace Gala
*/
public class WindowIcon : GtkClutter.Texture
{
public Meta.Window window { get; construct; }
public uint32 xid { get; construct; }
public int icon_size { get; construct; }
Bamf.Matcher matcher;
uint32 xid;
static Bamf.Matcher? matcher = null;
bool loaded = false;
public WindowIcon (Meta.Window window, int icon_size)
{
Object (window: window, icon_size: icon_size);
var xid = (uint32)window.get_xwindow ();
Object (xid: xid, icon_size: icon_size);
width = icon_size;
height = icon_size;
xid = (uint32)window.get_xwindow ();
matcher = Bamf.Matcher.get_default ();
if (matcher == null)
matcher = Bamf.Matcher.get_default ();
// 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
@ -111,8 +112,6 @@ namespace Gala
{
if (!loaded)
matcher.view_opened.disconnect (retry_load);
matcher = null;
}
void retry_load (Bamf.View view)
@ -131,7 +130,7 @@ namespace Gala
void update_texture (bool initial)
{
var pixbuf = get_icon_for_window (window, icon_size, !initial);
var pixbuf = get_icon_for_xid (xid, icon_size, !initial);
try {
set_from_pixbuf (pixbuf);
@ -144,9 +143,12 @@ namespace Gala
**/
public static Gdk.Pixbuf get_icon_for_window (Meta.Window window, int size, bool ignore_cache = false)
{
Gdk.Pixbuf? result = null;
return get_icon_for_xid ((uint32)window.get_xwindow (), size, ignore_cache);
}
var xid = (uint32)window.get_xwindow ();
public static Gdk.Pixbuf get_icon_for_xid (uint32 xid, int size, bool ignore_cache = false)
{
Gdk.Pixbuf? result = null;
var xid_key = "%u::%i".printf (xid, size);
if (!ignore_cache && (result = xid_pixbuf_cache.get (xid_key)) != null)

View File

@ -199,6 +199,8 @@ namespace Gala
var primary_monitor = screen.get_primary_monitor ();
var monitor = screen.get_monitor_geometry (primary_monitor);
set_clip (monitor.x, monitor.y, monitor.width, monitor.height);
if (opening) {
wm.begin_modal ();
wm.block_keybindings_in_modal = false;

View File

@ -2,11 +2,12 @@ using Clutter;
namespace Gala
{
class FramedBackground : BackgroundManager
class FramedBackground : Background
{
public FramedBackground (Meta.Screen screen)
{
base (screen);
base (screen, screen.get_primary_monitor (),
BackgroundSettings.get_default ().schema);
add_effect (new BackgroundShadowEffect (screen));
}
@ -41,15 +42,15 @@ namespace Gala
if (bitmap == null) {
screen = _screen;
int screen_width, screen_height;
screen.get_size (out screen_width, out screen_height);
var primary = screen.get_primary_monitor ();
var monitor_geom = screen.get_monitor_geometry (primary);
width = screen_width + SHADOW_SIZE * 2;
height = screen_height + SHADOW_SIZE * 2;
width = monitor_geom.width + SHADOW_SIZE * 2;
height = monitor_geom.height + SHADOW_SIZE * 2;
var buffer = new Granite.Drawing.BufferSurface (width, height);
buffer.context.rectangle (SHADOW_SIZE - SHADOW_OFFSET, SHADOW_SIZE - SHADOW_OFFSET,
screen_width + SHADOW_OFFSET * 2, screen_height + SHADOW_OFFSET * 2);
monitor_geom.width + SHADOW_OFFSET * 2, monitor_geom.height + SHADOW_OFFSET * 2);
buffer.context.set_source_rgba (0, 0, 0, 0.5);
buffer.context.fill ();
@ -86,7 +87,7 @@ namespace Gala
public WindowManager wm { get; construct; }
public Meta.Workspace workspace { get; construct set; }
public BackgroundManager background { get; private set; }
public Background background { get; private set; }
public IconGroup icon_group { get; private set; }
public TiledWorkspaceContainer window_container { get; private set; }