Implement the multi-window highlight on WellDisplayItem
This commit is contained in:
parent
15a3f39f65
commit
4b47803162
@ -487,7 +487,8 @@ WellDisplayItem.prototype = {
|
|||||||
if (this._windows.length > 0) {
|
if (this._windows.length > 0) {
|
||||||
let glow = new Shell.DrawingArea({});
|
let glow = new Shell.DrawingArea({});
|
||||||
glow.connect('redraw', Lang.bind(this, function (e, tex) {
|
glow.connect('redraw', Lang.bind(this, function (e, tex) {
|
||||||
Shell.draw_glow(tex,
|
Shell.draw_app_highlight(tex,
|
||||||
|
this._windows.length > 1,
|
||||||
GLOW_COLOR.red / 255,
|
GLOW_COLOR.red / 255,
|
||||||
GLOW_COLOR.green / 255,
|
GLOW_COLOR.green / 255,
|
||||||
GLOW_COLOR.blue / 255,
|
GLOW_COLOR.blue / 255,
|
||||||
@ -764,10 +765,10 @@ AppWell.prototype = {
|
|||||||
this._appSystem.connect('favorites-changed', Lang.bind(this, function(appSys) {
|
this._appSystem.connect('favorites-changed', Lang.bind(this, function(appSys) {
|
||||||
this._redisplay();
|
this._redisplay();
|
||||||
}));
|
}));
|
||||||
this._appMonitor.connect('app-added', Lang.bind(this, function(monitor) {
|
this._appMonitor.connect('window-added', Lang.bind(this, function(monitor) {
|
||||||
this._redisplay();
|
this._redisplay();
|
||||||
}));
|
}));
|
||||||
this._appMonitor.connect('app-removed', Lang.bind(this, function(monitor) {
|
this._appMonitor.connect('window-removed', Lang.bind(this, function(monitor) {
|
||||||
this._redisplay();
|
this._redisplay();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -146,25 +146,12 @@ shell_draw_clock (ClutterCairoTexture *texture,
|
|||||||
cairo_destroy (cr);
|
cairo_destroy (cr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
shell_draw_glow (ClutterCairoTexture *texture,
|
draw_glow (cairo_t *cr, double red, double green, double blue, double alpha)
|
||||||
double red,
|
|
||||||
double green,
|
|
||||||
double blue,
|
|
||||||
double alpha)
|
|
||||||
{
|
{
|
||||||
cairo_t *cr;
|
|
||||||
guint width, height;
|
|
||||||
cairo_pattern_t *gradient;
|
cairo_pattern_t *gradient;
|
||||||
|
|
||||||
clutter_cairo_texture_get_surface_size (texture, &width, &height);
|
|
||||||
|
|
||||||
clutter_cairo_texture_clear (texture);
|
|
||||||
cr = clutter_cairo_texture_create (texture);
|
|
||||||
|
|
||||||
cairo_save (cr);
|
cairo_save (cr);
|
||||||
cairo_translate (cr, width / 2.0, height / 2.0);
|
|
||||||
cairo_scale (cr, width / 2.0, height / 2.0);
|
|
||||||
|
|
||||||
gradient = cairo_pattern_create_radial (0.0, 0.0, 0.0, 0.0, 0.0, 1.0);
|
gradient = cairo_pattern_create_radial (0.0, 0.0, 0.0, 0.0, 0.0, 1.0);
|
||||||
cairo_pattern_add_color_stop_rgba (gradient, 0.0, red, green, blue, alpha);
|
cairo_pattern_add_color_stop_rgba (gradient, 0.0, red, green, blue, alpha);
|
||||||
@ -174,8 +161,55 @@ shell_draw_glow (ClutterCairoTexture *texture,
|
|||||||
|
|
||||||
cairo_arc (cr, 0.0, 0.0, 1.0, 0.0, 2.0 * M_PI);
|
cairo_arc (cr, 0.0, 0.0, 1.0, 0.0, 2.0 * M_PI);
|
||||||
cairo_fill (cr);
|
cairo_fill (cr);
|
||||||
|
|
||||||
cairo_restore (cr);
|
cairo_restore (cr);
|
||||||
cairo_pattern_destroy (gradient);
|
cairo_pattern_destroy (gradient);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
shell_draw_app_highlight (ClutterCairoTexture *texture,
|
||||||
|
gboolean multi,
|
||||||
|
double red,
|
||||||
|
double green,
|
||||||
|
double blue,
|
||||||
|
double alpha)
|
||||||
|
{
|
||||||
|
cairo_t *cr;
|
||||||
|
guint width, height;
|
||||||
|
|
||||||
|
clutter_cairo_texture_get_surface_size (texture, &width, &height);
|
||||||
|
|
||||||
|
clutter_cairo_texture_clear (texture);
|
||||||
|
cr = clutter_cairo_texture_create (texture);
|
||||||
|
|
||||||
|
cairo_save (cr);
|
||||||
|
cairo_translate (cr, width / 2.0, height / 2.0);
|
||||||
|
|
||||||
|
if (multi)
|
||||||
|
{
|
||||||
|
double scale;
|
||||||
|
|
||||||
|
/* We draw three circles of radius 1, at 0.0, -1.8, and +1.8.
|
||||||
|
* Total width is therefore 1 + 1.8 + 1.8 + 1 = 5.6.
|
||||||
|
*/
|
||||||
|
scale = MIN (height / 2.0, width / 5.6);
|
||||||
|
cairo_scale (cr, scale, scale);
|
||||||
|
|
||||||
|
draw_glow (cr, red, green, blue, alpha);
|
||||||
|
|
||||||
|
cairo_translate (cr, -1.8, 0.0);
|
||||||
|
draw_glow (cr, red, green, blue, alpha);
|
||||||
|
|
||||||
|
cairo_translate (cr, 3.6, 0.0);
|
||||||
|
draw_glow (cr, red, green, blue, alpha);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cairo_scale (cr, width / 2.0, height / 2.0);
|
||||||
|
draw_glow (cr, red, green, blue, alpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
cairo_restore (cr);
|
||||||
cairo_destroy (cr);
|
cairo_destroy (cr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,8 @@ void shell_draw_clock (ClutterCairoTexture *texture,
|
|||||||
int hour,
|
int hour,
|
||||||
int minute);
|
int minute);
|
||||||
|
|
||||||
void shell_draw_glow (ClutterCairoTexture *texture,
|
void shell_draw_app_highlight (ClutterCairoTexture *texture,
|
||||||
|
gboolean multi,
|
||||||
double red,
|
double red,
|
||||||
double blue,
|
double blue,
|
||||||
double green,
|
double green,
|
||||||
|
Loading…
Reference in New Issue
Block a user