Commit Graph

10011 Commits

Author SHA1 Message Date
Matthias Clasen
1be4684441 gdktoplevelsize: Comment out some unused code
This is not currently useful, and clang complains.
2021-05-03 07:44:38 -04:00
Matthias Clasen
2b0c474117 Add gdk_wayland_device_get_xkb_keymap
This can be useful to get more detailed information
about keyboard configuration.
2021-05-02 21:02:09 -04:00
Matthias Clasen
0f74798a82 Add 4.4 version macros 2021-05-02 21:02:09 -04:00
Matthias Clasen
945b32ca1b Merge branch 'mesa.win32.fixes' into 'master'
gdkglcontext-win32.c: Fix running with Mesa drivers

See merge request GNOME/gtk!3483
2021-05-02 22:42:35 +00:00
Matthias Clasen
7ab8109ef8 contentdeserializer: Fix an oversight
The argument passed with string_deserializer must be
a charset name. Passing the mimetype there does not
make sense.
2021-05-01 22:44:41 -04:00
Matthias Clasen
97afffba4e wayland: Rewrite shm format debug spew
Rewrite this in a way that doesn't depend on kernel
header defines at the time the wayland scanner was run.

This was causing the build to break on Centos 8, where
a bunch of fourcc formats are missing.
2021-05-01 11:17:28 -04:00
Bilal Elmoussaoui
ec38e53249 gdk: add zero-terminated annotation to content_formats_get_gtypes 2021-04-30 15:43:33 +02:00
Bilal Elmoussaoui
e473e7a83a gdk: fix content_formats_get_mime_types annotation 2021-04-30 15:43:17 +02:00
Chun-wei Fan
66e7f3b404 gdkglcontext-win32.c: Fix running with Mesa drivers
Some GL drivers such as Mesa-D3D12 do not allow one to call SetPixelFormat() on
a given HDC if one pixel format has been already set for it, so first check the
HDC with GetPixelFormat() to see whether a pixel format has already been set
with the HDC, and only attempt to acquire the pixel format if one has not been
set.

This will fix running with GL/NGL on Windows using the Mesa drivers.
2021-04-29 12:12:01 +08:00
David Lechner
2a610267eb gdk/wayland/cursor/os-compatibility: fix build when memfd_create is not available
When building for homebrew/linuxbrew on Ubuntu 16.04, memfd_create() is
not available and causes the build to fail.

This adds a proper check for the function.
2021-04-27 11:46:39 -05:00
Matthias Clasen
f37662c655 x11: Try harder to find the right monitor
If we deal with a panel, we end up with no monitor,
and crash, which isn't great and isn't necessary.

Fixes: #3900
2021-04-26 23:20:10 -04:00
Benjamin Otte
1a12ea6e5a Merge branch 'wip/otte/for-master' into 'master'
clipboard: Make sure G_TYPE_STRING is nul-terminated

Closes #3899

See merge request GNOME/gtk!3476
2021-04-26 21:15:32 +00:00
Benjamin Otte
1be899459c clipboard: Fix reading of files
Make sure writing a terminating null byte actually works and we don't
just ignore the error message.
2021-04-26 21:32:57 +02:00
Benjamin Otte
f34e3c573b clipboard: Make sure G_TYPE_STRING is nul-terminated
When reading text, we need to check we terminate the G_TYPE_STRING
string with a null byte, because the clipboard does not guarantee one.

So just append a \0 to the stream.

Fixes #3899
2021-04-26 21:32:57 +02:00
Matthias Clasen
2c34abed20 wayland: Print all layouts in debug spew 2021-04-26 00:16:41 -04:00
Matthias Clasen
d225f14657 gdk: Avoid synthetic motion confusion
Don't emit a synthetic motion event on a surface
that is grab-shadowed by a popup. This has been
known to confuse GTK, at times.

Fixes: #3439
2021-04-22 21:09:54 -04:00
Matthias Clasen
142984cbf7 Merge branch 'untrusted-beep' into 'master'
x11: Don't beep on untrusted displays

