Commit Graph

7971 Commits

Author SHA1 Message Date
Benjamin Otte
2d86c1a869 x11: Make clipboard use translate-event signal 2017-12-13 00:56:52 +01:00
Benjamin Otte
c93ddf62c3 gdk: Clean up marshalers
Don't generate marshallers that are not needed.

Use the default ones if they exist.
2017-12-13 00:56:52 +01:00
Benjamin Otte
0d1ea05658 x11: Add GdkX11Display:translate-event signal
This is supposed to replace gdk_window_add_filter() in the long run.
2017-12-13 00:56:52 +01:00
Benjamin Otte
f34297cfba x11: Constify XEvent usage 2017-12-13 00:56:52 +01:00
Benjamin Otte
8a453924a0 gdk: Remove gdk_event_put(), peek() etc
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().
2017-12-13 00:56:52 +01:00
Benjamin Otte
5df527edaf x11: Refactor code
This is in preparation for DND.

It moves a lot of code from gdkclipboard-x11.c to
gdkselectionoutputstream-x11.c to untangle it from GdkX11Clipboard
usage.
2017-12-13 00:56:52 +01:00
Benjamin Otte
80dcdd3df6 gdk: Remove unused function
Fun fact: This function was never used.
2017-12-13 00:56:52 +01:00
Benjamin Otte
643a6c2311 gdk: Remove gdk_drag_manage_dnd()
Instead, pass the actions as part of gdk_drag_begin() and insist DND is
always managed.

A new side effect is that gdk_drag_begin() can now return %NULL.
2017-12-11 01:46:33 +01:00
Benjamin Otte
218efa62ef dnd: Pass dx/dy instead of x_root/y_root
This way, we don't need root coordinates when computing the dnd start
position.
2017-12-11 01:02:31 +01:00
Benjamin Otte
a7c3c794df dnd: Make gdk_drag_context_set_device() private
There's no need to call it from GTK anymore, because we pass the device
to gdk_drag_begin().
2017-12-11 01:02:31 +01:00
Benjamin Otte
565d8325c4 gdk: Remove outdated gdk_drag_begin() alternatives
There's only one that's ever used, so delete the others and rename this
one to gdk_drag_begin().
2017-12-11 01:02:31 +01:00
Daniel van Vugt
3b2f939590 Fix irregular gdk_frame_clock_get_frame_time
This fixes stuttering in animations that rely on the regularity of
gdk_frame_clock_get_frame_time.

https://bugzilla.gnome.org/show_bug.cgi?id=787665

BEFORE
gdkgears:
58 FPS and visibly stuttering
gnome-maps on a 59.95Hz monitor:
"paint" g_get_monotonic_time +17278μs, gdk_frame_clock_get_frame_time +17278μs
"paint" g_get_monotonic_time +17449μs, gdk_frame_clock_get_frame_time +17426μs
"paint" g_get_monotonic_time +17620μs, gdk_frame_clock_get_frame_time +17600μs

AFTER
gdkgears:
60 FPS and smoother
gnome-maps on a 59.95Hz monitor:
"paint" g_get_monotonic_time +18228μs, gdk_frame_clock_get_frame_time +16680μs
"paint" g_get_monotonic_time +15010μs, gdk_frame_clock_get_frame_time +16680μs
"paint" g_get_monotonic_time +17134μs, gdk_frame_clock_get_frame_time +16680μs
2017-12-09 20:52:36 -05:00
Benjamin Otte
803cbd576f dnd: Introduce gdk_drop_read_async() and use it
This is the replacement for selection usage.

Backend implementations for X11 (missing support for backwards compat
formats like COMPOUND_TEXT) and Wayland are included.

GTK code should be adapted to use gdk_drop_read_*() functions instead
of gtk_drag_get_data().
2017-12-10 01:09:14 +01:00
Benjamin Otte
963264a73a gdk: Fix wrong usage of g_task_propagate_pointer()
The return value is transfer full, not transfer none.
2017-12-10 01:09:14 +01:00
Benjamin Otte
0d31eb8670 dnd: Add gdk_drag_context_get_display()
Also turn it into a readable, construct-only property.

