Commit Graph

345 Commits

Author SHA1 Message Date
Camilla Löwy
5066f57371 Clean up internal Unicode code point handling
Call code points by their name and store them as uint32_t.

(cherry picked from commit fe7be39793)
2022-02-15 21:08:17 +01:00
Camilla Löwy
a69648e192 Win32: Handle content scale error on creation
Only apply the content scale to the initial size of the window if
content scale retrieval succeeded.

Related to #1615.

(cherry picked from commit 53d86c64d7)
2021-12-08 20:06:18 +01:00
Camilla Löwy
20a7962a9b Improve error description for invalid scancodes
(cherry picked from commit 56092814f3)
2021-08-03 15:59:59 +02:00
Camilla Löwy
900dda7e89 Win32: Fix content area rescaling on older systems
GLFW_SCALE_TO_MONITOR had no effect on Windows 8.1 up to and including
Windows 10 version 1607 (Anniversary Update), despite those having
support for per-monitor DPI.

That done was to avoid handling systems that have non-client scaling,
introduced in Windows 10 version 1607, without reliable overriding of
the new window size, introduced in Windows 10 version 1703 (Creators
Update).  Both are needed to keep the content area at a fixed size for
windows that have GLFW_SCALE_TO_MONITOR disabled.

This change enables window rescaling on Windows 8.1 and all later
versions but disables non-client scaling for unscaled windows on Windows
10 version 1607.  Versions after 1607 are unaffected.

Fixes #1511.

(cherry picked from commit 729c9988d0)
2021-02-17 21:15:32 +01:00
Camilla Löwy
56230ca173 Win32: Fix full screen windows affected by scaling
Per-monitor DPI scaling should not affect full screen windows.

Fixes #1582.

(cherry picked from commit 410890aa80)
2021-02-17 21:14:47 +01:00
Camilla Löwy
395ab660d5 Win32: Filter out duplicate size events
This mirrors the filtering done on X11 and Cocoa.  Possibly this should
be done by shared code instead.

Fixes #1610.

(cherry picked from commit 0bccc3852b)
2021-02-09 21:49:16 +01:00
Camilla Löwy
8363179eee Win32: Disable fb transparency when it is broken
On Windows 7, when GLFW framebuffer transparency and the DWM are enabled
but DWM transparency is disabled (i.e. when the Transparency setting is
disabled under Personalization > Color), the contents of the framebuffer
is combined with the last frame using additive blending instead of
replacing the previous contents.

This commit limits GLFW framebuffer transparency on Windows 7 to when
DWM transparency is enabled, removing the previous workaround of setting
a layered window color key that led to rendering artifacts.

Fixes #1512.

(cherry picked from commit 05dd2fa298)
2020-09-02 22:27:45 +02:00
Camilla Löwy
d858e48860 Win32: Fix non-BMP Unicode codepoint input
Supplementary Plane codepoints from WM_CHAR and WM_SYSCHAR messages were
reported as UTF-16 surrogate pairs.

Related to #1635.

(cherry picked from commit 6ce2070392)
2020-06-30 17:21:24 +02:00
Camilla Löwy
6a9fd2e13f Win32: Add matching comment
(cherry picked from commit 190673e779)
2020-01-17 15:47:03 +01:00
Camilla Löwy
e53538010a Win32: Fix scancode when key message only had VK
Some synthetic key messages come with a scancode of zero, causing them
to be translate to GLFW_KEY_UNKNOWN.  This fills in the missing scancode
by translating the provided virtual key.

Rather than further complicate a single-use function, its body is merged
into the key message handler.

Fixes #1623.

(cherry picked from commit 789a2bcb39)
2020-01-17 15:46:40 +01:00
Camilla Löwy
ec28696994 Check scancode before use in glfwGetKeyName
(cherry picked from commit 5f1631cb0e)
2020-01-17 15:46:18 +01:00
Camilla Löwy
0af3bf3b36 Win32: Use non-async key state for modifier hack
The synchronous key state seems to make more sense in context.

(cherry picked from commit a491b0698c)
2020-01-17 15:45:32 +01:00
Camilla Löwy
8552152f80 Win32: Fix no Super key release event after Win+V
The Win+V hotkey brings up a clipboard history IME that consumes the key
release.  This adds left and right Super to the modifier keys manually
polled for undetected release during event processing.

Fixes #1622.

