Commit Graph

472 Commits

Author SHA1 Message Date
Luca Bacci
7f9363d471 Windows: Build with UNICODE
Build with UNICODE (and _UNICODE) defined when targeting Windows.
2024-05-28 16:37:48 +02:00
Luca Bacci
8a1bee1d79 GdkWin32: Don't explicitly set the transient owner as active
...when a transient child is hidden.

The system does that automatically
2024-04-06 10:58:25 +02:00
Luca Bacci
9297439de4 GdkWin32: Remove some work arounds that are not needed anymore
2cc650ce was added to work around some of the regressions
introduced by 79557271, but that commit was finally reverted
in 43476c09.

We can now revert 2cc650ce as well.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/6614
2024-04-06 10:44:02 +02:00
Matthias Clasen
59578c6d18 Fix typos throughout
These were pointed out by codespell.
2024-01-07 20:44:05 -05:00
Benjamin Otte
310ab7b531 Remove G_ENABLE_DEBUG around debug checks
It started out as busywork, but it does many separate things. If I could
start over, I'd take them apart into multiple commits:

1. Remove G_ENABLE_DEBUG around GDK_DEBUG_*() calls
   This is not needed at all, the calls themselves take care of it.

2. Remove G_ENABLE_DEBUG around profiling code
   This now enables profiling support in release builds.

3. Stop poking _gdk_debug_flags and use GDK_DEBUG_CHECK()
   This was old code that was never updated.

4. Make !G_ENABLE_DEBUG turn off GDK_DEBUG_CHECK()
   The code used to
     #define GDK_DEBUG_CHECK(...) false
     #define GDK_DEBUG(...)
   which would compile away all the code inside those macros. This
   means a lot of variable definitions and debug utility functions
   would suddenly no longer be used and cause compiler errors.
2023-11-05 11:16:23 +01:00
Luca Bacci
5b39abd1a4 Merge branch 'fix-server-side-decorations' into 'main'
win32: Fix minimize and maximize buttons missing on ssd

Closes #5142

See merge request GNOME/gtk!6052
2023-08-08 15:17:09 +00:00
Jonas Ådahl
7f946eff01 gtk: Add suspended window state
This is implemented using a new xdg_toplevel `suspended` state, and is
meant for allowing applications to know when they can stop doing
unnecessary work and thus save power.

In the other backends, the `suspended` state is set at the same time as
`minimized` as it's the closest there is to traditional windowing
systems.
2023-07-30 11:40:09 +03:00
Luca Bacci
871685e271 GdkWin32: Use double coordinates for mouse events
Mouse coordinates reported by the system are still integers,
but go sub-pixel when dividing by the window scale factor.
2023-06-21 16:07:55 +02:00
Luca Bacci
5e9daa9728 GdkWin32: Unscaled coordinates in current_root_x, current_root_y
Also modify gdk_win32_surface_do_move_resize_drag() to take
unscaled root coordinates.

Fixes #5877
2023-06-21 16:01:42 +02:00
dgsasha
5240d8cdf5 win32: Fix minimize and maximize buttons missing on ssd
Completely fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5142
2023-06-10 23:08:21 -04:00
dgsasha
b7e3a231b4 win32: Focus modal windows when clicking on unfocused parent 2023-06-02 12:33:03 -04:00
Luca Bacci
1a058a41c9 Do not keep HINSTANCE variables around
Use &__ImageBase for the GTK DLL and GetModuleHandle (NULL)
for the application module. Then remove DllMain as it's not
necessary anymore.

References:

 [1] Accessing the current module's HINSTANCE from a static library:
     https://devblogs.microsoft.com/oldnewthing/20041025-00/?p=37483
2023-05-30 19:31:54 +02:00
Luca Bacci
48bcae99af Merge branch 'gdk-win32-fix-native-decoration-resize' into 'main'
GdkWin32: Fix resizes with native decorations

