Commit Graph

2484 Commits

Author SHA1 Message Date
Camilla Löwy
ff2c00091d Cleanup
Related to #1528.

(cherry picked from commit d232bcfcdd)
2019-07-16 14:39:38 +02:00
Denis Bernard
b3eb6dd38b X11: Query and keep track of Xkb group index
For users with multiple keyboard layouts configured, glfwGetKeyName
works fine only with the primary layout.  Switching layouts results in
changing the group index.  This commit querries the current group index
when initializing keyboard input and keeps track of any change to it.

As a result the scancode -> keyname mapping may change while the program
is running (needs to be documented).

Fixes #1462.
Closes #1528.

(cherry picked from commit 36f90800d8)
2019-07-16 14:39:34 +02:00
Camilla Löwy
84fa724456 X11: Fix focus events not being filtered
The filter condition had ended up below the action.

(cherry picked from commit c6b95e3b07)
2019-07-16 14:39:28 +02:00
Luflosi
633ba53f2c Fix typo
Closes #1513.

(cherry picked from commit e463e85bba)
2019-07-16 14:39:19 +02:00
Camilla Löwy
eb466a0e0b Cocoa: Cleanup
This makes the Cocoa _glfwPlatformSetWindowMonitor consistent with its
X11 and Win32 counterparts.

(cherry picked from commit 3262c29440)
2019-07-16 14:39:05 +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
1e12653348 X11: Let the language initialize XEvent structs
(cherry picked from commit 1f508530f0)
2019-07-16 14:38:55 +02:00
Camilla Löwy
e276f6731e X11: Clean up EWMH feature detection
The EWMH feature detection atoms are now named and loaded the same way
as other X11 atoms.  Detection is now performed after all
non-conditional atoms have been loaded.  The EWMH detection now has
hopefully more readable comments.

(cherry picked from commit fad9896d38)
2019-07-16 14:38:48 +02:00
Camilla Löwy
66e06b0609 Convert some declarations to C99 style
(cherry picked from commit 0c6b505619)
2019-07-16 14:38:26 +02:00
Luflosi
71a4f2d8a2 Replace some tabs with spaces
I found some tabs where there should be spaces for consistency.
Closes #1496.

(cherry picked from commit 2db3b9688d)
2019-07-16 14:38:14 +02:00
Camilla Löwy
b436d8e3e6 Remove pointless comments
(cherry picked from commit 84ec99bb01)
2019-05-27 16:34:23 +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
051424f196 WGL: Add extension function macro aliases
This should have been done when the WGL extension members were moved
from the context struct to the library struct.

(cherry picked from commit 22a6c02a4c)
2019-05-27 16:33:59 +02:00
Camilla Löwy
97393223ee WGL: Fix misplaced block comment
(cherry picked from commit 3fd4e79adb)
2019-05-27 16:33:55 +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
bc8b567d7c Move to the modern CMake project version option
This replaces the manual ad-hoc version variables we have used since
CMake 2.x (and GLFW 2.x lite).

(cherry picked from commit a255e7ace6)
2019-05-19 18:30:58 +02:00
Konstantin Podsvirov
2e3b4cf898 Fix use of absolute path in INSTALL_INTERFACE
Closes #1470.

(cherry picked from commit 15af302f77)
2019-05-19 18:26:58 +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
334a485968 Win32: Fix potential buffer overrun
Found with VS static analysis.
2019-04-15 15:35:19 +02:00
Camilla Löwy
0e74265426 Cocoa: Fix cursor hover test 2019-04-15 14:52:17 +02:00
Camilla Löwy
3c3981a4f0 Cocoa: Fix coordinate transformations
Window relative mouse locations provided via NSWindow and NSEvent are
based at 0,1 while screen relative locations use 0,0.  Incorrect
handling of this had crept into other coordinate transformations.  Note
that most of these errors canceled each other out, so the reported
positions of windows, monitors and work areas are unaffected.  This
corrects the cursor position for glfwGetCursorPos and glfwSetCursorPos.

Fixes #1461.
2019-04-15 14:52:17 +02:00
Camilla Löwy
28f118f4de NSGL: Disable swap interval
Swap interval now uses CVDisplayLink.
2019-04-15 14:36:12 +02:00
Camilla Löwy
93962ec168 Win32: Fix VS 2010 build error 2019-04-15 02:46:07 +02:00
Camilla Löwy
3461d1c2a5 Fix missing context APIs in version strings 2019-04-08 20:51:34 +02:00
Camilla Löwy
c585bf010b Fix file flags 2019-04-07 20:44:21 +02:00
Cliff Smolinsky
87458617e0 Win32: Bypass composition check on Windows 8+
DWM composition is always enabled on Windows 8 and later, so there's no
need to call DwmIsCompositionEnabled on those platforms.

