Cleanup: remove unused variables from macos code
authorArjan Molenaar <gaphor@gmail.com>
Sat, 12 Nov 2022 19:38:29 +0000 (20:38 +0100)
committerArjan Molenaar <gaphor@gmail.com>
Sun, 4 Dec 2022 11:50:20 +0000 (12:50 +0100)
Remove unused variables. In case if Cairo code it would
allocate memory, which would result in a memory leak.

gdk/macos/gdkmacosdisplay-translate.c
gdk/macos/gdkmacosdisplay.c
gdk/macos/gdkmacosglcontext.c
gdk/macos/gdkmacoskeymap.c
gdk/macos/gdkmacosmonitor.c
gdk/macos/gdkmacossurface.c

index 502a9a8cacec583f4079fe1976c7967fb828ad9e..b06dc83dbe8c999e9fe07ea560dc278a6c05ec6a 100644 (file)
@@ -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,
index a999908d88c3b40d75e0e79baf2cfdd4b9fac825..0e5a9b8eb62980dd5ad213639306e4dcb594e14a 100644 (file)
@@ -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) &&
index 20ed528ff990c811f96edd24611af87bb91bea9e..8b6b928d5f99efd26be298f416ad7c45f8f65082 100644 (file)
@@ -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));
 
index 5cf34d3ed3de0c88141beffc2ccf8fff8fc9f2a2..a286c093bb01b33c889dc24acc1101a12e6200a7 100644 (file)
@@ -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;
index a9aba3634b9312342aeda4e8ad60cb0ff86a46a3..df2676b6cf9afb970c4d65a64d38ea3003f6019d 100644 (file)
@@ -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;
 
index 00a33975d4fbdc9aae5585e9b387f95cbcc70724..ef0b5efa17c7afa13bbd8aa030b76f445d7de8fd 100644 (file)
@@ -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),