Commit Graph

2615 Commits

Author SHA1 Message Date
Camilla Löwy
0f46d089e8 X11: Fix attribs not applied on leaving fullscreen
If the GLFW_DECORATED and/or GLFW_FLOATING window attributes were
changed while in fullscreen mode, the changes did not take effect when
the window entered windowed mode.

Bug reported on the GLFW forum.
https://discourse.glfw.org/t/turning-on-off-window-decorations-while-in-full-screen-wont-work-properly/1780

(cherry picked from commit 4afa227a05)
2021-03-19 16:18:12 +01:00
Camilla Löwy
0c22ebac36 Wayland: Move DPI fallback work to output done
This removes the dependency on the (unspecified) ordering of geometry
and mode events in wl_output.

Based on feedback from @linkmauve and @caramelli.

Related to #1792.

(cherry picked from commit b925a54ef1)
2021-02-17 21:15:51 +01: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
c6fa2c8cfb Cocoa: Fix console apps getting a dock icon
Regression introduced by @elmindreda in
8b11867464.

Adapted to 3.3-stable from 6de084000b.
2021-02-10 18:17:16 +01:00
Laurent Aphecetche
5a15d8a784 Cocoa: Fix install name for installed dylib
The install name was incorrectly set to a relative path.

This change leaves the install name of the installed dylib as
@rpath/soname.  Those who wish to override this can set the
CMAKE_INSTALL_NAME_DIR variable.

Closes #1504.

(cherry picked from commit 384ff74a46)
2021-02-10 17:14:46 +01:00
Camilla Löwy
8270081334 Simplify references in CMake if-statements
Adapted to 3.3-stable from f8d6801a50.
2021-02-10 17:14:46 +01:00
Camilla Löwy
15b0c43e2d Cocoa: Unify CG display to NS screen mapping
This moves the matching of CG displays to NS screens to monitor
enumeration time.

(cherry picked from commit 3959ee8949)
2021-02-10 17:14:46 +01:00
Nevyn Bengtsson
8746f68d61 Cocoa: Use modern API to get display name
On Apple Silicon, IOKit is deprecated and there will be no
matching io_service that we can query for name. Luckilly,
NSScreen got an API to fetch the display name in 10.15.

This is a blocker to get glfw running on Apple Silicon.

Fixes #1809.
Closes #1833.

(cherry picked from commit 2bc52ca82e)
2021-02-10 17:14:45 +01:00
Camilla Löwy
14921d1e24 Cocoa: Fix duplicate monitor connection events
(cherry picked from commit 5aff72aa00)
2021-02-10 17:14:45 +01:00
Camilla Löwy
eda12dd949 Cocoa: Fix menubar for unbundled apps on 10.15
NSApp setActivationPolicy: was being called too soon when the app was
not bundled and launched from the command line.

This fix is based on #1802 by @richardwilkes.

Fixes #1648.
Closes #1802.

Adapted to 3.3-stable from 8b11867464.
2021-02-10 17:14:45 +01:00
Philip Rideout
078e8fcf55 Cocoa: Fix duplicate video mode detection
Closes #1830.

(cherry picked from commit f5af421a6b)
2021-02-09 21:49:17 +01:00
ashishgamedev
cdd5ee8d36 Fix indentation in internal.h
Closes #1818.

(cherry picked from commit 761f97d6b6)
2021-02-09 21:49:17 +01:00
Leonard König
b31d7ddc8c Wayland: Fix destroying CSDs in the correct order
On Wayland we implement Client-Side Decorations if the compositors do not
implement SSDs.  In that case, the destructors of the surfaces were called
in the wrong order, leading to a dereference of an already freed object.
We need to first destroy the subsurface before destroying the parent surface.

Related PR on kitty: https://github.com/kovidgoyal/kitty/pull/3066
Related issue on kitty: https://github.com/kovidgoyal/kitty/issues/3051

Closes #1798.

(cherry picked from commit 0dc1005c85)
2021-02-09 21:49:16 +01:00
Camilla Löwy
baf26a6ea7 Cocoa: Fix ObjC being built as C with CMake 3.19
CMake 3.19 adds -xc when the LANGUAGE file property is C, breaking our
workaround for CMake 3.15 and earlier not understanding the .m suffix.

Fixes #1787.

(cherry picked from commit 3327050ca6)
2021-02-09 21:49:16 +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
7dee4e05f9 Win32: Fix clang-cl interpreting -Wall as /Wall
Unlike -Wall, VS /Wall really means all warnings.

Closes #1780.

