Skip to content
This repository was archived by the owner on Mar 13, 2023. It is now read-only.

Commit 577bbb8

Browse files
committed
fixed issue #115
1 parent d2ada61 commit 577bbb8

File tree

3 files changed

+23
-13
lines changed

3 files changed

+23
-13
lines changed

src/images/themedIcon.vala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public class ThemedIcon : Image {
7474
if (layer.layer_type == SliceLayer.Type.ICON) {
7575
ctx.push_group();
7676

77+
ctx.translate(layer.x, layer.y);
7778
layer.image.paint_on(ctx);
7879

7980
ctx.set_operator(Cairo.Operator.IN);
@@ -86,18 +87,21 @@ public class ThemedIcon : Image {
8687
}
8788

8889
icon.paint_on(ctx);
90+
ctx.translate(-layer.x, -layer.y);
8991

9092
ctx.pop_group_to_source();
9193
ctx.paint();
9294
ctx.set_operator(Cairo.Operator.OVER);
9395

9496
} else if (layer.layer_type == SliceLayer.Type.CAPTION) {
9597
Image text = new RenderedText(caption, layer.width, layer.height, layer.font, layer.color, Config.global.global_scale);
96-
ctx.translate(0, layer.position);
98+
ctx.translate(layer.x, layer.y);
9799
text.paint_on(ctx);
98-
ctx.translate(0, -layer.position);
100+
ctx.translate(-layer.x, -layer.y);
99101
} else if (layer.layer_type == SliceLayer.Type.FILE) {
102+
ctx.translate(layer.x, layer.y);
100103
layer.image.paint_on(ctx);
104+
ctx.translate(-layer.x, -layer.y);
101105
}
102106

103107
// colorize the whole layer if neccasary

src/themes/sliceLayer.vala

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,35 +48,41 @@ public class SliceLayer : GLib.Object {
4848
public string font {get; private set; default="";}
4949
public int width {get; private set; default=0;}
5050
public int height {get; private set; default=0;}
51-
public int position {get; private set; default=0;}
51+
public int x {get; private set; default=0;}
52+
public int y {get; private set; default=0;}
5253
public Color color {get; private set; default=new Color();}
5354

5455
/////////////////////////////////////////////////////////////////////
5556
/// C'tor, initializes all members of the layer.
5657
/////////////////////////////////////////////////////////////////////
5758

58-
public SliceLayer.file(string icon_file, int icon_size, bool colorize, Visibility visibility) {
59+
public SliceLayer.file(string icon_file, int icon_size, int x, int y, bool colorize, Visibility visibility) {
5960
this.layer_type = Type.FILE;
6061
this.icon_file = icon_file;
6162
this.colorize = colorize;
6263
this.icon_size = icon_size;
64+
this.x = x;
65+
this.y = y;
6366
this.visibility = visibility;
6467
}
6568

66-
public SliceLayer.icon(string icon_file, int icon_size, bool colorize, Visibility visibility) {
69+
public SliceLayer.icon(string icon_file, int icon_size, int x, int y, bool colorize, Visibility visibility) {
6770
this.layer_type = Type.ICON;
6871
this.icon_file = icon_file;
6972
this.colorize = colorize;
7073
this.icon_size = icon_size;
74+
this.x = x;
75+
this.y = y;
7176
this.visibility = visibility;
7277
}
7378

74-
public SliceLayer.caption(string font, int width, int height, int position, Color color, bool colorize, Visibility visibility) {
79+
public SliceLayer.caption(string font, int width, int height, int x, int y, Color color, bool colorize, Visibility visibility) {
7580
this.layer_type = Type.CAPTION;
7681
this.font = font;
7782
this.width = width;
7883
this.height = height;
79-
this.position = position;
84+
this.x = x;
85+
this.y = y;
8086
this.color = color;
8187
this.visibility = visibility;
8288
this.colorize = colorize;

src/themes/theme.vala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -486,17 +486,17 @@ public class Theme : GLib.Object {
486486
this.visible_slice_radius = Math.fmax(slice_radius*scale, this.visible_slice_radius);
487487

488488
if (slice->name.down() == "activeslice") {
489-
if (type == SliceLayer.Type.ICON) active_slice_layers.add(new SliceLayer.icon(file, size, colorize, visibility));
489+
if (type == SliceLayer.Type.ICON) active_slice_layers.add(new SliceLayer.icon(file, size, pos_x, pos_y, colorize, visibility));
490490
else if (type == SliceLayer.Type.CAPTION) active_slice_layers.add(new SliceLayer.caption(slice_caption_font,
491491
slice_caption_width, slice_caption_height,
492-
pos_y, slice_caption_color, colorize, visibility));
493-
else active_slice_layers.add(new SliceLayer.file(file, size, colorize, visibility));
492+
pos_x, pos_y, slice_caption_color, colorize, visibility));
493+
else active_slice_layers.add(new SliceLayer.file(file, size, pos_x, pos_y, colorize, visibility));
494494
} else {
495-
if (type == SliceLayer.Type.ICON) inactive_slice_layers.add(new SliceLayer.icon(file, size, colorize, visibility));
495+
if (type == SliceLayer.Type.ICON) inactive_slice_layers.add(new SliceLayer.icon(file, size, pos_x, pos_y, colorize, visibility));
496496
else if (type == SliceLayer.Type.CAPTION) inactive_slice_layers.add(new SliceLayer.caption(slice_caption_font,
497497
slice_caption_width, slice_caption_height,
498-
pos_y, slice_caption_color, colorize, visibility));
499-
else inactive_slice_layers.add(new SliceLayer.file(file, size, colorize, visibility));
498+
pos_x, pos_y, slice_caption_color, colorize, visibility));
499+
else inactive_slice_layers.add(new SliceLayer.file(file, size, pos_x, pos_y, colorize, visibility));
500500
}
501501

502502
} else {

0 commit comments

Comments
 (0)