Commit Graph

8278 Commits

Author SHA1 Message Date
Matthias Clasen
a732ebf521 Stop using settings for modules
The Wayland backend was already not supporting this setting
since it is an XSetting that is not backed by a GSetting.

Drop this setting altogether, since we will stop supporting
general-purpose modules.
2018-02-18 09:41:29 -05:00
Carlos Garnacho
f22403a317 gdk/wayland: Use GDK_AVAILABLE_IN_ALL
GDK_AVAILABLE_IN_4_0 makes it unavailable till 4.0, but we want
it now.
2018-02-16 19:36:41 +01:00
Tom Schoonjans
ffa85a41d0 gdkquartz.h: export pasteboard functions 2018-02-16 12:16:02 +00:00
Matthias Clasen
c2531b7ff2 Merge branch 'wip/carlosg/imwayland' into 'master'
modules: Add wayland IM implementation

See merge request GNOME/gtk!4
2018-02-15 03:01:43 +00:00
Emmanuele Bassi
7f25cc9d4e Rewrite toarray Perl script to Python
We don't need to shell out to Perl to generate a C array out of a text
file.
2018-02-14 15:51:45 +00:00
Emmanuele Bassi
490899e271 x11: Do not include fallback-c89.c
We're definitely using a C99-compliant toolchain, if we're building the
X11 backend.
2018-02-14 11:15:31 +00:00
Carlos Garnacho
3b568fbe77 gdk/wayland: Add GdkDisplay call to query available globals
The internal known_globals hashtable is used to carry accounting for
interfaces that depend on others (as ordering is not guaranteed), extend
its usage so it also keeps track of unimplemented interfaces (here at
least).

The API call will then use this to allow querying the globals offered by
the compositor, it will be useful to determine whether we can use
text-input protocols or should fallback to other IMs.
2018-02-13 15:47:57 +01:00
Benjamin Otte
365707e4eb x11: Run event filters on all windows
The event filters that were split out in commit
65beb0fc22 need to be run for every event
window and not just for the root window.
2018-02-13 10:34:06 +01:00
Matthias Clasen
f771046a00 gdk: Add some more docs
Add another reference to the docs.
2018-02-11 00:41:31 +00:00
Matthias Clasen
c289d7c176 gdk: Expand the docs a bit
Add a reference to the getter to the GdkKeymap::direction-changed
signal docs.
sh: indent: command not found
2018-02-10 23:46:14 +00:00
Matthias Clasen
89f6b8751e Remove gdk_window_add_filter
Drop the public filtering API. The x11 backend already has
the ::xevent signal as replacement. The win32 backend needs
a similar signal to replace filtering.

Reshuffle header inclusions in the x11 backend a little bit
to avoid a cyclic inclusion between gdkprivate-x11.h and
gdkdisplay-x11.h that is otherwise causing problems.
2018-02-07 15:12:03 -05:00
Matthias Clasen
65beb0fc22 x11: Don't use gdk_window_add_filter
This function is going away.
2018-02-07 12:24:40 -05:00
Matthias Clasen
1a9a0c2577 Drop a leftover declaration
The function gdk_add_option_entries does not exist anymore.
2018-02-06 01:17:18 -05:00
Matthias Clasen
5b63583c0b Make gdk_event_get_history public
This function is meant to be public, but was missing
an annotation in the header.
2018-02-06 01:17:17 -05:00
Matthias Clasen
0fe3fafac1 gdk: Drop gdk_x11_window_set_frame_extents
This function is unused and has been deprecated
for a long time.
2018-02-06 01:16:32 -05:00
Matthias Clasen
4c150d8eb5 The big versioning cleanup
Remove all the old 2.x and 3.x version annotations.
GTK+ 4 is a new start, and from the perspective of a
GTK+ 4 developer all these APIs have been around since
the beginning.
2018-02-06 01:16:32 -05:00
Matthias Clasen
2616e6857c gdk: Add some missing autocleanup definitions
Best to be consistent.
2018-02-06 01:16:32 -05:00
Carlos Garnacho
f964fe3ee5 gdk: Rename gdk_event_get_history() to get_motion_history()
It only applies to GDK_MOTION_NOTIFY events, so this is a more descriptive
name. Also add Since tag in docs, and GDK_AVAILABLE_IN_3_94.
2018-02-05 16:05:34 +01:00
Emmanuele Bassi
3b0e6720af build: Use pkg-config to find Vulkan
The standard Vulkan SDK ships with a pkg-config file, like a modern
library should.

