Commit Graph

8230 Commits

Author SHA1 Message Date
Benjamin Otte
0ce19eed08 gdk: Remove gdk_surface_shape_combine_region()
If you want transparent region, you can just render them transparent.
If you want input shaping, use gdk_surface_input_shape_combine_region().

Also remove gtk_widget_shape_combine_region().
2018-03-21 04:10:07 +01:00
Benjamin Otte
ef693f317c surface: Remove gdk_surface_get_clip_region()
... and gdk_surface_get_visible_region() APIs. They are unused.
2018-03-21 04:10:07 +01:00
Benjamin Otte
f5ff44595a gdk: Remove unused members from surface struct 2018-03-21 04:10:06 +01:00
Benjamin Otte
101cf7dcbd surface: Stop shaping native children of csw surfaces
We don't have them anymore and they are goig away anyway.
2018-03-21 04:10:06 +01:00
Benjamin Otte
5a32469303 surface: Remove GSK_SURFACE_ROOT
Root surface have been dead for a while now, no need to keep the enum
value around.
2018-03-21 00:58:01 +01:00
Benjamin Otte
7862894f11 surface: Remove gdk_surface_invalidate_maybe_recurse()
This also means we can now get rid of child funcs because they're not
used anymore.
2018-03-21 00:43:28 +01:00
Benjamin Otte
a1898d678b surface: Remove gdk_surface_scroll()
It's yet another fancy way to call gdk_surface_invalidate_region().

Also remove the one testgtk test that was still using it.
2018-03-21 00:43:28 +01:00
Benjamin Otte
d6ba10bacf surface: Remove gdk_surface_move_region()
It's just a cute version of gdk_surface_invalidate_region()
these days and people can call that function instead.
2018-03-21 00:43:28 +01:00
Benjamin Otte
c4ecc3f4f7 surface: Remove queue_antiexpose()
... and its implementation in the X11 backend.

GDK does lots of work trying to reduce the region in expose events
so that when the server sends multiple expose events, touching the
same area we can make sure to only redraw stuff once. However:
(1) this is only relevant of there's tons of delay and multiple
    expose events get sent
(2) we coalesce multiple events into a single expose event anyway
(3) we do this on the frame clock

But most importantly:
(4) Since the invention of compositing, servers caches all contents
    anyway
2018-03-21 00:43:28 +01:00
Benjamin Otte
63edf43e86 gdk: Remove unused area member from GdkEventExpose 2018-03-21 00:43:28 +01:00
Benjamin Otte
5c7ee3a483 gdk: Remove unused count member from GdkEventExpose 2018-03-21 00:43:28 +01:00
Olivier Fourdan
77a5d00047 wayland: Drop cairo surfaces when withdrawing
If a surface is unmapped by the client while gdk is processing updates,
(for example Firefox un-mapping its window on Expose events), the
windowing backend resources might be lost (for example with Wayland)
which can cause a crash in end_paint().

Make sure we drop the cairo surfaces as well when hiding the surface,
that will avoid the crash in gdk_surface_impl_wayland_end_paint() when
trying to attach the staging cairo surface to a released wl_surface,
these will be recreated when needed when the surface becomes visible
again and there is no need to keep such buffers around for a surface
which is not visible anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=793062
2018-03-20 18:49:56 +01:00
Carlos Garnacho
28c27f37ee Merge branch 'detect-synaptics-touchpads-v2' into 'master'
x11/xi2: Report touchpads as TOUCHPAD, not MOUSE

See merge request GNOME/gtk!65
2018-03-20 17:03:15 +00:00
Alexander Larsson
695d141f32 Merge branch 'rename-window-to-surface' into 'master'
Rename window to surface

See merge request GNOME/gtk!72
2018-03-20 16:16:57 +00:00
Alexander Larsson
4ac450b324 Convert all references to GdkEvent->surface 2018-03-20 16:25:50 +01:00
Alexander Larsson
63e060a21d GtkWidget: Start renaming widget->window
This is an automated change doing these command:

git sed -f g gtk_widget_set_has_window gtk_widget_set_has_surface
git sed -f g gtk_widget_get_has_window gtk_widget_get_has_surface
git sed -f g gtk_widget_set_parent_window gtk_widget_set_parent_surface
git sed -f g gtk_widget_get_parent_window gtk_widget_get_parent_surface
git sed -f g gtk_widget_set_window gtk_widget_set_surface
git sed -f g gtk_widget_get_window gtk_widget_get_surface
git sed -f g gtk_widget_register_window gtk_widget_register_surface
git sed -f g gtk_widget_unregister_window gtk_widget_unregister_surface