Closes #3862

See merge request GNOME/gtk!3463
2021-04-21 10:12:39 +00:00
Matthias Clasen
5587ee0c30 x11: Don't beep on untrusted displays
This can trigger BadAccess, and we don't
want that.

Fixes: #3862
2021-04-20 21:42:57 -04:00
Matthias Clasen
ce2a433ca1 Fix a possible crash in gtk_show_uri
g_file_get_basename can return NULL.
Deal with it somehow.

Fixes: #3883
2021-04-19 16:49:02 -04:00
Matthias Clasen
05af726446 Merge branch 'wayland-xdg-surface-setup' into 'master'
wayland: Don't duplicate xdg_surface setup code

See merge request GNOME/gtk!3191
2021-04-16 15:16:28 +00:00
David Keijser
db8bf5e7b9 wayland: Don't duplicate xdg_surface setup code 2021-04-16 16:23:16 +02:00
David Keijser
5bbdf3a807 wayland: Avoid directly accessing shadow property of parent surface 2021-04-16 16:13:07 +02:00
Chun-wei Fan
14632e11da GDK: Fix builds against latest stable GLib with MSVC
GLib-2.68.x now considers warning C4098 ('void' function returning a value) as
an error, so avoid doing that.
2021-04-16 11:39:09 +08:00
Matthias Clasen
d1d009b491 Merge branch 'x11-quiet-exit' into 'master'
x11: Be quiet on exit by default

See merge request GNOME/gtk!3436
2021-04-14 00:32:05 +00:00
Matthias Clasen
6f11165dd1 x11: Be quiet on exit by default
The condition we check for to catch X servers going away
may not be accurate anymore, and the warning shows up in
logs, causing customers to be concerned. So, be quiet by
default, unless the user explicitly asked for a message.
2021-04-13 14:52:48 -04:00
Emmanuele Bassi
b0990aa8e2 wayland: Build with G_DISABLE_ASSERT 2021-04-12 21:26:02 -04:00
Matthias Clasen
cce36ae701 wayland: Improve font setting fallback more
We may get a response from the portal that contains
no useful settings at all. In that case, we should
fallback as well.

Fixes: #3838
2021-04-07 19:24:09 -04:00
Carlos Garnacho
07167fdf22 surface: Always set PHASE_PAINT as pending when updates are scheduled
At times (most often when closing subsurfaces that are scheduling
relayouts) the PHASE_PAINT handling gets broken with the following
sequence:

1. Surface receives wl_callback.done for the previous frame.
   Surface is thawed.
2. A new update on the surface is scheduled. PHASE_PAINT is
   requested directly on the frame clock. priv->pending_phase is
   left unset in the surface.
3. Surface gets frozen
4. Frame clock processes the update scheduled at 2. The surface
   is frozen, so paint is prevented. PHASE_PAINT is considered
   handled.
5. Compositor emits wl_callback.done again. Surface is thawed.
6. At this point the machinery is off
   - The surface didn't paint but has pending update regions
   - priv->draw_needed is set in the toplevel and other portions
     of the widget tree
   - So queueing redraws is ineffective at eventually calling
     gdk_surface_schedule_update() again on the toplevel surface.
   - We don't paint anymore, so this broken state is not flushed
     until other subsurface changes manage to schedule the missing
     update.

To fix this, always set PHASE_PAINT in priv->pending_phase when
doing gdk_surface_schedule_update(). If the frame clock turns
around before the surface is thawed, it will still be waiting to
be processed the next iteration.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3750
2021-04-07 23:06:06 +02:00
Matthias Clasen
62f10b1b8f wayland: Improve font setting fallback
When we don't get stettings from the portal, the current
fallback is 'awful fonts'. There is no need for that. Instead,
set the fallback values to grayscale antialiasing with slight
hinting.
2021-04-07 08:50:14 -04:00
Robert Mader
56d37ceed0 gdk/wayland: Defer processing of globals closures
... until all globals have been received.

