Skip to content

Commit 1b1c155

Browse files
committed
Transform coords to stage space for monitor index
1 parent 7c1d48c commit 1b1c155

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Widgets/WindowClone.vala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,9 @@ public class Gala.WindowClone : Clutter.Actor {
477477
var close_button_alloc = InternalUtils.actor_box_from_rect (close_button_x, -close_button_height * 0.33f, close_button_width, close_button_height);
478478
close_button.allocate (close_button_alloc);
479479

480-
var monitor_index = wm.get_display ().get_monitor_index_for_rect ({ (int) box.get_x (), (int) box.get_y (), (int) box.get_width (), (int) box.get_height ()});
480+
var rect = Graphene.Rect ().init (box.get_x (), box.get_y (), box.get_width (), box.get_height ());
481+
get_relative_transformation_matrix (get_stage ()).transform_rect (rect);
482+
var monitor_index = wm.get_display ().get_monitor_index_for_rect (Mtk.Rectangle.from_graphene_rect (rect, ROUND));
481483
var monitor_scale = wm.get_display ().get_monitor_scale (monitor_index);
482484

483485
float window_title_max_width = box.get_width () - InternalUtils.scale_to_int (TITLE_MAX_WIDTH_MARGIN, monitor_scale);

0 commit comments

Comments
 (0)