Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions plugins/pip/SelectionArea.vala
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public class Gala.Plugins.PIP.SelectionArea : CanvasActor {
public Gala.WindowManager wm { get; construct; }

private Gala.ModalProxy? modal_proxy;
private Gdk.Point start_point;
private Gdk.Point end_point;
private Graphene.Point start_point;
private Graphene.Point end_point;
private bool dragging = false;
private bool clicked = false;

Expand Down Expand Up @@ -130,10 +130,10 @@ public class Gala.Plugins.PIP.SelectionArea : CanvasActor {
}

private void get_selection_rectangle (out int x, out int y, out int width, out int height) {
x = int.min (start_point.x, end_point.x);
y = int.min (start_point.y, end_point.y);
width = (start_point.x - end_point.x).abs ();
height = (start_point.y - end_point.y).abs ();
x = (int) float.min (start_point.x, end_point.x);
y = (int) float.min (start_point.y, end_point.y);
width = (int) (start_point.x - end_point.x).abs ();
height = (int) (start_point.y - end_point.y).abs ();
}

protected override void draw (Cairo.Context ctx, int width, int height) {
Expand Down
12 changes: 6 additions & 6 deletions src/Widgets/MultitaskingView/WindowCloneContainer.vala
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ public class Gala.WindowCloneContainer : ActorTarget {
// https://projects.kde.org/projects/kde/kde-workspace/repository/revisions/master/entry/kwin/effects/presentwindows/presentwindows.cpp

// some math utilities
private static int squared_distance (Gdk.Point a, Gdk.Point b) {
private static float squared_distance (Graphene.Point a, Graphene.Point b) {
var k1 = b.x - a.x;
var k2 = b.y - a.y;

Expand All @@ -394,7 +394,7 @@ public class Gala.WindowCloneContainer : ActorTarget {
return {rect.x + dx1, rect.y + dy1, rect.width + (-dx1 + dx2), rect.height + (-dy1 + dy2)};
}

private static Gdk.Point rect_center (Mtk.Rectangle rect) {
private static Graphene.Point rect_center (Mtk.Rectangle rect) {
return {rect.x + rect.width / 2, rect.y + rect.height / 2};
}

Expand All @@ -419,7 +419,7 @@ public class Gala.WindowCloneContainer : ActorTarget {
taken_slots.resize (rows * columns);

// precalculate all slot centers
Gdk.Point[] slot_centers = {};
Graphene.Point[] slot_centers = {};
slot_centers.resize (rows * columns);
for (int x = 0; x < columns; x++) {
for (int y = 0; y < rows; y++) {
Expand All @@ -437,7 +437,7 @@ public class Gala.WindowCloneContainer : ActorTarget {
var rect = window.rect;

var slot_candidate = -1;
var slot_candidate_distance = int.MAX;
var slot_candidate_distance = float.MAX;
var pos = rect_center (rect);

// all slots
Expand Down Expand Up @@ -510,8 +510,8 @@ public class Gala.WindowCloneContainer : ActorTarget {
if (scale > 1.0) {
scale = 1.0f;
target = {
rect_center (target).x - (int) Math.floorf (rect.width * scale) / 2,
rect_center (target).y - (int) Math.floorf (rect.height * scale) / 2,
(int) (rect_center (target).x - Math.floorf (rect.width * scale) / 2),
(int) (rect_center (target).y - Math.floorf (rect.height * scale) / 2),
(int) Math.floorf (scale * rect.width),
(int) Math.floorf (scale * rect.height)
};
Expand Down