Closes #5142, #5088, and #5090

See merge request GNOME/gtk!5096
2022-12-14 13:13:14 +00:00
Luca Bacci
acd7d739f5 GdkWin32: Fix resizes with native decorations
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5142
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5088
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5090
2022-12-08 11:41:05 +01:00
Luca Bacci
26c524a578 GdkWin32: Do not use MA_NOACTIVATEANDEAT
GTK knows when a surface is modally blocked and automatically drops
button press and release events, so do not block input in advance
from WM_MOUSEACTIVATE.
2022-11-10 09:27:24 +01:00
Luca Bacci
995f00d23f Merge branch 'forward-port-mr-991-to-gtk4-2' into 'main'
Use native Windows API for converting keystrokes to characters

Closes #2944

See merge request GNOME/gtk!4986
2022-10-17 19:20:08 +00:00
Philip Zander
c84c469b78 Use native Windows API for converting keystrokes to characters 2022-10-17 19:36:48 +02:00
Luca Bacci
d6f7449636 GdkWin32: Return TRUE when processing WM_XBUTTONDOWN/UP messages
As documented on MSDN:

> Unlike the WM_LBUTTONUP, WM_MBUTTONUP, and WM_RBUTTONUP messages, an
> application should return TRUE from this message if it processes it.
2022-10-07 19:05:29 +02:00
Matthias Clasen
a8af7caae1 Rename gdk-private.h to gdkprivate.h
The extra - does not add any value.
2022-09-23 23:23:27 -04:00
Marc-André Lureau
52e3ed13e2 gdk/win32: deprecate gdk_win32_handle_table_lookup
This function is probably not generally useful for a Gtk+/win32 user,
and it's only used internally by gdk-win32. It's time to deprecate it, I
believe.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-24 21:02:57 +04:00
Luca Bacci
5e299cd3d2 GdkWin32: Fix handling of WM_NCHITTEST
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5114
2022-08-19 19:21:17 +02:00
Ricardo Maia Louro
6ceacee0f9 GdkWin32: Support high resolution scroll wheel events 2022-08-14 18:30:28 +01:00
Luca Bacci
8f19099f1a GdkWin32: Add support for DirectManipulation
Adds support for Precision TouchPads (PTPs) gestures
and scroll events.
2022-05-15 14:37:55 +02:00
Luca Bacci
66a0e0a59e GdkWin32: Send smooth scroll events
Bring back smooth scroll events as the issues mentioned
in [1] do not occur anymore. Also rework code style and
comments.

References:

  [1] GTK4: Scrolling hides mouse on windows
      https://gitlab.gnome.org/GNOME/gtk/-/issues/3581

  [2] Why are mouse wheel messages delivered to the focus window
      instead of the window under the mouse?
      https://devblogs.microsoft.com/oldnewthing/20160420-00/?p=93325
2022-05-06 15:01:59 +02:00
Luca Bacci
cb0c1b3f08 GdkWin32: Generate crossing event after button release
Fixes #4813
2022-04-06 20:27:46 +02:00
Luca Bacci
91f200167e GdkWin32: Correct generation of crossing events when holding an implicit grab
Fixes #4722
2022-04-06 20:27:32 +02:00
Luca Bacci
2b6fb005a8 GdkWin32: Report serial for events 2022-04-06 19:45:50 +02:00
panoplie
fb4927827b gdk: Add enum to indicate the unit of scroll deltas
Add a new GdkScrollUnit enum that represent the
unit of scroll deltas provided by GdkScrollEvent.
The unit is accessible through
gdk_scroll_event_get_unit().
2022-03-19 00:41:26 +01:00
Luca Bacci
43476c09ed GdkWin32: Remove implicit_grab_surface 2022-02-21 17:38:50 +01:00
Luca Bacci
243bb57a27
GdkWin32: Add translation result w/o CAPS LOCK to key events for accelerator matching 2022-01-17 14:14:55 +01:00
Luca Bacci
4916ebd05e
GdkWin32: Remove _gdk_input_codepage variable
It's unused
2022-01-17 14:14:55 +01:00
Luca Bacci
8bbf48eb64
GdkWin32: Code reorganization for gdk_event_translate 2022-01-17 14:14:47 +01:00
Philip Zander
b9bc7d9166 IMContextSimple/IMContextIME: Fix AltGr not working on Win32
The old code assumed that any key press containing Ctrl or Alt cannot be
regular text input. This is not correct on Win32 as AltGr = Ctrl + Alt.
2022-01-13 17:26:59 +01:00
Philip Zander
ea65abc7e2
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.

