Commit Graph

7798 Commits

Author SHA1 Message Date
Luca Bacci
46c12b2c92
Winpointer: Fix keyboard state
The dwKeyStates field of the POINTER_INFO structure is
always set to 0 no matter what.

Use GetKeyState instead.

Fixes https://gitlab.com/inkscape/inbox/-/issues/5946
2022-01-03 15:08:58 +01:00
Luca Bacci
728f0e13a8 Merge branch 'fix_windows_build' into 'gtk-3-24'
Fix Windows build in gtk 3.24.31

See merge request GNOME/gtk!4292
2022-01-02 16:27:33 +00:00
Thomas Holder
0ac6144369 macOS: Fix QuartzCore linking and compiling with 10.11
Follow-up on 10b5f8a0d6

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/4573
2021-12-29 11:33:50 +01:00
Melroy van den Berg
37f9af5805
Add define for GC_ALLGESTURES, in-case WINVER is not set. 2021-12-28 00:50:17 +01:00
Melroy van den Berg
4090306fd7
Lowercaps Windows.h -> windows.h 2021-12-28 00:47:28 +01:00
Matthias Clasen
aa89959942 Merge branch 'fix-dist' into 'gtk-3-24'
gdk/win32/Makefile.am: Dist gdkkeys-win32.h

See merge request GNOME/gtk!4270
2021-12-21 19:25:50 +00:00
Florian Müllner
da8f634b25 gdk/wayland: Support new high-contrast key
We now have a boolean setting that determines whether the high-contrast
theme should be used. Support it by automatically setting the existing
`gtk-theme-name` and `gtk-icon-theme-name` properties when enabled.

With that, it is no longer necessary to change the regular theme settings
for high-contrast, so toggling between high-contrast and a non-default
theme finally works reliably.
2021-12-21 14:01:10 +01:00
Chun-wei Fan
1a73728e04 gdk/win32/Makefile.am: Dist gdkkeys-win32.h
This was missing from the tarball.
2021-12-21 16:38:17 +08:00
Lukas Oberhuber
10b5f8a0d6 macOS: Big Sur performance patch
One of 4 that were applied on Gimp 2.99. Original authorship
@DesMcGuiness and adapted to Gtk3 by @lukaso
2021-12-18 22:59:58 +00:00
Lukas Oberhuber
71e2821578 gdkquartz: fix crash on uninitialized attribute
`gdk_quartz_display_get_monitor_at_window` crashes when it tries to access the NSWindow on
an offscreen window. The attribute `toplevel` of `impl` is uninitialized and
causes a segfault.

This partially fixes: https://gitlab.gnome.org/GNOME/gimp/-/issues/7608
2021-12-16 13:00:02 +00:00
Luca Bacci
ff06d5d59f Merge branch 'win32-rewrite-keymap-v2' into 'gtk-3-24'
Rewrite GdkWin32Keymap (V2)

See merge request GNOME/gtk!1051
2021-12-15 11:15:27 +00:00
Carlos Garnacho
2800dc356b Merge branch 'gtk-3-24-x11-xi2.4-gestures' into 'gtk-3-24'
[GTK3] Touchpad gestures for X11 (XInput 2.4, X Server 21.1)

See merge request GNOME/gtk!4212
2021-12-13 13:21:09 +00:00
Philip Zander
e658e3c449 gdk/win32: Fix modifiers sometimes being consumed for special keys
Windows keymaps contain some bogus mappings, e.g. Ctrl+Backspace=Delete.
Previously, we correctly identified the key as Backspace, but the Ctrl
was still consumed, so the Ctrl+Backspace keybinding did not work.
2021-12-10 01:14:47 +01:00
Philip Zander
b3fcfa4bbc gdk/win32: Fix group parameter not being used by translate_keyboard_state
gdk_win32_keymap_translate_keyboard_state erroneously used the active
group rather than the specified group, which caused shortcuts not to
work in Inkscape when using a Cyrillic layout.
2021-12-09 12:29:19 +01:00
Philip Zander
4601d3aee4 gdk/win32: Add licensing boilerplate to gdkkeys-win32 2021-12-09 12:29:15 +01:00
Philip Zander
64eedbfaf4 gdk/win32: Remove unneeded struct _GdkWin32KernelCPUFuncs
It only had a single member and was only used internally by one
function.
2021-12-08 22:46:52 +01:00
Chun-wei Fan
4a55c527d7 gdk/win32: Consolidate CPU detection in one place
This consolidates the check for the running CPU in one single location,
to make things a bit cleaner, as:

