Skip to content

Commit 4619e7c

Browse files
committed
mag: Stabilize cursor position
1 parent 4a8c101 commit 4619e7c

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/mag.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ class wayfire_magnifier : public wf::per_output_plugin_instance_t
297297
{
298298
auto og = output->get_relative_geometry();
299299
float aspect = (float)og.width / og.height;
300-
wf::geometry_t start_geometry = {100, 100, (int)(default_height * aspect), default_height};
300+
wf::geometry_t start_geometry = {100, 100, default_height *aspect, (double)default_height};
301301
return start_geometry;
302302
}
303303

@@ -345,7 +345,7 @@ class wayfire_magnifier : public wf::per_output_plugin_instance_t
345345
glm::translate(glm::mat4(1.0), glm::vec3(0.5, 0.5, 0.0)) *
346346
glm::scale(glm::mat4(1.0), glm::vec3{0.5, -0.5, 1.0}) * ortho;
347347

348-
glm::vec4 cursor = glm::vec4(cursor_position.x, cursor_position.y, 0.0, 1.0);
348+
glm::vec4 cursor = glm::vec4((int)cursor_position.x, (int)cursor_position.y, 0.0, 1.0);
349349
cursor = cursor_transform * cursor;
350350

351351
float x = cursor.x;
@@ -400,10 +400,10 @@ class wayfire_magnifier : public wf::per_output_plugin_instance_t
400400
zoom_box.y2 = 1.0;
401401
}
402402

403-
zoom_box.x1 *= width - 1;
404-
zoom_box.x2 *= width - 1;
405-
zoom_box.y1 *= height - 1;
406-
zoom_box.y2 *= height - 1;
403+
zoom_box.x1 *= width;
404+
zoom_box.x2 *= width;
405+
zoom_box.y1 *= height;
406+
zoom_box.y2 *= height;
407407

408408
/* Copy zoom_box part of the output to our own texture to be
409409
* read by the mag_view_t. */

0 commit comments

Comments
 (0)