(cherry picked from commit 562c17d131)
2020-01-17 15:44:45 +01:00
Camilla Löwy
c5a870ebd9 Win32: Change transparent framebuffer key color
This is a temporary fix while we determine if the color key workaround
should be removed completely.  See issue thread for discussion.

Related to #1512.

(cherry picked from commit c88ee1c9d3)
2019-11-14 21:30:02 +01:00
Camilla Löwy
087110aa63 Win32: Cleanup keyboard input flag parsing
This replaces some magic numbers with the corresponding winuser.h
provided macros and unifies how the MSB from Get*KeyState is tested.

(cherry picked from commit 3d2540c373)
2019-10-04 02:18:48 +02:00
Camilla Löwy
2032a8f0dc Clarify comment
(cherry picked from commit 4cc5d2e623)
2019-09-23 15:26:17 +02:00
Camilla Löwy
2d3f388158 Win32: Fix initial state of maximized state cache
(cherry picked from commit 2c7ef5b480)
2019-09-23 15:26:08 +02:00
Camilla Löwy
30e67357be Win32: Fix GLFW_MAXIMIZED not maximizing window
The window rect adjustment for content scale broke the initial, correct
maximization performed when creating the window with WS_MAXIMIZE.  This
switches to updating the restored rect instead of the current rect.

Fixes #1499.
Closes #1503.

(cherry picked from commit 711b9694a1)
2019-09-23 15:25:51 +02:00
Leon Linhart
9fc035a562 Win32: Fix cursor enter/position event order
This fixes the cursor enter event being emitted after the first cursor
position event on Windows.

Closes #1490.

(cherry picked from commit 4f0b8b0dda)
2019-07-16 14:41:16 +02:00
A. Tombs
8542f8dd84 Win32: Cleanup pointer test in win32_window.c
MSVC 2019 complains that the code at line 1744
(`GetMonitorInfo(window->monitor->win32.handle, &mi);`) can potentially
dereference a null pointer. The compiler is wrong in this case (it has
not spotted that `monitor` and `window->monitor` must be equal), but
I think it makes sense for our non-NULL test to be on the variable we
actually use rather than the one it was set from.

Related to #1491.

(cherry picked from commit 1d62157268)
2019-07-16 14:39:02 +02:00
Camilla Löwy
ad3e7c7f39 Win32: Fix non-client actions for disabled cursor
Disabled cursor mode interfered with some non-client actions.

(cherry picked from commit d0c3fa900a)
2019-05-27 16:34:17 +02:00
Camilla Löwy
15f078c6ad Win32: Remove stale comment
(cherry picked from commit 267e06a41e)
2019-05-27 16:34:13 +02:00
Camilla Löwy
04522580ad Add C dialect reminders to each source file
Files built for Win32 must use C89 style declarations for compatibility
with VS 2010 and 2012, which are still supported by GLFW.

(cherry picked from commit 56aad76b16)
2019-05-27 16:33:22 +02:00
Camilla Löwy
ab118b2529 Fix copyright years (somewhat) 2019-04-15 20:50:00 +02:00
Camilla Löwy
1f91697cd3 Win32: Fix VS static analysis warnings 2019-04-15 15:37:15 +02:00
Camilla Löwy
1155c83013 Rename raw input to raw mouse motion, cleanup
This renames 'raw input' to 'raw mouse motion' as there are other kinds
of raw input.  The update path is restructured to avoid reinitializing
all of disabled cursor mode.  Modification of shared state is moved out
into shared code.  Raw mouse motion is disabled by default for
compatibility.

Related to #1401.
2019-02-22 13:04:11 +01:00
Nathan Poirier
9e29f556fd Add GLFW_RAW_INPUT and glfwRawInputSupported
This adds runtime per-window control of whether accelerated or raw mouse
motion is provided when the cursor is disabled.

Fixes #1400.
Closes #1401.
2019-02-22 13:04:11 +01:00
Camilla Löwy
e2fa82ffbb Cleanup
Related to #1431.
2019-02-13 23:21:05 +01:00
Max Risuhin
cf79f06257 Win32: Fix standard cursors not being DPI aware
Closes #1431.
2019-02-11 19:19:06 +01:00
Camilla Löwy
d5ab3e919a Cleanup
Replace client area with content area.
2019-01-25 12:46:46 +01:00
iamCaveLamp
a46104ee69 Removed duplicates of centerCursor function 2019-01-22 20:17:35 +01:00
Camilla Löwy
1635fe2826 Cleanup
Put the non-client painting related message cases with the client ones
so that they can be happy together.