* We can make use of IsWow64Process2(), if available, to check both
  whether we are running on an ARM64 CPU, and whether we are running as
  a WOW64 process.  This is also the function to use to properly check
  whether we are running as a WOW64 process on ARM64 systems, as
  IsWow64Process() does not work as we want on ARM64 systems.

* If we don't have IsWow64Process2() (which is absent from Windows prior
  to Windows 10 1511, where ARM64 Windows is introduced), we can fall
  back to  IsWow64Process(), which will tell us whether we are running
  as an WOW64 process (but clearly not on an ARM64 system).

Also clean up things a bit so that we can reduce reliance on global
variables.
2021-12-08 22:46:49 +01:00
Philip Zander
aa3e6bb0a3 GdkWin32Keymap: Be more robust against DLL loading failures
Fixes failure on the CI servers when generating GIR files
2021-12-08 22:44:20 +01:00
Philip Zander
4039153ca7 Rewrite GdkWin32Keymap (load table directly from layout DLL)
The old code used repeated calls to `ToUnicodeEx` to populate
the translation table, which is slow and buggy. The new code
directly loads the layout driver DLLs from Windows.

Associated issues: #2055 #1033
Merge request: !1051

GdkWin32Keymap cleanup

Conform to C89, improve comments, whitespace
2021-12-08 22:44:17 +01:00
Carlos Garnacho
068df4874a Merge branch 'wayland-clipboard-fix' into 'gtk-3-24'
wayland: Ensure clipboard handling doesn't lock up in certain corner cases

See merge request GNOME/gtk!4058
2021-12-06 11:16:54 +00:00
msizanoen1
e23b4dd21b wayland: Ensure clipboard handling doesn't lock up in certain corner cases
When a selection request fails to be converted to the requested format in the
GTK layers, the wayland backend would miss bumping the machinery to handle
further pending selection requests. Fix this by reacting to
GdkDisplay::send_selection_notify with target=GDK_NONE (i.e. a failed
conversion as hinted from the upper layers) to do that.

This ensures the clipboard handling doesn't lock up in the following
scenarios:
  - GTK returned with a mismatching type to the one requested
  - GTK fails to convert to the requested type

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4340
2021-12-06 11:30:11 +01:00
Povilas Kanapickas
a94baf4c3d gdk/x11: Report XI2 version on the server 2021-12-03 00:04:10 +02:00
Povilas Kanapickas
a1a2f8ab56 gdk/x11: Implement XI2.4 touchpad gesture support 2021-12-03 00:04:10 +02:00
Emmanuele Bassi
34038aaf7d Merge branch 'wip/fix-randr-race-3-24' into 'gtk-3-24'
x11: Trap error when getting CRTC info [3.24]

See merge request GNOME/gtk!4168
2021-11-24 16:48:39 +00:00
Luca Bacci
78a0cdde83
Quartz: Fix keyboard layout notification
Register for notifications before initializing keymaps
2021-11-24 16:20:02 +01:00
Jonas Ådahl
102341ae9f x11: Trap error when getting CRTC info
This should fix a race happening when RANDR changes quickly, e.g. during
unit testing where tests change monitor configurations rapidly.
2021-11-17 11:14:00 +01:00
Luca Bacci
4d40300d8a
GdkWin32: Make OLE2 DND work in monitors with different OS scales
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3734
2021-11-13 19:41:58 +01:00
Luca Bacci
a174568ef9 Merge branch 'gtk3-dnd-find-dest-window-fix' into 'gtk-3-24'
GdkWin32: Fix DND destination window search

