Commit Graph

7321 Commits

Author SHA1 Message Date
Matthias Clasen
929a19ca89 gdk: Add a private api to find sandboxes
This will be used in more places in the future.
2018-05-29 20:27:05 -04:00
Daniel Boles
f040918ffa gdkdnd: Fix 2 typos in docs 2018-05-27 18:10:16 +01:00
Daniel Boles
6ff7fdfdc4 GdkWin: Avoid leak if bailing from process_updates
There is no point creating the list if we don't need to because we are
failing out, and even less point in leaking it in that case.
2018-05-25 21:10:58 +01:00
Olivier Fourdan
cc4dd0d343 wayland: check native window for crossing events
gdk_wayland_*_grab()/ungrab() would emit crossing events which translate
as focus_in/focus_out events for keyboard.

However, the ungrab() functions compare the native toplevel as this is
what gets the Wayland pointer enter/leave events with the grab window,
so if the grab is issued on a child gdk window, those won't match and we
would emit more focus_out events than focus_in events.

This means that a widget such as spice-gtk which issues a keyboard grab
whenever the pointer enters the window and releases the grab when it
leaves the window would get uneven numbers of focus_in/focus_out events.

Also, gdk_wayland_seat_ungrab() would not emit crossing events for
keyboard devices, whereas gdk_wayland_device_ungrab() does, which adds
even more potential discrepancies between focus_in/focus_out events.

To solve this problem, introduce two new helper functions which check
the relevant native windows to emit crossing events when needed that get
called evenly from both gdk_wayland_seat_grab()/ungrab() and gdk_Wayland
_device_grab()/ungrab() APIs.

Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=780422
Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/792
2018-05-25 21:10:58 +01:00
Matthias Clasen
7b3129ad4f Merge branch 'wip/restart-cursor-animation-gtk-3' into 'gtk-3-22'
wayland: Fix restarting cursor animation

See merge request GNOME/gtk!150
2018-05-11 15:24:55 +00:00
Jonas Ådahl
7edd465f6d wayland: Fix restarting cursor animation
When an animated cursor was set and the previous cursor animation delay
happened to be the same, we wouldn't restart the animation timeout and
just return G_SOURCE_CONTINUE assuming the timer would continue. This
assumption is however only valid if the function was called from the
timeout, which is not the case.

Instead also arm the timer also if there is no previous timer active.
2018-05-09 22:13:10 +02:00
John Ralls
828f634d5c [Quartz] Hardcode screen resolution for text at 96.0.
It seems that CoreText is internally calibrated for this, see
https://bugzilla.gnome.org/show_bug.cgi?id=787867 for a detailed
discussion.
2018-05-08 17:58:00 -07:00
Benjamin Otte
2ce63a86ba x11: Set a transparent background on windows by default
This avoids black flicker on compositing WMs when a window is first shown.
2018-05-04 13:46:46 +02:00
Ting-Wei Lan
a9f0704ae1 wayland: Use dev/evdev/input.h on FreeBSD
The header linux/input.h used by GDK is specific to Linux. It is
possible to get a few Linux headers on FreeBSD by installing v4l_compat,
but it is usually better to use the one shipped with FreeBSD.

We prefer dev/evdev/input.h to linux/input.h here, so it will always use
dev/evdev/input.h on FreeBSD regardless of v4l_compat.

https://svnweb.freebsd.org/changeset/ports/465644
2018-05-01 22:00:31 +08:00
Samuel Thibault
c926b28d96 gdk: do not deactivate surface on keyboard grabs
When pressing e.g. a window manager shortcut, which acquires keyboard grab,
Xorg would send FocusOut NotifyGrab then FocusIn NotifyUngrab.  Currently
gdk would then deactivate the current surface, which makes accessibility
screen readers think that we have switched to a non-accessible application
and came back again, and thus reannounce the application frame etc. which we
don't want when e.g. just raising volume.

And actually, receiving FocusOut NotifyGrab does not mean losing the
X focus, it only means an application aqcuired a grab, i.e. it is
temporarily stealing keyboard events. On Wayland, this isn't even
notified actually.

This commit makes gdk only deactivate surfaces when there was an actual
focus switch to another window, as determined by has_focus_window (instead
of just has_focus), which happens either normally through FocusOut with
NotifyNormal, or during grabs through FocusOut with NotifyWhileGrabbed.

Fixes #85

