gtk2/gdk
Руслан Ижбулатов 6c29e81051 W32: Massive W32 DnD fix
Massive changes to OLE2 DnD protocol, which was completely broken before:
* Keep GdkDragContext and OLE2 objects separate (don't ref/unref them
  together, don't necessarily create them together).
* Keep IDataObject formats in the object itself, not in a global variable.
* Fix getdata() to look up the request target in its format list, not in the
  global hash table
* Create target GdkDragContext on each drag_enter, destroy it on drag_leave,
  whereas IDropTarget is created when a window becomes a drag destination
  and is re-used indefinitely.
* Query the source IDataObject for its supported types, cache them in the
  target (!) context. This is how GTK+ works, honestly.
* Remember current_src_object when we initiate a drag, to be able
  to detect later on that the data object is ours and use a
  shortcut when querying targets
* Make sure GDK_DRAG_MOTION is only sent when something changes
* Support GTK drag cursors
* Ensure that exotic GTK clipboard formats are registered
  (but try to avoid registering formats that can't be used between applications).
* Don't enumerate internal formats
* Ensure that DnD indicator window can't accept drags or receive any kind of input
  (use WS_EX_TRANSPARENT).
* Remove unneeded indentation in _gdk_win32_dnd_do_dragdrop()
* Fix indentation in gdk_win32_drag_context_drop_finish()
* Remove obsolete comments in _gdk_win32_window_register_dnd()
* Check for DnD in progress when processing WM_KILLFOCUS, don't emit a grab
  break event in such cases (this allows alt-tabbing while DnD is in progress,
  though there may be lingering issues with focus after dropping...)
* Support Shell ID List -> text/uri-list conversion, now it's possible
  to drop files (dragged from Explorer) on GTK+ applications
* Explicitly use RegisterClipboardFormatA() when we know that the string
  is not in unicode. Otherwise explicitly use RegisterClipboardFormatW()
  with a UTF8->UTF16 converted string
* Fix _gdk_win32_display_get_selection_owner() to correctly bail
  when selection owner HWND is NULL (looking up GdkWindow for NULL
  HWND always succeeds and returns the root window - not the intended
  effect)
* More logging
* Send DROP_FINISHED event after DnD loop ends
* Send STATUS event on feedback
* Move GetKeyboardState() and related code into _gdk_win32_window_drag_begin(),
  so that it's closer to the point where last_pt and start_pt are set
* Use & 0x80 to check for the key being pressed. Windows will set low-order bit
  to 1 for all mouse buttons to indicate that they are toggled, so simply
  checking for the value not being 0 is not enough anymore.
  This is probably a new thing in modern W32 that didn't exist before
  (OLE2 DnD code is old).
* Fixed (hopefully) and simplified HiDPI parts of the code.

Also adds managed DnD implementation for W32 GDK backend (for both
OLE2 and LOCAL protocols). Mostly a copy of the X11 backend code, but
there are some minor differences:
* doesn't use drag_window field in GdkDragContext,
  uses the one in GdkWin32DragContext exclusively
* subtracts hotspot offset from the window coordinates when showing
  the dragback animation
* tries to consistently support scaling and caches the scale
  in the context
* Some keynav code is removed (places where grabbing/ungrabbing should
  happen is marked with TODOs), and the rest is probably inert.

Also significantly changes the way selection (and clipboard) is handled
(as MSDN rightly notes, the handling for DnD and Clipboard
 formats is virtually the same, so it makes sense to handle
 both with the same code):
* Don't spam GDK_OWNER_CHANGE, send them only when owner
  actually changes
* Open clipboard when our process becomes the clipboard owner
  (we are doing it anyway, to empty the clipboard and *become* the owner),
  and then don't close it until a scheduled selection request event
  (with TARGETS target) is received. Process that event by announcing
  all of our supported formats (by that time add_targets() should have
  been called up the stack, thus the formats are known; just in case,
  add_targets() will also schedule a selection request, if one isn't
  scheduled already, so that late-coming formats can still be announced).
* Allow clipboard opening for selection_convert() to be delayed if it
  fails initially.
* The last two points above should fix all the bugs about GTK+ rising
  too much ruckus over OpenClipboard() failures, as owner change
  *is allowed* to fail (though not all callers currently handle
  that case), and selection_convert() is asynchronous to begin with.
  Still, this is somewhat risky, as there's a possibility that the
  code will work in unexpected ways and the clipboard will remain open.
  There's now logging to track the clipboard being opened and closed,
  and a number of failsafes that try to ensure that it isn't kept open
  for no reason.
* Added copious notes on the way clipboard works on X11, Windows and GDK-W32,
  also removed old comments in DnD implementation, replaced some of them
  with the new ones
* A lot of crufty module-global variables are stuffed into a singleton
  object, GdkWin32Selection. It's technically possible to make it a
  sub-object of the Display object (the way Wayland backend does),
  but since Display object on W32 is a singleton anyway... why bother?
* Fixed the send_change_events() a bit (was slightly broken in one of the
  previous iterations)
* Ensure that there's no confusion between selection conversion (an artifact
  term from X11) and selection transmutation (changing the data to be W32-compatible)
* Put all the transmutation code and format-target-matching code into gdkselection-win32.c,
  now this code isn't spread across multiple files.
* Consequently, moved some code away from gdkproperty-win32.c and gdkdnd-win32.c
* Extensive format transmutation checks for OLE2 DnD and clipboard.
  We now keep track of which format mappings are for transmutations,
  and which aren't (for example, when formats are passed as-is, or when
  a registered name is just an alias)
