Commit Graph

1224 Commits

Author SHA1 Message Date
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
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
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
Luca Bacci
c71dca236c
Use WindowFromPoint to find DND target window 2021-09-10 13:59:27 +02: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
Matthias Clasen
d450cbe517 Merge branch 'opengl.win32.fixes' into 'gtk-3-24'
GDK/Win32: Fix up OpenGL a bit (part of !3767 for GTK3)

See merge request GNOME/gtk!3792
2021-07-28 17:55:51 +00:00
Chun-wei Fan
15817973d7 GDK/Win32: Fix up OpenGL a bit
Like the recent updates in GTK4, the HWND that we use to obtain the HDC
that we need for OpenGL/GLES operations should really be tied to
GdkWindow, not GdkDisplay, as that is where the Win32 HWND where we
originate from is located, so stop storing the GL HWND in
GdkWin32Display, but just grab them from the GdkWindow that is bound to
the GdkGLContext.

We are more conservative about freeing up GL resources in GTK3, so we
will continue to call ReleaseDC() as we did before.
2021-07-28 11:28:17 +08:00
Chun-wei Fan
71aa479d16 gdkdevicemanager-win32.c: Fix build
Fix the call to p_WTSetA, as we should be passing in a HCTX, not a
HCTX*.  Also clean up things a bit.
2021-07-28 09:58:06 +08:00
Chun-wei Fan
71d7054ff7 Merge branch 'wintab-set-cxo-system-option' into 'gtk-3-24'
Wintab: Set the CXO_SYSTEM option

See merge request GNOME/gtk!3644
2021-07-12 01:52:57 +00:00
Matthias Clasen
a8c83fe3bc Merge branch 'gdkkeys' into 'gtk-3-24'
gdkkeys-win32.c: fix initialisation of key_state in update_keymap

See merge request GNOME/gtk!3741
2021-07-09 10:58:09 +00:00
Luca Bacci
de31fdcc68
Add winpointer.h to Makefile.am sources list 2021-07-09 09:00:36 +02:00
Jeremy Tan
7303854310 gdkkeys-win32.c: fix initialisation of key_state in update_keymap
It apparently worked by chance in the past, but now causes e.g.
alphanumeric characters to be interpreted as half-width katakana
when using the Japanese IME.
2021-07-09 12:35:44 +08:00
Luca Bacci
712721b60a
Add support for Windows Pointer Input Stack
https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/1563
2021-07-03 16:04:28 +02:00
Chun-wei Fan
88730e81c1 Merge branch 'fix-issue-2019' into 'gtk-3-24'
[Gtk3] GdkWin32: Remove klassTEMPSHADOW

See merge request GNOME/gtk!2749
2021-06-22 06:51:56 +00:00
Luca Bacci
f67bf8d892
Wintab: Set the CXO_SYSTEM option
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3860
2021-06-11 19:52:44 +02:00
Luca Bacci
af747315d7
Wintab: set the right device field in the event structure
Even when sends_core is FALSE

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3860
2021-06-11 19:52:43 +02:00
Luca Bacci
547ea8b073
Backport 'fix integer overflow in monitor refresh rate calculation' to GTK3
Original MR by Volker Rümelin.

See https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/2884
2021-06-04 17:44:49 +02:00
Chun-wei Fan
1b1dee86a5 gdkglcontext-win32.c: Fix running with Mesa drivers
Some GL drivers such as Mesa-D3D12 do not allow one to call SetPixelFormat() on
a given HDC if one pixel format has been already set for it, so first check the
HDC with GetPixelFormat() to see whether a pixel format has already been set
with the HDC, and only attempt to acquire the pixel format if one has not been
set.