Fixes #1452.
Closes #1453.
2019-04-01 18:11:55 +02:00
Camilla Löwy
297999c9e1 Add missing SDL2 attribution 2019-04-01 17:42:27 +02:00
Camilla Löwy
5292914ce1 Win32: Fix message pump filtering during init
Fixes #886.
2019-03-28 23:50:13 +01:00
Camilla Löwy
02874d9c14 Align joystick axis to gamepad button behavior
This is an SDL2 compatibility fix.
2019-03-28 23:01:27 +01:00
Camilla Löwy
0d355379e0 Cocoa: Support some sim page joystick elements
This is an SDL2 compatibility fix.
2019-03-28 22:58:47 +01:00
Camilla Löwy
c32dc3a085 Fix half-axis to gamepad button value mapping
Negative half-axes were not negated when mapped onto gamepad buttons.
2019-03-27 20:34:54 +01:00
Camilla Löwy
cad22cb2f6 Cocoa: Fix missing check for selector
Fixes #1457.
2019-03-27 20:04:43 +01:00
Camilla Löwy
1fca33b3c1 Cocoa: Remove checks for pre-10.8 SDK
OS X 10.8 is now the minimum required version but these checks were not
removed when that change was made.
2019-03-27 20:03:05 +01:00
Camilla Löwy
9420e6f0d0 Fix invalid ranges for gamepad axis sources
Buttons and hat bits were mapped to [0,1] instead of [-1,1].

Fixes #1293.
2019-03-27 19:35:19 +01:00
Camilla Löwy
980fc9b52f Cocoa: Apply retina window hint to Metal layer
Related to #1340.
2019-03-27 17:14:30 +01:00
Camilla Löwy
e108c0de0d Cocoa: Explicitly set layer on surface creation
Implicitly setting the layer doesn't work when there is already a layer.
Our view is now layer-hosting for Vulkan.

Fixes #1340.
2019-03-27 16:28:16 +01:00
Camilla Löwy
056c5d3f90 Cleanup 2019-03-27 01:26:39 +01:00
Camilla Löwy
a4fbc6fe91 NSGL: Disable API deprecation warnings 2019-03-26 18:30:17 +01:00
Camilla Löwy
8d7e5cdb49 NSGL: Update current display for display link
This solution of one display link per window is far from ideal but is
still better than no solution.

As a side-effect this fixes swap interval breaking being ignored for
occluded windows on earlier versions of macOS.

Fixes #680.
Fixes #1337.
Related to #1417.
Fixes #1435.
2019-03-05 20:22:00 +01:00
Camilla Löwy
f8bcc7e65c NSGL: Fix leak of condition object
Related to #1417.
2019-03-05 20:22:00 +01:00
Camilla Löwy
ba761ab06e NSGL: Fix display link leaking and left running
Related to #1417.
2019-03-05 20:22:00 +01:00
Camilla Löwy
d0e8d06d95 Cleanup
Related to #1417.
2019-03-05 20:22:00 +01:00
Camilla Löwy
3615d437a7 Formatting
Related to #1417.
2019-03-05 20:22:00 +01:00
amarcu5
82ca58da04 NSGL: Implement swap interval with CVDisplayLink
This fixes OpenGL swap interval (vsync) on macOS 10.14 Mojave by using
CVDisplayLink to synchronise to the monitor refresh rate rather than
setting NSOpenGLContextParameterSwapInterval.

Solution based on advice provided by @rcgordon.

Closes #1417.
2019-03-05 20:21:56 +01:00
Camilla Löwy
4e3204d86d Cocoa: Replace global autorelease pool with blocks
This is another small step towards having GLFW play nice with other
toolkits sharing the same process, including AppKit.

Any macOS platform function that touches Cocoa must now wrap itself in
an autoreleasepool block.

Since GLFW no longer provides an autoreleasepool outside of its
functions, THIS MAY BREAK EXISTING CODE MIXING GLFW AND COCOA.  Sorry!
Please add your own autoreleasepool blocks as needed.

Fixes #1107.
Closes #1114.
2019-03-05 20:11:20 +01:00
Camilla Löwy
9883cb64f0 Cocoa: Disable shadow for transparent framebuffer 2019-03-05 20:03:29 +01:00
Camilla Löwy
4b20fb705b Cocoa: Fix work area using NS screen coordinates
Related to #1322.
2019-03-05 17:41:32 +01:00
Camilla Löwy
3a2a97f15d X11: Fix implementation of work area retrieval
This intersects the global work area from _NET_WORKAREA with the monitor
viewport.  The monitor viewport falls back to the core display
dimensions where working RandR is missing.  The _NET_WORKAREA query is
now checked for success.  The _NET_WORKAREA extent array is now indexed
by _NET_CURRENT_DESKTOP.  The _NET_WORKAREA atom is now checked for
availability.

Related to #1322.
2019-03-05 16:58:45 +01:00