We should fall back to finding the library and header only for platforms
where pkg-config is not really a thing.

Based on a patch by: Daniel Stone <daniels@collabora.com>

https://bugzilla.gnome.org/show_bug.cgi?id=793181
2018-02-05 14:01:59 +00:00
Emmanuele Bassi
bfcb978079 Drop the last mentions of motion hint events
The GDK_POINTER_MOTION_HINT_MASK enumeration value is gone, but we're
still keeping around the "is_hint" field in GdkEventMotion, even though
every backend sets it to `false` — except for the core X11 device
manager.
2018-02-05 14:00:51 +00:00
Matthias Clasen
fd25a8cdf2 Drop the mir backend
Mir is in the process of switching over to the Wayland protocol,
so we don't need to maintain a separate backend, going forward.
2018-02-05 07:50:17 +01:00
Timm Bäder
cd6408b47a gdk: fix a format string warning 2018-02-04 15:48:47 +01:00
Emmanuele Bassi
2cbe094b91 Allow binding GdkContentFormatsBuilder
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/
2018-02-03 16:24:13 +01:00
Emmanuele Bassi
2432e53652 Remove all gdk_threads_* entry points
Now that we don't use them anywhere, it's time for them to go.

https://bugzilla.gnome.org/show_bug.cgi?id=793124
2018-02-03 12:07:10 +01:00
Emmanuele Bassi
888dfe499d Drop the Big GDK Lock
GDK has a lock to mark critical sections inside the backends.
Additionally, code that would re-enter into the GTK main loop was
supposed to hold the lock.

Back in the Good Old Days™ this was guaranteed to kind of work only on
the X11 backend, and would cause a neat explosion on any other GDK
backend.

During GTK+ 3.x we deprecated the API to enter and leave the critical
sections, and now we can remove all the internal uses of the lock, since
external API that uses GTK+ 4.x won't be able to hold the GDK lock.

https://bugzilla.gnome.org/show_bug.cgi?id=793124
2018-02-03 12:07:10 +01:00
Emmanuele Bassi
c655759cef Replace gdk_threads_add_timeout* with g_timeout_add()
The main GDK thread lock is not portable and deprecated.

The only reason why gdk_threads_add_timeout() and
gdk_threads_add_timeout_full() exist is to allow invoking a callback
with the GDK lock held, in case 3rd party libraries still use the
deprecated gdk_threads_enter()/gdk_threads_leave() API.

Since we're removing the GDK lock, and we're releasing a new major API,
such code cannot exist any more; this means we can use the GLib API for
installing timeout callbacks.

https://bugzilla.gnome.org/show_bug.cgi?id=793124
2018-02-03 12:06:58 +01:00
Emmanuele Bassi
334acbfc39 Replace gdk_threads_add_idle* with g_idle_add()
The main GDK thread lock is not portable and deprecated.

The only reason why gdk_threads_add_idle() and
gdk_threads_add_idle_full() exist is to allow invoking a callback with
the GDK lock held, in case 3rd party libraries still use the deprecated
gdk_threads_enter()/gdk_threads_leave() API.

Since we're removing the GDK lock, and we're releasing a new major API,
such code cannot exist any more; this means we can use the GLib API for
installing idle callbacks.

https://bugzilla.gnome.org/show_bug.cgi?id=793124
2018-02-03 12:06:58 +01:00
Benjamin Otte
38b25599d8 texture: Add sanity checks to constructors
width, height and GL texture ID may not be 0, so return_if_fail() if
they are.
2018-02-02 14:59:23 +01:00
Benjamin Otte
df0b4d6684 texture: Make the texture id a guint
Texture IDs are unsigned, so treat them like that.
2018-02-02 14:59:23 +01:00
Emmanuele Bassi
b8828023e6 docs: Annotate gdk_keymap_get_display()
Avoid a warning from the introspection scanner.
2018-02-01 16:13:53 +01:00
Benjamin Otte
02892c59d1 dnd: Remove unused member variable 2018-01-31 13:21:26 +01:00
Benjamin Otte
bdd2f68ab5 dnd: Move GdkDragProtocol to X11
It's not needed in the generic implementation, so don't have it there.
2018-01-31 13:21:26 +01:00
Benjamin Otte
3e0fab6b93 dnd: Remove 2 vfuncs that aren't needed
They're only used inside the X11 backend, and the backend can just call
its own function.
2018-01-31 13:21:26 +01:00
Jason Gerecke
6fd6ff2ea1 wayland: Add support for BTN_STYLUS3
BTN_STYLUS3 is defined by the Linux 4.15 kernel and is sent when the
third button on a stylus is pressed. At the moment, only Wacom's "Pro
Pen 3D" has three stylus buttons. Pressing this button triggers a button
8 event to be sent under X11, so we use the same mapping here.

