Commit Graph

7572 Commits

Author SHA1 Message Date
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
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
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
Philip Zander
d33c24b31e Win32 IME fixes
See merge request !1063
2019-09-06 20:45:45 +02:00
Matthias Clasen
340c62ecd6 Merge branch 'issue1044' into 'gtk-3-24'
Fix resize requests being forgotten when maximizing a hidden window

See merge request GNOME/gtk!367
2019-09-03 15:43:07 +00:00
Jonas Ådahl
e9fdb35687 Revert "gdk/wayland: go through monitor to compute scale factor"
This reverts commit 6d545b6d03.

Reverting as this broke multi DPI systems, where a client is expected to
render at scale = 1 if it is only visible on a scale = 1 monitor.

Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/2129
2019-09-03 17:13:17 +02:00
Olivier Fourdan
a1becccd3f wayland: Fix xdg-output v3 support
The xdg_output.done event is deprecated in xdg-output v3, so clients
need to rely on the wl_output.done event instead.

However, applying the changes on the fist wl_output.event when using
xdg-output v3 may lead to an incomplete change, as following xdg-output
updates may follow.

Make sure we apply xdg-output events on wl_output.done events with
xdg-output v3.

https://gitlab.gnome.org/GNOME/gtk/issues/2128
2019-09-03 16:10:33 +02:00
John Ralls
a12931b9f8 Silence compiler type warnings about converting enums to gboolean. 2019-08-28 19:54:58 -07:00
Christoph Reiter
31a57fe389 Drop the mir backend
It depends on libcontent-hub-glib which was dropped from Ubuntu in mid 2017:
https://bugs.launchpad.net/ubuntu/+source/content-hub/+bug/1712874

It was patched downstream to still build until it was disabled at the beginning
of 2018: https://launchpad.net/ubuntu/+source/gtk+3.0/3.22.28-1ubuntu3

This likely means no one has built gtk with mir in 2 years, and there is no plan
to change that, so just remove it.
2019-08-25 22:46:28 +02:00
Matthias Clasen
64fe119643 Merge branch 'wip/carlosg/ensure-selection-notify' into 'gtk-3-24'
Ensure to emit GDK_SELECTION_NOTIFY on all circumstances

See merge request GNOME/gtk!1057
2019-08-25 11:54:46 +00:00
Matthias Clasen
3857077701 Merge branch 'build-remove-xiproto-xreply-check' into 'gtk-3-24'
autotools: remove NEED_XIPROTO_H_FOR_XREPLY check

See merge request GNOME/gtk!1058
2019-08-25 11:46:40 +00:00
Matthias Clasen
a579083b17 Merge branch 'fix-opengl-profiling' into 'gtk-3-24'
Fix profiling output when rendering with OpenGL

See merge request GNOME/gtk!1060
2019-08-24 09:52:00 +00:00
Alexander Larsson
e417fa1b7a Fix profiling output when rendering with OpenGL
I was not getting any gtk+ profile markers output from the frame clock
when I was profiling an OpenGL app (gnome-hexgl). I debugged this and
it turns out that the profiling depends on getting the _NET_WM_FRAME_TIMINGS
event from the compositor, and once we switched to OpenGL rendering
this never appeared.

It turns out the reason it didn't is that the compositor only does
so if the client increases the counter tied to the window, and the
x11 gdk code has this optimization where if we do a draw pass
but nothing is actually drawn we don't update the counter.

Unfortunately the detection of whether something was draw or not
is based on some cairo surface hack that breaks when we render with
OpenGL instead. The fix is to just always update the counter if
we're drawing with OpenGL.
2019-08-23 23:18:32 +03:00
Carlos Garnacho
022d0044cc Merge branch 'fix-2070' into 'gtk-3-24'
Fixes incorrect crossing emulation of proximity events in Wayland

See merge request GNOME/gtk!1044
2019-08-21 22:23:10 +00:00
Christoph Reiter
a1c1c788c9 autotools: remove NEED_XIPROTO_H_FOR_XREPLY check
This was added with https://bugzilla.gnome.org/show_bug.cgi?id=148032
to make gtk compile against X11R5, see commit 3b9a31df0

That release is >20 years old now, so we can safely remove it.

The motivation for this is to remove any checks that we don't have in the
meson build.
2019-08-21 20:39:15 +02:00
Julius Lehmann
94960b828f Add slave device option for emulated crossing events under Wayland
This fixes an issue where stylus proximity in/out events emulate enter/leave events.
The emulated events didn't contain the correct slave device and therefore the
resulting device class was set incorrectly. Crossing event emulation now also
works with slave devices.

Closes #2070
Fixes #2070
Closes: https://gitlab.gnome.org/GNOME/gtk/issues/2070
2019-08-21 16:23:45 +02:00
Carlos Garnacho
6841c73808 gdk/wayland: Unset clipboard/primary if giving up selection ownership
If gdk_selection_owner_set() is called with a NULL window, we should unset
the related data source for the current selection.
2019-08-20 23:51:04 +02:00
Carlos Garnacho
f43f6900c9 gdk/wayland: Emit GDK_SELECTION_NOTIFY on all failure/unset paths
Either on failure, or when replacing a selection buffer due to a new
wl_offer. We should emit one event for each pending requestor then.
2019-08-20 23:51:04 +02:00
Jonas Ådahl
9dd198e53f gdk/x11: Clamp window size both when creating and resizing
We clamp to 32767 when creating a new X11 GdkWindow due to larger sizes
not being supported, but still try to resize to larger when
gdk_window_resize() is called. Fix this by clamping in both places.