git checkout NEWS*
2018-03-20 15:21:12 +01:00
Alexander Larsson
3dce0dcca7 GdkSurface: Rename lots of stuff from window->surface
Mostly these are internal things, but the major public change is
that event.window is now event.surface.
2018-03-20 15:14:10 +01:00
Alexander Larsson
9a7e721181 GdkSurface: Rename various functions and variables
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
2018-03-20 12:05:26 +01:00
Alexander Larsson
890080ebf7 GdkWindow -> GdkSurface: File renames
Rename all *window.[ch] source files.

This is an automatic operation, done by the following commands:

for i in $(git ls-files gdk | grep window); do
    git mv $i $(echo $i | sed s/window/surface/);
    git sed -f g $(basename $i) $(basename $i | sed s/window/surface/) ;
done

git checkout NEWS* po-properties po
2018-03-20 11:46:11 +01:00
Alexander Larsson
391727bd0d GdkWindow -> GdkSurface initial type rename
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
2018-03-20 11:40:08 +01:00
Timm Bäder
4353ad224f rendernode: Check cairo surface status after creation 2018-03-20 09:37:59 +01:00
Rico Tzschichholz
f7326ff828 texture: Fix documentation block of gdk_texture_download 2018-03-19 20:31:15 +01:00
Daniel Boles
a15080c640 gdkrgba: Add a missing apostrophe in a doc comment 2018-03-19 15:14:20 +00:00
Daniel van Vugt
0ad27cc598 x11/xi2: Report touchpads as TOUCHPAD, not MOUSE
is_touchpad_device() for XI2 was hardcoded to look for libinput only.
Extend it slightly to correctly identify other Xorg touchpad drivers.

https://gitlab.gnome.org/GNOME/gtk/issues/97
2018-03-19 12:08:29 +08:00
Rico Tzschichholz
4642e86284 texture: Fix compilation by avoiding to include not-yet available headers 2018-03-18 20:52:46 +01:00
Benjamin Otte
ea84e974e6 snapshot: Turn into GObject
This makes GdkSnapshot the base class for GtkSnapshot and hopefully
stops confusing bindings.

C code should see no difference to before.
2018-03-18 19:21:33 +01:00
Benjamin Otte
6dc29f2852 gltexture: Rename variable
Makes docs build happy.
2018-03-18 18:42:20 +01:00
Benjamin Otte
82a99a3643 texture: Expose subclasses as subclasses
This is necessary so that bidnings work properly and don't make
gdk_gl_texture_release() a function on GdkTexture.
It also allows code to identify what type of texture they are dealing
with.

Finally, we can now decide to add getters later without screwing
anything up, if we want to allow people to access GL textures directly.
2018-03-18 05:57:07 +01:00
Benjamin Otte
d54ca3c74f gdk: Add GDK_MEMORY_DEFAULT
This is the default memory format.

I added it because it is way better than including a private header and
using GDK_MEMORY_CAIRO_FORMAT_ARGB32.
2018-03-18 05:57:07 +01:00
Benjamin Otte
ee8e42f19b gdk: Remove gdk_texture_new_from_data()
Use gdk_memory_texture_new() instead.
2018-03-18 05:57:07 +01:00
Benjamin Otte
536714a147 paintable: Add gdk_paintable_compute_concrete_size()
Do the CSS size computation routine. This will be used elsewhere soon.
2018-03-16 06:04:44 +01:00
Benjamin Otte
a4e16ce3cc texture: Implement GdkPaintable
This is kind of evil because we need to link to GTK to be able to
snapshot, but I hope nobody notices.
2018-03-16 06:04:44 +01:00
Benjamin Otte
8f43d7e188 gdk: Add GdkPaintable 2018-03-16 06:04:44 +01:00
Benjamin Otte
7f0ef81e11 vulkan: Our data is premultiplied, don't pretend it isn't
If the backend can't do premultiplied alpha, better make the backend treat
2018-03-16 06:04:43 +01:00
Timm Bäder
a0729f9683 gdk: Remove unused variable 2018-03-15 09:25:42 +01:00
Christoph Reiter
f91ea2ce37 Merge branch 'master' into 'master'
Add proper annotation for gdk_frame_clock_get_refresh_info

See merge request GNOME/gtk!55
2018-03-13 20:30:53 +00:00
Emmanuele Bassi
9d045db142 Annotate gdk_gl_texture_new() appropriately
This is a constructor, and it needs a transfer annotation.

