Commit Graph

55079 Commits

Author SHA1 Message Date
Benjamin Otte
7769be22f0 dnd: Implement gtk_drag_get_source_widget() differently
Instead of keeping a list of source contexts, just use the current
drag's info.
2018-06-10 03:17:12 +02:00
Benjamin Otte
00a171626d x11: Replace the hardcoded DND filter
Use the new method of connecting to the xevent signal instead.

Also, don't consume the xevent, there might be other code listening for
it. And we don't use PropertyNotify in the generic code path anymore, so
it'll just be ignored there.
2018-06-10 03:17:12 +02:00
Руслан Ижбулатов
bdc37cf161 GDK W32: Remove unused files 2018-06-10 03:17:12 +02:00
Руслан Ижбулатов
ad7d4acc77 GDK W32: Adapt to GdkDrop and GdkDragContext changes
* Remove clipdrop->dnd_target_state, it's not used anymore
* Remove non-functioning _gdk_dropfiles_store(), store dropfiles
  list in GdkWin32Drop instead
* Fix multiple comment typos
* Fix _gdk_win32_get_clipboard_format_name_as_interned_mimetype() to
  leave names that look like mime/types alone
* Refactor _gdk_win32_add_w32format_to_pairs() to populate
  GdkContentFormatsBuilder directly, instead of making a GList
* Rename context -> drag (still using GdkDragContext type,
  but [almost?] all variables and comments say "drag" now)
* Rename GdkDropContext -> GdkDrop
* Rename some parameter names for clarity
* Rewrite local protocol to look more like OLE2 protocol
  instead of mirroring the structure of the X11 API.
* Add handle_events field to GdkWin32DragContext,
  to shut off event handling (temporary fix until GTK is patched up)
* Remove _gdk_win32_drag_context_find() - the drag object is stored
  in GdkDrop instead. Use _gdk_win32_find_drag_for_dest_surface()
  to get it initially.
* Remove target_ctx_for_window, droptarget context is stored
  in the surface instead.
* Call gdk_drag_context_set_cursor() just like wayland backend does
  (slightly broken for now)
* Clean up the action choosing code (filter source actions by using
  keyboard state, pass that to GTK, get all actions supported by GTK in
  response, match them up with filtered source actions, return the
  result, falling back to COPY in case of multiple actions)
* Check drag_win32->protocol instead of the use_ole2_dnd variable where
  possible
* Remove protocol checks from functions that are only used by the local
  protocol
* Use event state to manufacture the keyboard state for WM_MOUSEMOVE
* Change function names printed by GDK_NOTE to name the actual
  functions, not their theoretical generic GDK stack ancestors
* Consistently use drag_win32 and drop_win32 variables instead of a mix
  of that and win32_drag/win32_drop
* Return FALSE from button handler to ensure that GTK gets the button
  event to break implicit grab
* Emit leave event on failed idroptarget_drop() calls
2018-06-10 03:17:12 +02:00
Benjamin Otte
604a85b852 dnd: Add read_value() and read_text() functions to GdkDrop
These just copy what GdkClipboard does.
2018-06-10 03:17:12 +02:00
Benjamin Otte
209ceaa844 drop: Implement shortcut for local DND
Now that we have the drop->drag, we can use the same shortcut we use in
the clipboard code to shortcut DND operations.
2018-06-10 03:17:12 +02:00
Benjamin Otte
8d1bdcef8f x11: Pass the drag source when creating a drop context 2018-06-10 03:17:12 +02:00
Benjamin Otte
431f78a992 x11: Find dest drops differently
Instead of looking at the list of contexts, just look at the current
drop context. There is only one, after all.

