Commit Graph

10154 Commits

Author SHA1 Message Date
Matthias Clasen
38fce67a9b Annotate gdk_rgba_to_string as malloc 2021-09-14 16:38:08 -04:00
Matthias Clasen
04ef7055cd Annotate gdk_drag_action_is_unique as const 2021-09-14 16:38:08 -04:00
Matthias Clasen
ebca260f2d Annotate gdk_unichar_direction as const 2021-09-14 16:38:08 -04:00
Benjamin Otte
6785461c26 gltexture: Make sure downloading textures works in a different thread
This happens in the real world when using the inspector to look at a
node recording of a GStreamer video while the video is still playing.

GStreamer will use the GL context in a different thread while we are
busy trying to download it.

A test is included.
2021-09-13 01:40:03 +02:00
Benjamin Otte
719eafa60c gl: Implement uploading and downloading HDR formats
Also refactor the GL uploading so it does the fallback in a
GLES-compatible way, which means we only need one fallback.
2021-09-12 05:54:37 +02:00
Benjamin Otte
1759d27da9 memorytexture: Add support for HDR formats
Also sanitize the input bytes so the strides match alignment
requirements of the data types.
2021-09-12 05:54:37 +02:00
Benjamin Otte
53275481a5 texture: Add gdk_texture_download_float() 2021-09-12 05:54:37 +02:00
Benjamin Otte
cbe6d0da76 gdk: Deprecate gdk_cairo_draw_from_gl()
It's broken with various pixel formats and OpenGL ES, it's hard to
understand what everything does, and gdk_texture_download() can be used
instead.
2021-09-12 05:54:37 +02:00
Benjamin Otte
c349ed9562 gltexture: Implement download() via glGetTexImage()
1. The download via gdk_cairo_draw_from_gl() was broken sometimes

2. We get easy conversion on fallback by chaining up and using
   download_texture().

3. One more place where Cairo is no longer necessary.
2021-09-12 05:22:21 +02:00
Benjamin Otte
74ce69a8a1 gltexture: Make release() use download_texture()
1. It avoids Cairo, and in particular conversion to Cairo.

2. Keeping a texture allows easy chaining in the vfuncs.

3. Using a texture means releasing will work for HDR formats
   too, once we add them.
2021-09-12 05:22:21 +02:00
Benjamin Otte
4f17f3ac24 texture: Add gdk_texture_download_texture()
A private vfunc that downloads a texture as a GdkMemoryTexture in
whatever format the texture deems best.

There are multiple reasons for this:

 * GLES cannot download the Cairo format. But it can download some
   format and then just delegate to the GdkMemoryTexture implementation.

 * All the other download vfuncs (including the ones still coming) can
   be implemented via download_texture() and delegation, making the
   interface easier.

 * We want to implement image loading and saving support. By using
   download_texture(), we can save in the actual format of the texture.

 * A potential GdkCompressedTexture could be implemented by just
   providing this one vfunc as a compress() step.
2021-09-12 05:22:21 +02:00
Benjamin Otte
9c8e464b04 texture: Add GdkMemoryConversion private enum
Now gdk_memory_convert() converts to one of these conversions instead of
re(ab)using parts of the GdkMemoryFormat enum.
2021-09-12 05:22:21 +02:00
Benjamin Otte
51d0d13a9e gltexture: release() to a texture, not a cairo_surface
This makes forwarding vfuncs a lot easier, because we can just call them
on the texture.
2021-09-12 05:22:21 +02:00
Benjamin Otte
0ee3b1c861 texture: Remove unused argument from vfunc 2021-09-12 05:22:21 +02:00
Benjamin Otte
9e11ea699c Merge branch 'hsl' into 'master'
gdk_rgba_parse: Support HSL colors

See merge request GNOME/gtk!3899
2021-09-11 12:57:25 +00:00
Matthias Clasen
c1c1d4431d Refactor gdk_gl_context_upload_texture slightly
Introduce a gl_internalformat variable. This will
let us handle more formats in a uniform way in
future commits.
2021-09-10 22:17:31 -04:00
James Westman
0782c8a051
gdk_rgba_parse: Support HSL colors 2021-09-10 16:56:42 -05:00
Matthias Clasen
a4f067481c gdk: Make GDK_DEBUG=default-settings unconditional
Our tests use this settings, so we should respect it
in non-debug builds as well.
2021-08-30 11:01:55 -04:00
Benjamin Otte
119458f13e contentdeserializer: Fix some API awkwardness
Allow uninitialized GValues to be passed. Makes life easier for the
inspector code I'm writing.
2021-08-30 06:02:16 +02:00
Benjamin Otte
3b15f32335 Merge branch 'wip/otte/symbolic-paintable' into 'master'
Add GtkSymbolicPaintable

See merge request GNOME/gtk!3895
2021-08-30 03:54:35 +00:00
Benjamin Otte
2f9a67b8a1 docs: Fix vfunc references
vfunc references should just use the object name, not the
class/interface/iface name.
2021-08-29 04:29:02 +02:00
Ian Douglas Scott
9e5a501c73 x11: Fix handling of RRScreenChangeNotify/RRNotify events
It seems these are sent with `xwindow` set to the root window, so this
was failing to find a surface and get the screen from that.

I'm not sure if there's a reason not to get the screen this way
elsewhere in the function, but it seems this should be correct.