The dependency tracking introduced in 4e9be39518 only allows to
specify required globals and processes the closures as soon as
the requirements have been met. There are, however, also optional
dependencies - most notably the primary_selection protocol.
Currently we rely on the fact that compositors like Mutter announce
it before `wl_seat`, even though the order is not specified in
the spec.

Process globals closures only after all globals have been announced,
so optional dependencies can be accommodated.

Closes https://gitlab.gnome.org/GNOME/gtk/-/issues/3791
2021-03-30 15:20:00 +02:00
Matthias Clasen
7644605dfc Plug a small memory leak 2021-03-27 19:11:56 -04:00
Matthias Clasen
08f68cce40 gdk: Add an arg check to gdk_device_get_timestamp
Pointed out by Emmanuele Bassi.
2021-03-26 11:09:50 -04:00
Matthias Clasen
7849590a82 gdk: Add gdk_device_get_timestamp
Give each device a timestamp that reflects the last
user activity with that device, as reflected in the
events that are produced for this device.
2021-03-26 11:09:05 -04:00
Matthias Clasen
f131d68fef gdk: Add gdk_device_get_timestamp
Give each device a timestamp that reflects the last
user activity with that device, as reflected in the
events that are produced for this device.
2021-03-26 10:30:33 -04:00
Carlos Garcia Campos
50b70298c0 clipboard: Fix a crash when GdkContentProviderUnion doesn't support the given data format
After iterating all the providers, all of them returning unsupported
error, gdk_content_provider_union_get_value() returns FALSE without
filing the given GError. Then gdk_clipboard_read_value_internal()
assumes there's a GError when FALSE is returned and
g_task_return_error() fails. We can just chain up to parent
implementation to ensure the GError is filled with unsupported error.
2021-03-25 15:10:00 +01:00
Matthias Clasen
5531906973 Merge branch 'gles-fallback' into 'master'
gdkglcontext-wayland: Fallback to GLES 2.0 after legacy failed

See merge request GNOME/gtk!3327
2021-03-24 11:21:21 +00:00
Tom Schoonjans
d5de73fb9d gdkmacosglcontext: fix compilation error
See https://developer.apple.com/documentation/appkit/nsopenglpixelformat/1436219-initwithattributes?language=occ
2021-03-24 10:08:11 +00:00
Olivier Fourdan
80ba38a0b3 x11/dnd: Ignore XErrors from the COW
The DnD code for X11 adds the composite overlay window (aka COW) to the
cache.

Yet the X11 requests to get and release the COW may trigger XErrors that
we ought to ignore otherwise the client will abort.

Fixes: #3715
2021-03-22 15:38:58 +01:00
Emmanuel Gil Peyrot
aced6030ee gdkglcontext-wayland: Fallback to GLES 2.0 after legacy failed
This lets the NGL backend be selected instead of the Cairo backend on
devices which expose both GL and GLES, but have better support of GLES.

Tested on a PinePhone.
2021-03-21 20:37:04 +00:00
dparisot
82b11623f4 Load icon from executable on Windows 2021-03-21 15:24:28 +01:00
Chun-wei Fan
38ad068d9b GDK-Win32: Remove extraneous call to _gdk_win32_append_event()
Apparently, by comparing with the other backends, we should not call
_gdk_win32_append_event() after calling gdk_scroll_event_new() but we should
call it after calling gdk_scroll_event_new_discrete(), which was why we didn't
restore the cursor after we scroll using the mouse wheel and didn't manage to
remove the shade that appears after we scrolled to the very top or very bottom.

Also, as suggested by the reporter, use IDC_SIZEALL for the system cursor that
we fall back to if no cursor theme is installed, as with other Windows
programs.