Every GDK object should have this. (Apart from GdkDisplay, obviously.)
2017-12-10 01:09:14 +01:00
Benjamin Otte
815cd0ed68 gdk: Include gio.h in gdktypes.h
It's where we include all our external dependencies.

This way, we don't have to include it in all headers again and again.
2017-12-10 01:09:14 +01:00
Philip Withnall
276c462553 mir: Fix potential use of NULL GDBusConnection
If we fail to connect to the session bus, it would be a bit silly to
immediately try and use that NULL connection.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=668590
2017-12-08 09:55:27 +00:00
Jonas Ådahl
6412d25602 wayland: Destroy the xdg_imported after the wl_surface
This way the window manager can handle destruction while having the
transient-for relationship still valid.

https://bugzilla.gnome.org/show_bug.cgi?id=791062
2017-12-07 22:13:30 -05:00
Jonas Ådahl
7c743e6f41 wayland: Maybe postpone xdg-foreign state setup until mapping
In order to map a window with the correct initial parent-child
relationship when a modal dialog is set up to be a child of an imported
foreign window, the relationship must be set up before the window is
mapped.

In order to do this, if a window is not yet mapped, postpone the
relationship setup until when the window is eventually mapped.

https://bugzilla.gnome.org/show_bug.cgi?id=791062
2017-12-07 22:13:30 -05:00
Carlos Garnacho
7531be3510 gdk: Add GDK_SEAT_CAPABILITY_TABLET_PAD
Tablet pads don't adapt really well to any other capability, so add a
distinct one to be able to query those properly.

https://bugzilla.gnome.org/show_bug.cgi?id=790920
2017-12-07 21:27:33 -05:00
Carlos Garnacho
4c45022ed0 gdk: Add gdk_seat_get_master_pointers()
Traditionally (and on most backends) there's a single master pointer driven
by all pointing devices. The notable exception is Wayland though, where
master pointing devices are created per capability in the case of
pointer/touch, and one for each drawing tablet.

This function call makes it easy to access all these.

https://bugzilla.gnome.org/show_bug.cgi?id=790920
2017-12-07 21:27:14 -05:00
Alexander Larsson
df2716a109 broadway: Add broadway_server_lookup_surface helper 2017-12-05 16:10:06 +01:00
Alexander Larsson
2cad2c21e6 broadway: Make the use of next_texture_id clearer
It used to actually be pre-incremented, so meant like "one before
next id".
2017-12-05 15:54:36 +01:00
Alexander Larsson
d141bd4121 broadway: Use "surface" instead of window/toplevel for browser object
Als fixes indentation/tabs and removes some unused code.
2017-12-05 15:50:34 +01:00
Alexander Larsson
e80ad0e0f9 broadway: Remove references to unused BROADWAY_EVENT_DELETE_NOTIFY 2017-12-05 15:50:34 +01:00
Alexander Larsson
4694885015 broadway: Remove now unused toplevel surface 2017-12-05 15:50:34 +01:00
Emmanuele Bassi
51db8f8f53 Ensure that the path is always set
We are using `path` unconditionally, but it can be conditionally filled.
To avoid inconsistent internal state, and a compiler warning, let's
assert that the variable is always set.
2017-12-05 11:07:46 +00:00
Emmanuele Bassi
66f7f1768f Fix the build
Use the right argument name in the preconditions check.
2017-12-05 11:02:20 +00:00
Matthias Clasen
4a11baa372 gdk: Documentation improvements 2017-12-04 23:52:48 -08:00
Matthias Clasen
b5c62cf86f Revert "clipboard: Add gdk_clipboard_set()"
This reverts commit dc50e0637f.