Sadly, the resulting introspection representation is going to be a less
than satisfactory `Gdk.gl_texture_new()`, because there is no such thing
as a GdkGLTexture in the public API.
2018-03-13 16:00:55 +00:00
Benjamin Otte
13d943f763 texture: Change download vfunc
A problem with textures is that they can become too big for GPU memory,
which would require tiling. But for tiling we only need to download
the pixels needed by the tile.

Similarly, there might be interest to not upload full textures if a
renderer knows it only needs a small part.

Both of these methods require the ability to specify an area of the
texture to be downloaded. So change the download vfunc to include
this parameter now before we add even more textures later.

A private gdk_texture_download_area() function has also been added, but
nobody is using it yet.
2018-03-12 17:21:45 +01:00
Benjamin Otte
e5813b3ae7 texture: Export gdk_memory_texture_new() and GdkMemoryFormat
Also add tests for all these newfangled formats.
2018-03-12 17:21:45 +01:00
Sander Sweers
fe8225e573
Add proper annotation for gdk_frame_clock_get_refresh_info
See https://gitlab.gnome.org/GNOME/gtk/issues/77
2018-03-12 16:07:39 +01:00
Timm Bäder
7eb3736760 GdkCursor: Add some missing (nullable) annotations 2018-03-09 11:57:23 +01:00
Pavel Roskin
01fda3b85e x11: Avoid a division by zero
This is similar to f44baf51d9 but for RandR 1.3 servers like
x11rdp and Windows Exceed which don't return a refresh rate. Avoid a
crash when that happens.

https://bugzilla.gnome.org/show_bug.cgi?id=775546
2018-03-08 16:20:01 +01:00
Benjamin Otte
8920639a2b texture: Add GdkMemoryTexture
GdkMemoryTexture is a texture implementation for holding data in memory
(read: GBytes). You specify the GdkMemoryFormat that data is in and off
you go.

Renderers can use this to add uploads in various different formats and
don't need to fallback to GDK doing the conersion on the CPU.

Supported formats can be extended if we need new ones, for now I just
added the relevant ones for Cairo and GdkPixbuf.

The constructor is also private still, because I'm not sure we want to
export GdkMemoryFormat.
Wrappers that do from_cairo_surface() and for_pixbuf() do exist though.
2018-03-07 16:17:15 +01:00
Benjamin Otte
160e6ad6f6 gdk: Split out GL texture
Put GdkGLTexture into its own file and rename the API to
gdk_gl_texture_foo() instead of gdk_texture_foo_for_gl().

Apart from naming, no actual code changes.
2018-03-07 16:17:15 +01:00
Timm Bäder
2f5d5ca9f8 GdkSelectionInputStreamX11: Plug a memory leak 2018-03-06 19:59:29 +01:00
Timm Bäder
49a7bf267b GdkSelectionOutputStreamX11: Plug a memory leak 2018-03-06 19:47:18 +01:00
Christoph Reiter
26e2af26ed macos: export gdk_quartz_drag_source_context()
It's used in the gtk dnd code but not exported in gdk.
Append a "_libgtk_only" suffix as with other internal exports and
export the symbol.

See #32
2018-03-01 14:36:44 +01:00
Christoph Reiter
94d6d56913 macos: Fix gdk_quartz_drag_context_get_dragging_info_libgtk_only symbol export
The header got included without config.h being included first which resulted in the
wrong _GDK_EXTERN macro being used. As a result some symbols weren't exported
and starting a DnD action would crash in the linker.

This patch adds config.h includes in all places where clang complained about
_GDK_EXTERN redefinitions.

See #32 for more info.
2018-02-27 20:04:34 +01:00
Patrick Griffis
971f46e1f2 build: Error if no backends enabled 2018-02-27 13:42:28 -05:00
Timm Bäder
dc1612b865 contentsformat: Avoid a GPtrArray
We know how many items this array will have in advance, so just malloc
enough.
2018-02-25 16:47:20 +01:00
Benjamin Otte
45603f70a8 vulkan: Don't quiet the compiler
This reverts 76461a8004.

We don't want to quiet the compiler here because new warnings should be
added to the enum the moment they become available.
2018-02-23 14:12:47 +01:00
Benjamin Otte
4cfaee99e7 vulkan: Add error strings for missing VkResults
Also, guard newer error returns with proper #if, so they don't trip up
older Vulkan versions.
2018-02-23 14:12:47 +01:00
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