Related to #1383.
2018-12-26 15:22:20 +01:00
Aaron Loucks
9ac9d7b85a Win32: Disable non-client painting if undecorated
Fixes an issue where a small title bar and window caption
buttons were being painted after restoring a minimized
undecorated window.

Closes #1383.
2018-12-26 15:00:39 +01:00
Camilla Löwy
e779280802 Win32: Fix invalid calls to GetDpiForWindow
The check for Windows 10 Anniversary Edition or later was not always
performed before calling GetDpiForWindow.

Fixes #1335.
Closes #1363.
2018-10-22 00:51:08 +02:00
Camilla Löwy
089ea9af22 Add GLFW_SCALE_TO_MONITOR
This adds the GLFW_SCALE_TO_MONITOR window hint for automatically
resizing the content area of a window to the requested size times the
monitor content scale each time it is placed on a new monitor.  This
only applies to windowed mode windows and includes the initial placement
at window creation.

This hint only has an effect on platforms where screen coordinates and
pixels always map 1:1 such as Windows and X11.  Platforms like macOS
instead change the resolution of the framebuffer independently of the
window size.

Related to #676.
Related to #1115.
2018-09-03 23:12:39 +02:00
Camilla Löwy
5294439595 Win32: Add support for Per-Monitor V2 awareness
This adds basic support for the Per-Monitor V2 level of DPI awareness
in Windows 10, which allows for automatic DPI scaling of window
decorations.

This commit does not include resizing the window content area to match
the new window content scale.

Related to #1115.
Fixes #1294.
2018-09-03 23:12:39 +02:00
Camilla Löwy
a67d8afbd4 Win32: Clean up DWM detection 2018-08-24 15:06:39 +02:00
Camilla Löwy
d4cbe451fc Win32: Clean up cursor shape translation 2018-08-24 15:06:39 +02:00
Camilla Löwy
f82a8f09eb Win32: Disable mouse trails for full screen
When mouse trails are enabled, the cursor becomes invisible when the
OpenGL ICD detects a full screen window and switches to page flipping.

Mouse trails are now disabled as long as any full screen windows are
visible.

Fixes #1263.
2018-08-02 00:01:26 +02:00
Camilla Löwy
50eccd298a Fix cursor mode application for unfocused windows
Fixes #1239.
Fixes #1247.
2018-04-25 21:49:26 +02:00
Camilla Löwy
58cc4b2c5c Move full screen cursor centering to shared code 2018-02-07 16:47:00 +01:00
Camilla Löwy
d10463ac91 Win32: Fix extra resize event during mode switch
The switch to full screen is now done with a single call to
SetWindowPos.
2018-02-07 16:46:59 +01:00
Camilla Löwy
1d75b205cb Cleanup
Allow window creation despite video mode setting failure.

Video mode setting failure is ignored the rest of the time and the
desired video mode has never been a hard constraint anyway.
2018-02-07 16:46:58 +01:00
ocornut
20b12204af Win32: Fix GLFW_FOCUSED hint being ignored
The window was activated by _glfwPlatformShowWindow, causing the
GLFW_FOCUSED window hint to be ignored when set to false.

Fixes #1179.
Closes #1180.
2018-01-09 20:36:13 +01:00
Camilla Löwy
ee9dffcd66 Add GLFW_HOVERED for polling cursor hover state
This window attribute corresponds to the cursor enter/leave callback.

Fixes #1166.
2018-01-09 18:02:52 +01:00
Camilla Löwy
370eac3c48 Add glfwSetWindowContentScaleCallback
Related to #677.
Related to #1115.
2018-01-09 18:00:22 +01:00
Camilla Löwy
0e8c4ea7ce Add lock key modifier bits input mode
This adds the GLFW_MOD_CAPS_LOCK and GLFW_MOD_NUM_LOCK modifier bits.
Set the GLFW_LOCK_KEY_MODS input mode to enable these for all callbacks
that receive modifier bits.

Fixes #946.
2017-12-06 18:01:34 +01:00
Camilla Löwy
7c87948eaf Win32: Fix accidentally working bit tests
Good grief.
2017-11-28 19:59:59 +01:00
Camilla Löwy
d630684654 Win32: Remove double resize of full screen window
Related to #1085.
2017-11-16 11:56:03 +01:00
Camilla Löwy
11e47f08b1 Add glfwGetWindowOpacity and glfwSetWindowOpacity
This adds support for setting the opacity of the whole window, including
any decorations.

Fixes #1089.
2017-11-15 15:46:01 +01:00