Commit Graph

10146 Commits

Author SHA1 Message Date
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
Chun-wei Fan
5d0f188615 GDK-Win32: Reject WGL context if shaders aren't supported
When we initialize OpenGL, check whether we have OpenGL  2.0 or later; if not,
check whether we have the 'GL_ARB_shader_objects' extension, since we must be
able to support shaders if using OpenGL for GTK.

If we don't support shaders, as some Windows graphics drivers do not support
OpenGL adequately, notably older Intel drivers, reject and destroy the GL
context that we created, and so fallback to the Cairo GSK renderer, so that
things continue to run, albeit with an expected warning message that the GL
context cannot be realized.

Also, when we could not make the created dummy WGL context current during
initialization, make sure that we destroy the dummy WGL context as well.

Fixes issue #4165.
2021-08-17 16:25:09 +08:00
Benjamin Otte
27cad85247 gdk: Include Vulkan error code in vulkan_strerror() 2021-08-12 14:19:30 +02:00
Simon Ser
ad0c1d4dbe gdk/wayland: add support for wl_seat version 7
Version 7 requires wl_keyboard keymaps to be mapped with
MAP_PRIVATE, so that the compositor can share the same keymap
file between multiple clients.
2021-08-11 16:37:03 +02:00
Simon Ser
00abaed89a gdk/wayland: add support for wl_seat version 6
Version 6 adds two new wl_touch events, which can be ignored.
2021-08-11 16:36:57 +02:00
Vincent Bernat
2ebde276d1 x11: ensure WM class is not null even if display is initialized early
With gtkmm, when using `Application()`, the display is initialized
before we know the application name and therefore, the program class
associated to the display is NULL.

Instead of providing a default value, we set it equal to program name
when NULL. Moreover, we give up on capitalizing the class name to keep
the code super simple. Also, not using a capitalized name is
consistent with `gdk_x11_display_open()`. If someone has a good reason
to use a capitalized name, here is how to do it.

```c
  class_hint = XAllocClassHint ();
  class_hint->res_name = (char *) g_get_prgname ();
  if (display_x11->program_class)
    {
      class_hint->res_class = (char *) g_strdup (display_x11->program_class);
    }
  else if (class_hint->res_name && class_hint->res_name[0])
    {
      class_hint->res_class = (char *) g_strdup (class_hint->res_name);
      class_hint->res_class[0] = g_ascii_toupper (class_hint->res_class[0]);
    }
  XSetClassHint (xdisplay, impl->xid, class_hint);
  g_free (class_hint->res_class);
  XFree (class_hint);
```

Fix eff53c023a ("x11: set a default value for program_class")
2021-08-10 09:14:36 +02:00
Chun-wei Fan
8acce5f294 gdk/win32: Drop local DnD protocol
It is basically not used by default and is pretty much broken at this point, so
it's about time to drop it.

Let's focus on fixing the OLE2 DnD protocol.
2021-08-06 17:16:27 +08:00
Matthias Clasen
2a528df977 Merge branch 'titlebar-gesture' into 'master'
Delegate titlebar action to the compositor if possible

See merge request GNOME/gtk!3797
2021-08-02 01:14:08 +00:00
Vincent Bernat
eff53c023a x11: set a default value for program_class
This was also the behaviour with GTK 3. We use the capitalized program
name.

Fixes #4138

Signed-off-by: Vincent Bernat <vincent@bernat.ch>
2021-07-30 23:22:32 +02:00