This fixes an issue in mutter where ridiculously sized Java windows
would not show up.
2019-08-06 11:13:55 +02:00
Lionel Landwerlin
6d545b6d03 gdk/wayland: go through monitor to compute scale factor
The current code only goes through the output associated to the
window's wayland surface enter/leave events. That means that to update
the scale factor the window only looks at the outputs on which it
received enter/leave events. That doesn't include a new monitor
connected to the system on which the window might be display next.

The spirit of the existing logic seems to be to go through all the
scale factor available on the current monitors of the system and pick
the highest. So fix the current behavior by looking at the monitor on
the display.

Fixes #1144.

Signed-off-by: Lionel Landwerlin <llandwerlin@gmail.com>
2019-08-03 22:36:48 +03:00
Lionel Landwerlin
27b4032680 gdk/wayland: remove unused variable
Signed-off-by: Lionel Landwerlin <llandwerlin@gmail.com>
2019-08-03 22:30:59 +03:00
Matthias Clasen
25dd5d9eb0 Merge branch 'gdkmonitor-x11-manufacturer-stable' into 'gtk-3-24'
gdk: x11: Fill GdkMonitor manufacturer with PNP id from EDID

See merge request GNOME/gtk!848
2019-08-02 12:38:04 +00:00
Carlos Garnacho
a2b9ceaf99 gdk/x11: Store idle ID, and ensure it is eventually unset
This idle happens on mutter around the x11 display being closed, which
has it running after it did actually happen. Ensure the window removes
this idle on dispose.
2019-08-02 12:54:10 +02:00
Olivier Fourdan
ab1e86a3b1 wayland: Add xdg-output v3 support
xdg-output v3 marks xdg-output.done as deprecated and compositors are
not required to send that event anymore.

So if the xdg-output version is 3 or higher, simply set the initial
value `xdg_output_done` to TRUE so we don't wait/expect that event
from the compositor.

https://gitlab.gnome.org/GNOME/gtk/issues/2053
2019-07-26 17:26:05 +02:00
Olivier Fourdan
a393e2ef33 wayland: Update saved size when maximized/fullscreen
If a client issues a `move_resize()` request while the window is
maximized or fullscreen, update the saved size for when it will be
unmaximized/unfullscreened

Related: https://gitlab.gnome.org/GNOME/gtk/issues/1044
2019-07-26 15:51:47 +02:00
Jeremy Tan
ff21730d8e Fix gdkconfig.h generation for GDK_WINDOWING_QUARTZ 2019-07-20 15:10:34 +08:00
James Westman
abaf682870 macOS: Fix GdkScreen::monitors-changed
This signal was not being emitted on macOS, a bug introduced in 941f3c38.
`emit_monitors_changed` was never set to TRUE, so the signal was never
emitted. `emit_monitors_changed` has now been removed, because its
functionality was moved to GdkDisplay.

In addition, kCGDisplayDesktopShapeChangedFlag was removed from the list of
flags that indicate a new/reconfigured monitor, because monitor removals also
include this flag, which caused removed monitors to not be removed from
GdkDisplay.

Fixes #2004.
2019-07-15 15:40:48 -05:00
Priit Laes
50a32b4b99 gdk: x11: Fill GdkMonitor manufacturer with PNP id from EDID
Previously, the manufacturer property of the GdkMonitor was NULL,
and having at least PNP id at GdkMonitor.manufacturer makes it
possible to distinguish between different monitors programmatically.
2019-06-26 12:07:52 +03:00
Christoph Reiter
ecf2c68d97 Merge branch 'gtk3-build-explicit-encoding' into 'gtk-3-24'
build: always use utf-8 when reading/writing text files

See merge request GNOME/gtk!953
2019-06-25 07:27:58 +00:00
Christoph Reiter
5107735c9f build: always use utf-8 when reading/writing text files
open() in text mode should never be used without an encoding because it defaults
to the locale encoding which is rarely what is wanted.

This fixes the Windows build in some cases (depending on the locale/paths used)
2019-06-25 08:53:26 +02:00
John Ralls
3994e75550 Redo the fullscreen MacOS version control to allow building on 10.6
Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1686
2019-06-22 14:43:50 -07:00
John Ralls
a26f6d9768 Prevent compile error for pressedMouseButtons when using SDK < 10.6.
Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1687
2019-06-22 14:30:59 -07:00
John Ralls
ef72fe750a Hide Objective-C from outside GdkQuartz.
Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1737

Don't export any functions taking or returning MacOS types in
gdkquartz.h, gdkprivate-quartz.h, or any header that either includes.

The GdkQuartz internal functions are moved to a new header
gdkinternal-quartz.h, the functions used by quartz-specific
Gtk files are moved to another new header gdkquartz-gtk-only.h, and
the key and event enums to a new header gdkkeys-quartz.h.
2019-06-22 13:37:46 -07:00