https://bugzilla.gnome.org/show_bug.cgi?id=790033
2018-01-30 21:32:07 +01:00
Matthias Clasen
f00f5508d4 gdk: Stop referring to ::key-press/release-event
These signals are going away, don't mention them in
the docs.
2018-01-24 12:04:32 +01:00
Emmanuele Bassi
f83b3c8af2 Enforce UTF-8 encoding when opening C files
We have a couple of Python 3.x scripts that parse C files, and since C
does not have any encoding, we need to force one ourselves, to avoid the
case when we're running the build in a non-UTF-8 locale.

https://bugzilla.gnome.org/show_bug.cgi?id=792497
2018-01-23 14:04:49 +01:00
Timm Bäder
fb81686a89 vulkan: Fix release builds 2018-01-21 15:23:17 +01:00
Simon McVittie
e22990302a Set GDK_WINDOW_STATE_TILED if any edge is tiled
This state flag is used in several places in GTK+, for example to
ignore RESIZE_INC hints if tiled. Setting it is also necessary for
backwards compatibility with applications that changed their behaviour
when tiled, such as GNOME Terminal and its MATE fork.

Signed-off-by: Simon McVittie <smcv@debian.org>

https://bugzilla.gnome.org/show_bug.cgi?id=789357
2018-01-20 13:10:49 +01:00
Georges Basile Stavracas Neto
42ff22f222 display-x11: Unset tiled state if _GTK_EDGE_CONSTRAINTS is supported
Commit c415bef5de introduced support for the new _GTK_EDGE_CONSTRAINTS
atom. If the compositor supports that atom, however, we were always
setting the tiled state, even if no actual tiling information is
available, where the correct action is to completely remove any traces
of the tiled state.

Fix that by correctly removing the tiled state when compositor supports
_GTK_EDGE_CONSTRAINTS Xatom.

