diff --git a/demos/gtk-demo/event_axes.c b/demos/gtk-demo/event_axes.c index 8794000597..5335d30614 100644 --- a/demos/gtk-demo/event_axes.c +++ b/demos/gtk-demo/event_axes.c @@ -444,7 +444,7 @@ draw_device_info (GtkWidget *widget, g_string_append_printf (string, "\nTool: %s", tool_type); if (serial != 0) - g_string_append_printf (string, ", Serial: %lx", serial); + g_string_append_printf (string, ", Serial: %" G_GINT64_MODIFIER "x", serial); } cairo_move_to (cr, 10, *y); diff --git a/gdk/win32/gdkcairocontext-win32.c b/gdk/win32/gdkcairocontext-win32.c index 5868a270ed..9a12ddd0d3 100644 --- a/gdk/win32/gdkcairocontext-win32.c +++ b/gdk/win32/gdkcairocontext-win32.c @@ -59,7 +59,6 @@ gdk_win32_surface_apply_queued_move_resize (GdkSurface *surface, { if (!IsIconic (GDK_SURFACE_HWND (surface))) { - GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (surface->impl); GDK_NOTE (EVENTS, g_print ("Setting window position ... ")); API_CALL (SetWindowPos, (GDK_SURFACE_HWND (surface), @@ -122,12 +121,9 @@ static cairo_surface_t * create_cairo_surface_for_surface (GdkSurface *surface, int scale) { - GdkDisplay *display; cairo_surface_t *cairo_surface; HDC hdc; - display = gdk_surface_get_display (surface); - hdc = GetDC (GDK_SURFACE_HWND (surface)); if (!hdc) { @@ -146,9 +142,7 @@ gdk_win32_cairo_context_begin_frame (GdkDrawContext *draw_context, cairo_region_t *region) { GdkWin32CairoContext *self = GDK_WIN32_CAIRO_CONTEXT (draw_context); - GdkRectangle clip_box; GdkSurface *surface; - double sx, sy; GdkSurfaceImplWin32 *impl; int scale; cairo_t *cr; @@ -238,19 +232,15 @@ gdk_win32_cairo_context_begin_frame (GdkDrawContext *draw_context, static void gdk_win32_cairo_context_end_frame (GdkDrawContext *draw_context, - cairo_region_t *painted, - cairo_region_t *damage) + cairo_region_t *painted) { GdkWin32CairoContext *self = GDK_WIN32_CAIRO_CONTEXT (draw_context); GdkSurface *surface; gint scale; - GdkSurfaceImplWin32 *impl; surface = gdk_draw_context_get_surface (draw_context); scale = gdk_surface_get_scale_factor (surface); - impl = GDK_SURFACE_IMPL_WIN32 (surface->impl); - /* The code to resize double-buffered windows immediately * before blitting the buffer contents onto them used * to be here. diff --git a/gdk/win32/gdkclipboard-win32.c b/gdk/win32/gdkclipboard-win32.c index a5cfe28d96..4544b3a080 100644 --- a/gdk/win32/gdkclipboard-win32.c +++ b/gdk/win32/gdkclipboard-win32.c @@ -149,8 +149,6 @@ gdk_win32_clipboard_claim_remote (GdkWin32Clipboard *cb) static void gdk_win32_clipboard_finalize (GObject *object) { - GdkWin32Clipboard *cb = GDK_WIN32_CLIPBOARD (object); - G_OBJECT_CLASS (gdk_win32_clipboard_parent_class)->finalize (object); } @@ -173,7 +171,6 @@ gdk_win32_clipboard_store_async (GdkClipboard *clipboard, GAsyncReadyCallback callback, gpointer user_data) { - GdkWin32Clipboard *cb = GDK_WIN32_CLIPBOARD (clipboard); GdkContentProvider *content; GdkContentFormats *formats; GTask *store_task; @@ -195,7 +192,7 @@ gdk_win32_clipboard_store_async (GdkClipboard *clipboard, formats = gdk_content_provider_ref_storable_formats (content); formats = gdk_content_formats_union_serialize_mime_types (formats); - if (!_gdk_win32_store_clipboard_contentformats (cb, store_task, formats)) + if (!_gdk_win32_store_clipboard_contentformats (clipboard, store_task, formats)) { GDK_NOTE (CLIPBOARD, g_printerr ("clipdrop says there's nothing to store: SUCCESS!\n")); g_task_return_boolean (store_task, TRUE); @@ -224,10 +221,7 @@ gdk_win32_clipboard_read_async (GdkClipboard *clipboard, GAsyncReadyCallback callback, gpointer user_data) { - GdkWin32Clipboard *cb = GDK_WIN32_CLIPBOARD (clipboard); - GSList *targets; GTask *task; - GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get (); task = g_task_new (clipboard, cancellable, callback, user_data); g_task_set_priority (task, io_priority); diff --git a/gdk/win32/gdkclipdrop-win32.c b/gdk/win32/gdkclipdrop-win32.c index 6774d6cb3b..2cefb583ea 100644 --- a/gdk/win32/gdkclipdrop-win32.c +++ b/gdk/win32/gdkclipdrop-win32.c @@ -914,7 +914,6 @@ process_retrieve (GdkWin32ClipboardThreadRetrieve *retr) UINT fmt, fmt_to_use; HANDLE hdata; GdkWin32ContentFormatPair *pair; - gpointer ptr; guchar *data; gsize data_len; GInputStream *stream; @@ -1026,9 +1025,9 @@ process_retrieve (GdkWin32ClipboardThreadRetrieve *retr) } stream = g_memory_input_stream_new_from_data (data, data_len, g_free); - g_object_set_data (stream, "gdk-clipboard-stream-contenttype", pair->contentformat); + g_object_set_data (G_OBJECT (stream), "gdk-clipboard-stream-contenttype", (gpointer) pair->contentformat); - GDK_NOTE (CLIPBOARD, g_printerr ("%s: reading clipboard data from a %lu-byte buffer\n", + GDK_NOTE (CLIPBOARD, g_printerr ("reading clipboard data from a %" G_GSIZE_FORMAT "-byte buffer\n", data_len)); send_input_stream (retr->parent.item_type, retr->parent.opaque_task, @@ -1619,7 +1618,7 @@ gdk_win32_clipdrop_init (GdkWin32Clipdrop *win32_clipdrop) win32_clipdrop->n_known_pixbuf_formats++; } - win32_clipdrop->known_pixbuf_formats = g_new (gchar *, win32_clipdrop->n_known_pixbuf_formats); + win32_clipdrop->known_pixbuf_formats = g_new (const gchar *, win32_clipdrop->n_known_pixbuf_formats); i = 0; for (rover = pixbuf_formats; rover != NULL; rover = rover->next) @@ -1655,7 +1654,7 @@ gdk_win32_clipdrop_init (GdkWin32Clipdrop *win32_clipdrop) fmt.w32format = CF_TEXT; g_array_append_val (comp, fmt); - g_hash_table_replace (win32_clipdrop->compatibility_w32formats, fmt.contentformat, comp); + g_hash_table_replace (win32_clipdrop->compatibility_w32formats, (gpointer) fmt.contentformat, comp); comp = g_array_sized_new (FALSE, FALSE, sizeof (GdkWin32ContentFormatPair), 3); @@ -1672,7 +1671,7 @@ gdk_win32_clipdrop_init (GdkWin32Clipdrop *win32_clipdrop) fmt.transmute = TRUE; g_array_append_val (comp, fmt); - g_hash_table_replace (win32_clipdrop->compatibility_w32formats, fmt.contentformat, comp); + g_hash_table_replace (win32_clipdrop->compatibility_w32formats, (gpointer) fmt.contentformat, comp); comp = g_array_sized_new (FALSE, FALSE, sizeof (GdkWin32ContentFormatPair), 4); @@ -1692,7 +1691,7 @@ gdk_win32_clipdrop_init (GdkWin32Clipdrop *win32_clipdrop) fmt.w32format = CF_DIB; g_array_append_val (comp, fmt); - g_hash_table_replace (win32_clipdrop->compatibility_w32formats, fmt.contentformat, comp); + g_hash_table_replace (win32_clipdrop->compatibility_w32formats, (gpointer) fmt.contentformat, comp); comp = g_array_sized_new (FALSE, FALSE, sizeof (GdkWin32ContentFormatPair), 4); @@ -1712,7 +1711,7 @@ gdk_win32_clipdrop_init (GdkWin32Clipdrop *win32_clipdrop) fmt.w32format = CF_DIB; g_array_append_val (comp, fmt); - g_hash_table_replace (win32_clipdrop->compatibility_w32formats, fmt.contentformat, comp); + g_hash_table_replace (win32_clipdrop->compatibility_w32formats, (gpointer) fmt.contentformat, comp); comp = g_array_sized_new (FALSE, FALSE, sizeof (GdkWin32ContentFormatPair), 2); @@ -1726,7 +1725,7 @@ gdk_win32_clipdrop_init (GdkWin32Clipdrop *win32_clipdrop) fmt.transmute = TRUE; g_array_append_val (comp, fmt); - g_hash_table_replace (win32_clipdrop->compatibility_w32formats, fmt.contentformat, comp); + g_hash_table_replace (win32_clipdrop->compatibility_w32formats, (gpointer) fmt.contentformat, comp); /* Not implemented, but definitely possible @@ -1879,8 +1878,6 @@ gdk_win32_clipdrop_init (GdkWin32Clipdrop *win32_clipdrop) void _gdk_dropfiles_store (gchar *data) { - GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get (); - /* FIXME: REMOVE ALL THAT STUFF if (data != NULL) { @@ -2099,7 +2096,7 @@ _gdk_win32_add_w32format_to_pairs (UINT w32format, } if (list && interned_w32format_name != 0 && g_list_find (*list, interned_w32format_name) == NULL) - *list = g_list_prepend (*list, interned_w32format_name); + *list = g_list_prepend (*list, (gpointer) interned_w32format_name); } comp_pairs = _gdk_win32_get_compatibility_contentformats_for_w32format (w32format); @@ -2124,7 +2121,7 @@ _gdk_win32_add_w32format_to_pairs (UINT w32format, pair = g_array_index (comp_pairs, GdkWin32ContentFormatPair, i); if (g_list_find (*list, pair.contentformat) == NULL) - *list = g_list_prepend (*list, pair.contentformat); + *list = g_list_prepend (*list, (gpointer) pair.contentformat); } } @@ -2629,7 +2626,7 @@ _gdk_win32_transmute_windows_data (UINT from_w32format, gsize *set_data_length) { const guchar *data; - gint length; + SIZE_T length; /* FIXME: error reporting */ @@ -2683,58 +2680,13 @@ _gdk_win32_transmute_windows_data (UINT from_w32format, return TRUE; } -static void -transmute_selection_format (UINT from_format, - GdkAtom to_target, - const guchar *data, - gint length, - guchar **set_data, - gint *set_data_length) -{ - if ((to_target == _gdk_win32_clipdrop_atom (GDK_WIN32_ATOM_INDEX_IMAGE_PNG) && - from_format == _gdk_win32_clipdrop_cf (GDK_WIN32_CF_INDEX_PNG)) || - (to_target == _gdk_win32_clipdrop_atom (GDK_WIN32_ATOM_INDEX_IMAGE_JPEG) && - from_format == _gdk_win32_clipdrop_cf (GDK_WIN32_CF_INDEX_JFIF)) || - (to_target == _gdk_win32_clipdrop_atom (GDK_WIN32_ATOM_INDEX_GIF) && - from_format == _gdk_win32_clipdrop_cf (GDK_WIN32_CF_INDEX_GIF))) - { - /* No transmutation needed */ - *set_data = g_memdup (data, length); - *set_data_length = length; - } - else if (to_target == _gdk_win32_clipdrop_atom (GDK_WIN32_ATOM_INDEX_TEXT_PLAIN_UTF8) && - from_format == CF_UNICODETEXT) - { - transmute_cf_unicodetext_to_utf8_string (data, length, set_data, set_data_length, NULL); - } - else if (to_target == _gdk_win32_clipdrop_atom (GDK_WIN32_ATOM_INDEX_TEXT_PLAIN_UTF8) && - from_format == CF_TEXT) - { - transmute_cf_text_to_utf8_string (data, length, set_data, set_data_length, NULL); - } - else if (to_target == _gdk_win32_clipdrop_atom (GDK_WIN32_ATOM_INDEX_IMAGE_BMP) && - (from_format == CF_DIB || from_format == CF_DIBV5)) - { - transmute_cf_dib_to_image_bmp (data, length, set_data, set_data_length, NULL); - } - else if (to_target == _gdk_win32_clipdrop_atom (GDK_WIN32_ATOM_INDEX_TEXT_URI_LIST) && - from_format == _gdk_win32_clipdrop_cf (GDK_WIN32_CF_INDEX_CFSTR_SHELLIDLIST)) - { - transmute_cf_shell_id_list_to_text_uri_list (data, length, set_data, set_data_length, NULL); - } - else - { - g_warning ("Don't know how to transmute format 0x%x to target 0x%p", from_format, to_target); - } -} - gboolean _gdk_win32_transmute_contentformat (const gchar *from_contentformat, UINT to_w32format, const guchar *data, gint length, guchar **set_data, - gint *set_data_length) + gsize *set_data_length) { if ((from_contentformat == _gdk_win32_clipdrop_atom (GDK_WIN32_ATOM_INDEX_IMAGE_PNG) && to_w32format == _gdk_win32_clipdrop_cf (GDK_WIN32_CF_INDEX_PNG)) || @@ -2784,110 +2736,6 @@ _gdk_win32_transmute_contentformat (const gchar *from_contentformat, return TRUE; } -static GdkAtom -convert_clipboard_selection_to_targets_target (GdkSurface *requestor) -{ - gint fmt; - int i; - int format_count = CountClipboardFormats (); - GArray *targets = g_array_sized_new (FALSE, FALSE, sizeof (GdkWin32ContentFormatPair), format_count); -/* FIXME: REMOVE ALL THAT STUFF - for (fmt = 0; 0 != (fmt = EnumClipboardFormats (fmt)); ) - _gdk_win32_add_format_to_targets (fmt, targets, NULL); -*/ - GDK_NOTE (DND, { - g_print ("... "); - for (i = 0; i < targets->len; i++) - { - const char *atom_name = (const char *)g_array_index (targets, GdkWin32ContentFormatPair, i).contentformat; - - g_print ("%s", atom_name); - if (i < targets->len - 1) - g_print (", "); - } - g_print ("\n"); - }); - - if (targets->len > 0) - { - gint len = targets->len; - GdkAtom *targets_only = g_new0 (GdkAtom, len); - - for (i = 0; i < targets->len; i++) - targets_only[i] = g_array_index (targets, GdkWin32ContentFormatPair, i).contentformat; - - g_array_free (targets, TRUE); -/* FIXME: REMOVE ALL THAT STUFF - selection_property_store (requestor, GDK_SELECTION_TYPE_ATOM, - 32, (guchar *) targets_only, - len * sizeof (GdkAtom)); -*/ - return _gdk_win32_clipdrop_atom (GDK_WIN32_ATOM_INDEX_GDK_SELECTION); - } - else - { - g_array_free (targets, TRUE); - return NULL; - } -} - -/* It's hard to say whether implementing this actually is of any use - * on the Win32 platform? gtk calls only - * gdk_text_property_to_utf8_list_for_display(). - */ -gint -gdk_text_property_to_text_list_for_display (GdkDisplay *display, - GdkAtom encoding, - gint format, - const guchar *text, - gint length, - gchar ***list) -{ - gchar *result; - const gchar *charset; - gchar *source_charset; - - GDK_NOTE (DND, { - const char *enc_name = (const char *)encoding; - - g_print ("gdk_text_property_to_text_list_for_display: %s %d %.20s %d\n", - enc_name, format, text, length); - }); - - if (!list) - return 0; - - if (encoding == g_intern_static_string ("STRING")) - source_charset = g_strdup ("ISO-8859-1"); - else if (encoding == _gdk_win32_clipdrop_atom (GDK_WIN32_ATOM_INDEX_TEXT_PLAIN_UTF8)) - source_charset = g_strdup ("UTF-8"); - else - source_charset = g_strdup ((const char *)encoding); - - g_get_charset (&charset); - - result = g_convert ((const gchar *) text, length, charset, source_charset, - NULL, NULL, NULL); - g_free (source_charset); - - if (!result) - return 0; - - *list = g_new (gchar *, 1); - **list = result; - - return 1; -} - -void -gdk_free_text_list (gchar **list) -{ - g_return_if_fail (list != NULL); - - g_free (*list); - g_free (list); -} - static gint make_list (const gchar *text, gint length, @@ -3185,10 +3033,10 @@ clipboard_store_hdata_ready (GObject *clipboard, { GdkWin32ClipboardStorePrepElement *el = &g_array_index (prep->elements, GdkWin32ClipboardStorePrepElement, i); - if (el->stream == stream) + if (el->stream == G_OUTPUT_STREAM (stream)) { - g_output_stream_close (G_OUTPUT_STREAM (el->stream), NULL, NULL); - el->handle = gdk_win32_hdata_output_stream_get_handle (el->stream, NULL); + g_output_stream_close (el->stream, NULL, NULL); + el->handle = gdk_win32_hdata_output_stream_get_handle (GDK_WIN32_HDATA_OUTPUT_STREAM (el->stream), NULL); g_object_unref (el->stream); el->stream = NULL; } @@ -3222,10 +3070,9 @@ _gdk_win32_store_clipboard_contentformats (GdkClipboard *cb, { GArray *pairs; /* of GdkWin32ContentFormatPair */ const char * const *mime_types; - gint n_mime_types; - gint i, offset; + gsize n_mime_types; + gsize i; GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get (); - GArray *streams; GdkWin32ClipboardStorePrep *prep; g_assert (clipdrop->clipboard_window != NULL); @@ -3272,7 +3119,7 @@ _gdk_win32_store_clipboard_contentformats (GdkClipboard *cb, GdkWin32ClipboardStorePrepElement *el = &g_array_index (prep->elements, GdkWin32ClipboardStorePrepElement, i); GdkWin32ClipboardHDataPrepAndStream *prep_and_stream = g_new0 (GdkWin32ClipboardHDataPrepAndStream, 1); prep_and_stream->prep = prep; - prep_and_stream->stream = el->stream; + prep_and_stream->stream = GDK_WIN32_HDATA_OUTPUT_STREAM (el->stream); gdk_clipboard_write_async (GDK_CLIPBOARD (cb), el->contentformat, diff --git a/gdk/win32/gdkclipdrop-win32.h b/gdk/win32/gdkclipdrop-win32.h index 570f407dc4..c281c8d486 100644 --- a/gdk/win32/gdkclipdrop-win32.h +++ b/gdk/win32/gdkclipdrop-win32.h @@ -254,7 +254,7 @@ gboolean _gdk_win32_transmute_contentformat (const gchar const guchar *data, gint length, guchar **set_data, - gint *set_data_length); + gsize *set_data_length); gboolean _gdk_win32_transmute_windows_data (UINT from_w32format, const gchar *to_contentformat, diff --git a/gdk/win32/gdkdevice-wintab.c b/gdk/win32/gdkdevice-wintab.c index 553d2a3a62..3f499d9a00 100644 --- a/gdk/win32/gdkdevice-wintab.c +++ b/gdk/win32/gdkdevice-wintab.c @@ -119,7 +119,6 @@ gdk_device_wintab_query_state (GdkDevice *device, GdkDeviceWintab *device_wintab; POINT point; HWND hwnd, hwndc; - GdkSurfaceImplWin32 *impl; int scale; device_wintab = GDK_DEVICE_WINTAB (device); @@ -231,7 +230,6 @@ _gdk_device_wintab_translate_axes (GdkDeviceWintab *device_wintab, gint root_x, root_y; gdouble temp_x, temp_y; gint i; - GdkDisplay *display; device = GDK_DEVICE (device_wintab); impl_surface = _gdk_surface_get_impl_surface (window); @@ -239,8 +237,6 @@ _gdk_device_wintab_translate_axes (GdkDeviceWintab *device_wintab, gdk_surface_get_origin (impl_surface, &root_x, &root_y); - display = gdk_device_get_display (device); - for (i = 0; i < gdk_device_get_n_axes (device); i++) { GdkAxisUse use; diff --git a/gdk/win32/gdkdisplay-win32.c b/gdk/win32/gdkdisplay-win32.c index d610cb4dc3..4a7182758f 100644 --- a/gdk/win32/gdkdisplay-win32.c +++ b/gdk/win32/gdkdisplay-win32.c @@ -895,6 +895,10 @@ _gdk_win32_enable_hidpi (GdkWin32Display *display) break; case DPI_STATUS_FAILED: g_warning ("Failed to enable HiDPI support."); + break; + case DPI_STATUS_PENDING: + g_assert_not_reached (); + break; } } diff --git a/gdk/win32/gdkdisplaymanager-win32.c b/gdk/win32/gdkdisplaymanager-win32.c index 9d1e234ce5..ead0a49950 100644 --- a/gdk/win32/gdkdisplaymanager-win32.c +++ b/gdk/win32/gdkdisplaymanager-win32.c @@ -56,9 +56,4 @@ gdk_win32_display_manager_class_init (GdkWin32DisplayManagerClass *class) GObjectClass *object_class = G_OBJECT_CLASS (class); object_class->finalize = gdk_win32_display_manager_finalize; - -#if 0 - manager_class->atom_intern = _gdk_win32_display_manager_atom_intern; - manager_class->get_atom_name = _gdk_win32_display_manager_get_atom_name; -#endif } diff --git a/gdk/win32/gdkdrag-win32.c b/gdk/win32/gdkdrag-win32.c index f6ff6cf351..be4b55955d 100644 --- a/gdk/win32/gdkdrag-win32.c +++ b/gdk/win32/gdkdrag-win32.c @@ -2047,6 +2047,8 @@ gdk_win32_drag_context_find_surface (GdkDragContext *context, EnumWindows (find_window_enum_proc, (LPARAM) &a); + *protocol = GDK_DRAG_PROTO_NONE; + if (a.result == NULL) dest_surface = NULL; else diff --git a/gdk/win32/gdkdrop-win32.c b/gdk/win32/gdkdrop-win32.c index 5c3018985c..23d95d1824 100644 --- a/gdk/win32/gdkdrop-win32.c +++ b/gdk/win32/gdkdrop-win32.c @@ -435,10 +435,11 @@ idroptarget_dragenter (LPDROPTARGET This, */ source_context ? source_context->source_surface : NULL, ctx->dest_surface, - query_targets (pDataObj, context_win32->droptarget_w32format_contentformat_map), + query_targets (pDataObj, NULL), GDK_ACTION_DEFAULT | GDK_ACTION_COPY | GDK_ACTION_MOVE, GDK_DRAG_PROTO_OLE2); context_win32 = GDK_WIN32_DROP_CONTEXT (context); + gdk_content_formats_unref (query_targets (pDataObj, context_win32->droptarget_w32format_contentformat_map)); g_array_set_size (context_win32->droptarget_w32format_contentformat_map, 0); g_set_object (&context_win32->local_source_context, GDK_WIN32_DRAG_CONTEXT (source_context)); @@ -526,7 +527,6 @@ idroptarget_drop (LPDROPTARGET This, { target_drag_context *ctx = (target_drag_context *) This; GdkWin32DropContext *context_win32 = GDK_WIN32_DROP_CONTEXT (ctx->context); - GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get (); gint pt_x = pt.x / context_win32->scale + _gdk_offset_x; gint pt_y = pt.y / context_win32->scale + _gdk_offset_y; @@ -747,7 +747,7 @@ gdk_dropfiles_filter (GdkWin32Display *display, event->any.send_event = FALSE; g_set_object (&event->dnd.context, context); g_set_object (&event->any.surface, window); - gdk_event_set_display (event, display); + gdk_event_set_display (event, GDK_DISPLAY (display)); gdk_event_set_device (event, gdk_drag_context_get_device (context)); event->dnd.x_root = pt.x / context_win32->scale + _gdk_offset_x; event->dnd.y_root = pt.y / context_win32->scale + _gdk_offset_y; @@ -837,7 +837,7 @@ gdk_dropfiles_filter (GdkWin32Display *display, DragFinish (hdrop); - gdk_display_put_event (display, event); + gdk_display_put_event (GDK_DISPLAY (display), event); g_object_unref (event); *ret_valp = 0; @@ -895,7 +895,6 @@ gdk_win32_drop_context_drop_finish (GdkDragContext *context, guint32 time) { GdkDragContext *src_context; - GdkEvent *tmp_event; GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get (); g_return_if_fail (context != NULL); @@ -973,7 +972,7 @@ _gdk_win32_surface_register_dnd (GdkSurface *window) * whether the window (widget) in question actually accepts files * (in gtk, data of type text/uri-list) or not. */ - gdk_win32_display_add_filter (gdk_display_get_default (), gdk_dropfiles_filter, NULL); + gdk_win32_display_add_filter (GDK_WIN32_DISPLAY (gdk_display_get_default ()), gdk_dropfiles_filter, NULL); DragAcceptFiles (GDK_SURFACE_HWND (window), TRUE); } else diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c index ac8186c2b0..e69cd1e372 100644 --- a/gdk/win32/gdkevents-win32.c +++ b/gdk/win32/gdkevents-win32.c @@ -361,7 +361,7 @@ low_level_keystroke_handler (WPARAM message, if (message == WM_KEYDOWN) last_keydown = kbdhook->vkCode; - else if (message = WM_KEYUP && last_keydown == kbdhook->vkCode) + else if (message == WM_KEYUP && last_keydown == kbdhook->vkCode) last_keydown = 0; return 0; @@ -769,7 +769,6 @@ void _gdk_win32_print_event (const GdkEvent *event) { gchar *escaped, *kvname; - const char *selection_name, *target_name, *property_name; g_print ("%s%*s===> ", (debug_indent > 0 ? "\n" : ""), debug_indent, ""); switch (event->any.type) @@ -1029,7 +1028,6 @@ apply_message_filters (GdkDisplay *display, GList **filters) { GdkWin32MessageFilterReturn result = GDK_WIN32_MESSAGE_FILTER_CONTINUE; - GList *node; GList *tmp_list; tmp_list = *filters; @@ -1045,7 +1043,7 @@ apply_message_filters (GdkDisplay *display, } filter->ref_count++; - result = filter->function (display, msg, ret_valp, filter->data); + result = filter->function (GDK_WIN32_DISPLAY (display), msg, ret_valp, filter->data); /* get the next node after running the function since the function may add or remove a next node */ @@ -1757,13 +1755,10 @@ static void handle_dpi_changed (GdkSurface *window, MSG *msg) { - HWND hwnd = GDK_SURFACE_HWND (window); GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (window->impl); GdkDisplay *display = gdk_display_get_default (); GdkWin32Display *win32_display = GDK_WIN32_DISPLAY (display); - GdkDevice *device = gdk_seat_get_pointer (gdk_display_get_default_seat (display)); RECT *rect = (RECT *)msg->lParam; - GdkEvent *event; guint old_scale = impl->surface_scale; /* MSDN for WM_DPICHANGED: dpi_x == dpi_y here, so LOWORD (msg->wParam) == HIWORD (msg->wParam) */ @@ -2036,15 +2031,12 @@ handle_wm_sysmenu (GdkSurface *window, MSG *msg, gint *ret_valp) { GdkSurfaceImplWin32 *impl; LONG_PTR style, tmp_style; - gboolean maximized, minimized; LONG_PTR additional_styles; impl = GDK_SURFACE_IMPL_WIN32 (window->impl); style = GetWindowLongPtr (msg->hwnd, GWL_STYLE); - maximized = IsZoomed (msg->hwnd) || (style & WS_MAXIMIZE); - minimized = IsIconic (msg->hwnd) || (style & WS_MINIMIZE); additional_styles = 0; if (!(style & WS_SYSMENU)) @@ -2252,24 +2244,19 @@ gdk_event_translate (MSG *msg, GdkSurface *grab_window = NULL; gint button; - GdkAtom target; gchar buf[256]; gboolean return_val = FALSE; int i; - GdkWin32Clipdrop *clipdrop = NULL; - - STGMEDIUM *property_change_data; - display = gdk_display_get_default (); win32_display = GDK_WIN32_DISPLAY (display); if (win32_display->filters) { /* Apply display filters */ - GdkWin32MessageFilterReturn result = apply_message_filters (win32_display, msg, ret_valp, &win32_display->filters); + GdkWin32MessageFilterReturn result = apply_message_filters (display, msg, ret_valp, &win32_display->filters); if (result == GDK_WIN32_MESSAGE_FILTER_REMOVE) return TRUE; diff --git a/gdk/win32/gdkhdataoutputstream-win32.c b/gdk/win32/gdkhdataoutputstream-win32.c index 0a9d35b71b..b6cfb9745f 100644 --- a/gdk/win32/gdkhdataoutputstream-win32.c +++ b/gdk/win32/gdkhdataoutputstream-win32.c @@ -196,7 +196,7 @@ gdk_win32_hdata_output_stream_close (GOutputStream *output_stream, if (priv->pair.transmute) { guchar *transmuted_data = NULL; - gint transmuted_data_length; + gsize transmuted_data_length; if (priv->handle_is_buffer) { @@ -341,7 +341,6 @@ gdk_win32_hdata_output_stream_class_init (GdkWin32HDataOutputStreamClass *klass) static void gdk_win32_hdata_output_stream_init (GdkWin32HDataOutputStream *stream) { - GdkWin32HDataOutputStreamPrivate *priv = gdk_win32_hdata_output_stream_get_instance_private (stream); } GOutputStream * diff --git a/gdk/win32/gdkprivate-win32.h b/gdk/win32/gdkprivate-win32.h index 57905f998e..b494816a00 100644 --- a/gdk/win32/gdkprivate-win32.h +++ b/gdk/win32/gdkprivate-win32.h @@ -439,11 +439,6 @@ GdkSurface *gdk_win32_display_get_root_window (GdkDisplay *display); /* Distributed display manager implementation */ GdkDisplay *_gdk_win32_display_open (const gchar *display_name); -GdkAtom _gdk_win32_display_manager_atom_intern (GdkDisplayManager *manager, - const gchar *atom_name, - gint only_if_exists); -gchar *_gdk_win32_display_manager_get_atom_name (GdkDisplayManager *manager, - GdkAtom atom); void _gdk_win32_append_event (GdkEvent *event); void _gdk_win32_emit_configure_event (GdkSurface *window); diff --git a/gdk/win32/gdkproperty-win32.c b/gdk/win32/gdkproperty-win32.c index 6b37920858..17729300df 100644 --- a/gdk/win32/gdkproperty-win32.c +++ b/gdk/win32/gdkproperty-win32.c @@ -33,50 +33,6 @@ #include "gdkprivate-win32.h" #include "gdkwin32.h" -GdkAtom -_gdk_win32_display_manager_atom_intern (GdkDisplayManager *manager, - const gchar *atom_name, - gint only_if_exists) -{ - ATOM win32_atom; - GdkAtom retval; - static GHashTable *atom_hash = NULL; - - if (!atom_hash) - atom_hash = g_hash_table_new (g_str_hash, g_str_equal); - - retval = g_hash_table_lookup (atom_hash, atom_name); - if (!retval) - { - win32_atom = GlobalAddAtom (atom_name); - retval = GUINT_TO_POINTER ((guint) win32_atom); - - g_hash_table_insert (atom_hash, - g_strdup (atom_name), - retval); - } - - return retval; -} - -gchar * -_gdk_win32_display_manager_get_atom_name (GdkDisplayManager *manager, - GdkAtom atom) -{ - ATOM win32_atom; - gchar name[256]; - - if (NULL == atom) return g_strdup (""); - - win32_atom = GPOINTER_TO_UINT (atom); - - if (win32_atom < 0xC000) - return g_strdup_printf ("#%p", atom); - else if (GlobalGetAtomName (win32_atom, name, sizeof (name)) == 0) - return NULL; - return g_strdup (name); -} - /* For reference, from gdk/x11/gdksettings.c: diff --git a/gdk/win32/gdkscreen-win32.c b/gdk/win32/gdkscreen-win32.c index 56e7886803..94c404c819 100644 --- a/gdk/win32/gdkscreen-win32.c +++ b/gdk/win32/gdkscreen-win32.c @@ -51,7 +51,6 @@ init_root_window_size (GdkWin32Screen *screen) GdkDisplay *display = _gdk_display; int monitor_count; GdkMonitor *monitor; - GdkSurfaceImplWin32 *root_impl; monitor_count = gdk_display_get_n_monitors (display); monitor = gdk_display_get_monitor (display, 0); diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c index f0e6def13d..8b3cfa15bd 100644 --- a/gdk/win32/gdksurface-win32.c +++ b/gdk/win32/gdksurface-win32.c @@ -125,8 +125,6 @@ static void gdk_win32_impl_frame_clock_after_paint (GdkFrameClock *clock, GdkSurface *surface); static gboolean _gdk_surface_get_functions (GdkSurface *window, GdkWMFunction *functions); -static HDC _gdk_win32_impl_acquire_dc (GdkSurfaceImplWin32 *impl); -static void _gdk_win32_impl_release_dc (GdkSurfaceImplWin32 *impl); #define SURFACE_IS_TOPLEVEL(window) \ (GDK_SURFACE_TYPE (window) != GDK_SURFACE_FOREIGN) @@ -185,8 +183,6 @@ _gdk_surface_impl_win32_get_type (void) static void gdk_surface_impl_win32_init (GdkSurfaceImplWin32 *impl) { - GdkDisplay *display = gdk_display_get_default (); - impl->hicon_big = NULL; impl->hicon_small = NULL; impl->hint_flags = 0; @@ -391,7 +387,6 @@ static ATOM RegisterGdkClass (GdkSurfaceType wtype, GdkSurfaceTypeHint wtype_hint) { static ATOM klassTOPLEVEL = 0; - static ATOM klassCHILD = 0; static ATOM klassTEMP = 0; static ATOM klassTEMPSHADOW = 0; static HICON hAppIcon = NULL; @@ -1337,7 +1332,6 @@ gdk_win32_surface_resize (GdkSurface *window, else { RECT outer_rect; - GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (window->impl); get_outer_rect (window, width, height, &outer_rect); @@ -1881,11 +1875,6 @@ gdk_win32_surface_get_geometry (GdkSurface *window, gint *width, gint *height) { - GdkDisplay *display; - gboolean window_is_root; - - display = gdk_surface_get_display (window); - if (!GDK_SURFACE_DESTROYED (window)) { RECT rect; @@ -1929,7 +1918,7 @@ gdk_win32_surface_get_geometry (GdkSurface *window, if (height) *height = (rect.bottom - rect.top) / impl->surface_scale; - GDK_NOTE (MISC, g_print ("gdk_win32_surface_get_geometry: %p: %ldx%ld@%+ld%\n", + GDK_NOTE (MISC, g_print ("gdk_win32_surface_get_geometry: %p: %ldx%ld@%+ld%+ld\n", GDK_SURFACE_HWND (window), (rect.right - rect.left) / impl->surface_scale, (rect.bottom - rect.top) / impl->surface_scale, @@ -2019,7 +2008,7 @@ gdk_win32_surface_get_frame_extents (GdkSurface *window, rect->x = r.left / impl->surface_scale + _gdk_offset_x; rect->y = r.top / impl->surface_scale + _gdk_offset_y; - GDK_NOTE (MISC, g_print ("gdk_surface_get_frame_extents: %p: %ldx%ld@%+ld%+ld\n", + GDK_NOTE (MISC, g_print ("gdk_surface_get_frame_extents: %p: %dx%d@%+d%+d\n", GDK_SURFACE_HWND (window), rect->width, rect->height, @@ -3770,7 +3759,6 @@ handle_aerosnap_move_resize (GdkSurface *window, gint halfright = 0; gint fullup = 0; gboolean fullup_edge = FALSE; - GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (window->impl); if (context->op == GDK_WIN32_DRAGOP_RESIZE) switch (context->edge) @@ -4024,7 +4012,6 @@ setup_drag_move_resize_context (GdkSurface *window, const gchar *cursor_name; GdkSurface *pointer_window; GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (window->impl); - GdkDisplay *display = gdk_device_get_display (device); gboolean maximized = gdk_surface_get_state (window) & GDK_SURFACE_STATE_MAXIMIZED; /* Before we drag, we need to undo any maximization or snapping. @@ -5135,55 +5122,6 @@ gdk_win32_surface_get_type_hint (GdkSurface *window) return GDK_SURFACE_IMPL_WIN32 (window->impl)->type_hint; } -static HRGN -cairo_region_to_hrgn (const cairo_region_t *region, - gint x_origin, - gint y_origin, - guint scale) -{ - HRGN hrgn; - RGNDATA *rgndata; - RECT *rect; - cairo_rectangle_int_t r; - const int nrects = cairo_region_num_rectangles (region); - guint nbytes = - sizeof (RGNDATAHEADER) + (sizeof (RECT) * nrects); - int i; - - rgndata = g_malloc (nbytes); - rgndata->rdh.dwSize = sizeof (RGNDATAHEADER); - rgndata->rdh.iType = RDH_RECTANGLES; - rgndata->rdh.nCount = rgndata->rdh.nRgnSize = 0; - SetRect (&rgndata->rdh.rcBound, - G_MAXLONG, G_MAXLONG, G_MINLONG, G_MINLONG); - - for (i = 0; i < nrects; i++) - { - rect = ((RECT *) rgndata->Buffer) + rgndata->rdh.nCount++; - - cairo_region_get_rectangle (region, i, &r); - rect->left = (r.x + x_origin) * scale; - rect->right = (rect->left + r.width) * scale; - rect->top = (r.y + y_origin) * scale; - rect->bottom = (rect->top + r.height) * scale; - - if (rect->left < rgndata->rdh.rcBound.left) - rgndata->rdh.rcBound.left = rect->left; - if (rect->right > rgndata->rdh.rcBound.right) - rgndata->rdh.rcBound.right = rect->right; - if (rect->top < rgndata->rdh.rcBound.top) - rgndata->rdh.rcBound.top = rect->top; - if (rect->bottom > rgndata->rdh.rcBound.bottom) - rgndata->rdh.rcBound.bottom = rect->bottom; - } - if ((hrgn = ExtCreateRegion (NULL, nbytes, rgndata)) == NULL) - WIN32_API_FAILED ("ExtCreateRegion"); - - g_free (rgndata); - - return (hrgn); -} - GdkSurface * gdk_win32_surface_lookup_for_display (GdkDisplay *display, HWND anid) @@ -5293,12 +5231,6 @@ gdk_win32_surface_get_impl_hwnd (GdkSurface *window) return NULL; } -static void -gdk_win32_cairo_surface_destroy (void *data) -{ - GdkSurfaceImplWin32 *impl = data; -} - BOOL WINAPI GtkShowWindow (GdkSurface *window, int cmd_show) @@ -5421,8 +5353,6 @@ _gdk_win32_surface_get_scale_factor (GdkSurface *window) GdkSurfaceImplWin32 *impl; GdkWin32Display *win32_display; - UINT dpix, dpiy; - gboolean is_scale_acquired; if (GDK_SURFACE_DESTROYED (window)) return 1; diff --git a/gsk/gl/gskgldriver.c b/gsk/gl/gskgldriver.c index 3f6c4c70d0..2a2c980ce4 100644 --- a/gsk/gl/gskgldriver.c +++ b/gsk/gl/gskgldriver.c @@ -217,9 +217,9 @@ gsk_gl_driver_end_frame (GskGLDriver *self) #ifdef G_ENABLE_DEBUG GSK_NOTE (OPENGL, - g_message ("Textures created: %ld\n" - " Textures reused: %ld\n" - " Surface uploads: %ld", + g_message ("Textures created: %" G_GINT64_FORMAT "\n" + " Textures reused: %" G_GINT64_FORMAT "\n" + " Surface uploads: %" G_GINT64_FORMAT, gsk_profiler_counter_get (self->profiler, self->counters.created_textures), gsk_profiler_counter_get (self->profiler, self->counters.reused_textures), gsk_profiler_counter_get (self->profiler, self->counters.surface_uploads))); diff --git a/gsk/gskprofiler.c b/gsk/gskprofiler.c index 2a09702826..253a0b6282 100644 --- a/gsk/gskprofiler.c +++ b/gsk/gskprofiler.c @@ -503,7 +503,7 @@ gsk_profiler_append_timers (GskProfiler *profiler, if (timer->n_samples > 1) { timer->avg_value = timer->avg_value / timer->n_samples; - g_string_append_printf (buffer, " Min: %.2f Avg: %.2f Max: %.2f (%ld samples)", + g_string_append_printf (buffer, " Min: %.2f Avg: %.2f Max: %.2f (%" G_GINT64_FORMAT " samples)", (double) timer->min_value / scale, (double) timer->avg_value / scale, (double) timer->max_value / scale, diff --git a/gtk/gtkiconcache.c b/gtk/gtkiconcache.c index df2805b1dd..273865a338 100644 --- a/gtk/gtkiconcache.c +++ b/gtk/gtkiconcache.c @@ -108,7 +108,7 @@ gtk_icon_cache_new_for_path (const gchar *path) /* Bug 660730: _fstat32 is only defined in msvcrt80.dll+/VS 2005+ */ /* or possibly in the msvcrt.dll linked to by the Windows DDK */ /* (will need to check on the Windows DDK part later) */ -#if ((_MSC_VER >= 1400 || __MSVCRT_VERSION__ >= 0x0800) || defined (__MINGW64_VERSION_MAJOR)) && !defined(_WIN64) +#if ((defined (_MSC_VER) && (_MSC_VER >= 1400 || __MSVCRT_VERSION__ >= 0x0800)) || defined (__MINGW64_VERSION_MAJOR)) && !defined(_WIN64) #undef fstat /* Just in case */ #define fstat _fstat32 #endif diff --git a/gtk/gtkimcontextime.c b/gtk/gtkimcontextime.c index ae382c26ae..706c1e54f2 100644 --- a/gtk/gtkimcontextime.c +++ b/gtk/gtkimcontextime.c @@ -1050,7 +1050,6 @@ gtk_im_context_ime_message_filter (GdkWin32Display *display, if (msg->lParam & GCS_RESULTSTR) { gsize len; - gchar *utf8str = NULL; GError *error = NULL; len = ImmGetCompositionStringW (himc, GCS_RESULTSTR, NULL, 0); diff --git a/gtk/gtkimcontextsimple.c b/gtk/gtkimcontextsimple.c index 3ba25d2765..f1436bd62b 100644 --- a/gtk/gtkimcontextsimple.c +++ b/gtk/gtkimcontextsimple.c @@ -454,6 +454,8 @@ check_win32_special_cases (GtkIMContextSimple *context_simple, value = 0x00B4; break; case GDK_KEY_dead_diaeresis: value = 0x00A8; break; + default: + break; } if (value > 0) { @@ -1262,6 +1264,9 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context, return TRUE; case GDK_WIN32_KEYMAP_MATCH_INCOMPLETE: return TRUE; + default: + g_assert_not_reached (); + break; } } #endif diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c index fd26bdef73..0f3639d139 100644 --- a/gtk/gtkmain.c +++ b/gtk/gtkmain.c @@ -432,6 +432,8 @@ enum_locale_proc (LPTSTR locale) case MAKELANGID (LANG_SERBIAN, 0x07): /* Serbian in Bosnia and Herzegovina, Cyrillic */ return TRUE; + default: + break; } } else if (strcmp (script_to_check, "Cyrl") == 0) @@ -447,6 +449,8 @@ enum_locale_proc (LPTSTR locale) case MAKELANGID (LANG_SERBIAN, 0x06): /* Serbian in Bosnia and Herzegovina, Latin */ return TRUE; + default: + break; } } } @@ -522,7 +526,7 @@ setlocale_initialization (void) */ if (strcmp (iso3166_to_check, "CS") == 0 || strcmp (iso3166_to_check, "YU") == 0) - iso3166_to_check = "SP"; + iso3166_to_check = (char *) "SP"; } else { @@ -531,7 +535,7 @@ setlocale_initialization (void) *script_to_check++ = '\0'; /* LANG_SERBIAN == LANG_CROATIAN, recognize just "sr" */ if (strcmp (iso639_to_check, "sr") == 0) - iso3166_to_check = "SP"; + iso3166_to_check = (char *) "SP"; } EnumSystemLocales (enum_locale_proc, LCID_SUPPORTED); diff --git a/gtk/gtkprintoperation-win32.c b/gtk/gtkprintoperation-win32.c index db7247e0e4..ca7c1be125 100644 --- a/gtk/gtkprintoperation-win32.c +++ b/gtk/gtkprintoperation-win32.c @@ -1402,10 +1402,6 @@ pageDlgProc (HWND wnd, UINT message, WPARAM wparam, LPARAM lparam) */ if (message == WM_SIZE) { - GtkAllocation alloc; - alloc.width = LOWORD (lparam); - alloc.height = HIWORD (lparam); - gtk_widget_queue_resize (op_win32->embed_widget); } diff --git a/gtk/gtkwin32.c b/gtk/gtkwin32.c index d290505a1c..91e9bfba96 100644 --- a/gtk/gtkwin32.c +++ b/gtk/gtkwin32.c @@ -53,6 +53,8 @@ DllMain (HINSTANCE hinstDLL, gtk_dll = (HMODULE) hinstDLL; _gdk_dll_hinstance = hinstDLL; break; + default: + break; } return TRUE; diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index f53aa6855a..5e5950f056 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -1873,7 +1873,9 @@ gtk_window_init (GtkWindow *window) GtkWidget *widget; GtkCssNode *widget_node; GdkSeat *seat; +#ifdef GDK_WINDOWING_X11 GdkContentFormats *targets; +#endif widget = GTK_WIDGET (window); diff --git a/gtk/updateiconcache.c b/gtk/updateiconcache.c index 92f0924f23..cc681c16be 100644 --- a/gtk/updateiconcache.c +++ b/gtk/updateiconcache.c @@ -70,7 +70,7 @@ static GStatBuf cache_dir_stat; static gboolean cache_up_to_date; static int check_dir_mtime (const char *dir, - const GStatBuf *sb, + const struct stat *sb, int tf) { if (tf != FTW_NS && sb->st_mtime > cache_dir_stat.st_mtime)