mirror of
https://github.com/elementary/gala.git
synced 2024-12-18 06:41:36 +03:00
Moved workspaceview drawing to gtk css
This commit is contained in:
parent
fb5bf75e38
commit
85907d7fdb
@ -41,6 +41,18 @@ namespace Gala
|
|||||||
|
|
||||||
static GtkClutter.Texture? plus = null;
|
static GtkClutter.Texture? plus = null;
|
||||||
|
|
||||||
|
Gtk.StyleContext selector_style;
|
||||||
|
static const string FALLBACK_STYLE = """
|
||||||
|
.workspace-selector {
|
||||||
|
background-image: -gtk-gradient (linear,
|
||||||
|
left top, left bottom,
|
||||||
|
from(#eee),
|
||||||
|
to(#555));
|
||||||
|
border: 1px solid black;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
""";
|
||||||
|
|
||||||
internal Clone wallpaper;
|
internal Clone wallpaper;
|
||||||
Clutter.Actor windows;
|
Clutter.Actor windows;
|
||||||
internal Clutter.Actor icons;
|
internal Clutter.Actor icons;
|
||||||
@ -54,6 +66,19 @@ namespace Gala
|
|||||||
workspace = _workspace;
|
workspace = _workspace;
|
||||||
screen = workspace.get_screen ();
|
screen = workspace.get_screen ();
|
||||||
|
|
||||||
|
//setup styles
|
||||||
|
var fallback = new Gtk.CssProvider ();
|
||||||
|
try {
|
||||||
|
fallback.load_from_data (FALLBACK_STYLE, -1);
|
||||||
|
} catch (Error e) { warning (e.message); }
|
||||||
|
|
||||||
|
var e = new Gtk.EventBox ();
|
||||||
|
e.show ();
|
||||||
|
selector_style = e.get_style_context ();
|
||||||
|
selector_style.add_class ("workspace-selector");
|
||||||
|
selector_style.add_provider (fallback, Gtk.STYLE_PROVIDER_PRIORITY_FALLBACK);
|
||||||
|
|
||||||
|
|
||||||
screen.workspace_switched.connect (handle_workspace_switched);
|
screen.workspace_switched.connect (handle_workspace_switched);
|
||||||
screen.workspace_added.connect (workspace_added);
|
screen.workspace_added.connect (workspace_added);
|
||||||
|
|
||||||
@ -200,13 +225,7 @@ namespace Gala
|
|||||||
|
|
||||||
bool draw_indicator (Cairo.Context cr)
|
bool draw_indicator (Cairo.Context cr)
|
||||||
{
|
{
|
||||||
Granite.Drawing.Utilities.cairo_rounded_rectangle (cr, 0, 0, indicator.width, indicator.height, 8);
|
selector_style.render_activity (cr, 0, 0, indicator.width, indicator.height);
|
||||||
|
|
||||||
cr.set_source_rgb (0.35, 0.75, 1.0);
|
|
||||||
cr.fill_preserve ();
|
|
||||||
cr.set_line_width (1);
|
|
||||||
cr.set_source_rgba (0.0, 0.0, 0.0, 0.8);
|
|
||||||
cr.stroke ();
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,18 @@ namespace Gala
|
|||||||
|
|
||||||
bool wait_one_key_release; //called by shortcut, don't close it on first keyrelease
|
bool wait_one_key_release; //called by shortcut, don't close it on first keyrelease
|
||||||
|
|
||||||
|
Gtk.StyleContext background_style;
|
||||||
|
static const string FALLBACK_STYLE = """
|
||||||
|
.workspaces-background {
|
||||||
|
border-top: 1px solid alpha(#fff, 0.5);
|
||||||
|
background-image: -gtk-gradient (linear,
|
||||||
|
left top, left bottom,
|
||||||
|
from (#161616),
|
||||||
|
color-stop (0.15, #262626),
|
||||||
|
to (#262626));
|
||||||
|
}
|
||||||
|
""";
|
||||||
|
|
||||||
public WorkspaceView (Gala.Plugin _plugin)
|
public WorkspaceView (Gala.Plugin _plugin)
|
||||||
{
|
{
|
||||||
plugin = _plugin;
|
plugin = _plugin;
|
||||||
@ -46,6 +58,18 @@ namespace Gala
|
|||||||
opacity = 0;
|
opacity = 0;
|
||||||
reactive = true;
|
reactive = true;
|
||||||
|
|
||||||
|
//setup styles
|
||||||
|
var fallback = new Gtk.CssProvider ();
|
||||||
|
try {
|
||||||
|
fallback.load_from_data (FALLBACK_STYLE, -1);
|
||||||
|
} catch (Error e) { warning (e.message); }
|
||||||
|
|
||||||
|
var e = new Gtk.EventBox ();
|
||||||
|
e.show ();
|
||||||
|
background_style = e.get_style_context ();
|
||||||
|
background_style.add_class ("workspaces-background");
|
||||||
|
background_style.add_provider (fallback, Gtk.STYLE_PROVIDER_PRIORITY_FALLBACK);
|
||||||
|
|
||||||
thumbnails = new Clutter.Actor ();
|
thumbnails = new Clutter.Actor ();
|
||||||
thumbnails.layout_manager = new Clutter.BoxLayout ();
|
thumbnails.layout_manager = new Clutter.BoxLayout ();
|
||||||
(thumbnails.layout_manager as Clutter.BoxLayout).spacing = 12;
|
(thumbnails.layout_manager as Clutter.BoxLayout).spacing = 12;
|
||||||
@ -113,7 +137,7 @@ namespace Gala
|
|||||||
|
|
||||||
bool draw_background (Cairo.Context cr)
|
bool draw_background (Cairo.Context cr)
|
||||||
{
|
{
|
||||||
cr.rectangle (0, 1, width, height);
|
/*cr.rectangle (0, 1, width, height);
|
||||||
cr.set_source_rgb (0.15, 0.15, 0.15);
|
cr.set_source_rgb (0.15, 0.15, 0.15);
|
||||||
cr.fill ();
|
cr.fill ();
|
||||||
|
|
||||||
@ -129,7 +153,9 @@ namespace Gala
|
|||||||
|
|
||||||
cr.rectangle (0, 1, width, 15);
|
cr.rectangle (0, 1, width, 15);
|
||||||
cr.set_source (grad);
|
cr.set_source (grad);
|
||||||
cr.fill ();
|
cr.fill ();*/
|
||||||
|
|
||||||
|
background_style.render_activity (cr, 0, 0, width, height);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user