Commit Graph

7819 Commits

Author SHA1 Message Date
Luca Bacci
4a8d96b95b
GdkWin32: Fix gdk_win32_window_get_frame_extents
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/4690
2022-02-14 16:16:47 +01:00
Philip Zander
a40f9261e9 gdkkeys-win32: Also ignore Ctrl + Shift (etc.)
Some Windows keymaps have bogus mappings for the Ctrl modifier. !4423 attempted
to fix this by ignoring the Ctrl layer, but that was not enough. We also need to
ignore combinations of Ctrl with other modifiers, i.e. Ctrl + Shift. For example,
Ctrl + Shift + 6 is mapped to the character 0x1E on a US keyboard (but it should
be treated as Ctrl + ^). Basically, always ignore Ctrl unless it is used in
conjunction with Alt, i.e. as part of AltGr.

Related issue: #4667
2022-02-08 20:44:35 +01:00
Matthias Clasen
38a1a23a53 Merge branch '3-24-30-api-additions-since-marker' into 'gtk-3-24'
Add `Since` markers for new API between 3.24.11 and 3.24.30

See merge request GNOME/gtk!4425
2022-02-08 00:15:10 +00:00
Phaedrus Leeds
c5c76ad327 gdkapplaunchcontext: Improve set_screen() docs 2022-02-01 11:24:04 -08:00
Sebastian Dröge
a47bb16cff Add Since marker for gdk_wayland_window_set_application_id()
It was added in 3.24.22.
2022-01-30 19:07:42 +02:00
Philip Zander
cfc6d6ddb7 gdkkeys-win32: Ignore CTRL bit for key translation
Some keymaps on Windows contain bogus mappings for Ctrl+key for certain
keys, e.g. Ctrl+Backspace = Delete, or Ctrl+[ = 0x1B. These are never
used on Windows, so we should ignore them.

Fixes #4667
2022-01-29 22:36:40 +01:00
John Ralls
1b77a4dba9 Merge Lukas Oberhuber's 'fix-retina-cursors' into gtk-3-24. 2022-01-26 21:41:45 -08:00
Florian Müllner
de360b3745 gdk/display-wayland: Don't bypass portal for theme entries
When commit 49589e1da added support for the new high-contrast key,
it missed that the getter should only use the setting directly when
not going through the portal.

https://gitlab.gnome.org/GNOME/gtk/-/issues/4651
2022-01-19 02:17:43 +01:00
Chun-wei Fan
58e038f32e Revert "Bug 676077: Fix handling of Keyboard Input on Windows"
The actual code that does the IM context code handling on Windows now uses the
native Windows APIs to handle keystrokes, so this patch is no longer needed, as
it was found that it instead caused issues.

Pointed out in issue #2865.

This reverts commit fd6ce9975e.
2022-01-17 11:31:28 +08:00
Lukas Oberhuber
021cdf382d macos: correctly handle retina cursors
This change correctly sizes HiDPI curors on macOS.

Before this, the cursors would appear double the size of normal cursors
on non HiDPI screens.
Based in part on this comment:
https://gitlab.gnome.org/GNOME/gtk/-/issues/613#note_687914
2022-01-14 00:10:15 +00:00
Matthias Clasen
dac9baf3b1 Merge branch 'wip/keep-scale-3-24' into 'gtk-3-24'
wayland/window: Only update the scale if on any outputs

See merge request GNOME/gtk!4353
2022-01-12 19:45:50 +00:00
David Hogan
cc47262ccb gdkkeys-win32: Perform keyboard layout substitution
For some users, GetKeyboardLayoutNameA() returns an alias instead of the
fully resolved keyboard layout identifier. In that case, we have to
query the registry to resolve the alias before we can look up the DLL
path.

See comments under #4610
2022-01-10 03:34:59 +01:00
Philip Zander
4e9ddaf086 gdkkeys-win32: Fix handling of SGCAPS
Contrary to what you can read on the internet, SGCAPS keys don't work
by having capslock toggle the KBDCTRL bit, they actually have two
consecutive table entries, the first of which is for the normal
version and the second of which is for the capslocked version.

Background: SGCAPS is short for Swiss German caps because Swiss German
was the first layout to use this feature. For keys with the SGCAPS flag,
capslock has a different effect than pressing shift. For example:
Shift + ü = è,  CapsLock + ü = Ü,  CapsLock + Shift + ü = È
2022-01-09 12:36:47 +01:00
Philip Zander
8b1c334c4a gdkkeys-win32: Fix crash when keyboard DLL failed to load
DLL loading failures should not happen under normal circumstances, but
we should at least try not to crash and and print better diagnostic
messages if they do happen.

See #4610
2022-01-09 12:36:47 +01:00
Philip Zander
404229ad75 gdkkeys-win32: Add keysym mapping for capslock key
Add missing mapping between VK_CAPITAL and GDK_KEY_Caps_Lock, so
applications get a meaningful keyval rather than ffffff.
2022-01-09 12:36:47 +01:00
Philip Zander
acf5db32f1 gdkkeys-win32: Fix capslock handling
Previously, we treated CapsLock and KanaLock as part of the global
keyboard state, much like NumLock and ScrollLock, rather than using
the supplied modifier mask. This was because GDK does not have a
modifier mask for KanaLock, only for CapsLock, so it would not have been
possible to properly support it.

However, this approach ended up causing problems, with certain keyboard
shortcuts not registering when capslock was active. This was first
observed in Inkscape [0] and appears to affect shortcuts consisting of a
single key (like 'a') with no additional modifiers (wheareas shortcuts
like 'ctrl+a' work).

So now we are using the supplied GDK_LOCK_MASK instead, and dropped
support for KanaLock, which we probably don't need anyway (since regular
text input should be handled by the IME input module -- the keymap is
mainly for shortcuts and keybindings, where you don't really want
KanaLock).

