From a23bc894e9c2ab6d9454e6df7404e6add219c8df Mon Sep 17 00:00:00 2001 From: Luca Bacci Date: Tue, 30 May 2023 19:51:38 +0200 Subject: [PATCH] GdkWin32: Remove unused debug functions * _gdk_win32_print_paletteentries * _gdk_win32_print_system_palette * _gdk_win32_print_hpalette * _gdk_win32_drag_protocol_to_string * _gdk_win32_data_to_string * _gdk_win32_gdkrectangle_to_string * _gdk_win32_cairo_region_to_string * _gdk_win32_surface_description --- gdk/win32/gdkmain-win32.c | 140 ----------------------------------- gdk/win32/gdkprivate-win32.h | 11 --- 2 files changed, 151 deletions(-) diff --git a/gdk/win32/gdkmain-win32.c b/gdk/win32/gdkmain-win32.c index bcc1d21ad4..79ddcacd7f 100644 --- a/gdk/win32/gdkmain-win32.c +++ b/gdk/win32/gdkmain-win32.c @@ -45,9 +45,6 @@ #include #include -/* for CFSTR_SHELLIDLIST */ -#include - static gboolean gdk_synchronize = FALSE; /* Whether GDK initialized COM */ @@ -186,77 +183,6 @@ static_printf (const char *format, return retval; } -void -_gdk_win32_print_paletteentries (const PALETTEENTRY *pep, - const int nentries) -{ - char buf[20]; - int i; - - for (i = 0; i < nentries; i++) - g_print (" %3d %02x: %02x %02x %02x%s\n", - i, i, - pep[i].peRed, pep[i].peGreen, pep[i].peBlue, - (pep[i].peFlags == 0 ? "" : - (pep[i].peFlags == PC_EXPLICIT ? " PC_EXPLICIT" : - (pep[i].peFlags == PC_NOCOLLAPSE ? " PC_NOCOLLAPSE" : - (pep[i].peFlags == PC_RESERVED ? " PC_RESERVED" : - (g_sprintf (buf, " %d", pep[i].peFlags), buf)))))); -} - -void -_gdk_win32_print_system_palette (void) -{ - PALETTEENTRY *pe; - int k; - - k = GetSystemPaletteEntries (_gdk_display_hdc, 0, 0, NULL); - pe = g_new (PALETTEENTRY, k); - k = GetSystemPaletteEntries (_gdk_display_hdc, 0, k, pe); - - if (!k) - g_print ("GetSystemPaletteEntries failed: %s\n", - g_win32_error_message (GetLastError ())); - else - { - g_print ("System palette: %d entries\n", k); - _gdk_win32_print_paletteentries (pe, k); - } - g_free (pe); -} - -static int -palette_size (HPALETTE hpal) -{ - WORD npal = 0; - - if (!GetObject (hpal, sizeof (npal), &npal)) - WIN32_GDI_FAILED ("GetObject (HPALETTE)"); - - return npal; -} - -void -_gdk_win32_print_hpalette (HPALETTE hpal) -{ - PALETTEENTRY *pe; - int n, npal; - - npal = palette_size (hpal); - pe = g_new (PALETTEENTRY, npal); - n = GetPaletteEntries (hpal, 0, npal, pe); - - if (!n) - g_print ("HPALETTE %p: GetPaletteEntries failed: %s\n", - hpal, g_win32_error_message (GetLastError ())); - else - { - g_print ("HPALETTE %p: %d (%d) entries\n", hpal, n, npal); - _gdk_win32_print_paletteentries (pe, n); - } - g_free (pe); -} - void _gdk_win32_print_dc (HDC hdc) { @@ -299,22 +225,6 @@ _gdk_win32_print_dc (HDC hdc) DeleteObject (hrgn); } -char * -_gdk_win32_drag_protocol_to_string (GdkDragProtocol protocol) -{ - switch (protocol) - { -#define CASE(x) case GDK_DRAG_PROTO_##x: return #x - CASE (NONE); - CASE (WIN32_DROPFILES); - CASE (OLE2); -#undef CASE - default: return static_printf ("illegal_%d", protocol); - } - /* NOTREACHED */ - return NULL; -} - char * _gdk_win32_surface_state_to_string (GdkToplevelState state) { @@ -892,26 +802,6 @@ _gdk_win32_cf_to_string (UINT format) } } -char * -_gdk_win32_data_to_string (const guchar *data, - int nbytes) -{ - GString *s = g_string_new (""); - int i; - char *retval; - - for (i = 0; i < nbytes; i++) - if (data[i] >=' ' && data[i] <= '~') - g_string_append_printf (s, "%c ", data[i]); - else - g_string_append_printf (s, "%02X ", data[i]); - - retval = static_printf ("%s", s->str); - g_string_free (s, TRUE); - - return retval; -} - char * _gdk_win32_rect_to_string (const RECT *rect) { @@ -920,34 +810,4 @@ _gdk_win32_rect_to_string (const RECT *rect) rect->left, rect->top); } -char * -_gdk_win32_gdkrectangle_to_string (const GdkRectangle *rect) -{ - return static_printf ("%dx%d@%+d%+d", - rect->width, rect->height, - rect->x, rect->y); -} - -char * -_gdk_win32_cairo_region_to_string (const cairo_region_t *rgn) -{ - cairo_rectangle_int_t extents; - cairo_region_get_extents (rgn, &extents); - return static_printf ("%dx%d@%+d%+d", - extents.width, extents.height, - extents.x, extents.y); -} - -char * -_gdk_win32_surface_description (GdkSurface *d) -{ - g_return_val_if_fail (GDK_IS_SURFACE (d), NULL); - - return static_printf ("%s:%p:%dx%d", - G_OBJECT_TYPE_NAME (d), - GDK_SURFACE_HWND (d), - gdk_surface_get_width (GDK_SURFACE (d)), - gdk_surface_get_height (GDK_SURFACE (d))); -} - #endif /* G_ENABLE_DEBUG */ diff --git a/gdk/win32/gdkprivate-win32.h b/gdk/win32/gdkprivate-win32.h index f4d9b4812a..967491b826 100644 --- a/gdk/win32/gdkprivate-win32.h +++ b/gdk/win32/gdkprivate-win32.h @@ -217,19 +217,13 @@ gboolean gdk_win32_ensure_com (void); gboolean gdk_win32_ensure_ole (void); #ifdef G_ENABLE_DEBUG -void _gdk_win32_print_paletteentries (const PALETTEENTRY *pep, - const int nentries); -void _gdk_win32_print_system_palette (void); -void _gdk_win32_print_hpalette (HPALETTE hpal); void _gdk_win32_print_dc (HDC hdc); -char *_gdk_win32_drag_protocol_to_string (GdkDragProtocol protocol); char *_gdk_win32_surface_state_to_string (GdkToplevelState state); char *_gdk_win32_surface_style_to_string (LONG style); char *_gdk_win32_surface_exstyle_to_string (LONG style); char *_gdk_win32_surface_pos_bits_to_string (UINT flags); char *_gdk_win32_drag_action_to_string (GdkDragAction actions); -char *_gdk_win32_surface_description (GdkSurface *d); char *_gdk_win32_rop2_to_string (int rop2); char *_gdk_win32_lbstyle_to_string (UINT brush_style); @@ -240,13 +234,8 @@ char *_gdk_win32_psjoin_to_string (DWORD pen_style); char *_gdk_win32_message_to_string (UINT msg); char *_gdk_win32_key_to_string (LONG lParam); char *_gdk_win32_cf_to_string (UINT format); -char *_gdk_win32_data_to_string (const guchar*data, - int nbytes); char *_gdk_win32_rect_to_string (const RECT *rect); -char *_gdk_win32_gdkrectangle_to_string (const GdkRectangle *rect); -char *_gdk_win32_cairo_region_to_string (const cairo_region_t *box); - void _gdk_win32_print_event (GdkEvent *event); #endif -- 2.30.2