Then remove the is_source argument from gdk_drag_context_find().
2018-06-10 03:17:12 +02:00
Benjamin Otte
bce4305bee wayland: Store the current drag operation
Use it to detect local drags when creating drop objects.
2018-06-10 03:17:12 +02:00
Benjamin Otte
58a6c8f237 dnd: Move GdkDragAction to gdktypes.h
That way, both gdkdrag.h and gdkdrop.h can use it without one having to
include the other.
2018-06-10 03:17:12 +02:00
Benjamin Otte
637d5d633c gdk: Remove leftover type from autocleanup 2018-06-10 03:17:12 +02:00
Benjamin Otte
31e850cd7f wayland: Get rid of GdkWaylandSelection
Move data source handling into the DND code instead.
2018-06-10 03:17:12 +02:00
Benjamin Otte
cde1ee8662 wayland: Split drop context into GdkWaylandDrop
GdkWaylandDrop no longer inherits from GdkDragContext now.
2018-06-10 03:17:12 +02:00
Benjamin Otte
3c4d1356a0 wayland: Remove a bunch of unused functions 2018-06-10 03:17:11 +02:00
Benjamin Otte
1413ce13cb events: Make GdkEventDND have a GdkDrop member
... instead of a GdkDragContext.
2018-06-10 03:17:11 +02:00
Benjamin Otte
70ef32bb29 x11: Refactor DND filter
The filters now return TRUE/FALSE and no longer a GdkFilterReturn. They
also don't conform to the GdkFilterFunc typedef anymore but instead take
the arguments that they need.
2018-06-10 03:17:11 +02:00
Benjamin Otte
af70ca4ca2 x11: Use new DND event emitters 2018-06-10 03:17:11 +02:00
Benjamin Otte
de3a0dbcfd win32: Use new DND event emitters 2018-06-10 03:17:11 +02:00
Benjamin Otte
7ff9738561 wayland: Use new DND event emitters 2018-06-10 03:17:11 +02:00
Benjamin Otte
9870688e27 drop: Add private API for event emission 2018-06-10 03:17:11 +02:00
Benjamin Otte
41cc232c55 drop: Add GdkDrop:surface property
This replaces gdk_drag_context_get_dest_surface().
2018-06-10 03:17:11 +02:00
Benjamin Otte
7f715168c9 display: Don't wake up the main loop anymore
This is not needed because GTK must be run in the main thread these days,
which is the same one that runs the main loop. So when this function is
called, the main loop is awake.

https://bugzilla.gnome.org/show_bug.cgi?id=550989
2018-06-10 03:17:11 +02:00
Benjamin Otte
0d78bc7500 x11: Don't sneakily allocate memory in initializers 2018-06-10 03:17:11 +02:00
Benjamin Otte
83af276f35 dnd: Add gdk_event_get_drop()
And remove gdk_event_get_drag_context().

All GTK code now only uses GdkDrop for dropping.
2018-06-10 03:17:11 +02:00
Benjamin Otte
0964f2b2c0 wayland: Fix drop operations for new semantics 2018-06-10 03:17:11 +02:00
Benjamin Otte
e2891cd506 dnd: Remove GdkDragContext::commit_drag_status() vfunc
The idea behind the vfunc doesn't work as status updates can happen
asynchronously.

A better solution needs to be found.
2018-06-10 03:17:11 +02:00
Benjamin Otte
f40f33afb9 dnd: Make drag-motion and drag-drop signals use GdkDrop 2018-06-10 03:17:11 +02:00
Benjamin Otte
2a85948942 dnd: Make drag-data-received use a GdkDrop 2018-06-10 03:16:51 +02:00
Benjamin Otte
d4b8579488 drop: Add gdk_drop_get_drag()
For now, it'll always return NULL. We'll fix that later.
2018-06-10 03:16:51 +02:00
Benjamin Otte
b5d89153b5 widget: Make GtkWidgetClass::drag_leave() take a GdkDrop
Drag Contexts are on their way out!
2018-06-10 03:16:51 +02:00
Benjamin Otte
390012a633 dnd: Add gdk_drop_finish()
and move the vfunc into GdkDrop.
2018-06-10 03:16:51 +02:00
Benjamin Otte
60d83804d7 dnd: Get rid of gtk_drag_finish()
It's just a wrapper around gdk_drag_finish(), so use that one instead.
2018-06-10 03:16:51 +02:00
Benjamin Otte
ed8423e15c dnd: Rename gdk_drop_finish() => gdk_drag_finish()
This is a simple rename, so that we can reintroduce gdk_drop_finish()
with the GdkDrop object.
2018-06-10 03:16:51 +02:00
Benjamin Otte
63571fc5e5 dnd: Move the gdk_drag_status() function
It's now gdk_drop_status().