This broke the build.
2017-12-04 23:09:54 -08:00
Benjamin Otte
dc50e0637f clipboard: Add gdk_clipboard_set()
This API allows specifying a GType and va_args of a value of that type
to set the clipboard contents. This massively simplifies setting weird
object types into the clipboard.
2 example patches included in this patch are the GtkTextBuffer and the
file list in the file chooser.

Using gobject-introspection, this should work without specifying the
type, so that you can literlally say
  clipboard.set ("Hello World")
or
  clipboard.set (pixbuf)
which is why I've also marked all other setters as (skip). They just
exist in C as wrappers for type safety reasons.
2017-12-05 05:29:03 +01:00
Benjamin Otte
4658d7ea54 dnd: Remove x/y coordinates from drag-data-received
This is in preparation of using input streams to show that these
coordinates aren't needed most of the time and can otherwise be saved
during GtkWidget::drag-drop.
2017-12-05 05:29:00 +01:00
Matthias Clasen
6f00c1b626 Expand the docs
Cross-reference the serializers.
2017-12-04 16:28:33 -08:00
Matthias Clasen
ddcd687617 Document gdk_content_provider_contents_changed 2017-12-04 16:08:32 -08:00
Matthias Clasen
91499d4b0e gdk: Expand the clipboard documentation 2017-12-04 16:06:02 -08:00
Matthias Clasen
77f0e678ec gdk: Fill in some blanks in the docs
This is just an initial cut; more work is needed.
2017-12-04 15:58:30 -08:00
Matthias Clasen
d5afb9e805 Add a long description for GdkTexture 2017-12-04 11:04:02 -08:00
Benjamin Otte
2f12eb616a wayland: Initialize variable
Otherwise we get NULL-warnings when we try to use (read: unref) it.
2017-12-04 18:28:53 +01:00
Piotr Drąg
794a2bfd00 Use Unicode quotation marks in new strings
See https://developer.gnome.org/hig/stable/typography.html

https://bugzilla.gnome.org/show_bug.cgi?id=772371
2017-12-03 18:38:39 +01:00
Руслан Ижбулатов
bcc77e169c GDK W32: Remove stray debug code
I have no idea how this slipped into master (these two lines are not present
in the same commit that went into gtk-3-22).
2017-12-03 06:10:03 +00:00
Matthias Clasen
6ab72b2653 Remove GdkDragProtocol from the api
...together with apis that return it. We were not using this
information in GTK+ at all, so no need to provide it.
2017-12-03 06:41:08 +01:00
Matthias Clasen
8b1b9f8c55 Drop api that is only for unmanaged dnd
These functions are not needed as public api anymore.
2017-12-03 06:24:24 +01:00
Benjamin Otte
ff577e6c2c wayland: Add primary clipboard subclass
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.
2017-12-03 05:46:49 +01:00
Benjamin Otte
ef69daacdf wayland: Implement taking over the clipboard
The clipboard is now complete.
That was fast.
2017-12-03 05:46:49 +01:00
Benjamin Otte
82002eabfe wayland: Implement reading the clipboard
We now keep track of what's in the clipboard and allow people to read
its contents.
2017-12-03 05:46:49 +01:00
Benjamin Otte
00192266a1 wayland: Add skeleton for a GdkClipboardWayland
Creates the source file and a custom subclass and makes sure it's used
by GDK.
2017-12-03 05:46:49 +01:00
Benjamin Otte
437d70f569 gdk: Get rid of owner change events
They're unused now.
2017-12-03 05:46:49 +01:00
Benjamin Otte
2d5c82b4ec gtk: Remove GtkClipboard 2017-12-03 05:46:49 +01:00
Benjamin Otte
18bf0eb61a clipboard: Change image convenience APIs
Don't use pixbufs anymore, use textures.
2017-12-03 05:46:49 +01:00
Benjamin Otte
a34836f35b gdk: Add (de)serializers for GDK_TYPE_TEXTURE
We want to use textures more, so we should be able to use them for
copy/paste and dnd.
2017-12-03 05:46:49 +01:00