https://bugzilla.gnome.org/show_bug.cgi?id=788516
2018-01-20 13:10:42 +01:00
Matthias Clasen
e1d81d096c Document new texture api 2018-01-17 21:45:08 -05:00
Matthias Clasen
5e302ae2cc Add a way to release GL resources
The inspector may hold on to render nodes and textures
beyond the lifetime of the widget (and thus the GL
resources). To handle this situation, allow the widget
to explicitly release the GL resources, and make
the texture available on the clent-side as a cairo
surface. This lets the recorder still show the content
after the widget is gone.
2018-01-17 20:15:45 -05:00
Matthias Clasen
b366ea84a7 gdk: Add a gl texture implementation
This will be used to pass a GL textures from the application
(or rather, GtkGLArea) down to the GSK GL renderer.
2018-01-17 11:56:47 -05:00
Matthias Clasen
77bab4e027 gdk: Drop some unused cursor apis
The query function for cursor sizes and capabilities
are not very interesting. At least, they are not used
in GTK+, and all backends but X11 just hardcode
made-up values anyway. So, lets drop them.
2018-01-16 23:32:01 -05:00
Matthias Clasen
3358c1fb32 vulkan: use GDK_DISPLAY_NOTE
Where we have a display, we should use the per-display logging.
2018-01-15 08:01:01 -05:00
Timm Bäder
e048889a12 vulkan: Fix build
This was changed in e151058dff but
GDK_NOTE only takes 2 arguments.
2018-01-15 11:02:37 +01:00
Matthias Clasen
845ae20954 wayland: Use g_message for logging
g_printerr is not the best for this.
2018-01-14 17:05:04 -05:00
Matthias Clasen
1d2606dc94 Drop the cairo-recording debug flag
It is not very useful. The cairo-image option on the
other hand is has been useful in tracking down problems
in the past, so we'll keep it.
2018-01-14 17:05:04 -05:00
Matthias Clasen
08dc2cd6a8 Drop the gl-always debug option
This doesn't seem very useful.
2018-01-14 17:05:04 -05:00
Matthias Clasen
e151058dff Make gdk logging per-display
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.
2018-01-14 17:05:04 -05:00
Matthias Clasen
c5fc841285 gdk: Reorganize env vars
Drop GDK_GL, GDK_VULKAN and GDK_RENDERING_MODE.
Merge the useful bits into GDK_DEBUG.
Drop unused debug flags (CURSOR).
2018-01-14 17:05:04 -05:00
Matthias Clasen
c2793de6e2 Add a display property to keymaps
This is a general pattern we want to follow for all
objects in GDK. Also add a getter.
2018-01-14 17:05:04 -05:00
Daniel Boles
e99992669c GdkMonitor: Fix link to nonexistent Display method
There is no gdk_display_get_monitors(). Instead, we have to use
gdk_display_get_n_monitors() and gdk_display_get_monitor(int).
2018-01-13 20:06:39 +00:00
Timm Bäder
badcf022bf gdk: Remove unused GdkStatus enum 2018-01-12 22:34:22 +01:00
Matthias Clasen
d1eb8cd809 x11: Only set the keymap display once
Not necessary to do this more than once.
2018-01-12 09:24:08 -05:00
Matthias Clasen
d72508590b wayland: Set display on keymaps
This was forgotten so far: The display of keymaps
was NULL.
2018-01-12 09:23:59 -05:00
Matthias Clasen
76461a8004 Quiet a compiler warning
Avoid this warning the other way, without bumping the libvulkan
dependency.
2018-01-10 07:35:46 -05:00
Matthias Clasen
5009c691ac Revert "Quiet a compiler warning"
This reverts commit 888f289114.
2018-01-10 07:34:36 -05:00
Руслан Ижбулатов
266d4b31b8 GDK W32: Remove non-managed DnD code
All DnD is now managed in GDK.

This commit also rearranges some code in _gdk_win32_window_drag_begin().

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-01-10 16:57:31 +08:00
Руслан Ижбулатов
b11b342ad4 GDK W32: stop using the OWNERCHANGE event
It was removed completely. For now just comment out the code that used to emit it.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-01-10 16:57:24 +08:00
Timm Bäder
b6ee3490c3 GdkDrawingContext: Add missing nullable annotation 2018-01-10 08:46:22 +01:00
Matthias Clasen
4dbae1d4bf Drop unused GDK_GL values
And document the existing ones.
2018-01-10 00:02:23 -05:00
Matthias Clasen
0290b28564 Drop unused debug keys
The multihead, xim and xinerama keys do nothing anymore.
2018-01-09 23:21:33 -05:00
Matthias Clasen
ccdeaab1f9 vulkan: Add a way to specify a device
We should be smarter in picking a good device eventually,
but for now, we just allow to explicitly choose one. To
see a list of all devices, use GDK_VULKAN_DEVICE=list