Also clarify the intended semantics.
2018-06-10 03:16:51 +02:00
Benjamin Otte
b36c5e48e3 dnd: Add gdk_drop_get_actions()
This uses the new method without GDK_ACTION_ASK:

Either it is a single action (queryable via gdk_drag_action_is_unique())
or it is not and then the drop target has to make a decision
(potentially by asking someone).
2018-06-10 03:16:51 +02:00
Benjamin Otte
2d6e88e3ee dnd: Make actions a private member variable
Use a setter in the backends.
2018-06-10 03:16:51 +02:00
Benjamin Otte
0c1f739c1a x11: Remove unused variables 2018-06-10 03:16:51 +02:00
Benjamin Otte
8aadfd730e wayland: Set correct variable
This got messed up in commit 7f8a8f221d.
2018-06-10 03:16:51 +02:00
Benjamin Otte
7b2e2d6bad dnd: Add gdk_drag_action_is_unique()
This will be necessary once we remove the ASK action.
2018-06-10 03:16:51 +02:00
Benjamin Otte
34c2e1b3fb dnd: Remove GDK_ACTION_DEFAULT and GDK_ACTION_PRIVATE
They're unused and nobody knows what they're supposed to men anyway.
2018-06-10 03:16:51 +02:00
Benjamin Otte
7be144b436 drop: Move gdk_drop_read_async() to GdkDrop class 2018-06-10 03:16:51 +02:00
Benjamin Otte
0ee542e588 dnd: Add GdkDrop base class for GdkDragContext
The ultimate goal of this patch series is to split GdkDragContext into
GdkDrop + GdkDrag classes for the destination and source side of a dnd
operation.

The refactoring is meant to work something like this:
1. Introduce GdkDrop as a base class
2. Make all drop related code (like GdkEvent) use GdkDrop instead of
   GdkDragContext. Move/duplicate APIs to allow that.
3. Port all drop contexts in the backends from GdkDragContext to GdkDrop
4. Delete all APIs in GdkDragContext that aren't needed anymore.
5. Make GdkDragContext no longer a GdkDrop subclass
6. Rename GdkDragContext to GdkDrag
2018-06-10 03:16:51 +02:00
Benjamin Otte
a34a5df674 picture: Don't use g_str_equal() with potential NULLs 2018-06-10 02:56:18 +02:00
Benjamin Otte
299e2ed44c docs: Add GtkEventControllerKey to index 2018-06-10 02:35:30 +02:00
Benjamin Otte
4c961349ab dnd: Ref the GdkDrop during the DND operation
It might go away if the DND takes too long otherwise...
2018-06-10 02:35:30 +02:00
Benjamin Otte
b7ecfbce21 quartz: Remove gtkdnd-quartz.c
It shows up in my git diff calls and is completely broken.
2018-06-10 02:33:53 +02:00
Benjamin Otte
40321d331f x11: Remove useless check
The check survived from GTK2 when that function could still return
GdkPixmap and GdkFont objects and was accompanied by this comment:

  /* We may receive events such as NoExpose/GraphicsExpose
   * and ShmCompletion for pixmaps
   */
2018-06-10 02:33:53 +02:00
Benjamin Otte
ce6227840d clipboard: Remove return statements from void function 2018-06-10 02:31:10 +02:00
Benjamin Otte
896f72d33b gtk-demo: Use GtkImages to select the puzzle 2018-06-10 02:25:55 +02:00
Benjamin Otte
884aaa2193 iconhelper: Always size contents to icon size
No more special casing for paintables. If you want the special case for
paintables, you should use GtkPicture.
2018-06-10 02:25:28 +02:00