(cherry picked from commit 01455399e8)
2018-04-30 11:17:34 +02:00
Emmanuele Bassi
88b08c05c0 wayland: Allow a NULL inhibitors hash table
The shortcuts inhibitors hash table is created when we create a
GdkWaylandWindow implementation for a GdkWindow, and it's destroyed once
we finalize the instance. The fake "root" window we create for the
Wayland display does not have a backing native window, so the shortcuts
inhibitors hash table is set to NULL; this causes a critical error
message when calling g_hash_table_destroy() on it. The finalization of
the root window happens when we close a display connection.

We should use g_clear_pointer(), instead, as it's NULL safe.

Without this change, the displayclose test fails, as all warnings are
considered fatal.
2018-04-23 10:02:43 +01:00
Emmanuele Bassi
07124b5e99 x11: Query whether we have GLX support
Epoxy 1.4 has new ad hoc API that we can use to check whether GLX is
available on the current system.

If we didn't use this API, we'd have to manually dlopen libGL (or its
equivalent on different OSes) and check if it had GLX symbols; since
Epoxy already does all of this internally, we can simply ask it instead.

https://bugzilla.gnome.org/show_bug.cgi?id=775279
(cherry picked from commit 02eb344950)
Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
2018-04-23 09:13:41 +01:00
Daniel Boles
2d02854685 gdkselection: Clarify that X is only a design base
rather than being a requirement for using our selection APIs.

https://bugzilla.gnome.org/show_bug.cgi?id=791542
2018-04-22 16:11:01 +01:00
Benjamin Otte
d92df4ff2c Merge branch 'gtk-3-22' into 'gtk-3-22'
wayland: Fix setting geometry hints

See merge request GNOME/gtk!98
2018-04-09 20:17:00 +00:00
Sébastien Villemot
59136773b8 gdk_x11_display_get_monitor: fix monitor number test logic
When asked for a nonexistent (positive) monitor number,
gdk_x11_display_get_monitor would (at best) return an uninitialized pointer,
instead of returning NULL.

https://gitlab.gnome.org/GNOME/gtk/merge_requests/107
2018-04-09 18:27:44 +01:00
Jan Alexander Steffens (heftig)
8e74e515c7
wayland: Fix setting geometry hints
The stable xdg_shell port (5c8bb51a) introduced an error in
gdk_wayland_window_set_geometry_hints which would set the minimum size
to the maximum size, if provided.

This resulted in various wxWidgets apps (FileZilla, Audacity, Veracrypt)
crashing because they attempted to allocate a ginormous surface.

Fixes #157.
2018-04-04 14:38:45 +02:00
Matthias Clasen
a09df57a5f Merge branch 'gtk-3-22-bz773274' into 'gtk-3-22'
wayland: Don't paint if the window is unmapped

See merge request GNOME/gtk!31
2018-03-25 20:47:02 +00:00
Matthias Clasen
5c8bb51a58 Merge branch 'wip/xdg-shell-gtk-3-22' into 'gtk-3-22'
xdg shell (stable; gtk 3 22)

See merge request GNOME/gtk!36
2018-03-20 16:28:00 +00:00
Daniel Boles
92bef46b4c gdkrgba: Add a missing apostrophe in a doc comment 2018-03-19 15:13:04 +00:00
Руслан Ижбулатов
3e68abddbc Merge branch 'lrn/issue-82_3-22' into gtk-3-22 2018-03-19 09:40:58 +00:00
Olivier Fourdan
3bd7b379c8 wayland: Drop cairo surfaces when withdrawing
If a window 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_window_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-16 16:01:21 +01:00
Jonas Ådahl
0454a1cace wayland: Minor whitespace cleanups
Broke up a long line, added an empty one, and indented another one.

https://bugzilla.gnome.org/show_bug.cgi?id=791939
2018-03-16 17:44:48 +08:00
Jonas Ådahl
a46bc8b5a3 wayland: Add support for xdg-shell stable
This commit adds support the stable version of the xdg-shell protocol.
Support for the last version of the unstable series is left intact, but
will not receive new features.

The stable version is prioritized above the older version.

https://bugzilla.gnome.org/show_bug.cgi?id=791939
2018-03-16 17:44:48 +08:00
Руслан Ижбулатов
577f1a992e GDK W32: send a DELETE selection when using LOCAL selection protocol
This was not needed before, but now it seems to be necessary for
some reason. The code is just an adjusted copy of the appropriate
piece of the OLE2 protocol code, sending GDK_SELECTION_REQUEST.