This should really fix issue #3581.
2021-03-17 11:22:23 +08:00
Matthias Clasen
74e2bb4cf1 dnd: Add some warnings to the docs
Add some warnings about pitfalls of the async dnd api.
2021-03-16 14:48:44 -04:00
Kjell Ahlstedt
0f6b91109e gdkglcontext-x11: Don't assume that cairo-xlib.h is in cairo directory
If cairo is a subproject, it's not necessarily installed when gtk
is built. In the source tree, cairo's headers are not stored in
a directory called 'cairo'.
2021-03-16 11:47:16 +01:00
Matthias Clasen
f279c7b1c2 Merge branch 'fix-3581' into 'master'
gdkcursor-win32.c: Add cursor map for all-scroll (issue #3581)

Closes #3581

See merge request GNOME/gtk!3298
2021-03-15 22:32:23 +00:00
Matthias Clasen
e3dcc3d369 wayland: Fix cross-layout accelerators
GTK traditionally lets you activate keyboard shortcuts
even if they are for a non-active layout. But it is meant
to only activate with a keysym from a non-active layout
when that symbol is not present in the current layout.
That last condition was lost when key event handling
was redone for GTK4. Bring it back.
2021-03-15 17:14:49 -04:00
Matthias Clasen
568fe2e97b wayland: Add debug spew for active keyboard layouts
Print out what we think the active keyboard layout is,
when it changes, with GDK_DEBUG=input.
2021-03-15 17:14:49 -04:00
Matthias Clasen
1eebf0ebd1 wayland: Emit keys-changed on layout changes
We were forgetting to do this in when layout changes are
communicated via handle_modifiers.
2021-03-15 12:34:23 -04:00
Chun-wei Fan
54b3048584 gdkcursor-win32.c: Add cursor map for all-scroll
This makes sure that we don't have cursors disappearing on Windows upon
scrolling because we can't find a cursor that exists on the system during
a scroll, and unlike GTK-3.x, we do not default to the arrow pointer on GTK4.

Just mimic what we have on X11 and Wayland: the trusty standard arrow pointer.

Fixes issue #3581.
2021-03-15 17:16:33 +08:00
Benjamin Otte
dbd19bf27a x11: Don't call _gdk_surface_update_size() all the time
We were calling _gdk_surface_update_size() every frame, even if the
window size didn't change. This would cause us to discard all cached
buffers and redraw the whole screen.

This was BAD.
2021-03-15 03:16:50 +01:00
Benjamin Otte
97fad45237 surface: Remove unused gdk_surface_get_unscaled_size()
Also remove unscaled_width/height members in the win32 backend.

Both of those are unused.
2021-03-15 02:56:28 +01:00
Chun-wei Fan
e941e2be7d gdksurface-win32.c: Fix window menu positioning
We ought to get the coordinates of where the window menu should be
displayed using gdk_win32_surface_get_root_coords(), instead of rounding
the position that we obtained with gdk_event_get_position().

Also rename items a bit in the same function, and call
gdk_event_get_event_type() for consistency with the other backends.

Fixes issue #3704.
2021-03-12 18:45:43 +08:00
Matthias Clasen
47c1b50eba cursor: Use a table for cursor names
This gets all the names into view at the same time.
2021-03-11 16:37:35 +00:00
Matthias Clasen
494bdad887 contentprovider: Convert some more markup 2021-03-11 16:37:34 +00:00
Matthias Clasen
d5e9e10d0a toplevel: Add property annotations
Connect properties, getters, and setters with annotations.
2021-03-11 16:37:32 +00:00
Matthias Clasen
d262f740b2 texture: Add property annotations
Connect properties, getters, and setters with annotations.
2021-03-11 16:37:32 +00:00
Matthias Clasen
d886ab9229 surface: Add property annotations
Connect properties, getters, and setters with annotations.
2021-03-11 16:37:32 +00:00
Matthias Clasen
6be66205cc seat: Add property annotations
Connect properties, getters, and setters with annotations.
2021-03-11 16:37:32 +00:00
Matthias Clasen
abb6fe326f popup: Add property annotations
Connect properties, getters, and setters with annotations.
2021-03-11 16:37:32 +00:00
Matthias Clasen
d6c763f2ae monitor: Add property annotations
Connect properties, getters, and setters with annotations.
2021-03-11 16:37:32 +00:00
Matthias Clasen
34533b544a glcontext: Add property annotations
Connect properties, getters, and setters with annotations.
2021-03-11 16:37:32 +00:00
Matthias Clasen
d92647a92b drop: Add property annotations
Connect properties, getters, and setters with annotations.
2021-03-11 16:37:32 +00:00
Matthias Clasen
553a959102 drawcontext: Add property annotations
Connect properties, getters, and setters with annotations.
2021-03-11 16:37:32 +00:00
Matthias Clasen
9a33a1852a drag: Add property annotations
Connect properties, getters, and setters with annotations.
2021-03-11 16:37:32 +00:00
Matthias Clasen
ce83a0e5bb displaymanager: Add property annotations
Connect properties, getters, and setters with annotations.
2021-03-11 16:37:32 +00:00
Matthias Clasen
d724ea294d display: Add property annotations
Connect properties, getters, and setters with annotations.
2021-03-11 16:37:32 +00:00
Matthias Clasen
038006d582 devicetool: Add property annotations
Connect properties, getters, and setters with annotations.
2021-03-11 16:37:32 +00:00
Matthias Clasen
4a4301be38 device: Add property annotations
Connect properties, getters, and setters with annotations.
2021-03-11 16:37:32 +00:00
Matthias Clasen
50fe533246 cursor: Add property annotations
Connect properties, getters, and setters with annotations.
2021-03-11 16:37:32 +00:00
Matthias Clasen
11022fc485 contentprovider: Add property annotations
Connect properties, getters, and setters with annotations.
2021-03-11 16:37:32 +00:00
Matthias Clasen
c51585bab1 clipboard: Add property annotations
Connect properties, getters, and setters with annotations.
2021-03-11 16:37:32 +00:00
Matthias Clasen
701ebd55c7 applaunchcontext: Add property annotations
Connect properties and getters with annotations.
2021-03-11 16:37:32 +00:00
Emmanuele Bassi
9a16b1b971 docs: Remove duplicate documentation stanzas 2021-03-11 16:37:31 +00:00
Emmanuele Bassi
895aa1d3ab docs: Fix typos 2021-03-11 16:37:31 +00:00
Emmanuele Bassi
da6861188b docs: Fix value annotation
Drop the `:`.
2021-03-11 16:37:31 +00:00
Emmanuele Bassi
1dd240974b docs: Fix copy-paste error in GdkDevice 2021-03-11 16:37:31 +00:00
Matthias Clasen
4ee4c88e43 wayland: Fix a link
gi-docgen currently can't handle links without namespace
in the Wayland docs.
2021-03-11 16:37:31 +00:00
Matthias Clasen
205a13eaa0 docs: Brush up the Wayland backend docs
Add some content here.
2021-03-11 16:37:31 +00:00
Matthias Clasen
a9dd352986 gdk: Some more tweaks of the docs 2021-03-11 16:37:31 +00:00
Matthias Clasen
9132f1831c docs: Rework the gdk docs
Convert links, make things more concise.
2021-03-11 16:37:31 +00:00
Matthias Clasen
3d04c0f4be docs: Move GdkEvent docs inline
This is not really worth a chapter of its own.
2021-03-11 16:37:31 +00:00
Emmanuele Bassi
6f93e63d21 docs: Move detached sections into their own content file 2021-03-11 16:37:30 +00:00
Emmanuele Bassi
04fb95ce9f docs: Split GdkDrag and GdkDrop sections
This way we have a section for each class.
2021-03-11 16:37:30 +00:00
Emmanuele Bassi
548280da9f docs: Rename GdkTexture section
The name needs to match the class.
2021-03-11 16:37:30 +00:00
Emmanuele Bassi
b9f0cf1c8b docs: Move gdkcairo section to an external file 2021-03-11 16:37:30 +00:00
Matthias Clasen
e62f9e33a1 Merge branch 'gdk-win32-use-window-from-point-for-master' into 'master'
GdkWin32: Fix mouse events in presence of transparent windows on the desktop

Closes #370, #417, and gimp#1082

See merge request GNOME/gtk!2800
2021-03-11 01:09:39 +00:00
Benjamin Otte
0a9d075b47 wayland: Fix memleaks when rendering with Cairo
We were leaking buffers. This wasn't caught by valgrind and friends
because it was shared memory (with the compositor), but top(1) would
instantly see memory consumption of the app and the shell go through the
roof.
2021-03-09 19:52:59 +01:00
Benjamin Otte
b63c4d6722 wayland: Don't call _gdk_surface_update_size() all the time
We were calling _gdk_surface_update_size() every frame, even if the
window size didn't change. This would cause us to discard all cached
buffers and redraw the whole screen.

This was BAD.
2021-03-09 19:50:56 +01:00
Rafał Dzięgiel
d586410416
broadway: Restore guint32 type for memory size
guint32 is used as part of the protocol in broadway backend.
Memory size declared with it was mistakenly replaced with size_t type
which does not guarantee being 32bit on all platforms, leading to a crash.
2021-02-27 23:43:12 +01:00
Carlos Garnacho
68ced9b553 gdk/wayland: Assign logical pointer to touchpad gesture events
These events don't make sense on physical devices (for starters, they
are relative to the logical pointer position). Use this device for
those events, also happens to be what the upper parts expect of them.
2021-02-25 01:08:07 +01:00
Matthias Clasen
177f6b377d Merge branch 'bilelmoussaoui/gdk-draw-context' into 'master'
gdk: drop the latest mention of DrawingContext

