Commit Graph

7602 Commits

Author SHA1 Message Date
Emmanuele Bassi
c08908b488 Fix build when G_ENABLE_DEBUG is undefined 2020-03-13 15:51:57 +00:00
Emmanuele Bassi
7687f9a06f docs: Remove redundant gtk-doc stanza 2020-03-13 15:51:57 +00:00
Torsten Maehne
245ea77da6 Fix spelling of AppKit framework in gdkquartz-gtk-only.h
gtk+-3.24.14 with quartz backend fails to compile on macOS when using
a case-sensitive file system. The cause for the compilation error is a
simple typo in line 26 of `gdk/quartz/gdkquartz-gtk-only.h`. The
AppKit framework is included there with `<Appkit/Appkit.h>` instead of
`<AppKit/AppKit.h>`, which is fixed with this commit.

References: https://trac.macports.org/ticket/60168
Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/2503
2020-03-10 19:21:23 +01:00
Carlos Garnacho
a097ca0906 gdk/wayland: Harden against NULL selection content
If NULL is returned, probably the client shouldn't advertise the
mimetype. Make it sure we forget entirely about the attempt to
cache this mimetype, as it'll be mistaken as pending otherwise.

Dropping this cached selection will in consequence close the fd
of all pending readers, which seems appropriate for NULL content.

https://gitlab.gnome.org/GNOME/gtk/issues/2456
2020-02-20 14:09:00 +01:00
Carlos Garnacho
6893118510 gdk/wayland: Avoid invalid memory access on cancellation
The only way to have G_IO_ERROR_CANCELLED in the write callback
goes through having the array of pending writers already cleared.
It should not access the invalid AsyncWriteData and StoredSelection
in that case.
2020-02-20 14:09:00 +01:00
David Hogan
a1720b97a4 Prevent Quartz/CoreGraphics runtime assertion failures.
gdk_window_impl_quartz_release_context () can be called with a NULL CGContextRef. This causes CoreGraphics assertion failures when debugging a Gtk application in Xcode, as the code was blindly passing that NULL to CGContextRestoreGState () and CGContextSetAllowsAntialiasing (). Given that the matching pair of CGContextSaveGState () and CGContextSetAllowsAntialiasing () calls are already checking for a NULL CGContextRef, it seems reasonable to wrap these calls in a NULL check.
2020-02-17 10:02:50 +11:00
Matthias Clasen
56ee5f03c7 Merge branch 'wip/carlosg/simultaneous-clipboard-access-3.24' into 'gtk-3-24'
gdk/wayland: Handle simultaneous selection requests

See merge request GNOME/gtk!1438
2020-02-14 23:32:07 +00:00
Carlos Garnacho
2ba067e3bc gdk/wayland: Handle simultaneous selection requests
Cache separately the selection contents for each given window/selection/atom
combination, and keep the requestors separate for each of those.

This allows us to incrementally request multiple mimetypes, and dispatch
the requestors as soon as the data is up. This stored selection content is
cached until the selection owner changes, at which point all pending readers
could get their transfers cancelled, and the stored content for the selection
forgotten.
2020-02-14 21:06:59 +01:00
David Hogan
66e2e9c02a Fixed OpenGL extension detection for extensions promoted to OpenGL core.
For a given OpenGL context, macOS in particular does not support enumeration / detection of OpenGL features that have been promoted to core OpenGL functionality. It is possible other drivers are the same. This change assumes support for GL_ARB_texture_non_power_of_two with OpenGL 2.0+, GL_ARB_texture_rectangle with OpenGL 3.1+ and GL_EXT_framebuffer_blit with OpenGL 3.0+. I failed to find definitive information on whether GL_GREMEDY_frame_terminator has been promoted to OpenGL core, or whether GL_ANGLE_framebuffer_blit or GL_EXT_unpack_subimage have been promoted to core in OpenGL ES. This change results in a significant GtkGLArea performance boost on macOS.

Closes #2428
2020-02-14 17:51:22 +11:00
Emmanuele Bassi
418b80e6c8 Merge branch 'private-code' into 'gtk-3-24'
Use `wayland-scanner private-code` in autotools build

See merge request GNOME/gtk!1295
2020-02-11 16:35:30 +00:00
Matthias Clasen
9c8babacae Merge branch 'vista_clipboard' into 'gtk-3-24'
GDK W32: Use Vista+ clipboard API