* Put transmutation code into separate functions

* Ensure that drop target keeps a format->target map for supported formats,
  this is useful when selection_convert() is called, as it only receives a
  single target and no hints on the format from which the data should
  be transmuted into this target.
* Add clear_targets() on W32, to de called by GTK
* Use g_set_object() instead of g_ref_object() where it is allowed.
* Fix indentation (and convert tabs to spaces), remove unused variables

(This commit is cherry-picked from the gtk-3-22 branch)

https://bugzilla.gnome.org/show_bug.cgi?id=786509
2017-12-02 10:38:34 +00:00
..
broadway broadway: Add some (disabled) debugging tools 2017-11-30 21:57:42 +01:00
mir gdk: Replace GDK_NONE with NULL 2017-11-15 19:07:17 +01:00
quartz quartz: Stop deriving from GdkDeviceManager 2017-11-25 11:04:15 -05:00
resources/glsl Use GLSL version 110 for OpenGL 2 shaders. 2016-11-01 15:42:46 -03:00
wayland wayland: Never send NULL app id 2017-12-01 07:30:25 +01:00
win32 W32: Massive W32 DnD fix 2017-12-02 10:38:34 +00:00
x11 docs: Remove mentions of gdk_cursor_new_from_pixbuf 2017-11-29 20:14:53 -05:00
COPYING
fallback-c89.c fallback-c89: Include config.h 2017-05-03 14:47:14 +01:00
gdk-autocleanup.h gdk: Add some missing autocleanups 2017-11-28 15:03:48 -05:00
gdk-private.h Add private api for setting cursor theme 2017-11-17 17:42:12 -05:00
gdk.c Stop including gdkmain.h 2017-11-17 00:16:09 -05:00
gdk.h Drop GdkDeviceManager entirely 2017-11-25 11:04:15 -05:00
gdkapplaunchcontext.c Stop including gdkscreen.h 2017-11-17 10:51:55 -05:00
gdkapplaunchcontext.h Drop GdkScreen from public api 2017-11-01 19:44:29 -04:00
gdkapplaunchcontextprivate.h Drop gdk_app_launch_context_set_screen 2017-10-30 23:01:34 -04:00
gdkcairo.c docs: Remove mention of GdkColor 2017-01-18 04:13:56 +01:00
gdkcairo.h API: gdk: Remove ability to render window contents 2016-11-20 11:47:44 +01:00
gdkconfig.h.meson gdk/gdkconfig.h.meson: Add GDK_WINDOWING_WIN32 2017-09-15 21:41:15 +08:00
gdkconfig.h.win32
gdkconfig.h.win32_vulkan Visual Studio builds: Support Vulkan builds 2016-12-30 14:42:38 +08:00
gdkcontentformats.c Fix some parameter name mismatches to make g-ir-scanner happier 2017-11-28 15:24:49 +01:00
gdkcontentformats.h gdk: Add GType support to GdkContentFormats 2017-11-20 23:22:28 +01:00
gdkcontentformatsprivate.h gdk: Sanitize GdkContentFormats API 2017-11-20 23:15:11 +01:00
gdkcursor.c Drop gdk_cursor_new_from_pixbuf 2017-11-29 20:16:43 -05:00
gdkcursor.h Drop gdk_cursor_new_from_pixbuf 2017-11-29 20:16:43 -05:00
gdkcursorprivate.h gdk: Add gdk_cursor_hash() and gdk_cursor_equal() 2017-11-04 00:07:13 +01:00
gdkdevice.c Drop the ::device-manager property 2017-11-25 11:04:15 -05:00
gdkdevice.h Don't mention GdkDeviceManager in docs 2017-11-25 11:04:14 -05:00
gdkdevicepad.c gdk: Add GdkDevicePad 2016-08-23 21:01:44 +02:00
gdkdevicepad.h gdk: Add GdkDevicePad 2016-08-23 21:01:44 +02:00
gdkdevicepadprivate.h gdk: Add GdkDevicePad 2016-08-23 21:01:44 +02:00
gdkdeviceprivate.h Drop the ::device-manager property 2017-11-25 11:04:15 -05:00
gdkdevicetool.c gdk: Use G_PARAM_SPEC_STATIC_STRINGS throughout 2017-11-17 21:38:08 -05:00
gdkdevicetool.h gdk: Add a getter for the hardware id of a GdkDeviceTool 2016-08-23 21:01:44 +02:00
gdkdevicetoolprivate.h gdk: Pass hardware ID on gdk_device_tool_new() 2016-08-23 21:01:44 +02:00
gdkdisplay.c display: Drop the device_manager for good 2017-11-25 11:04:14 -05:00
gdkdisplay.h display: Drop the device_manager for good 2017-11-25 11:04:14 -05:00
gdkdisplaymanager.c gdk: Use G_PARAM_SPEC_STATIC_STRINGS throughout 2017-11-17 21:38:08 -05:00
gdkdisplaymanager.h gdk: Move some headers around 2017-11-16 22:18:45 -05:00
gdkdisplaymanagerprivate.h
gdkdisplayprivate.h display: Drop the device_manager for good 2017-11-25 11:04:14 -05:00
gdkdnd.c gdkdnd: Make GdkDragContext->formats a GdkContentFormats 2017-11-20 23:12:33 +01:00
gdkdnd.h gdkdnd: Make GdkDragContext->formats a GdkContentFormats 2017-11-20 23:12:33 +01:00
gdkdndprivate.h gdkdnd: Make GdkDragContext->formats a GdkContentFormats 2017-11-20 23:12:33 +01:00
gdkdrawcontext.c Trivial doc fixups 2016-12-09 14:59:46 -05:00
gdkdrawcontext.h gdk: Add GdkDrawContext 2016-12-05 15:02:47 +01:00
gdkdrawcontextprivate.h gdk: Make gdk_window_begin_draw_frame() take a draw context 2016-12-05 15:02:47 +01:00
gdkdrawingcontext.c GdkDrawingContext: Add missing break in switch statement 2017-03-18 07:07:06 +01:00
gdkdrawingcontext.h gdk: Make gdk_window_begin_draw_frame() take a draw context 2016-12-05 15:02:47 +01:00
gdkdrawingcontextprivate.h drawingcontext: Add a private struct 2016-11-23 18:49:48 +01:00
gdkenumtypes.c.template
gdkenumtypes.h.template
gdkevents.c gdk: Move code around 2017-11-17 16:22:21 -05:00
gdkevents.h gdk: Remove VisibilityNotify events 2017-11-01 22:00:34 +01:00
gdkeventsprivate.h Stop providing the owner in GdkEventOwnerChange 2017-11-01 22:53:24 -04:00
gdkframeclock.c frame-clock: Fix typo in API documentation 2017-11-22 15:24:19 +01:00
gdkframeclock.h
gdkframeclockidle.c build: Enable -Wswitch-enum and -Wswitch-default 2017-10-06 21:23:39 +02:00
gdkframeclockidle.h
gdkframeclockprivate.h frametimings: reuse previous frame timing in common case 2016-04-26 09:06:07 -04:00
gdkframetimings.c frametimings: reuse previous frame timing in common case 2016-04-26 09:06:07 -04:00
gdkframetimings.h
gdkgl.c build: Enable -Wswitch-enum and -Wswitch-default 2017-10-06 21:23:39 +02:00
gdkglcontext.c doc: Replace uses of #NULL with %NULL 2017-11-22 20:58:28 +00:00
gdkglcontext.h gdkgl: Add gdk_gl_context_get_damage() 2016-12-05 15:02:47 +01:00
gdkglcontextprivate.h gdkgl: Add gdk_gl_context_get_damage() 2016-12-05 15:02:47 +01:00
gdkglobals.c gdk: Move gdk_disable_multidevice tot he X11 backend 2017-11-25 11:04:14 -05:00
gdkinternals.h Drop support for setting event masks for floating devices 2017-11-25 11:04:14 -05:00
gdkintl.h
gdkkeynames.c
gdkkeys.c gdk: Intern signal names 2017-11-17 22:47:26 -05:00
gdkkeys.h
gdkkeysprivate.h
gdkkeysyms-update.pl Remove gdkkeysyms-compat.h 2017-05-03 14:54:37 +01:00
gdkkeysyms.h
gdkkeyuni.c GDK W32: Cache multiple keyboard layouts simultaneously 2016-08-04 16:37:18 +00:00
gdkmarshalers.list gdkwindow: add gdk_window_move_to_rect () 2016-07-19 09:38:54 -04:00
gdkmonitor.c gdk: Use G_PARAM_SPEC_STATIC_STRINGS throughout 2017-11-17 21:38:08 -05:00
gdkmonitor.h monitor: Add a ::valid property 2017-11-01 14:17:20 -04:00
gdkmonitorprivate.h monitor: Add a ::valid property 2017-11-01 14:17:20 -04:00
gdkpango.c Stop including gdkscreen.h 2017-11-17 10:51:55 -05:00
gdkpango.h Drop gdk_pango_context_get_for_display 2017-10-31 18:15:50 -04:00
gdkpixbuf-drawable.c API: gdk: Remove ability to render window contents 2016-11-20 11:47:44 +01:00
gdkpixbuf.h API: gdk: Remove ability to render window contents 2016-11-20 11:47:44 +01:00
gdkproperty.c Remove gdkprivate.h 2017-11-17 00:34:04 -05:00
gdkproperty.h
gdkrectangle.c gdk/gtk: Fix Since tags for 3.92 symbols 2017-05-30 15:10:25 +02:00
gdkrectangle.h gdk/gtk: Fix more AVAILABLE_IN annotations to 3_92 2017-05-28 14:20:19 +01:00
gdkrgba.c GdkRGBA: Fix misspelt parameter names in docs 2017-07-06 14:03:08 +01:00
gdkrgba.h API: gdk: Add gdk_rgba_is_clear() and gdk_rgba_is_opaque() 2016-12-20 18:01:12 +01:00
gdkseat.c gdk: Add GdkSeat::tool-added/removed signals 2016-04-06 15:43:29 +02:00
gdkseat.h GdkSeat: Add G_BEGIN_DECLS and G_END_DECLS 2015-12-22 10:33:41 +01:00
gdkseatdefault.c gdkseatdefault: Use TABLET_STYLUS capability for styli/erasers/cursors 2017-11-27 21:41:25 +01:00
gdkseatdefaultprivate.h GdkSeatDefault: Add functions to add/remove tools 2016-04-06 15:43:29 +02:00
gdkseatprivate.h gdk: Add GdkSeat::tool-added/removed signals 2016-04-06 15:43:29 +02:00
gdkselection.c gdk: Replace GDK_NONE with NULL 2017-11-15 19:07:17 +01:00
gdkselection.h gdk: Get rid of magic special atoms 2017-11-15 19:07:17 +01:00
gdktexture.c Remove gdkprivate.h 2017-11-17 00:34:04 -05:00
gdktexture.h Fix some typos 2017-11-04 23:51:25 -04:00
gdktextureprivate.h GskTexture => GdkTexture 2017-11-04 00:07:13 +01:00
gdkthreads.h gdk: Remove deprecated gdk_threads_set_lock_functions 2016-10-24 10:33:17 +02:00
gdktypes.h Drop GdkDeviceManager entirely 2017-11-25 11:04:15 -05:00
gdkversionmacros.h.in Add 3.94 version macros 2017-10-19 12:18:52 +02:00
gdkvulkancontext.c vulkan: Don't crash if vkEnumeratePhysicalDevices fails 2017-11-30 21:57:42 +01:00
gdkvulkancontext.h gdk: Skip GdkVulkanContext methods when building introspection data 2017-01-19 18:18:07 +00:00
gdkvulkancontextprivate.h Fix a typo 2017-09-25 17:53:54 -04:00
gdkwindow.c docs: Remove mentions of gdk_cursor_new_from_pixbuf 2017-11-29 20:14:53 -05:00
gdkwindow.h Drop support for setting event masks for floating devices 2017-11-25 11:04:14 -05:00
gdkwindowimpl.c Drop support for offscreen GdkWindows 2016-10-25 09:54:37 +02:00
gdkwindowimpl.h gdkdnd: Make GdkDragContext->formats a GdkContentFormats 2017-11-20 23:12:33 +01:00
gen-gdk-gresources-xml.py meson: gdk: update and sync with Makefiles 2017-05-03 15:10:53 +01:00
gen-keyname-table.pl
keyname-table.h gdk: Translate some more key names 2017-10-09 20:33:14 +02:00
keynames-translate.txt gdk: Translate some more key names 2017-10-09 20:33:14 +02:00
keynames.txt
meson.build Drop GdkDeviceManager entirely 2017-11-25 11:04:15 -05:00