See merge request GNOME/gtk!3885
2021-11-13 14:51:49 +00:00
Luca Bacci
ae8fde9630 Merge branch 'win32-gl-reorg-3' into 'gtk-3-24'
GDK-Win32: Reorganize backend GL code and add fallback mode

See merge request GNOME/gtk!3859
2021-11-06 11:21:43 +00:00
Carlos Garnacho
d81f58bc09 gdk/wayland: Do not use xdg_wm_base.ping serials as "user input" serials
Ping/pong serials are not meant to be interpreted as user input serials
(e.g. those given back later to the compositor on grabs). As a matter
of fact, Mutter uses a different count (i.e. timestamps) in these, so
using these serials may confuse the compositor into denying certain
operations like DnD.
2021-11-05 14:43:23 +01:00
Matthias Clasen
1e72dac839 Merge branch 'wip/hadess/quiet-broadway-gtk3' into 'gtk-3-24'
broadway: Quiet initialisation failures

See merge request GNOME/gtk!4052
2021-10-19 02:45:56 +00:00
Matthias Clasen
25d01b7610 Merge branch 'wip/fix-remap-up-left-popup' into 'gtk-3-24'
window/wayland: Reset position when hiding popup

See merge request GNOME/gtk!3913
2021-10-18 22:34:39 +00:00
Jonas Ådahl
0f871584fc Merge branch 'surfaceloop' into 'gtk-3-24'
Check if size changed before hiding a surface

See merge request GNOME/gtk!3944
2021-10-18 14:20:44 +00:00
Luca Bacci
d34f4416bd Merge branch 'gdk-win32-ensure-correct-order-of-operations-when-handling-dpi-scale-and-gdk-screen-offset' into 'gtk-3-24'
GdkWin32: Ensure consistent order of operations when handling DPI scale and GDK screen offset

See merge request GNOME/gtk!3931
2021-10-18 11:36:47 +00:00
John Ralls
36315cbe2b [quartz]Use the absolute value of Scale values for CGContextScaleSCM
In macOS-12.sdk CGContextConverSizeToDeviceSpace returns a negative
height and passing that to CGContextScaleCTM in turn causes the cairo
surface to draw outside the window where it can't be seen. Passing the
absolute values of the scale factors fixes the display on macOS 12 without
affecting earlier macOS versions.
2021-10-14 12:45:48 -07:00
Bastien Nocera
e7679635b0 broadway: Quiet initialisation failures
Broadway is the only GTK+ backend that throws an error on stderr for a
"display server" connection failure.

This causes problems when gtk_init_check() is used and unexpected error
output is generated such as with hotdoc, which fails when generating a
GTK plugin's documentation instead of overlooking the issue.

"Unable to init server: Could not connect: Connection refused"
2021-10-11 20:29:40 +02:00
Ting-Wei Lan
26d61e2abc GDK/Win32: Fix MinGW autotools build
MinGW-w64 CRT provides no 'hid.lib' file. Instead, it has 'libhid.a'
which can be linked with '-lhid' linker argument.

Also, we have to declare the '_LIBADD' variable and add 'LDADDS' to it,
or 'LDADDS' won't do anything for the build.
2021-09-24 00:06:51 +08:00
Luca Bacci
378ed797a4
GdkWin32: Initialize _gdk_offset_x / _gdk_offset_x to unscaled values
Note that gdk_monitor_get_geometry () returns DPI-scaled values,
while the screen offset should be unscaled, as scales are properties
of indivdual monitors.
2021-09-23 17:37:54 +02:00
Luca Bacci
876a2e6225
GdkWin32: Ensure a consistent order of operations when handling DPI scale and GDK screen offset 2021-09-23 17:37:45 +02:00
Luca Bacci
cac1c7cd22
GdkWin32: Use a signed integral type for the DPI scale
An arithmetic operation involving a signed and an unsigned operand
of the same rank will have both operands converted to *unsigned*.
That's an issue if the signed operand actually has a negative value.