This will fix running with GL on Windows using the Mesa drivers.
2021-04-29 12:17:58 +08:00
Chun-wei Fan
416e6b9cdd gdkglcontext-win32.c: Avoid C4715 warning
We can just group the code for the desktop GL codepath and the EGL
codepath a bit so that we can just have a single location where we
return TRUE upon a successful setup of our WGL/EGL context, and avoid
the C4715 warning that is considered an error when building with
GLib-2.68.x or later using Visual Studio, when we are building without
EGL support.
2021-04-16 15:08:41 +08:00
Matthias Clasen
b94955e614 Merge branch 'gdk-win32-use-window-from-point-api' into 'gtk-3-24'
GdkWin32: Fix mouse events in presence of transparent windows on the desktop

See merge request GNOME/gtk!2767
2021-03-11 01:10:20 +00:00
Knuckx
d7d6098281 WinTab - Add support for Wheel/Rotation axis - Rebase and fix conflicts for merge 2021-03-05 23:35:29 +00:00
Steven Calwas
86d38e6ae2 Fix window unresponsive to mouse after app-switch w/drawing tablet
Partially fixes issue #2191 regarding switching to another app while
hovering a stylus over a drawing tablet causes subsequent mouse
clicks in the app to be ignored. I was not able to reproduce the
other behavior described in #2191 concerning tiling a window.
2021-03-05 14:37:29 -05:00
Matthias Clasen
94befed65f Merge branch 'issue1549' into 'gtk-3-24'
Handle Wintab cursors that are recognized after GDK app init

See merge request GNOME/gtk!2458
2021-03-05 18:53:42 +00:00
Luca Bacci
fa2ae10599
Fix leak of event structures
Inside generate_button_event, if _gdk_input_ignore_core is > 0 we
leak an event structure. Fix that.
2021-03-01 10:51:38 +01:00
Chun-wei Fan
79e512ab0b gdkglcontext-win32.c: Workaround Intel glBlitFramebuffer() issues
Intel OpenGL drivers have an issue where the results of a series of
glBlitFramebuffer() can delay updating the display, when we use GDK_GL=always,
which is manifested when attempting to enter text in text boxes.

This attempts to work around this issue by requiring a glFlush() call and a
retry to the same glBlitFramebuffer() calls to avoid delays in keystrokes when
using GDK_GL=always and when not using libANGLE OpenGL/ES emulation, when an
Intel OpenGL driver is being used.

Special thanks to Lukas K. for the analysis and coming up with a workaround,
which this patch builds upon.

Fixes issue 3487
2020-12-23 19:01:31 +08:00
Luca Bacci
67be62aeaf
GdkWin32: Fix mouse events in presence of transparent windows on the desktop
In gdkdevice-win32.c we are interested in knowing which window
receives mouse input at a specific location.

Only WindowFromPoint is the right API for the task, other API's
(such as (Real)ChildWindowFromPoint(Ex)) have shortcomings because
they are really designed for other purposes. For example, only
WindowFromPoint is able to look through transparent layered windows.

So even if we want to find a direct child we have to use
WindowFromPoint and then walk up the hierarchy.

Fixes: #370, #417
See: !2767
2020-11-11 14:34:40 +01:00
Luca Bacci
0cb78a9808
GdkW32: remove klassTEMPSHADOW
Fixes issue #2019

See !2749
2020-10-27 18:12:42 +01:00
LRN
69b43edd55 Merge branch 'w32-transient-ordering-rollback' into 'gtk-3-24'
GDK W32: transient Z-order rollback

See merge request GNOME/gtk!1769
2020-10-08 05:16:11 +00:00
Steven Calwas
4c10134295 Handle Wintab cursors that are recognized after GDK app init
Previously, a GDK application handled the Wintab cursors (stylus,
eraser, etc.) only during app initialization. If new cursors were
recognized by Wintab during app execution, the app would not know
about them.

This fix still handles Wintab cursors known during app initialization.
In addition, when Wintab recognizes new cursors and notifies the app
via a WT_CSRCHANGE message, the app handles the new cursors, creating
new Wintab device objects for them.

Closes #1549
2020-08-20 22:54:36 -07:00
Chun-wei Fan
0cbeee3857 Merge branch 'move-msvc-projects' into 'gtk-3-24'
Visual Studio projects: move projects to win32/