See merge request GNOME/gtk!1143
2020-02-06 12:52:11 +00:00
Thomas Holder
5e8d97ef0b gdk quartz: add missing include (-Werror=implicit)
Regression of GNOME/gtk!641 (ef72fe750a)
2020-02-02 11:16:40 +01:00
Thomas Holder
528f780871 gdk quartz: add missing include
Fixes startup crash with Inkscape.

Regression of GNOME/gtk!641 (ef72fe750a)
2020-02-01 23:56:56 +01:00
Matthias Clasen
9c832b388b Merge branch 'gdk-device-leak-fix-gtk3' into 'gtk-3-24'
GdkDevice leak fix

See merge request GNOME/gtk!1359
2020-01-30 09:10:50 +00:00
Alberts Muktupāvels
6609a9f061 x11: add support for _GTK_WORKAREAS_Dn
If window manager supports _GTK_WORKAREAS use per-monitor work areas.

https://mail.gnome.org/archives/wm-spec-list/2018-December/msg00000.html
https://gitlab.freedesktop.org/xdg/xdg-specs/merge_requests/22

https://gitlab.gnome.org/GNOME/gtk/merge_requests/478
2020-01-28 14:51:22 +02:00
Sebastian Keller
9ce66b9d05 gdk/x11: Properly unref removed device in XI2 device manager
When a device is added, there are two references to it by the device
manager, the initial one and the one used for the id_table. Removing a
device only removed the reference added by the id_table resulting in the
GdkDevice being leaked.

https://gitlab.gnome.org/GNOME/gtk/merge_requests/1359
2020-01-27 22:06:49 +01:00
Sebastian Keller
4cef9f3471 gdkseatdefault: Unref removed slave devices
Adding a slave device adds a ref, but removing it does not unref it.

https://gitlab.gnome.org/GNOME/gtk/merge_requests/1359
2020-01-27 01:48:37 +01:00
Olivier Fourdan
c9601f1567 gdk/wayland: Fix gdk_window_impl_wayland_finalize() warnings
On Wayland, opening and closing a `GdkDisplay` generates a coupe of
warnings at runtime:

```
  GLib-GObject-WARNING **:
    invalid cast from 'GdkWindowImplWayland' to 'GdkWindow'
  GLib-GObject-WARNING **:
    invalid cast from 'GdkWaylandWindow' to 'GdkWindowImplWayland'
```

This is from `gdk_window_impl_wayland_finalize()` which tries to cast
the given GObject to a `GdkWindow` while it's a `GdkWindowImplWayland`.

Use the correct type casting of objects to avoid the warnings.
2020-01-23 17:34:47 +01:00
Matthias Clasen
9f9fdd6caa Merge branch 'wip/muktupavels/root-surface-scale' into 'gtk-3-24'
gdkscreen-x11: update device scale also for root window