[0] https://gitlab.com/inkscape/inkscape/-/issues/3082
2022-01-09 12:36:32 +01:00
Philip Zander
f81da43b00 gdkkeys-win32: Fix uninitialized value
gdk_win32_keymap_get_entries_for_keycode() did not initialize n_entries,
which led to a wrong number of items being returned in some cases.

/fixes #4610
2022-01-07 20:48:50 +01:00
Jonas Ådahl
b86e6bc38a wayland/window: Only update the scale if on any outputs
If we ended up on no output at all, keep the HiDPI scale as is, as it
likely means we were on a workspace that was switched away from. By
keeping the same scale, we avoid unnecessary scale changes that would
otherwise take place if the scale when on monitors would end up being
more than 1.
2022-01-07 19:33:33 +01:00
Chun-wei Fan
67f27409e0 GDK/build: Rename deprecated_h_sources to gdk_deprecated_h_sources
This will enable us to not confuse with the deprecated headers in
gtk/deprecated as those headers are also listed under deprecated_h_sources in
gtk/deprecated/Makefile.inc, when we include the makefile snippets in both
gdk/ and gtk/.
2022-01-04 11:07:28 +08:00
Chun-wei Fan
334333f779 Visual Studio projects: Improve generating GDK sources
This makes the rest of the sources that are generated being put in GDK's build
directory for the Visual Studio projects, instead of being placed in GDK's
source subdir, so that:

*  We can avoid polluting GDK's source tree.
*  The Visual Studio builds won't interfere with the Meson builds.

Update the project files to look for the generated sources and headers in the
right places, as well as making the introspection builds look for the generated
sources as well.

Also remove the gtk3-gen-srcs property sheets and put the relevant parts in the
corresponding gtk3-build-defines property sheets, to clean things up a bit.
2022-01-04 11:07:28 +08:00
Chun-wei Fan
caa1c0e4e5 gdk: Split out public headers listing
This is so that we can share the list with other Makefile-based build systems
to generate the enumeration sources.
2022-01-04 11:07:27 +08:00
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