See merge request GNOME/gtk!3232
2021-02-24 22:28:47 +00:00
Carlos Garnacho
75ae0e04e1 gdk/wayland: Make more matched settings from the portal as valid
Commit 97b5fad131 was a forward port from a gtk3 patch, but the hunk
was applied on the wrong bits of code.

Ensure the initialization paths also do mark settings read from the
portal as valid, so the checks for optional/newer settings actually have
the expected result. It is also desirable to mark settings as valid
after configuration changes (as that patch did effectively do), but not
enough to fix all situations.
2021-02-24 16:41:13 +01:00
Bilal Elmoussaoui
adf9377b61 gdk: drop the latest mention of DrawingContext 2021-02-22 22:15:14 +00:00
Matthias Clasen
e220b24b70 Merge branch 'wip/chergert/macos-gl-opaque-context' into 'master'
macos: make OpenGL context opaque when possible

See merge request GNOME/gtk!3226
2021-02-20 02:37:52 +00:00
Christian Hergert
ea0d487f0b macos: fix resizing of resizable windows on macOS 2021-02-19 15:43:49 -08:00
Christian Hergert
b2fd09625c macos: make OpenGL context opaque when possible
If our opaque region is the entire surface, then we can make the OpenGL
context opaque like we do for decorated windows. This improves performance
as the compositor does not need to blend the surface with the contents
behind the window.
2021-02-19 13:23:26 -08:00
Carlos Garnacho
1fbdfe340e gdk/wayland: Look for font settings recursively
Use the infrastructure already available to look up keys, instead.
This does the right thing and looks up the setting across all
sources.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3680
2021-02-18 16:50:45 +01:00
Matthias Clasen
bf6a40f39b wayland: Complete our buffer format listing
The debug spew for printing out supported buffer
formats was missing a bunch, among them the fp16
formats that are interesting for HDR support.
Add them.

Note that we still only support ARGB8888. But
at least we can print out what don't support.
2021-02-15 16:42:17 -05:00
Matthias Clasen
a4f17eaa8b macos: Apply popup shadow width 2021-02-14 10:52:33 -05:00
Matthias Clasen
e0c48e74bd win32: Apply popup shadow width 2021-02-14 10:52:33 -05:00
Matthias Clasen
ad9c813ed1 x11: Apply popup shadow with 2021-02-14 10:12:10 -05:00