Skip to content

Commit fed9a1c

Browse files
[Input] Update to MetaCursorTracker API change (#13218)
* [Input] Update to MetaCursorTracker API change --------- Co-authored-by: Michael Webster <miketwebster@gmail.com>
1 parent 927ea58 commit fed9a1c

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

src/cinnamon-global.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,13 +1283,16 @@ cinnamon_global_get_pointer (CinnamonGlobal *global,
12831283
{
12841284
ClutterModifierType raw_mods;
12851285
MetaCursorTracker *tracker;
1286-
graphene_point_t coords;
1286+
graphene_point_t point;
12871287

12881288
tracker = meta_cursor_tracker_get_for_display (global->meta_display);
1289-
meta_cursor_tracker_get_pointer (tracker, &coords, &raw_mods);
1289+
meta_cursor_tracker_get_pointer (tracker, &point, &raw_mods);
1290+
1291+
if (x)
1292+
*x = point.x;
1293+
if (y)
1294+
*y = point.y;
12901295

1291-
*x = (int) coords.x;
1292-
*y = (int) coords.y;
12931296
*mods = raw_mods & CLUTTER_MODIFIER_MASK;
12941297
}
12951298

src/cinnamon-screenshot.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,10 @@ _draw_cursor_image (cairo_surface_t *surface,
141141
cairo_surface_t *cursor_surface;
142142
cairo_region_t *screenshot_region;
143143
cairo_t *cr;
144-
graphene_point_t coords;
144+
int x, y;
145145
int xhot, yhot;
146146
double xscale, yscale;
147+
graphene_point_t point;
147148

148149
display = cinnamon_global_get_display (cinnamon_global_get ());
149150
tracker = meta_cursor_tracker_get_for_display (display);
@@ -153,9 +154,11 @@ _draw_cursor_image (cairo_surface_t *surface,
153154
return;
154155

155156
screenshot_region = cairo_region_create_rectangle (&area);
156-
meta_cursor_tracker_get_pointer (tracker, &coords, NULL);
157+
meta_cursor_tracker_get_pointer (tracker, &point, NULL);
158+
x = point.x;
159+
y = point.y;
157160

158-
if (!cairo_region_contains_point (screenshot_region, (int) coords.x, (int) coords.y))
161+
if (!cairo_region_contains_point (screenshot_region, x, y))
159162
{
160163
cairo_region_destroy (screenshot_region);
161164
return;
@@ -181,7 +184,7 @@ _draw_cursor_image (cairo_surface_t *surface,
181184
int monitor;
182185
float monitor_scale;
183186
MetaRectangle cursor_rect = {
184-
.x = (int) coords.x, .y = (int) coords.y, .width = width, .height = height
187+
.x = x, .y = y, .width = width, .height = height
185188
};
186189

187190
monitor = meta_display_get_monitor_index_for_rect (display, &cursor_rect);
@@ -193,8 +196,8 @@ _draw_cursor_image (cairo_surface_t *surface,
193196
cr = cairo_create (surface);
194197
cairo_set_source_surface (cr,
195198
cursor_surface,
196-
(int) coords.x - xhot - area.x,
197-
(int) coords.y - yhot - area.y);
199+
x - xhot - area.x,
200+
y - yhot - area.y);
198201
cairo_paint (cr);
199202

200203
cairo_destroy (cr);

0 commit comments

Comments
 (0)