ui: Clean up local variable shadowing

Local variables shadowing other local variables or parameters make the
code needlessly hard to understand.  Tracked down with -Wshadow=local.
Clean up: delete inner declarations when they are actually redundant,
else rename variables.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-ID: <20230921121312.1301864-4-armbru@redhat.com>
This commit is contained in:
Markus Armbruster
2023-09-21 14:13:08 +02:00
parent 7f3de3f02f
commit e33e66b1b3
5 changed files with 22 additions and 24 deletions

View File

@@ -930,8 +930,8 @@ static gboolean gd_motion_event(GtkWidget *widget, GdkEventMotion *motion,
GdkMonitor *monitor = gdk_display_get_monitor_at_window(dpy, win);
GdkRectangle geometry;
int x = (int)motion->x_root;
int y = (int)motion->y_root;
int xr = (int)motion->x_root;
int yr = (int)motion->y_root;
gdk_monitor_get_geometry(monitor, &geometry);
@@ -942,13 +942,13 @@ static gboolean gd_motion_event(GtkWidget *widget, GdkEventMotion *motion,
* may still be only half way across the screen. Without
* this warp, the server pointer would thus appear to hit
* an invisible wall */
if (x <= geometry.x || x - geometry.x >= geometry.width - 1 ||
y <= geometry.y || y - geometry.y >= geometry.height - 1) {
if (xr <= geometry.x || xr - geometry.x >= geometry.width - 1 ||
yr <= geometry.y || yr - geometry.y >= geometry.height - 1) {
GdkDevice *dev = gdk_event_get_device((GdkEvent *)motion);
x = geometry.x + geometry.width / 2;
y = geometry.y + geometry.height / 2;
xr = geometry.x + geometry.width / 2;
yr = geometry.y + geometry.height / 2;
gdk_device_warp(dev, screen, x, y);
gdk_device_warp(dev, screen, xr, yr);
s->last_set = FALSE;
return FALSE;
}