This fixes the behavior of `gdk_x11_display_get_monitors()`, which
wasn't correctly changing when monitors were added or removed. For
instance, this python code was always showing the same number of
monitors when one was turned off and on, but updates correctly with this
change applied:

```python
import gi
gi.require_version("GLib", "2.0")
gi.require_version("Gdk", "4.0")
gi.require_version("Gtk", "4.0")
from gi.repository import GLib, Gdk, Gtk

def f():
    print(len(Gdk.Display.get_default().get_monitors()))
    return True
GLib.timeout_add_seconds(1, f)

GLib.MainLoop().run()
```
2021-08-27 18:07:39 -07:00
Matthias Clasen
e281bbbb55 Merge branch 'treeexpander-indent-property' into 'master'
GtkTreeExpander: indent-without-expander property

Closes #4175

See merge request GNOME/gtk!3858
2021-08-25 11:48:59 +00:00
Matthias Clasen
892bacee52 Merge branch '4195-include-gdkprivate-h' into 'master'
gdkmacoseventsource: Include "gdk-private.h"

Closes #4195

See merge request GNOME/gtk!3882
2021-08-25 11:48:11 +00:00
Peter Bloomfield
9eb8aa9a32 gdkmacoseventsource: Include "gdk-private.h"
_gdk_macos_event_source_new() calls g_source_set_static_name(), which
for GLib versions before 2.69.1 is a macro defined in gdk-private.h.

Fixes #4195

modified:   gdk/macos/gdkmacoseventsource.c
2021-08-24 16:55:52 -04:00
Benjamin Otte
95931a7e6c wayland: Better error on eglGetDisplay() failure
Goals:

1. Provide as much information as possible in the error message, so
   users can try to fix their system themselves.
2. Try to formulate the error message in a way that explains that this
   is not something GTK can fix, but a lower layer problem.

Related: #4193
2021-08-24 19:55:22 +00:00
Jan Lukas Gernert
88e796bb45 Add 4.6 version macros 2021-08-23 07:54:27 +02:00
Benjamin Otte
d2ea7af335 docs: Expand gdk_clipboard_set() docs 2021-08-22 18:49:12 +00:00
Matthias Clasen
d8ab5c3c45 gdk: Add a missing annotation
Mark an array as zero-terminated.

Fixes: #4097
2021-08-20 08:57:27 -04:00
Luca Bacci
c02bae9e08
Move the _gdk_win32_pointer_input_api global variable into GdkWin32Display 2021-08-19 16:29:45 +02:00
Luca Bacci
3977518f00
Fix typo 2021-08-19 15:57:44 +02:00
Luca Bacci
8adee3dace
Disable visual feedback for pen ad touch 2021-08-19 15:57:43 +02:00
Luca Bacci
09ad930da4
Filter out spurious mouse messages while handling pen or touch input 2021-08-19 15:57:43 +02:00
Luca Bacci
52f7bb6950
Add _gdk_win32_get_cursor_pos utility 2021-08-19 15:57:42 +02:00
Luca Bacci
68db945e47
Handle WinPointer input 2021-08-19 15:57:41 +02:00
Luca Bacci
b54f4cf5d4
Initialize WinPointer and enumerate devices 2021-08-19 15:57:41 +02:00
Luca Bacci
9a8a9451b1
Add new GdkDeviceWinpointer type 2021-08-19 15:57:40 +02:00
Luca Bacci
fffa903ce9
Add winpointer.h header file for type declarations 2021-08-19 15:57:39 +02:00
Luca Bacci
ab08885a32
Add entry for WinPointer in GdkWin32TabletInputAPI enum 2021-08-19 15:57:38 +02:00
Luca Bacci
ad3995b1b9
Make room for other API's than Wintab 2021-08-19 15:57:38 +02:00
Luca Bacci
75cc0710ac
Remove _gdk_input_ignore_wintab variable
Also remove unused variable _gdk_max_colors
2021-08-19 15:57:37 +02:00
Luca Bacci
7cec7054e2
Rename some Wintab-related functions 2021-08-19 15:57:36 +02:00
Luca Bacci
fe280e578f
Set active physical device when using the mouse 2021-08-19 15:57:36 +02:00
Luca Bacci
a32973f56b
Move use of _gdk_win32_get_next_tick from synthesize_crossing_events to its callers 2021-08-19 15:57:35 +02:00
Luca Bacci
7762311911
Add a physical_device argument to send_crossing_event et al 2021-08-19 15:57:34 +02:00
Luca Bacci
edd73ffbed
Raise _WIN32_WINNT macro to target Windows 7 API 2021-08-19 15:57:33 +02:00
Benjamin Otte
6f165efcdb contentprovider: Switch wrong order in type check
We can provide textures as a paintable - we can't provide paintables as
textures.
2021-08-19 03:16:48 +02:00
Matthias Clasen
bb65564c7d Merge branch 'seat-v7' into 'master'
gdk/wayland: add support for wl_seat version 7

See merge request GNOME/gtk!3842
2021-08-18 21:10:30 +00:00
Matthias Clasen
03031b3dc1 Merge branch 'fix/wm_class2' into 'master'
x11: ensure WM class is not null even if display is initialized early

See merge request GNOME/gtk!3808
2021-08-18 18:24:37 +00:00
Benjamin Otte
b7636ebbc0 Merge branch 'win32-drop-local-dnd' into 'master'
gdk/win32: Drop local DnD protocol

See merge request GNOME/gtk!3830
2021-08-18 14:27:14 +00:00