From 097d87e502ae3167c563a79e1afdf63630258a5f Mon Sep 17 00:00:00 2001 From: Arjan Molenaar Date: Sat, 12 Nov 2022 20:38:29 +0100 Subject: [PATCH] Cleanup: remove unused variables from macos code Remove unused variables. In case if Cairo code it would allocate memory, which would result in a memory leak. --- gdk/macos/gdkmacosdisplay-translate.c | 7 ------- gdk/macos/gdkmacosdisplay.c | 3 --- gdk/macos/gdkmacosglcontext.c | 2 -- gdk/macos/gdkmacoskeymap.c | 4 +--- gdk/macos/gdkmacosmonitor.c | 2 -- gdk/macos/gdkmacossurface.c | 6 ------ 6 files changed, 1 insertion(+), 23 deletions(-) diff --git a/gdk/macos/gdkmacosdisplay-translate.c b/gdk/macos/gdkmacosdisplay-translate.c index 502a9a8cac..b06dc83dbe 100644 --- a/gdk/macos/gdkmacosdisplay-translate.c +++ b/gdk/macos/gdkmacosdisplay-translate.c @@ -760,16 +760,9 @@ find_surface_under_pointer (GdkMacosDisplay *self, int *x, int *y) { - GdkPointerSurfaceInfo *info; GdkMacosSurface *surface; - GdkDevice *pointer; - GdkSeat *seat; int x_tmp, y_tmp; - seat = gdk_display_get_default_seat (GDK_DISPLAY (self)); - pointer = gdk_seat_get_pointer (seat); - info = _gdk_display_get_pointer_info (GDK_DISPLAY (self), pointer); - surface = _gdk_macos_display_get_surface_at_display_coords (self, screen_point.x, screen_point.y, diff --git a/gdk/macos/gdkmacosdisplay.c b/gdk/macos/gdkmacosdisplay.c index a999908d88..0e5a9b8eb6 100644 --- a/gdk/macos/gdkmacosdisplay.c +++ b/gdk/macos/gdkmacosdisplay.c @@ -870,15 +870,12 @@ _gdk_macos_display_get_surface_at_coords (GdkMacosDisplay *self, for (const GList *iter = surfaces; iter; iter = iter->next) { GdkSurface *surface = iter->data; - NSWindow *nswindow; g_assert (GDK_IS_MACOS_SURFACE (surface)); if (!gdk_surface_get_mapped (surface)) continue; - nswindow = _gdk_macos_surface_get_native (GDK_MACOS_SURFACE (surface)); - if (x >= GDK_MACOS_SURFACE (surface)->root_x && y >= GDK_MACOS_SURFACE (surface)->root_y && x <= (GDK_MACOS_SURFACE (surface)->root_x + surface->width) && diff --git a/gdk/macos/gdkmacosglcontext.c b/gdk/macos/gdkmacosglcontext.c index 20ed528ff9..8b6b928d5f 100644 --- a/gdk/macos/gdkmacosglcontext.c +++ b/gdk/macos/gdkmacosglcontext.c @@ -460,12 +460,10 @@ gdk_macos_gl_context_begin_frame (GdkDrawContext *context, { GdkMacosGLContext *self = (GdkMacosGLContext *)context; GdkMacosBuffer *buffer; - cairo_region_t *copy; GdkSurface *surface; g_assert (GDK_IS_MACOS_GL_CONTEXT (self)); - copy = cairo_region_copy (region); surface = gdk_draw_context_get_surface (context); buffer = _gdk_macos_surface_get_buffer (GDK_MACOS_SURFACE (surface)); diff --git a/gdk/macos/gdkmacoskeymap.c b/gdk/macos/gdkmacoskeymap.c index 5cf34d3ed3..a286c093bb 100644 --- a/gdk/macos/gdkmacoskeymap.c +++ b/gdk/macos/gdkmacoskeymap.c @@ -276,10 +276,8 @@ gdk_macos_keymap_update (GdkMacosKeymap *self) { UInt32 state = 0; OSStatus err; - UInt16 key_code; UniChar uc; - key_code = modifiers[j] | i; err = UCKeyTranslate (chr_data, i, kUCKeyActionDisplay, (modifiers[j] >> 8) & 0xFF, LMGetKbdType(), @@ -369,7 +367,7 @@ gdk_macos_keymap_update (GdkMacosKeymap *self) if (p[0] == known_numeric_keys[i].normal_keyval) p[0] = known_numeric_keys[i].keypad_keyval; } - + for (i = 0; i < G_N_ELEMENTS (jis_keys); i++) { p = keyval_array + jis_keys[i].keycode * KEYVALS_PER_KEYCODE; diff --git a/gdk/macos/gdkmacosmonitor.c b/gdk/macos/gdkmacosmonitor.c index a9aba3634b..df2676b6cf 100644 --- a/gdk/macos/gdkmacosmonitor.c +++ b/gdk/macos/gdkmacosmonitor.c @@ -215,7 +215,6 @@ gdk_macos_monitor_display_link_cb (GdkMacosMonitor *self) { gint64 presentation_time; gint64 refresh_interval; - gint64 now; GList *iter; g_assert (GDK_IS_MACOS_MONITOR (self)); @@ -225,7 +224,6 @@ gdk_macos_monitor_display_link_cb (GdkMacosMonitor *self) presentation_time = self->display_link->presentation_time; refresh_interval = self->display_link->refresh_interval; - now = g_source_get_time ((GSource *)self->display_link); iter = self->awaiting_frames.head; diff --git a/gdk/macos/gdkmacossurface.c b/gdk/macos/gdkmacossurface.c index 00a33975d4..ef0b5efa17 100644 --- a/gdk/macos/gdkmacossurface.c +++ b/gdk/macos/gdkmacossurface.c @@ -195,7 +195,6 @@ gdk_macos_surface_hide (GdkSurface *surface) { GdkMacosSurface *self = (GdkMacosSurface *)surface; GdkSeat *seat; - gboolean was_mapped; gboolean was_key; g_assert (GDK_IS_MACOS_SURFACE (self)); @@ -204,7 +203,6 @@ gdk_macos_surface_hide (GdkSurface *surface) _gdk_macos_surface_cancel_frame (self); - was_mapped = GDK_SURFACE_IS_MAPPED (surface); was_key = [self->window isKeyWindow]; seat = gdk_display_get_default_seat (surface->display); @@ -285,14 +283,12 @@ gdk_macos_surface_end_frame (GdkMacosSurface *self) { GdkFrameTimings *timings; GdkFrameClock *frame_clock; - GdkDisplay *display; g_assert (GDK_IS_MACOS_SURFACE (self)); if (GDK_SURFACE_DESTROYED (self)) return; - display = gdk_surface_get_display (GDK_SURFACE (self)); frame_clock = gdk_surface_get_frame_clock (GDK_SURFACE (self)); if ((timings = gdk_frame_clock_get_current_timings (frame_clock))) @@ -420,7 +416,6 @@ gdk_macos_surface_drag_begin (GdkSurface *surface, GdkMacosSurface *drag_surface; GdkMacosDrag *drag; GdkCursor *cursor; - GdkSeat *seat; double px; double py; int sx; @@ -432,7 +427,6 @@ gdk_macos_surface_drag_begin (GdkSurface *surface, g_assert (GDK_IS_MACOS_DEVICE (device)); g_assert (GDK_IS_CONTENT_PROVIDER (content)); - seat = gdk_device_get_seat (device); gdk_macos_device_query_state (device, surface, NULL, &px, &py, NULL); _gdk_macos_surface_get_root_coords (GDK_MACOS_SURFACE (surface), &sx, &sy); drag_surface = _gdk_macos_surface_new (GDK_MACOS_DISPLAY (surface->display), -- 2.30.2