(cherry picked from commit ac627706ef)
2021-02-09 21:49:16 +01:00
Camilla Löwy
e0b3361683 Win32: Enable /W3 on VS for library sources
/W3 is the default for new VS projects and the library builds cleanly
with it on VS 2010-2019 so let's try to keep it that way.

(cherry picked from commit 6b78419c9a)
2021-02-09 21:49:16 +01:00
Camilla Löwy
0b56adb721 Remove ignored Clang compiler flag
Clang ignores this when C99 is enabled, while GCC does not.  Removing
the checks for Clang to hopefully avoid a false sense of security.

(cherry picked from commit 9b140d08d7)
2020-12-14 22:50:33 +01:00
Vladimir Perminov
41ad058ce3 Win32: Fix value for _WIN32_WINNT_WINBLUE
An incorrect value for _WIN32_WINNT_WINBLUE caused GLFW to think Windows
8 was 8.1 or greater.  This led to a crash when attempting to call
SetProcessDpiAwareness.

Closes #1775.

(cherry picked from commit e1d71cfa4701250a44a6c02d1bbb43309ac8a46c)
2020-09-30 16:11:14 +02:00
Doug Binks
c3250be690 Win32: Update all monitor handles on config change
Closes #1761.

(cherry picked from commit fecd711e0bc9779c379f00e63c1ab7a5081e1954)
2020-09-30 16:10:17 +02:00
Camilla Löwy
0ab31db9c0 Formatting
(cherry picked from commit 7765451d0f)
2020-09-02 22:29:30 +02: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
b8a6254a26 Cocoa: Fix potential leak of CFNumber object
Spotted by Clang static analysis.

(cherry picked from commit a2674a9034)
2020-09-02 22:12:40 +02:00
Camilla Löwy
114704262c Wayland: Fix scroll offsets being inverted
Scrolling offsets were inverted compared to X11 and Win32.

Fixes #1463.

(cherry picked from commit f760b124ca)
2020-07-16 13:34:28 +02:00
Camilla Löwy
bd2fb9ebaf Wayland: Fix partial framebuffer size retrieval
(cherry picked from commit 5f60c22cfa)
2020-07-16 13:33:58 +02:00
Camilla Löwy
85a169ff50 X11: Fix cursor hover query retry behavior
XQueryPointer returns zero on BadWindow so the retry did not happen.

Related to ceb20c7f97.

(cherry picked from commit 49dbcfcb8c)
2020-07-16 13:32:11 +02:00
Camilla Löwy
539f4bdca2 X11: Fix race in window hovered query
The window decoration window can go away between calls to XQueryPointer,
for example if the GLFW_DECORATED window attribute was just cleared.

(cherry picked from commit ceb20c7f97)
2020-07-16 13:32:04 +02:00
Camilla Löwy
606c0fc03e X11: Fix detection of key events duplicated by XIM
Background: The IM will filter out key events, instead sending exact
duplicate events that are not filtered.  It does not send these for
every event, however, so the duplicate events cannot be relied on for
key input.  Instead we need to identify and discard them.  Since they
are identical, they have the same timestamp as the originals.

The previous duplicate event detection would consume unrelated key
events if the keys were pressed simultaneously, as it only tracked
a single timestamp.

This fixes that issue for any combination of keys, at the expense of
a 1 KB array per GLFW window.

This fix is a stopgap until explicit IME support is done.

Based on #1472 by @LucaRood.

Fixes #1112.
Fixes #1415.
Fixes #1616.
Fixes #1663.
Closes #1472.

(cherry picked from commit 9a3664b4a9)
2020-07-16 13:30:39 +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
e6646c8508 Cocoa: Fix regression in private use area check
This fixes a regression introduced by
ad9eb768c9.

(cherry picked from commit e47832ffcf)
2020-06-30 17:14:24 +02:00
Camilla Löwy
9cae95faa3 Cocoa: Fix non-BMP Unicode codepoint input
Supplimentary Plane codepoints were reported as UTF-16 surrogate pairs.

Fixes #1635.

(cherry picked from commit ad9eb768c9)
2020-06-30 17:14:13 +02:00
Luflosi
1730184971 Fix typos
(cherry picked from commit b66f105f3e)
2020-06-30 17:09:55 +02:00
Camilla Löwy
5dbca2e2c9 Wayland: Fix repeated keys reported to NULL window
This fixes a race between the key repeat logic and the surface leave
event handler, which could result in repeated keys being reported with
a window of NULL.

Fixes #1704.