That was causing issues with the handling of monitor geometries that
had negative x / y positions.
2021-09-23 15:28:42 +02:00
Ronan Pigott
23c7e6e13b Check if size changed before hiding a surface
Commit 68188fc948 introduces a workaround for clients that try to
change the size of a popup after it is created, but inadvertently
introduces an infinite loop of surface creation when the popup enters
two or more wl_outputs with different scales on creation.

This commit checks if the size actually changed before applying the
workaround and avoids the loop.
2021-09-13 17:14:14 -07:00
Ronan Pigott
9a4e328928 Ignore wl_output globals not bound by us
Gdk doesn't know the scale of output globals it didn't bind. This
keeps them from entering the output list and triggering erroneous
changes in surface scales.
2021-09-13 03:08:49 -07:00
Luca Bacci
c71dca236c
Use WindowFromPoint to find DND target window 2021-09-10 13:59:27 +02:00
John Ralls
a752e33838 Update Quartz version detection for macOS 12. 2021-09-08 18:01:50 -07:00
John Ralls
e9d4b0dda0 Move includes of gdkinternal-quartz.h from headers to impl files.
gdkinternal-quartz.h isn't installed but the headers that included
it are, which which would cause the build to fail if an external
project included one of them.

Also changed the includes in gdkinteral-quartz.h to local for
faster loading.
2021-09-07 11:08:11 -07:00
John Ralls
7e732caa1e Let gdkquartz-cocoa-access.h find gdkquartz.h during build.
gdkquartz.h is installed in $PREFIX/include/gdk but is in gdk/quartz
in the source tree. Use "gdkquartz.h" to find it in both places.
2021-09-07 10:39:37 -07:00
Chun-wei Fan
bcdbb93296 GDK-Win32: Add fallback mode to GLES
...if GLES (libANGLE) support was enabled in the build.  This way, we can
check whether the GL driver is capable enough to support the OpenGL
features that we use in GTK.  If the driver is not capable enough, and
GLES support is enabled, we can try to create the GdkGLContext again as a
GLES context.
2021-09-06 19:36:14 +08:00
Chun-wei Fan
97d3024701 gdk/win32: Some further small GL-related cleanup
Remove from gdkglcontext-win32.h items that aren't really necessary, and
just include gdkglcontext-win32.h where applicable.
2021-09-06 19:36:13 +08:00
Chun-wei Fan
9e949209a1 GDK-Win32: Reorganize gdkgdlcontext-win32.c
Group the WGL-specific code and GLES-specific code together, so that we
can reduce the number of #ifdef ... in the code, to make the code more
readable and easily maintained.  This will pave the way to add a
fallback mode to use libANGLE (OpenGL/ES) in case the Desktop OpenGL
support is inadequte, if OpenGL/ES support is enabled in the build.

This is somewhat based on the updates that were done in GTK master, so
we are using one subclass for WGL-based GdkGLContexts, and another for
GLES-based GdkGLContexts.

Also remove the underscores in many of the functions in
gdkglcontext-win32.*.

Clean up the code a bit as a result.
2021-09-06 19:36:13 +08:00
Jonas Ådahl
d74b01636b window/wayland: Reset position when hiding popup
When a popup is remapped, if the GdkWindow::x/y position is negative,
some best-effort hueristics used to ignore internal X11-style hackery
windows incorrectly scooped up remapped popup windows.

Avoid these hueristics by resetting the x and y fields of GdkWindow to 0
whe hiding a popup. It'll then appear as if it was newly initialized,
and escape the mentioned hueristics.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4071
2021-09-02 10:24:38 +02:00