To specify which device to use, use GDK_VULKAN_DEVICE=<number>
2018-01-09 20:33:04 -05:00
Matthias Clasen
888f289114 Quiet a compiler warning
Vulkan grew a new error code.
2018-01-09 17:20:44 -05:00
Matthias Clasen
50975be4d0 wayland: Plug memory leaks
We were forgetting to free the GdkContentFormats
objects in an early exit case.
2018-01-04 22:55:04 -05:00
Matthias Clasen
407d3db2b6 Plug a memory leak
gdk_pixbuf_format_get_name returns newly allocated
strings.
2018-01-04 22:54:29 -05:00
Matthias Clasen
0ed670ed62 Remove a dead macro
GCs have been dead for a long time.
2018-01-04 18:23:36 -05:00
Rico Tzschichholz
6aeae2c828 gdk: Drop invalid "transfer" g-i annotations 2018-01-03 08:26:21 +01:00
Rico Tzschichholz
14d64eaf95 dnd: Add g-i annotations for gdk_drop_read_async/finish 2018-01-03 08:18:47 +01:00
Timm Bäder
6b44a70a09 GdkTexture: Add a missing (array) annotation 2018-01-02 18:56:19 +01:00
Matthias Clasen
6c33e37db2 Remove a duplicate doc comment
g-ir-scanner complains about this.
2017-12-26 19:19:12 -05:00
Matthias Clasen
5ba5f2c0c0 gdk: Cosmetic rewording of draw context docs
Avoid draw context <> drawing context confusion,
as far as possible.
2017-12-26 14:39:49 -05:00
Matthias Clasen
371d527092 window: Remove GtkButton reference from docs
GtkButton doesn't have its own window anymore, so it is
a misleading example here.
2017-12-26 14:39:49 -05:00
Matthias Clasen
5c9ea0cf4f display: Cosmetic doc changes 2017-12-26 14:39:49 -05:00
Matthias Clasen
5ec25cde21 cursor docs: Point to gtk_widget_set_cursor
This is the right API to use for applications.
2017-12-26 14:39:49 -05:00
Matthias Clasen
6374226d6b Add documentation for content (de)serializers 2017-12-26 14:39:49 -05:00
Matthias Clasen
e917949315 Document GdkClipboard::changed 2017-12-26 14:39:49 -05:00
Matthias Clasen
ca2a7c1efd Document more structs 2017-12-26 14:39:24 -05:00
Matthias Clasen
53522f3c25 Document GDK_DISPLAY_XDISPLAY 2017-12-26 13:14:07 -05:00
Matthias Clasen
6f82ba5e5e gdk: Document GdkVulkanContext
New API needs documentation.
2017-12-26 13:00:27 -05:00
Matthias Clasen
dbcf0d1b69 gdk: Move GdkWindowState enum around
We no longer have an event for this, so move the
enum to gdkwindow.h, where it belongs.
2017-12-26 13:00:27 -05:00
Matthias Clasen
bb992ff00d More documentation additions 2017-12-26 13:00:27 -05:00
Matthias Clasen
f2ad5ddbb6 Some GdkMonitor documentation additions
Document the ::invalidated signal.
2017-12-26 13:00:27 -05:00
Matthias Clasen
951456dbed Remove leftover API from headers
gdk_window_mark_paint_from_clip was removed in
bddfd7bb41
2017-12-26 13:00:27 -05:00
Matthias Clasen
278c4583fc Document new event getters
New API needs documentation.
2017-12-26 13:00:27 -05:00
Matthias Clasen
d6985d793f Try to make the docs build more quiet
Not sure if this really makes a difference.
2017-12-26 13:00:27 -05:00
Matthias Clasen
97dcf2461e gdk: Remove the event structs from the documentation
No longer public api.
2017-12-26 13:00:27 -05:00
Matthias Clasen
d3920d17fa Document gdk_display_get_setting
New api needs documentation.
2017-12-26 11:51:28 -05:00
Matthias Clasen
22a43dafc8 Remove leftover gdk_event_request_motions from headers
The implementation of this function was removed in
44cb3ccfa1.
2017-12-26 11:51:28 -05:00
Matthias Clasen
ffe838e7de gdk: Document GdkDisplay::setting-changed
New api needs documentation.
2017-12-26 11:51:28 -05:00
Matthias Clasen
d5f215f96d gdk: Reshuffle docs slightly
Deemphasize GdkPixbuf in the docs.
2017-12-25 16:40:47 -05:00
Ting-Wei Lan
5f8e2fcf93 gdk/broadway/toarray.pl: Don't hard-code the path of perl
https://bugzilla.gnome.org/show_bug.cgi?id=791927
2017-12-25 12:25:54 +08:00
Emmanuele Bassi
e847694e91 Update annotations for GdkDisplay
GdkDisplay is missing various annotations, and the introspection scanner
is complaining about it.
2017-12-21 19:13:28 +00:00
Emmanuele Bassi
90a4e33415 Update annotations for GdkEvent API
The GdkEvent API is missing some gtk-doc stanzas, as well as some
introspection annotations.
2017-12-21 19:07:02 +00:00
Emmanuele Bassi
cc80a2ec8e Annotate gdk_x11_display_get_screen()
We're missing the gtk-doc stanza, as well as the transfer annotation for
the returned pointer.
2017-12-21 18:49:25 +00:00
Emmanuele Bassi
6c0de43669 Remove unnecessary introspection annotation
Transfer annotations do not apply to integral types.
2017-12-21 18:46:08 +00:00
Emmanuele Bassi
f1ef422871 broadway: Use correct type in assignment
The new type propagation for g_object_ref() is raising a compiler
warning for an assignment with a different type.
2017-12-21 18:42:26 +00:00
Timm Bäder
964c6f7d58 x11: Fix wrong condition when unsetting transient-for
Setting a new transient-for parent is only possible if the given parent
window is valid, not when it is NULL or valid.
2017-12-21 18:25:51 +01:00
Carlos Garnacho
f93837ceb2 gdk: Remove leftover variable
This is unused and leaked.
2017-12-19 22:58:51 +01:00
Timm Bäder
f393552fec x11: Guard against NULL window
Otherwise, the NULL parent window causes a crash in the
GDK_WINDOW_IS_DESTROYED call.
2017-12-19 07:39:37 +01:00
Matthias Clasen
08c699c745 wayland: Handle scale 3 for cursors
This is just a bandaid solution to make scale 3 work.
If people seriously want to go for scales larger than
that, we need a better solution.
2017-12-17 16:41:54 -05:00
Benjamin Otte
f824439137 dnd: Get rid of IPC widgets
Instead, pass the source window to gdk_drag_begin().