The rest is just fixing the fallout, allowing LOCAL protocol to pass
the functions it wasn't supposed to pass before.

Closes #82
2018-03-13 18:21:50 +00:00
Sander Sweers
f0bea1ab1d
Add proper annotation for gdk_frame_clock_get_refresh_info
See https://gitlab.gnome.org/GNOME/gtk/issues/77
2018-03-12 16:06:46 +01:00
Pavel Roskin
cc967849f7 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:00:40 +01:00
Tomasz Miąsko
5d258bf314 Fix introspection for GdkEventTouchpadPinch and GdkEventTouchpadSwipe.
When using type annotations, the ABI of type being annotated and a new
type introduced from annotation should match.

In case of enumerations, the most common ABI, and probably the only one
currently used in practice with gtk, corresponds to -fno-short-enums
compiler option. It uses int as the underlying type of enum, bumping it
up to unsigned int, long int or unsigned long int, in that order, when
necessary.

Thus, when annotating a field of integer type with an enum type, it is
never correct to annotate field smaller than int, because it changes the
ABI from perspective on introspection.

The gint8 phase field in GdkEventTouchpadSwipe and GdkEventTouchpadPinch
structures have been previously annotated in such a way, and this change
removes this annotation to restore ABI compatibility.

Size of structures before (which does not match C):

```
>>> Gdk.EventTouchpadPinch.__info__.get_size()
104
>>> Gdk.EventTouchpadSwipe.__info__.get_size()
88
```

Size of structures after (which does match C):

```
>>> Gdk.EventTouchpadPinch.__info__.get_size()
96
>>> Gdk.EventTouchpadSwipe.__info__.get_size()
80
```

Fixes issue #57.
2018-03-04 17:55:44 +01:00
Christoph Reiter
342aee304a 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:35:05 +01:00
Christoph Reiter
5c0d242ea3 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 19:53:43 +01:00
Tom Schoonjans
2760b020a8 gdkquartz.h: export pasteboard functions 2018-02-16 12:44:18 +00:00
Carlos Garnacho
3146f29d3a 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-14 14:58:06 +01:00
Daniel van Vugt
c6901a8b95 Fix irregular gdk_frame_clock_get_frame_time
This fixes stuttering in animations that rely on the regularity of
gdk_frame_clock_get_frame_time.

https://bugzilla.gnome.org/show_bug.cgi?id=787665

BEFORE
gdkgears:
58 FPS and visibly stuttering
gnome-maps on a 59.95Hz monitor:
"paint" g_get_monotonic_time +17278μs, gdk_frame_clock_get_frame_time +17278μs
"paint" g_get_monotonic_time +17449μs, gdk_frame_clock_get_frame_time +17426μs
"paint" g_get_monotonic_time +17620μs, gdk_frame_clock_get_frame_time +17600μs

AFTER
gdkgears:
60 FPS and smoother
gnome-maps on a 59.95Hz monitor:
"paint" g_get_monotonic_time +18228μs, gdk_frame_clock_get_frame_time +16680μs
"paint" g_get_monotonic_time +15010μs, gdk_frame_clock_get_frame_time +16680μs
"paint" g_get_monotonic_time +17134μs, gdk_frame_clock_get_frame_time +16680μs
2018-02-14 08:02:52 -05:00
Benjamin Otte
4b1c02560f x11: Don't call XInput API for core events
Fixes emacs crashing with XMing.

https://bugzilla.redhat.com/show_bug.cgi?id=1483942
2018-02-12 21:11:58 +01:00
Emmanuele Bassi
299a91bd46 docs: Properly deprecate gdk_keymap_get_default()
We're using a compiler annotation, but there's no deprecation notice in
the gtk-doc stanza.
2018-02-11 23:28:50 +00:00
Emmanuele Bassi
80e5f28ca0 Remove stray format character
We are not using any string in the debug message.
2018-02-11 23:28:50 +00:00
Emmanuele Bassi
2de14479b2 broadway: Cast g_object_ref() to the right type
In GLib 2.56, g_object_ref() will check that you're assigning the return
value to a variable of the same type you're passing in.
2018-02-11 23:28:50 +00:00
Emmanuele Bassi
d219bd4d5a x11: Balance an error trap
We are pushing an error trap, and never popping it from the stack.
2018-02-11 23:28:50 +00:00
Carlos Garnacho
08f60dbcf6 wayland: Improve EOF detection when reading selections
g_input_stream_read_bytes() roughly provides the same guarantees
than g_input_stream_read() wrt the number of bytes being possibly
read (i.e. it being a best effort, but no real guarantees).

