mirror of
https://gitlab.gnome.org/GNOME/libmks.git
synced 2025-04-14 08:27:16 +00:00
display-picture: use compute_point()
The gtk_widget_translate_coordinates() API is now deprecated, so use the compute_point() API and ensure that we can translate to the target widget.
This commit is contained in:
parent
4be889b608
commit
f71a2002ba
@ -218,17 +218,20 @@ mks_display_picture_legacy_event_cb (MksDisplayPicture *self,
|
|||||||
|
|
||||||
if (gdk_event_get_position (event, &x, &y))
|
if (gdk_event_get_position (event, &x, &y))
|
||||||
{
|
{
|
||||||
|
graphene_point_t translated;
|
||||||
double guest_x, guest_y;
|
double guest_x, guest_y;
|
||||||
|
|
||||||
x -= translate_x;
|
x -= translate_x;
|
||||||
y -= translate_y;
|
y -= translate_y;
|
||||||
|
|
||||||
gtk_widget_translate_coordinates (GTK_WIDGET (native),
|
if (!gtk_widget_compute_point (GTK_WIDGET (native),
|
||||||
GTK_WIDGET (self),
|
GTK_WIDGET (self),
|
||||||
x, y, &x, &y);
|
&GRAPHENE_POINT_INIT (x, y),
|
||||||
|
&translated))
|
||||||
|
break;
|
||||||
|
|
||||||
guest_x = floor (x) / area.size.width * guest_width;
|
guest_x = floor (translated.x) / area.size.width * guest_width;
|
||||||
guest_y = floor (y) / area.size.height * guest_height;
|
guest_y = floor (translated.y) / area.size.height * guest_height;
|
||||||
|
|
||||||
guest_x = CLAMP (guest_x, 0, guest_width);
|
guest_x = CLAMP (guest_x, 0, guest_width);
|
||||||
guest_y = CLAMP (guest_y, 0, guest_width);
|
guest_y = CLAMP (guest_y, 0, guest_width);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user