Also make Wayland use this window instead of the one under the pointer
(though those 2 Windows are most likely the same anyway).
2017-12-16 02:48:12 +01:00
Benjamin Otte
3438dcdd4e x11: Add necessary NULL check 2017-12-16 02:48:12 +01:00
Benjamin Otte
aab86f8b98 x11: Try getting ipc_window vs source_window right
This is in preparation for splitting these. Unfortunately, source_window
== ipc_window, so this isn't very debuggable yet.
2017-12-16 02:48:12 +01:00
Benjamin Otte
510581e0ef x11: Use gdk_drag_context_get_display() 2017-12-16 02:48:12 +01:00
Benjamin Otte
5f326d7ec6 x11: Create IPC window outselves
Ignore the passed in IPC window.
2017-12-16 02:48:12 +01:00
Benjamin Otte
a04afde35c gdk: Remove DRAG_STATUS and DROP_FINISHED events
Those are source-side events that are handled by signals of the
Dragontext these days.
2017-12-15 23:48:36 +01:00
Matthias Clasen
61843d60b2 x11: Avoid crash in fallback move emulation
Quietly do nothing when there is already an ongoing operation.
This matches the behavior of the ewmh code, and is much nicer
than a crash.

https://bugzilla.gnome.org/show_bug.cgi?id=789054
2017-12-15 16:19:09 -05:00
Matthias Clasen
fa27d171d0 Drop gdk_keymap_get_for_display
It has been replaced by gdk_display_get_keymap.
2017-12-15 07:46:35 -05:00
Matthias Clasen
e92c0e85ec Replace gdk_keymap_get_for_display by gdk_display_get_keymap
Replace all uses of the old function by the new one.
No functional change.
2017-12-15 07:44:58 -05:00
Matthias Clasen
1012bbeecf Add gdk_display_get_keymap
This is just a better name for gdk_keymap_get_for_display.
2017-12-15 06:53:13 -05:00
Matthias Clasen
fd85ff0c7a Drop gdk_keymap_get_default()
It is better to use the explicit keymap getter - the
default display may not even use the current gdk backend.
2017-12-14 23:57:54 -05:00
Matthias Clasen
9194ee4973 gdk: Drop GDK_DAMAGE
We haven't been generating events of this type
since we dropped offscreen windows.
2017-12-14 23:35:08 -05:00
Matthias Clasen
65fc43a1f3 Drop GDK_CLIENT_EVENT
We never generate events of this type, so no need
to carry it around.
2017-12-14 22:55:03 -05:00
Matthias Clasen
8d42ab6b91 gdk: Remove explicit event type numbering
The numeric values of event types are irrelevant,
so we don't need to declare them explicitly.
2017-12-14 22:43:53 -05:00
Matthias Clasen
bcf570cc16 Move code around
gdk_window_set_state is now an ordinary (private) setter,
so it should live in gdkwindow.c.
2017-12-14 22:35:27 -05:00
Matthias Clasen
11a946df39 gdk: Drop GdkEventWindowState
No longer generate this event. Instead, emit change
notification for GdkWindow::state.
2017-12-14 22:24:06 -05:00
Matthias Clasen
e5b1867118 gdk: Add a GdkWindow::state property
This will eventually replace the window state event.
2017-12-14 22:24:06 -05:00
Benjamin Otte
84431ab927 x11: Remove GdkAtom usage from dnd code
Use strings instead.
2017-12-14 13:46:37 +01:00
Benjamin Otte
5d70bbf4c4 display: Remove leftover old clipboard APIs 2017-12-14 13:35:32 +01:00
Krzesimir Nowak
5a0fb278d1 x11: Fix erroneous & to be && 2017-12-14 13:35:32 +01:00
Benjamin Otte
920259c250 x11: Get rid of default Atom converters
No, using the default Wayland display is not okay to query Atoms.
2017-12-14 13:35:32 +01:00
Benjamin Otte
52b1a46549 device: Make axis label a regular string
Atoms are about to die.
2017-12-14 13:35:32 +01:00
Matthias Clasen
84eaf3da7d Drop atom-related cast macros
These don't really add anything, just drop them.
2017-12-13 23:47:02 -05:00
Matthias Clasen
54a6273191 Drop gdk_atom_intern
Atoms are just interned strings now, so we can just
use g_intern_string.
2017-12-13 23:39:03 -05:00
Matthias Clasen
4c083c1ed4 Drop gdk_atom_name
Since atoms are just interned strings now, we can just
cast them to const char * where needed.
2017-12-13 23:26:23 -05:00
Benjamin Otte
b49a9b9933 dnd: Remove gdk_drag_get_selection()
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.
2017-12-14 04:39:22 +01:00
Benjamin Otte
65fcff87b2 gdk: Remove ability to request selection notifications
Without selections, that's kinda pointless.
2017-12-14 04:20:48 +01:00
Benjamin Otte
f2bb2024c8 gdk: Remove properties
They are not used anymore.