See merge request GNOME/gtk!1208
2020-01-17 18:13:50 +00:00
Alex Samorukov
4a1dc1abfa Merge branch 'gtk-3-24-issue-2102' into 'gtk-3-24'
gdk_quartz_keymap_translate_keyboard_state fills consumed_modifiers incorrectly (closes #2102)

See merge request GNOME/gtk!1225
2020-01-10 21:07:46 +00:00
Michael Forney
fb98242e18 Use wayland-scanner private-code in autotools build
The sed -i flag is non-standard, and may not be available in all
implementations.

The meson build already requires wayland >= 1.14.91 and uses
private-code, so just do that in the autotools build as well.
2020-01-09 19:15:46 -08:00
Alex Samorukov
76e95a702f impl_class->set_functions listed twice in the object 2020-01-08 14:17:36 +00:00
Alex Samorukov
6fdef1055b move [NSApplication sharedApplication] after _gdk_quartz_events_init() to avoid initialization issues 2020-01-08 14:13:36 +00:00
Alex Samorukov
2406badb92 Fix was_fullscreen flag (again!) 2020-01-08 13:56:10 +00:00
Alex Samorukov
5cdca80c0c Fix typo which preventing fullscreen state from being updated correctly 2020-01-03 17:54:12 +00:00
Alberts Muktupāvels
489fb1783b gdkscreen-x11: update device scale also for root window
Window scale can change at runtime. If cairo_surface is already
created for root window gdk_pixbuf_get_from_window will return
wrong image.

_gdk_x11_screen_set_window_scale already updates window_scale for
root window, update also cairo_surface device scale.

https://gitlab.gnome.org/GNOME/gtk/merge_requests/1208
2020-01-03 18:50:14 +02:00
Christoph Reiter
3fe6c5caf8 Merge branch 'honor-hotspot' into 'gtk-3-24'
x11: Honor hotspot during drag cancel animation

See merge request GNOME/gtk!1235
2019-12-11 12:59:36 +00:00
John Ralls
235d28f02d Fix visibiity of gdkselection-quartz.c exported gtk-only functions.
Also ensure that gdkquartz-gtk-only.h is included in distribution
tarballs.

Failing to include gdkquartz-gtk-only.h in gdkselection-quartz.c
caused the compiler to not set the extern storage class on the
functions, in turn causing them to be not exported by libgdk-3.0.dylib.

Fixes https://gitlab.gnome.org/GNOME/gtk/issues/32 again.
2019-12-10 21:46:59 -08:00
Robert Mader
a3cff0add1 x11: Honor hotspot during drag cancel animation
Otherwise the icon "jumps" to the cursor position with its top left when
the animation starts.
This is especially visible if the dragged item is big, like when dragging
mails in Thunderbird.
2019-12-09 01:22:11 +01:00
Thomas Holder
af6487d70c gdk: quartz: fix #2102 consumed_modifiers 2019-12-01 15:14:20 +01:00
Matthias Clasen
f0002ad372 Merge branch 'no-objc' into 'gtk-3-24'
Hide Objective-C from outside GdkQuartz.

See merge request GNOME/gtk!641
2019-11-27 13:39:40 +00:00
Matthias Clasen
61d7700c17 Merge branch 'gtkq-events' into 'gtk-3-24'
gdk: quartz: prevent titlebar events from falling to the window below

See merge request GNOME/gtk!1140
2019-11-27 13:31:39 +00:00
Matthias Clasen
540d849a52 Merge branch 'pg_up_down' into 'gtk-3-24'
gdk: quartz: Avoid page up/down getting filtered by gtk_im_context_filter_keypress()

See merge request GNOME/gtk!1148
2019-11-27 13:25:36 +00:00
Matthias Clasen
56875730d1 Merge branch 'win32-gl-fullscreen-workaround-gtk3' into 'gtk-3-24'
gdkwindow-win32.c: Set WS_BORDER for fullscreen GL windows if requested

See merge request GNOME/gtk!648
2019-11-27 13:16:21 +00:00
Matthias Clasen
19f59cac3d Merge branch 'clipboard-image-miss' into 'gtk-3-24'
GDK W32: no "GDK_SELECTION" event for clipboard

See merge request GNOME/gtk!1198
2019-11-27 12:57:25 +00:00
Chun-wei Fan
11e5f2c473 gdkwindow-win32.c: Set WS_BORDER for fullscreen GL windows if requested
With some GL drivers, it may be the case that menus are not shown
correctly in fullscreen GL windows because DWM is deactivated in the
process.

Force WS_BORDER to be applied to the fullscreen GL window so that we have
a small 1px border when needed (by setting an envvar), so that DWM does
not get deactivated, hence enabling the menus to show.  Also, when we
force WS_BORDER to be applied in this situation, we also deliberately
place the window just outside the top lefthand corner of the screen by
1px and make the window 1px larger than the screen size, so that we
effectively hide the 1px border from view.

Fixes issue #1702.
2019-11-22 12:04:21 +08:00
Руслан Ижбулатов
6452d34cd7 GDK W32: no "GDK_SELECTION" event for clipboard
_gdk_win32_display_convert_selection() does not return anything,
it generates a selection notify event instead. Depending on how
successful it was, the event will have property=GDK_NONE or
property="GDK_SELECTION".

property="GDK_SELECTION" is the default return value for successful
cases, and it tells GTK to grab the data that GDK previously deposited
using selection_property_store().

The problem is that the clipboard branch of this function calls
open_clipboard_timeout(), which can't return anything meaningful (it's
normally a timeout function), and thus doesn't know whether the function
succeeded or failed. Due to my oversight, this resulted in GDK
generating two selection notification events - one from inside of
open_clipboard_timeout() (with the right property, if successful),
and one from the catch-all last line (always defaulting to "GDK_SELECTION").

This caused issue #2223, where GTK only expected exactly one
notification per request, and got confused because it was getting two.

I've looked at the code in open_clipboard_timeout(), and it seems to me
that it always generates a notification (a successful one or an
unsuccessful one). Thus the branch of the function that calls it
directly does not need to follow up with a catch-all notification and
can just return.