See merge request GNOME/gtk!2248
2020-07-24 02:43:18 +00:00
Chun-wei Fan
2dca4e310d Merge branch 'gtk3.win.egl.unfullscreen' into 'gtk-3-24'
gdkwindow-win32.c: Fix GLES glitches during un-fullscreen

See merge request GNOME/gtk!645
2020-07-24 02:39:25 +00:00
Chun-wei Fan
844555384b Merge branch 'gles-windows-arm64' into 'gtk-3-24'
GDK/Win32: Force GLES if running on ARM64

See merge request GNOME/gtk!827
2020-07-24 02:37:33 +00:00
Philip Zander
5b81864211 Fix 2 warnings, formatting 2020-07-16 15:44:08 +02:00
Philip Zander
9bf9c76365 Remove VK_PACKET handling code that has become unnecessary 2020-07-16 15:01:50 +02:00
Philip Zander
5413892b7d Formatting 2020-07-16 15:01:50 +02:00
Philip Zander
e6f05da6ef Use native Windows API for converting keystrokes to characters
Instead of using the incomplete GTK-internal emulation, use the WM_CHAR
messages sent by Windows. Make the IME input method the default for all
languages on Windows.
2020-07-16 15:01:47 +02:00
Chun-wei Fan
1feb169bfa Visual Studio projects: move projects to win32/
This will simplify our source tree a bit
2020-07-16 18:57:03 +08:00
Chun-wei Fan
98996aa60b GDK/Win32: Force GLES if running on ARM64
If GLES support is enabled on Windows, force GLES mode if we are running
on a ARM64 version of Windows (i.e. Windows 10 for ARM).

This is required as ARM64 versions of Windows only provide a software
implementation of OpenGL 1.1/1.2, which is not enough for our purposes.
Thus, we could make instead use the GLES support provided via Google's
libANGLE (which emulates OpenGL/ES 3 with Direct3D 9/11), so that we
can run GtkGLArea programs under OpenGL/ES in ARM64 versions of Windows.

Note that eventually we could update the libepoxy build files for Windows
to not check nor enable WGL when building for ARM64 Windows, as the WGL
items do not work, although they do build.
2020-07-07 16:53:01 +08:00
Руслан Ижбулатов
f67bad2346 GDK W32: Use SPI_GETFONTSMOOTHINGTYPE instead of SPI_GETCLEARTYPE
It turns out that SPI_GETCLEARTYPE always returns TRUE.

Fixes #1774 (for real this time).
2020-05-10 07:17:50 +00:00
Руслан Ижбулатов
217158995a GDK W32: Correctly infer gtk-xft-antialias & gtk-xft-rgba
Instead of hardcoding gtk-xft-antialias, use SPI_GETFONTSMOOTHING to
determine whether antialiasing is enabled.

Make gtk-xft-rgba query more complex - try to determine display
orientation, then use that to rotate subpixel structure. This
won't help with monitors that have naturally vertical subpixels,
but should improve things for monitors that are rotated (as long
as Windows display settings are adjusted accordingly).

Partially fixes #1774
2020-04-26 20:40:57 +00:00
Руслан Ижбулатов
00f06f2480 GDK W32: Remove stacking functions
Stacking functions enforce non-native stacking behaviour that is
mostly unneeded, and doing so introduces bugs and complicates things.
2020-04-26 19:16:02 +00:00
Руслан Ижбулатов
83ebdbdbf4 Revert "GDK W32: Use SWP_NOOWNERZORDER everywhere it can be applied"
This reverts commit fc2008f240.

Turns out, we *don't* have code to maintain Z-order. Restacking
code is not doint that, it just enforces a few weird Z-order-related
behaviours.
2020-04-26 19:11:45 +00:00
Martin Storsjö
01d4c29ce3 Add a missing 'extern' attribute, to fix building with -fno-common
With C compilers defaulting to -fcommon, this isn't an issue, but
upcoming compilers (GCC 10 and Clang 11) will default to -fno-common,
ending up with duplicate definitions of this variable.
2020-04-05 00:26:19 +03:00