summaryrefslogtreecommitdiff
path: root/gdk/wayland/gdkselection-wayland.c
Commit message (Collapse)AuthorAgeFilesLines
* dnd: Rename headersMatthias Clasen2018-07-021-1/+0
| | | | | | | Rename gdkdnd.h to gdkdrag.h, to go along with gdkdrop.h This commit includes the necessary updates to the X11, Wayland and Broadway backends. Other backends have to be updated separately.
* wayland: Get rid of GdkWaylandSelectionBenjamin Otte2018-06-181-204/+0
| | | | Move data source handling into the DND code instead.
* wayland: Redo DND offer handlingBenjamin Otte2018-05-061-245/+0
| | | | | | Instead of tracking offers in GdkWaylandSelection objects, track the pending offer in the GdkWaylandSeat and pass it to the GdkDragContext once we get an enter event.
* wayland: Create drop contexts on demandBenjamin Otte2018-04-271-6/+8
| | | | Instead of creating and reusing the same one from start to finish.
* GdkSurface: Rename various functions and variablesAlexander Larsson2018-03-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is an automatic rename of various things related to the window->surface rename. Public symbols changed by this is: GDK_MODE_WINDOW gdk_device_get_window_at_position gdk_device_get_window_at_position_double gdk_device_get_last_event_window gdk_display_get_monitor_at_window gdk_drag_context_get_source_window gdk_drag_context_get_dest_window gdk_drag_context_get_drag_window gdk_draw_context_get_window gdk_drawing_context_get_window gdk_gl_context_get_window gdk_synthesize_window_state gdk_surface_get_window_type gdk_x11_display_set_window_scale gsk_renderer_new_for_window gsk_renderer_get_window gtk_text_view_buffer_to_window_coords gtk_tree_view_convert_widget_to_bin_window_coords gtk_tree_view_convert_tree_to_bin_window_coords The commands that generated this are: git sed -f g "GDK window" "GDK surface" git sed -f g window_impl surface_impl (cd gdk; git sed -f g impl_window impl_surface) git sed -f g WINDOW_IMPL SURFACE_IMPL git sed -f g GDK_MODE_WINDOW GDK_MODE_SURFACE git sed -f g gdk_draw_context_get_window gdk_draw_context_get_surface git sed -f g gdk_drawing_context_get_window gdk_drawing_context_get_surface git sed -f g gdk_gl_context_get_window gdk_gl_context_get_surface git sed -f g gsk_renderer_get_window gsk_renderer_get_surface git sed -f g gsk_renderer_new_for_window gsk_renderer_new_for_surface (cd gdk; git sed -f g window_type surface_type) git sed -f g gdk_surface_get_window_type gdk_surface_get_surface_type git sed -f g window_at_position surface_at_position git sed -f g event_window event_surface git sed -f g window_coord surface_coord git sed -f g window_state surface_state git sed -f g window_cursor surface_cursor git sed -f g window_scale surface_scale git sed -f g window_events surface_events git sed -f g monitor_at_window monitor_at_surface git sed -f g window_under_pointer surface_under_pointer (cd gdk; git sed -f g for_window for_surface) git sed -f g window_anchor surface_anchor git sed -f g WINDOW_IS_TOPLEVEL SURFACE_IS_TOPLEVEL git sed -f g native_window native_surface git sed -f g source_window source_surface git sed -f g dest_window dest_surface git sed -f g drag_window drag_surface git sed -f g input_window input_surface git checkout NEWS* po-properties po docs/reference/gtk/migrating-3to4.xml
* GdkWindow -> GdkSurface initial type renameAlexander Larsson2018-03-201-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This renames the GdkWindow class and related classes (impl, backend subclasses) to surface. Additionally it renames related types: GdkWindowAttr, GdkWindowPaint, GdkWindowWindowClass, GdkWindowType, GdkWindowTypeHint, GdkWindowHints, GdkWindowState, GdkWindowEdge This is an automatic conversion using the below commands: git sed -f g GdkWindowWindowClass GdkSurfaceSurfaceClass git sed -f g GdkWindow GdkSurface git sed -f g "gdk_window\([ _\(\),;]\|$\)" "gdk_surface\1" # Avoid hitting gdk_windowing git sed -f g "GDK_WINDOW\([ _\(]\|$\)" "GDK_SURFACE\1" # Avoid hitting GDK_WINDOWING git sed "GDK_\([A-Z]*\)IS_WINDOW\([_ (]\|$\)" "GDK_\1IS_SURFACE\2" git sed GDK_TYPE_WINDOW GDK_TYPE_SURFACE git sed -f g GdkPointerWindowInfo GdkPointerSurfaceInfo git sed -f g "BROADWAY_WINDOW" "BROADWAY_SURFACE" git sed -f g "broadway_window" "broadway_surface" git sed -f g "BroadwayWindow" "BroadwaySurface" git sed -f g "WAYLAND_WINDOW" "WAYLAND_SURFACE" git sed -f g "wayland_window" "wayland_surface" git sed -f g "WaylandWindow" "WaylandSurface" git sed -f g "X11_WINDOW" "X11_SURFACE" git sed -f g "x11_window" "x11_surface" git sed -f g "X11Window" "X11Surface" git sed -f g "WIN32_WINDOW" "WIN32_SURFACE" git sed -f g "win32_window" "win32_surface" git sed -f g "Win32Window" "Win32Surface" git sed -f g "QUARTZ_WINDOW" "QUARTZ_SURFACE" git sed -f g "quartz_window" "quartz_surface" git sed -f g "QuartzWindow" "QuartzSurface" git checkout NEWS* po-properties
* Allow binding GdkContentFormatsBuilderEmmanuele Bassi2018-02-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | GdkContentFormatsBuilder is currently not introspectable, as it does not have a GType. We can turn it into a boxed type, but we need to implement memory management for it. The current gdk_content_formats_builder_free() function returns a newly constructed value, so we cannot use it as a GBoxedFreeFunc; additionally copying a GdkContentFormatsBuilder contents would make it a bit odd, as you could get multiple identical GdkContentFormats out of the copies. A simple approach is to model the GdkContentFormatsBuilder API to follow the GBytes one: use reference counting for memory management, and have a function to release a reference, return a GdkContentFormats, and reset the GdkContentFormatsBuilder state. For language bindings, we can provide a get_formats() function that returns the GdkContentFormats instance and resets the builder instance, leaving the reference count untouched. For C convenience we can keep gdk_content_formats_builder_free(), and make it a wrapper around gdk_content_formats_builder_get_formats(), with the guarantee that it'll free the builder instance regardless of its current reference count. https://bugzilla.gnome.org/show_bug.cgi?id=793097 https://blogs.gnome.org/otte/2018/02/03/builders/
* wayland: Use g_message for loggingMatthias Clasen2018-01-141-2/+2
| | | | g_printerr is not the best for this.
* Make gdk logging per-displayMatthias Clasen2018-01-141-11/+10
| | | | | | | As far as possible, use per-display debug flags. This will minimize the debug spew that we get from the inspector if it is running on a separate display.
* dnd: Remove gdk_drag_get_selection()Benjamin Otte2017-12-141-89/+18
| | | | | | | | | Without selections, drags can't have them either. Also included is removing the selection from GtkSelectionData. Includes a bunch of crude cleanups to Wayland code that no longer has to care about selection atoms.
* gdk: Remove propertiesBenjamin Otte2017-12-141-171/+0
| | | | | | They are not used anymore. Gone with them are PropertyNotify events.
* gdk: Remove selection definesBenjamin Otte2017-12-141-1/+0
| | | | | | And with it, remove the selections section from the docs. So selections are gone for good now.
* gdk: Remove gdk_selection_convert()Benjamin Otte2017-12-141-373/+0
| | | | It's not used anymore.
* gdk: Remove ability to own a selectionBenjamin Otte2017-12-131-86/+1
| | | | | With this, the GDK_EVENT_SELECTION_REQUEST and GDK_EVENT_SELECTION_CLEAR and the associated GtkWidget signals are gone, too.
* gdk: Remove gdk_selection_add_targets()Benjamin Otte2017-12-131-47/+0
| | | | | | | It's not needed anymore, now that we can look at the content provider's formats. Alose remove all the API in GTK that was used to set it.
* dnd: Pass content to gdk_drag_begin()Benjamin Otte2017-12-131-87/+33
| | | | | | | | | | | | | | | | Instead of just passing the GdkContentFormats, we are now passing the GdkContentProvider to gdk_drag_begin(). This means that GDK itself can now query the data from the provider directly instead of having to send selection events. Use this to provide the private API gdk_drag_context_write() that allows backends to pass an output stream that this data will be written to. Implement this as the mechanism for providing drag data on Wayland. And to make this all work, implement a content provider named GtkDragContent that is implemented by reverting to the old DND drag-data-get machinery inside GTK, so for widgets everything works just like before.
* Make sure events have displaysMatthias Clasen2017-12-121-4/+12
| | | | | This seems to be necessary if you want to call gdk_display_put_event on them.
* gdk: Remove gdk_event_put(), peek() etcBenjamin Otte2017-12-131-4/+4
| | | | | We don't want to treat events like they don't belong to displays. So instead, people should use gdk_display_put/peek/get_event().
* wayland: Add primary clipboard subclassBenjamin Otte2017-12-031-176/+12
| | | | | | | | | I decided to put this in a custom subclass, because then I could keep the whole gtk primary protocol self-contained. The other option would have been reusing GdkWaylandClipboard, but that didn't seem worth it, especially because that code needs to interact with the DND machinery, while the primary doesn't.
* wayland: Implement taking over the clipboardBenjamin Otte2017-12-031-64/+4
| | | | | The clipboard is now complete. That was fast.
* wayland: Implement reading the clipboardBenjamin Otte2017-12-031-0/+19
| | | | | We now keep track of what's in the clipboard and allow people to read its contents.
* wayland: Fix indentation of previous commitChristophe Fergeau2017-11-291-4/+5
|
* wayland: emit GDK_SELECTION_CLEAR on owner changesChristophe Fergeau2017-11-291-0/+24
| | | | | | | | | | | | | The wayland backend currently never emits GDK_SELECTION_CLEAR events. GtkClipboard uses this signal in order to clear the clipboard owner when the selection is set to something outside the application. This commit ensures the wayland backend emits GDK_SELECTION_CLEAR before setting the clipboard owner to NULL, as this means we lost the selection. Signed-off-by: Christophe Fergeau <cfergeau@redhat.com> https://bugzilla.gnome.org/show_bug.cgi?id=790031
* wayland: Remove unused data structureChristophe Fergeau2017-11-291-6/+0
| | | | | | Signed-off-by: Christophe Fergeau <cfergeau@redhat.com> https://bugzilla.gnome.org/show_bug.cgi?id=790031
* gdk: Sanitize GdkContentFormats APIBenjamin Otte2017-11-201-8/+7
| | | | | | | | | | Make sure the API reflects the idea that GdkContentFormats is a set containing mime types. In particular, treat the object itself as a plural - it's named content format`S' after all - and therefor use the correct verb form. Also make GdkContentFormats keep an array instead of a list, now that it's immutable.
* gdk: Make GdkContentFormats immutableBenjamin Otte2017-11-201-2/+12
|
* gdkdnd: Make GdkDragContext->formats a GdkContentFormatsBenjamin Otte2017-11-201-21/+15
| | | | Instead of it being a GList of GdkAtoms.
* Remove gdkprivate.hMatthias Clasen2017-11-171-1/+0
| | | | | This is one-too-many private headers. Move the few declarations here to gdkinternals.h.
* gdk: Replace GDK_NONE with NULLBenjamin Otte2017-11-151-3/+3
|
* gdk: Turn GdkAtom into a const char *Benjamin Otte2017-11-151-4/+4
| | | | | Instead of an integer, it is now a char pointer. We also use g_intern_string() instead of doing the interning ourselves.
* selection: Remove #ifdef WAYLANDBenjamin Otte2017-11-151-8/+8
| | | | | | | Instead, turn the functions into backend API: gdk_broadway_display_add_selection_targets() gdk_broadway_display_clear_selection_targets() Remove the old per-backend functions, too.
* wayland: Mark private function as staticEmmanuele Bassi2017-04-281-1/+1
| | | | | The selection_lookup_offer_by_atom() function is private to the file and not used elsewhere.
* wayland: Add some more debug spewMatthias Clasen2016-08-251-0/+9
|
* wayland: Replace g_debug by GDK_NOTEMatthias Clasen2016-08-251-12/+16
| | | | We have this framework, lets use it.
* wayland: Separate selection buffers and other per-selection atom dataCarlos Garnacho2016-06-301-38/+60
| | | | | | | | | | | | | | | This has most notably impact in selection buffers, because those were shared across all selection atoms. This turned out wrong on 2 situations: - Because the selection atom was set at SelectionBuffer creation time, the GDK_SELECTION_NOTIFY events generated will have unexpected info if the buffer is attempted to be reused for another selection. - Anytime different selections imply different stored content for the same target. This is better separated into per-selection buffers, so it's not possible to get collisions if a same target is used across different selections. https://bugzilla.gnome.org/show_bug.cgi?id=768177
* wayland: Implement gdk_utf8_to_string_targetCarlos Garnacho2016-06-301-1/+59
| | | | | | | | | The sanitize_utf8() function has been copied from X11 so both backends behave the same. This allows interaction with older clients (mainly through Xwayland, and the STRING selection target) that request non-utf8 text. https://bugzilla.gnome.org/show_bug.cgi?id=768082
* wayland: Clean up naming of GdkWaylandDisplay pointersJonas Ã…dahl2016-04-261-2/+2
| | | | | | | | | | | | | | | | | | | The naming of pointers to GdkWaylandDisplay's were inconsistent. Running the following commands in gtk+/gdk/wayland illustrate the inconsistency: $ grep -r '\<display_wayland\>' *.[ch] | wc -l 195 $ grep -r '\<wayland_display\>' *.[ch] | wc -l 81 This patch renames all occurrences of "wayland_display" to "display_wayland". This is also consistent with naming in the X11 backend. A couple of whitespace changes were done as well in places where the rename was already done, that added line breaks to long lines that stood out. https://bugzilla.gnome.org/show_bug.cgi?id=765474
* wayland: Make data_source_target() an empty stubCarlos Garnacho2016-03-091-26/+0
| | | | | | | | | | | | | | This request actually means nothing to the upper GDK layers, we used to preempt a GDK_SELECTION_REQUEST event, but this is too eager, and not like things work in X11. Originally in wayland, this event may be used for feedback purposes. We however don't perform any mimetype-based feedback, so we can safely ignored. This makes data_source_send() the only place where we actually trigger GDK_SELECTION_REQUEST, this one is conceptually the same than the X11 selection request event.
* wayland: Allow 0-size writes in selection/dndCarlos Garnacho2016-03-091-2/+1
| | | | | It's not something we should be forbidding explicitly, definitely no-op is not the best option.
* wayland: Clear more thoroughly the source-side data on dnd_finishedCarlos Garnacho2016-03-091-1/+1
| | | | The targets should also be unset.
* wayland: Unset the source-side DnD fd after passing it to the streamCarlos Garnacho2016-03-091-0/+2
| | | | The ownership is given to the stream, so unset it here.
* wayland: Strip newlines from g_warning and g_errorMatthias Clasen2016-02-281-1/+1
| | | | g_logv adds one for us already.
* wayland: Survive without primary selectionMatthias Clasen2016-02-261-4/+7
| | | | | | I am testing GTK+ master against mutter 3.19.90, so I'd like GTK+ to survive even when the compositor does not support the primary selection interface.
* wayland: Use the page size as the selection buffer sizeCarlos Garnacho2016-02-261-6/+15
| | | | And ensure we don't attempt to read EOF twice, once is enough.
* wayland: Implement the (so far internal) primary selection protocolCarlos Garnacho2016-02-261-56/+237
| | | | | | | | Implement it using the internal copy of the protocol. Otherwise, we just deal with it the same than clipboard selection, just mapping it to the PRIMARY atom instead of the CLIPBOARD one. https://bugzilla.gnome.org/show_bug.cgi?id=762561
* gdk: Add GdkDragCancelReason enum as argument to GdkDragContext::cancelCarlos Garnacho2016-02-151-1/+1
| | | | | | | | | | | | We should conform to a minimal set of reasons for the gtk side to emit a better GtkDragResult than GTK_DRAG_RESULT_ERROR. This fixes the notebook tab DnD feature, where we rely on GTK_DRAG_RESULT_NO_TARGET. In the wayland side, unfortunately we can't honor either NO_TARGET nor USER_CANCELLED, we don't know of the latter, so we could return false positives on the former. https://bugzilla.gnome.org/show_bug.cgi?id=761954
* wayland: Implement DnD actions as per wl_data_device v3Carlos Garnacho2016-01-191-36/+155
| | | | | Implement as a managed GdkDragContext, which actually fits nicely with the drag-and-drop model in wayland.
* wayland: Avoid GdkDeviceManager APIsCarlos Garnacho2015-12-161-6/+2
| | | | | | | In most places, we can do with the pointer/keyboard of the default seat instead of the client pointer. We can also remove some code from gdk_input_init() because we know for sure there's no floating devices to care about here.
* wayland: Invert drop_finished/button release call orderCarlos Garnacho2015-12-011-1/+1
| | | | | | If we "release" the button first, the drag will be eventually cancelled, we must first signal GDK_DROP_FINISHED, and then release the button so the success status prevails.
* wayland: Store requested target on GdkWaylandSelectionCarlos Garnacho2015-12-011-6/+4
| | | | | | | | It doesn't make a lot of sense to have this stored as data offer data, rather together with the source_targets array, which is what we're poking here in the end. https://bugzilla.gnome.org/show_bug.cgi?id=758713