This seems to be fixing issue #2223, at least for me, but i'm not
entirely sure that this will not have any adverse side-effects.
Clipboard handling in GTK3 is a complicated mess.
2019-11-18 13:43:42 +00:00
Niklas Hambüchen
d5457d1b14 build: Don't hardcode shared_library() in meson.
Instead, use the standard library().
This is a meson best practice.

Fixes #2248.

Fixes -Ddefault_library=static not having any effect.

Cherry-Picked-From: bb9c07d8fe
2019-11-18 03:31:20 +01:00
Emmanuele Bassi
b736018843 Document handling both discrete and smooth scrolling
It can be tricky to deal with both, so let's give an example of using
both gdk_event_get_scroll_direction() and gdk_event_get_scroll_deltas().

Closes: #2048
2019-11-13 15:24:35 +00:00
Jiří Techet
817e99640d gdk: quartz: Avoid page up/down getting filtered by gtk_im_context_filter_keypress()
For page up/down events (Fn+up_arrow and Fn+down_arrow on macOS)
gtk_im_context_filter_keypress() currently returns TRUE when im-quartz is
used. This means these events get removed when this function is used
(happens e.g. with the Scintilla text editing library).

Adding scrollPageDown: and scrollPageUp: into GdkQuartzView seems to
resolve the issue as these seem to get called instead of the already
present pageUp: and pageDown:.
2019-10-24 21:48:30 +02:00
Carlos Garnacho
ff41436b59 gdk: Do not change the windowing selection when cancelling source
We are interested in changing the owner window, so the upper bits know
that it is not this client who owns the selection. We are still not
interested in unsetting the selection desktop-wide though, so only avoid
emitting the relevant events then.

The same reasonings than in commit 7a891eeb6d apply otherwise.
2019-10-22 18:43:04 +02:00
Carlos Garnacho
ba0a0ce0a0 Revert "gdk: Do not call gdk_selection_owner_set() internally to the backend"
This reverts commit 7a891eeb6d.
2019-10-22 18:36:44 +02:00
Руслан Ижбулатов
e860ac5cf6 GDK W32: Use Vista+ clipboard API
Use RemoveClipboardFormatListener() and AddClipboardFormatListener().
These APIs remove the need for us to maintain the integrity of the
clipboard chain, which turned out to be problematic for some reason
that is yet to be identified.

Fixes #2215
Fixes #442
2019-10-21 19:10:48 +00:00
Carlos Garnacho
7a891eeb6d gdk: Do not call gdk_selection_owner_set() internally to the backend
This should just be called by the upper layers (and result in
wl_data_device.set_selection, etc). We should not trigger this within
the backend otherwise.

Related: https://gitlab.gnome.org/GNOME/mutter/issues/878
2019-10-21 20:41:14 +02:00
Carlos Garnacho
299902b008 gdk: Shuffle the situations where a selection is unset
This should only be explicitly unset (face to the windowing) on
gdk_selection_owner_set() with a NULL window. Other circumstances
(eg. selection being taken over by another client) should just
trigger the SelectionClear event in GDK internally.

Related: https://gitlab.gnome.org/GNOME/mutter/issues/878
2019-10-21 20:41:09 +02:00
Jeremy Tan
f91b429839 gdk: quartz: prevent titlebar events from falling to the window below 2019-10-19 20:27:50 +08:00
Carlos Garnacho
bcd384711a gdk: Avoid poking possibly freed memory
The event may end up freed after delivery, ensure to keep the data we need
in order to emit the matching emulated crossed event matching a proximity
event.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/2157
2019-10-08 17:59:43 +02:00
Carlos Garnacho
d70f85d6b9 gdk: Fix wl_output accounting on tablet devices
The code managing this accounting mixed seat and tablet output lists,
can't bode well. Fixes invalid reads on list elements, as there are
dangling pointers.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/2157
2019-10-08 17:59:37 +02:00
Christoph Reiter
8a9ffef52b Revert "Merge branch 'remove-mingw-SetupDiGetDevicePropertyW-check-3-24' into 'gtk-3-24'"
This reverts merge request !862
2019-09-15 15:19:29 +00:00
Matthias Clasen
f4cd637056 Merge branch 'drop-mir' into 'gtk-3-24'
Drop the mir backend

See merge request GNOME/gtk!1062
2019-09-09 20:02:02 +00:00