Gone with them are PropertyNotify events.
2017-12-14 03:05:34 +01:00
Benjamin Otte
82aa0eacb2 broadway: Make compile after GdkEvent objectification 2017-12-14 03:05:34 +01:00
Benjamin Otte
d7f34874ab x11: Make unsetting transient-for work
... and just unset it from GtkWindow instead of fiddling with
properties.
2017-12-14 03:05:34 +01:00
Benjamin Otte
a4b42f0b73 gdk: Remove selection defines
And with it, remove the selections section from the docs.

So selections are gone for good now.
2017-12-14 03:05:34 +01:00
Carlos Garnacho
2f65a2f5cc gdk: Make gdk_display_peek_event() Return a reference to the event
No need to copy it.
2017-12-14 01:05:48 +01:00
Carlos Garnacho
b03d3fb268 gdk/wayland: s/gdk_event_free/g_object_unref/ 2017-12-14 01:05:48 +01:00
Carlos Garnacho
3021edc38d gdk/x11: s/gdk_event_free/g_object_unref/ 2017-12-14 01:05:48 +01:00
Carlos Garnacho
f79ac6d30b gdk: Remove gdk_window_[gs]et_event_compression()
Motion compression is now the unmodifiable default, callers may
call gdk_event_get_motion_history() to check the uncoalesced
motion history.
2017-12-14 01:05:48 +01:00
Carlos Garnacho
ea216accd7 gdk: Implement motion history as motion event data
In the motion compression phase the coalesced events will be saved
as a GdkTimeCoord on the motion event that shall be delivered.