Instead, rely on the 0-len read that we'd get at the end of the
transfer.

Fixes clipboard/DnD transfers possibly being cut short, resulting
on "Broken pipe" errors on the other side.

https://gitlab.gnome.org/GNOME/gtk/issues/1

Closes: #1
2018-02-08 16:29:18 +01:00
Jason Gerecke
c94993e29b 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:24 +01:00
Daniel Boles
bcd3c42b92 GdkMonitor: Fix link to nonexistent Display method
There is no gdk_display_get_monitors(). Instead, we have to use
gdk_display_get_n_monitors() and gdk_display_get_monitor(int).
2018-01-13 20:03:37 +00:00
Ting-Wei Lan
b68e55ecce wayland: Use portable sed syntax in gdk/wayland/Makefile.am
Replace non-portable \<, \>, \+ with \(, \), \{, \} to avoid build
failure on systems not using GNU sed.

https://bugzilla.gnome.org/show_bug.cgi?id=792279
2018-01-10 00:45:07 +08:00
Matthias Clasen
7de01b31ef Remove a dead macro
GCs have been dead for a long time.
2018-01-07 16:38:42 +00:00
Matthias Clasen
176c1046cb Add some deprecation annotations
These functions have been removed in master, and their
replacements are already available here.
2017-12-25 23:00:30 -05:00
Matthias Clasen
a41e0ce4a4 wayland: Handle scale 3 for cursors
This is just a bandaid solution to make scale 3 work.
If people seriously want to go for scales larger than
that, we need a better solution.
2017-12-17 17:17:12 -05:00
Matthias Clasen
e834a2b089 x11: Avoid crash in fallback move emulation
Quietly do nothing when there is already an ongoing operation.
This matches the behavior of the ewmh code, and is much nicer
than a crash.

https://bugzilla.gnome.org/show_bug.cgi?id=789054
2017-12-15 16:17:27 -05:00
Chun-wei Fan
c9a54ba1c2 gdk/win32/gdkselection-win32.c: Fix build without G_ENABLE_DEBUG
_gdk_win32_data_to_string() is only available when G_ENABLE_DEBUG is
defined, so as in gdkproperty-win32.c, use GDK_NOTE on the parts where
we assemble and output the debug messages.
2017-12-15 01:11:17 +08:00
Jonas Ådahl
25dc32c1a1 wayland: Destroy the xdg_imported after the wl_surface
This way the window manager can handle destruction while having the
transient-for relationship still valid.

https://bugzilla.gnome.org/show_bug.cgi?id=791062
2017-12-07 22:13:40 -05:00
Jonas Ådahl
dee5142c91 wayland: Maybe postpone xdg-foreign state setup until mapping
In order to map a window with the correct initial parent-child
relationship when a modal dialog is set up to be a child of an imported
foreign window, the relationship must be set up before the window is
mapped.

In order to do this, if a window is not yet mapped, postpone the
relationship setup until when the window is eventually mapped.

https://bugzilla.gnome.org/show_bug.cgi?id=791062
2017-12-07 22:13:39 -05:00
Руслан Ижбулатов
6d0b0cb99b GDK W32: Plug a resource leak
Ensure that surfaces allocated in the impl are destroyed in finalize()

https://bugzilla.gnome.org/show_bug.cgi?id=787089
2017-12-03 03:14:28 +00:00
Carlos Garnacho
3c40b217b9 gdk: Always emit motion after enter
After a pointer emulating GDK_TOUCH_END event triggering a fake leave
notify with GDK_CROSSING_TOUCH_END mode, pointer_under_window will be
unset, which will make the next motion/touch_update event to trigger
an enter notify event again.

Up till there, that's fine, however the motion event is just consumed
in favor of the just synthesized enter notify event. This is unexpected
to clients like spice-gtk that will only update coordinates from motion
events, sending both enter and motion is more consistent with X11 and
will make them happy.

https://bugzilla.gnome.org/show_bug.cgi?id=791039
2017-11-30 19:26:48 +01:00