(cherry picked from commit c72da994ba)
2020-06-30 17:04:04 +02:00
ben1
37a86f24f0 Win32: Fix VS /W4 compile warnings
These are harmless errors but the code was worth fixing just to reduce
confusion and be more explicit.  E.g. using a different variable name
for a new variable of a different type in win32_joystick.c.

Closes #1700.

(cherry picked from commit a84a30ab63)
2020-06-02 19:01:15 +02:00
Luflosi
11e5102d83 Use the correct type in a for loop
The `atomCount` variable has the type `unsigned long`,
so the `for` loop iterating over it should use the same type.

Closes #1701.

(cherry picked from commit 250b94cd03)
2020-06-02 19:01:09 +02:00
Luflosi
a8e5c530ee Replace %m conversion specifier with %s and strerror()
When compiling with `-Wall` and `-pedantic-errors`, gcc complains with
```
warning: ISO C does not support the '%m' gnu_printf format [-Wformat=]
```
because the `%m` conversion specifier is a GNU extension.

Closes #1702.

(cherry picked from commit d4f5074535)
2020-06-02 19:01:05 +02:00
Corentin Wallez
8b63ca53de Use CALayer instead of NSView for EGLNativeWindowType
The only two EGL implementations on macOS are Swiftshader and ANGLE.
While Swiftshader supports both `NSView` and `CALayer` as
`EGLNativeWindowType`, ANGLE supports only `CALayer`. Furthermore
Swiftshader's OpenGL ES frontend is deprecated in favor of using ANGLE's
Vulkan backend on top of Swiftshader's Vulkan frontend.

This means that on macOS `EGLNativeWindowType` should be a `CALayer` for
compatibility with ANGLE.

Fixes #1169.
Closes #1680.

(cherry picked from commit 91eebe922d)
2020-06-02 19:00:53 +02:00
Camilla Löwy
ca2cd2f796 X11: Clarify function name and comment
(cherry picked from commit 5f9dfe3d83)
2020-05-22 16:29:54 +02:00
Camilla Löwy
0a7c24e48c X11: Clarify code flow for Clang static analysis
(cherry picked from commit ef5220d6b1)
2020-05-22 16:27:33 +02:00
Camilla Löwy
48bc089e9e X11: Fix XKB events being passed on to core path
(cherry picked from commit a17a1b2011)
2020-05-22 16:27:22 +02:00
Camilla Löwy
3df4ebeaac X11: Fix XKB state event bits being overwritten
This limits the update to the XKB group state event bit without clearing
all other state event bits.

(cherry picked from commit e07925c404)
2020-05-22 16:27:16 +02:00
Camilla Löwy
dff64496d6 X11: Remove duplicate XKB group initialization
The XKB group is already set to zero during initialization.

(cherry picked from commit cf3a03a85d)
2020-05-22 16:27:10 +02:00
Camilla Löwy
117f7694b2 X11: Fix XKB group event depending on state query
This fixes XKB group change events not being enabled if the initial
XKB keyboard state query fails.

(cherry picked from commit 0c403c8ca6)
2020-05-22 16:27:02 +02:00
Camilla Löwy
6e01359e36 Cocoa: Fix call to NSWindow from non-main threads
glfwSwapBuffers may be called by any thread but NSWindow may not.

Bug introduced by c3ca88055f and reported
by @crujose.

(cherry picked from commit 949275bbed)
2020-05-19 14:33:15 +02:00
Camilla Löwy
404c28df3d X11: Improve non-XKB fallback for key mapping
A regression introduced by b889aa7841
broke the special handling of numpad keys for the non-XKB fallback path.
The non-functional remains were later removed.  This restores the
original behavior.

(cherry picked from commit cab41529da)
2020-05-05 00:18:59 +02:00
Camilla Löwy
b0c79896a3 X11: Add additional XKB key names for Right Alt
(cherry picked from commit 318e08d914)
2020-05-05 00:18:54 +02:00
Camilla Löwy
4aaf8ba1d2 X11: Use XKB key name MENU for Menu key
(cherry picked from commit 560304e0f4)
2020-05-05 00:18:51 +02:00
Camilla Löwy
cf87e6549c X11: Check XKB key aliases in addition to names
(cherry picked from commit 9ecacf1d7f)
2020-05-05 00:18:48 +02:00
Camilla Löwy
27d7fc098d X11: Fix X keycode ranges for XKB and core
This replaces the hardcoded keycode ranges and various kludgy range
checks with the actual ranges reported by Xlib and XKB.

(cherry picked from commit ee45b58647)
2020-05-05 00:18:16 +02:00