See https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4338
2022-01-12 19:01:35 +01:00
Luca Bacci
7a1004df73
Remove WM_SYNCPAINT message handler
It was added to work around what seemed to be an OS or graphics
driver issue on Windows XP. The issue was not reproducible on
Windows Vista anyway.

References:
* https://bugzilla.gnome.org/show_bug.cgi?id=153567
* https://gitlab.gnome.org/GNOME/gtk/-/commit/c8fef535
* https://devblogs.microsoft.com/oldnewthing/20120723-00/?p=7073
2022-01-02 18:42:31 +01:00
Luca Bacci
4c8e703803
GdkWin32: Remove the global screen offset
Removes the _gdk_offset_x / _gdk_offset_y variables,
as today are not needed anymore.
2021-11-07 19:08:30 +01:00
Benjamin Otte
226ecaf9a2 win32: Don't include gdkinternals.h 2021-09-24 22:50:29 +02:00
Luca Bacci
c02bae9e08
Move the _gdk_win32_pointer_input_api global variable into GdkWin32Display 2021-08-19 16:29:45 +02:00
Luca Bacci
3977518f00
Fix typo 2021-08-19 15:57:44 +02:00
Luca Bacci
09ad930da4
Filter out spurious mouse messages while handling pen or touch input 2021-08-19 15:57:43 +02:00
Luca Bacci
52f7bb6950
Add _gdk_win32_get_cursor_pos utility 2021-08-19 15:57:42 +02:00
Luca Bacci
68db945e47
Handle WinPointer input 2021-08-19 15:57:41 +02:00
Luca Bacci
b54f4cf5d4
Initialize WinPointer and enumerate devices 2021-08-19 15:57:41 +02:00
Luca Bacci
ad3995b1b9
Make room for other API's than Wintab 2021-08-19 15:57:38 +02:00
Luca Bacci
7cec7054e2
Rename some Wintab-related functions 2021-08-19 15:57:36 +02:00
Luca Bacci
fe280e578f
Set active physical device when using the mouse 2021-08-19 15:57:36 +02:00
Luca Bacci
a32973f56b
Move use of _gdk_win32_get_next_tick from synthesize_crossing_events to its callers 2021-08-19 15:57:35 +02:00
Luca Bacci
7762311911
Add a physical_device argument to send_crossing_event et al 2021-08-19 15:57:34 +02:00
Matthias Clasen
19b534f7de Avoid copying static debug strings
The g_source_set_name calls were showing up as a
major source of strdups in our profiles. Avoid that
by using new GLib api when available.
2021-07-28 22:42:46 -04:00
Chun-wei Fan
e35490ba5b gdkdrag-win32.c: Fix drag surface positioning
Determine the root_x and root_y coordinates of the drag surface by
relying on the coordinates of the surface where the drag is being
carried out, plus the coordinates that we receive from the drag event,
which is in-line with what the X11 backend does.

This will prevent the drag surface from being initially drawn at the
correct position, but jumping towards the top-left corner of the screen
shortly afterwards.

The DnD support will still need some more updates to function correctly
on Windows, but at least this is a small improvement.

Fixes issue #3798.
2021-06-18 18:07:50 +08:00