For simplicity (and because history doesn't make much sense otherwise)
event history is only recorded while there are buttons pressed, this
also tidily ensures that those coalesced events would have the same
target widget on the gtk side than the delivered one, because of
implicit grabs.
2017-12-14 01:05:48 +01:00
Carlos Garnacho
a040ed55cc gdk: Keep reference on tools from motion/button events. 2017-12-14 01:05:48 +01:00
Carlos Garnacho
8c9231dbb4 gdk: Move additional code in gdk_event_new() to GdkEvent::constructed
Now that the type is a construct only property, we can initialize the
event fields properly here.
2017-12-14 01:05:48 +01:00
Carlos Garnacho
5ee1d4893a gdk: Make GdkEvent type a construct only property
So it must be set at the time of doing g_object_new().
2017-12-14 01:05:48 +01:00
Carlos Garnacho
ca89ad75b4 gdk: Remove gdk_event_is_allocated()
All events are allocated now.
2017-12-14 01:05:48 +01:00
Carlos Garnacho
2acbb7b01d gdk: Turn GdkEvent into a GObject
Two warts remain. gdk_event_copy() should be unnecessary as
events should be considered static after delivery, so g_object_ref()
should be just as good. There's a few exceptional cases that the event
is copied and then modifier for later processing, those cases should be
reconsidered individually.

And gdk_event_free() could be likewise turned into g_object_unref(),
many callers remain though.
2017-12-14 01:05:48 +01:00
Carlos Garnacho
1e1f2a6e67 gdk: Remove GdkDisplay from GdkEventPrivate
And add it to GdkEventAny.
2017-12-14 01:05:08 +01:00
Carlos Garnacho
8595e4b1d1 gdk: Figure out the GdkSeat of an event from the GdkDevice
Removes the need for gdk_event_set_seat() and the GdkSeat field from
GdkEventPrivate.
2017-12-14 00:58:32 +01:00
Carlos Garnacho
526486da6b gdk: Use allocated events
Stack allocated GdkEvent structs will not be ok when events become
objects.
2017-12-14 00:58:32 +01:00
Carlos Garnacho
59cab36035 gdk: Fold GdkEventPrivate fields into event structs
Now all events structs are private, it doesn't make as much sense
having GdkEventPrivate wrapping allocating events. This is a first
step towards removing it.
2017-12-14 00:58:32 +01:00
Carlos Garnacho
64decbfd74 gdk: Remove GdkEventType argument from GdkEvent union
It won't stand true anymore that the GdkEventType argument is the
first field of the GdkEvent* structs. All callers have been updated
to use event->any.type instead.
2017-12-14 00:58:32 +01:00
Carlos Garnacho
b9db0b55cb gdk: Refurbish GdkEvent struct hierarchy
Make all specific event structs contain a GdkEventAny, so the base
struct can be extended without modifying structs all over the place.
2017-12-14 00:58:32 +01:00
Benjamin Otte
54f9aef0d4 gdk: Remove gdk_selection_convert()
It's not used anymore.
2017-12-14 00:44:26 +01:00
Benjamin Otte
ca5f859dc8 dnd: Only send DELETE request on X11
This is Xdnd-specific and doesn't need to happen elsewhere.
2017-12-13 23:52:55 +01:00
Benjamin Otte
4042d5f242 gdk: Remove ability to own a selection
With this, the GDK_EVENT_SELECTION_REQUEST and GDK_EVENT_SELECTION_CLEAR
and the associated GtkWidget signals are gone, too.
2017-12-13 23:39:02 +01:00
Benjamin Otte
b66052f3ce gdk: Remove gdk_selection_add_targets()
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.
2017-12-13 19:27:51 +01:00
Benjamin Otte
65eab87238 x11: Move selection handling to GDK
Instead of claiming the selection in GTK, claim it in the X11 dnd code.
Also handle SelectionRequest and SelectionClear X events there.
2017-12-13 18:31:06 +01:00
Benjamin Otte
8648d5409e dnd: Pass content to gdk_drag_begin()
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.
2017-12-13 15:05:27 +01:00
Matthias Clasen
9b29369222 Make sure events have displays
This seems to be necessary if you want to call
gdk_display_put_event on them.
2017-12-12 23:21:26 -05:00
Benjamin Otte
fb0fdddd76 x11: Refactor xevent filtering some more
We now have a GdkX11Display::xevent signal that gets emitted for every
XEvent and allows you to interrupt processing via TRUE/FALSE return
values.
These return values to correspond to GDK_FILTER_REMOVE and
GDK_FILTER_CONTINUE respectively.

The GDK_FILTER_TRANSLATE case from gdk_window_add_filter() is now meant
to be handled via gdk_display_put_event().
2017-12-13 01:55:56 +01:00
Benjamin Otte
4b33a34ce3 x11: Use GdkX11Display::translate-event more 2017-12-13 01:09:32 +01:00
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