Commit Graph

2689 Commits

Author SHA1 Message Date
Camilla Löwy
081484ed34 Fix POSIX conformance issues for clock_gettime
CLOCK_MONOTONIC should not be used as a feature macro.  The POSIX
feature macros are provided by unistd.h.  CLOCK_MONOTONIC is provided by
time.h.  CLOCK_MONOTONIC requires _POSIX_C_SOURCE >= 199309L on some
systems.
2019-12-15 18:15:40 +01:00
Camilla Löwy
506a6aafde Formatting 2019-12-11 22:10:00 +01:00
Camilla Löwy
a875a536b7 Cocoa: Fix duplicate conversion of title string 2019-12-11 22:08:56 +01:00
Camilla Löwy
2551829f75 Win32: Add VERSIONINFO resource to GLFW DLL
This will let people see the API version in the Explorer property box.
2019-12-11 21:02:08 +01:00
Camilla Löwy
59055d585f Update minimum required CMake version to 3.1 2019-12-09 23:48:26 +01:00
Camilla Löwy
c194193797 Replace CMake generator expression with variable
Generator expressions are amazing but best used in moderation.
2019-12-09 23:35:51 +01:00
Camilla Löwy
9dc365f192 Merge GCC/Clang specific CMake blocks 2019-12-09 23:35:51 +01:00
Camilla Löwy
197193ac0b Fix source list for Objective-C fix 2019-12-09 23:35:51 +01:00
Camilla Löwy
9486ec0c02 Fix source list for -Wdeclaration-after-statement
The context creation files were not included on platforms other than
Win32.
2019-12-09 23:35:50 +01:00
Camilla Löwy
bc7b19cbd1 Remove tab character 2019-12-09 23:35:50 +01:00
Camilla Löwy
f6d44cedfd Trust CMake to do the right thing for static libs
CMake understands what private library dependencies for a static library
means and handles it correctly.
2019-12-09 23:35:40 +01:00
Camilla Löwy
fa60269245 NSGL: Fix disabling of Retina resolution
It appears the default is now YES.

Fixes #1442.
2019-12-09 22:25:59 +01:00
Camilla Löwy
6e6805000a Cocoa: Fix pre-window-creation event processing
Polling the event queue before NSApp had been allowed to finish
launching, in our case by starting our self-terminating run loop,
triggered an assertion inside NSApplication.

This fix, which makes all event processing functions capable of starting
it, makes that assertion less likely.

A more Cocoa-friendly fix would be to finish launching NSApp during
glfwInit and let people annoyed by the menu bar disabled it with
GLFW_COCOA_MENUBAR.  That may not be suitable for 3.3-stable, though.

Fixes #1543.
2019-12-09 22:25:59 +01:00
Camilla Löwy
b3544ca43e Cocoa: Update outdated comment 2019-12-09 18:46:31 +01:00
Emmanuel Gil Peyrot
ef6189f348 Wayland: Unset the cursor name on border exit
It would previously conserve the last name it had before leaving the
border, sometimes desynchronising with what it should have been.
2019-12-08 21:58:11 +01:00
Camilla Löwy
7dbdd2e6a5 Add more standard cursors
This adds the standard cursors for diagonal and omnidirectional
resize/move and operation-not-allowed.  It also adds new (better?) names
for the horizontal and vertical resize/move and pointing hand cursors.

References:
 - https://developer.apple.com/documentation/appkit/nscursor
 - https://stackoverflow.com/questions/10733228/
 - https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setsystemcursor
 - https://freedesktop.org/wiki/Specifications/cursor-spec/
 - https://tronche.com/gui/x/xlib/appendix/b/

Related to #427.
2019-11-28 22:24:00 +01:00
Camilla Löwy
80fde12fda Wayland: Fix pointing hand cursor shape
Related to #1432.
2019-11-25 18:55:50 +01:00
Emmanuel Gil Peyrot
a80788c17f Wayland: Don’t update cursor position in the frame
That way the application only sees the cursor moving when it is inside
of its area, it won’t go back to the top or left side when trying to
resize the window or just hovering the fallback decorations.
2019-11-21 13:53:08 +01:00
Emmanuel Gil Peyrot
a9f674e719 Wayland: Don’t reload the cursor on every pointer motion
Previously, any pointer motion in the window decorations when using the
fallback implementation would obtain the wl_cursor again, and do the
attach danse for no benefit.

This will ultimately allow animated cursors to not reset to the first
frame on motion, once these will be implemented.
2019-11-21 13:52:37 +01:00
Camilla Löwy
e96dc5d219 X11: Assume 96 DPI if RandR monitor size is zero
This falls back to calculating the monitor physical size from the
current resolution and the default X11 DPI when the physical size
returned by RandR is zero.
2019-11-14 19:49:23 +01:00
Camilla Löwy
2c519709be Cocoa: Fix full screen window iconification
Iconification (miniaturization) of undecorated windows stopped working
unless the window has the NSWindowStyleMaskMiniaturizable style.
2019-11-13 14:08:28 +01:00
Camilla Löwy
bd452016be Cocoa: Cleanup
Readability fix, does not affect generated code.
2019-11-11 22:49:00 +01:00
Camilla Löwy
bac15f9449 Cocoa: Fix multiple methods warning
This fixes a warning due to us using bare ids and
NSCollectionLayoutAnchor having a message with the same name.
2019-11-11 22:49:00 +01:00
Camilla Löwy
c819f27ce3 Cocoa: Process events after window destruction
On macOS a destroyed window remained on screen until the next time
events were processed.  This makes the behavior more consistent with
other platforms.

Fixes #1412.
2019-11-11 22:49:00 +01:00
Camilla Löwy
94cb0347ab Cocoa: Add comments for Cocoa symbol macros 2019-11-11 22:49:00 +01:00
Camilla Löwy
8e288dc94c Win32: Add GLFW_WIN32_KEYBOARD_MENU
This platform specific window hint enables access to the Windows window
menu via the keyboard shortcuts.
2019-11-11 22:37:18 +01:00
Camilla Löwy
b69fb99031 Remove mappings for GUID used by different devices
The SDL2 2.0.5+ controller GUID 03000000790000000600000000000000 matches
many devices with different layouts and element counts but with the same
chipset.  This issue is still being resolved upstream.  In the meantime
this removes those mappings from GLFW to avoid confusion and errors.

SDL upstream issue: https://bugzilla.libsdl.org/show_bug.cgi?id=4545

Related to #1583.
2019-11-11 22:37:18 +01:00
Camilla Löwy
c88ee1c9d3 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.
2019-11-11 22:37:13 +01:00
Camilla Löwy
75294462b3 X11: Fix content scale fallback value on KDE
KDE sometimes removes the Xft.dpi resource when it would be set to the
X11 default value of 96, causing GLFW to fall back to a value calculated
from the core display sizes in pixels and mm in a desktop environment
that supports Xft.dpi.

This moves to a hardcoded fallback value of 96 on the assumption that
there are more people running KDE with 96 DPI than there are people
running desktop environments that do not support Xft.dpi.

All of this is terrible please send help.

Fixes #1578.
2019-10-29 12:04:47 +01:00
Camilla Löwy
5fc4c01302 X11: Fix decoration enabling after window creation
This fixes the enabling of window decorations after creation.  Instead
of removing the _MOTIF_WM_HINTS property, we now set or unset the
MWM_DECOR_ALL bit of the decorations field.

Fixes #1566.
2019-10-29 12:04:47 +01:00
Camilla Löwy
33683ec60e Remove stray characters from hardcoded CFLAGS
The additional '>' characters were appended to the compiler option.

Related to #1576.
2019-10-29 12:04:47 +01:00
Camilla Löwy
04f7f55f07 Cleanup
Related to #1585.
2019-10-29 12:04:47 +01:00
Pablo Prietz
4d0ae4ffa7 Fix CMake 3.0 - 3.6 support regression
Replaces `VERSION_GREATER_EQUAL` with `VERSION_EQUAL OR
VERSION_GREATER`.  `VERSION_GREATER_EQUAL` was only added in CMake 3.7.

Fixes #1584.
Closes #1585.
2019-10-29 12:04:46 +01:00
Corentin Wallez
3a37a08998 Fix -Wextra-semi warnings
Closes #1440.
2019-10-17 20:09:38 +02:00
Luflosi
7749aac50d
Use the correct type in a for loop
The `monitorCount` member in the `_GLFWlibrary` struct is of type `int`, so the `for` loop iterating over it should also use the type `int`.

Closes #1572.
2019-10-17 13:47:28 +02:00
Guillaume Racicot
8f852e0833 Enable C99 explicitly with CMake where available
This enables compilation as C99 where supported by the compiler.
A workaround with per-compiler hardcoded flags is used for CMake 3.0,
which does not support the C_STANDARD target property.

Fixes #1560.
Closes #1576.
2019-10-16 02:33:12 +02:00
Luflosi
d25248343e Use the correct type for a struct member
The `name` member in the `_GLFWmonitorWayland` struct is used in two places. It is assigned the value from a variable of type `uint32_t` and is compared to another variable of type `uint32_t`, so `name` should also have the same type.

Closes #1569.
2019-10-06 17:36:46 +02:00
Camilla Löwy
3d2540c373 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.
2019-10-03 21:05:49 +02:00
Camilla Löwy
3ec8f4a7f5 Win32: Disable dynamic libgcc for MinGW DLL 2019-10-03 21:05:49 +02:00
Luflosi
243b1bc292 Use the correct type in a for loop
The `size` member in the `GLFWgammaramp` struct is of type `unsigned int`, so the `for` loop iterating over it should also use the type `unsigned int`.

Closes #1541.
2019-09-23 13:43:05 +02:00
luz.paz
7105ff2dfd Fix typos
Found via `codespell -q 3 -S ./deps -L fo,numer,te,uint,wille`
2019-09-16 12:30:25 +02:00
Camilla Löwy
7f02898264 Cocoa: Fix glfwSetWindowSize anchor point
This makes glfwSetWindowSize use the top-left corner as anchor point
instead of the bottom-left corner.

Fixes #1553.
2019-09-06 16:57:37 +02:00
httpdigest
2777f6a754 Fix comparison of video modes of equal area
This fixes the bug of video modes being discarded if they had
a different resolution but the same area as another mode.

Fixes #1555.
Closes #1556.
2019-09-01 21:57:06 +02:00
Camilla Löwy
cbf23e5615 Win32: Fix VS static analysis false positive
This way is perhaps also more readable for humans.
2019-08-28 20:59:49 +02:00
Camilla Löwy
56ca0cb3b3 Unify key name string handling
This makes key names per-key static strings for all supported platforms.

Fixes #1200.
2019-08-27 19:29:56 +02:00
Camilla Löwy
4cc5d2e623 Clarify comment 2019-08-15 17:25:36 +02:00
Camilla Löwy
2c7ef5b480 Win32: Fix initial state of maximized state cache 2019-08-14 19:18:29 +02:00
Camilla Löwy
711b9694a1 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.
2019-08-13 16:08:15 +02:00
Ave Milia
2e039d9275 CMake: remove -DGLFW_DLL on non-Windows targets
When using GLFW with CMake and installed GLFW binaries, `-DGLFW_DLL` is
passed on Linux, which should not happen.

Closes #1530.
2019-07-22 21:37:22 +02:00
Camilla Löwy
b430bc4935 Cocoa: Fix internal symbol hiding for dylib
The default symbol visibility was not set to hidden on macOS.
2019-07-16 23:14:16 +02:00
Camilla Löwy
062a1c22b5 Cocoa: Fix file-local function not declared static 2019-07-16 23:12:20 +02:00
Leon Linhart
4f0b8b0dda 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.
2019-07-12 16:39:17 +02:00
Camilla Löwy
d232bcfcdd Cleanup
Related to #1528.
2019-07-12 15:00:51 +02:00
Denis Bernard
36f90800d8 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.
2019-07-12 14:08:43 +02:00
Camilla Löwy
c6b95e3b07 X11: Fix focus events not being filtered
The filter condition had ended up below the action.
2019-07-11 00:36:34 +02:00
Luflosi
e463e85bba
Fix typo
Closes #1513.
2019-07-01 11:30:57 +02:00
Camilla Löwy
3262c29440 Cocoa: Cleanup
This makes the Cocoa _glfwPlatformSetWindowMonitor consistent with its
X11 and Win32 counterparts.
2019-06-27 18:14:48 +02:00
A. Tombs
1d62157268 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.
2019-06-27 18:14:48 +02:00
Camilla Löwy
1f508530f0 X11: Let the language initialize XEvent structs 2019-06-27 18:14:48 +02:00
Camilla Löwy
fad9896d38 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.
2019-06-27 18:14:48 +02:00
Camilla Löwy
0c6b505619 Convert some declarations to C99 style 2019-06-27 18:13:29 +02:00
Luflosi
2db3b9688d
Replace some tabs with spaces
I found some tabs where there should be spaces for consistency.
Closes #1496.
2019-06-16 16:57:09 +02:00
Camilla Löwy
84ec99bb01 Remove pointless comments 2019-05-24 14:43:49 +02:00
Camilla Löwy
d0c3fa900a Win32: Fix non-client actions for disabled cursor
Disabled cursor mode interfered with some non-client actions.
2019-05-24 14:43:49 +02:00
Camilla Löwy
267e06a41e Win32: Remove stale comment 2019-05-24 14:43:49 +02:00
Camilla Löwy
22a6c02a4c 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.
2019-05-24 14:43:49 +02:00
Camilla Löwy
3fd4e79adb WGL: Fix misplaced block comment 2019-05-24 14:43:49 +02:00
Camilla Löwy
56aad76b16 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.
2019-05-24 14:43:49 +02:00
Camilla Löwy
0b01d850ed NSGL: Remove enforcement of forward-compatible flag
This sharp corner should have been addressed a long time ago.
2019-05-19 21:10:29 +02:00
Camilla Löwy
a255e7ace6 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).
2019-05-17 16:12:52 +02:00
Konstantin Podsvirov
15af302f77 Fix use of absolute path in INSTALL_INTERFACE
Closes #1470.
2019-05-17 16:12:52 +02:00
Emmanuel Gil Peyrot
599fb3de34 Wayland: Remove wl_shell support
This protocol is part of the core Wayland, but it is pretty badly
designed and is missing quite a few features, and is in the process of
being phased out in compositors.  Its support in GLFW requires
duplicating pretty much every single window management codepath.

This bumps the required compositor versions to the ones which have
implemented xdg-shell, approximately two years ago, which seems sensible
to me.
2019-04-20 10:05:15 +02:00
Camilla Löwy
a337c56848 Start 3.4 2019-04-16 23:08:39 +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
Camilla Löwy
4f14c1e776 X11: Fix copypaste errors
Related to #1322.
2019-03-05 16:58:45 +01:00
Camilla Löwy
d82e7b5cb1 Win32: Use cached monitor handle for work area
This facility was added after the original PR was made.

Related to #1322.
2019-03-05 16:58:45 +01:00
Camilla Löwy
0118743333 Formatting
Related to #1322.
2019-03-05 16:58:45 +01:00
Camilla Löwy
a726942bfe Cocoa: Unify NSScreen cached lookup for monitors
Related to #1322.
2019-03-05 16:58:45 +01:00
Doug Binks
68fd4e8bb3 Cocoa: Fix work area retrieval on missing screen
Closes #1322.
2019-03-05 16:58:45 +01:00
Doug Binks
ba4e78e57f Wayland: Return whole output area as work area
Related to #1322.
2019-03-05 16:10:59 +01:00
Doug Binks
222ac78a44 Cocoa: Add work area NULL checks and fix size
Related to #1322.
2019-03-05 16:10:59 +01:00
Doug Binks
bea4818030 X11: Add NULL checks in work area retrieval
Related to #1322.
2019-03-05 16:10:59 +01:00
Doug Binks
e6d22346f9 Fix copypaste error in glfwGetMonitorWorkarea
Related to #1322.
2019-03-05 16:10:59 +01:00
Doug Binks
f7733c7b4f Win32: Add missing out parameter NULL checks
This fixes _glfwPlatformGetMonitorWorkarea not checking if its out
parameters were NULL.

Related to #1322.
2019-03-05 16:10:59 +01:00
Doug Binks
5c752355cb Win32: Fix and simplify work area retrieval
Related to #1322.
2019-03-05 16:10:59 +01:00
Felipe Ferreira da Silva
be295ccbea Add glfwGetMonitorWorkarea
This function retrieves the work area rectangle of the specified
monitor.

Related to #920.
Closes #989.
2019-03-05 16:10:59 +01:00
Camilla Löwy
c20754c4a6 Fix Coverity Scan false positive 2019-03-04 18:52:56 +01:00
Camilla Löwy
621ece63c8 Round refresh rate instead of truncating
Fixes #1441.
2019-03-04 17:31:14 +01:00
Camilla Löwy
2fbb560eb7 Cocoa: Fix window creation blocking after re-init
Fixes #1439.
2019-02-25 02:41:05 +01:00
Camilla Löwy
7c3aaf8065 Win32: Fix OCR_HAND macro missing on MinGW
Fixes #1438.
2019-02-24 04:18:11 +01:00
Camilla Löwy
44af6bb936 Wayland: Implement raw mouse motion control
Related to #1400.
Related to #1401.
2019-02-22 14:52:02 +01: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
Emmanuel Gil Peyrot
5f9cbd0ebc Wayland: keyboard repeat rate is given in Hz
It was currently interpreted as ms, which is obviously wrong.

Thanks to https://github.com/Smithay/client-toolkit/pull/62 for making
me notice this issue.
2019-02-20 15:56:04 +01:00
Camilla Löwy
ec3784f3d7 WGL: Unify query error handling 2019-02-17 18:34:56 +01:00
Camilla Löwy
782f7fe0c7 WGL: Fix leak on format attrib query failure
This was found by Coverity Scan.
2019-02-17 18:34:56 +01:00
Emmanuel Gil Peyrot
45bd991ea9 Wayland: Fix auto-iconify on kwin_wayland
We now keep track of the fullscreen and activated state and only iconify
if we were previously fullscreen and now we are either not fullscreen or
not activated anymore.

This is the proper way to do it, compared to the previous hack where we
didn’t iconify only if it was the first configure event received.
2019-02-15 18:12:09 +01:00
Emmanuel Gil Peyrot
edf0a07174 Wayland: Only auto-iconify fullscreen windows
Thanks to kwin for exposing a bug here!
2019-02-15 17:03:37 +01:00
Greg V
36ce73bbfd Wayland: use SHM_ANON on FreeBSD
This works like memfd on Linux.
2019-02-15 15:45:25 +01:00
Camilla Löwy
1d95acdf56 Cocoa: Fix detection of Clang 2019-02-14 00:19:45 +01:00
schraf
2e70950c0f Fix quoting of CMAKE_C_COMPILER_ID
I was getting an error in this cmake file when using 3.10.2 on linux.
Here was the error message I was getting:

[cmake] CMake Error at external/glfw/src/CMakeLists.txt:82 (if):
[cmake]   if given arguments:
[cmake]
[cmake]     "STREQUAL" "GNU" "OR" "STREQUAL" "Clang"
[cmake]
[cmake]   Unknown arguments specified

Adding the quotes around the cmake variables seems to do the trick. That
was also done with the STREQUAL condition earlier on line 66.

Closes #1411.
2019-02-14 00:19:45 +01:00
Camilla Löwy
2a27eb95e4 X11: Fix system cursor used for GLFW_HAND_CURSOR
Fixes #1432.
2019-02-14 00:04:39 +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
90e22947c6 Cleanup 2019-01-31 01:58:04 +01:00
Camilla Löwy
463ef7eb71 Cocoa: Fix handling of analog joystick buttons
The reported state was not clamped to [0,1], i.e. GLFW_RELEASE and
GLFW_PRESS.

Fixes #1385.
2019-01-31 01:54:49 +01:00
Camilla Löwy
51ca41dd9f Cocoa: Add missing IOHID page and usages
Related to #1385.
2019-01-31 01:53:55 +01:00
Camilla Löwy
530b37f4db Cocoa: Disable automatic tabbing for GLFW windows
Related to #1250.
2019-01-31 00:20:24 +01:00
Camilla Löwy
78e6a0063d X11: Fix EWMH state update for hidden windows
The EWMH window state code assumed the window was mapped.

Fixes #1358.
2019-01-31 00:02:16 +01:00
Camilla Löwy
b41cd34143 Cleanup 2019-01-25 12:46:46 +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
3d748cf530 Cleanup
Related to #1381.
2019-01-17 00:12:59 +01:00
Doug Binks
babafc13db WGL: Add array-based call to wglGetPixelFormatAttribivARB
This improves performance of pixel format enumeration and helps the very
poor performance reported on a small number of machines.

Closes #1381.
2019-01-17 00:12:59 +01:00
Camilla Löwy
2053f3ed22 Cleanup 2019-01-17 00:11:17 +01:00
Camilla Löwy
55b1a16f90 Remove window requirement for all event functions
This lets an application wait for non-window events without needing to
create a window.

Fixes #1317.
2019-01-15 19:28:17 +01:00
Camilla Löwy
ea7eb2ddab Cocoa: Move app delegate and menu creation to init
The application delegate needs to be set at init to receive monitor
events before window creation.  Menu creation is moved to
applicationWillFinishLaunching: to play nicer with other toolkits in the
same process.

Related to #1317.
2019-01-11 01:05:00 +01:00
Camilla Löwy
9a9568212c Cocoa: Move slightly towards modern Objective-C 2019-01-10 23:20:56 +01:00
Camilla Löwy
72c3908e14 X11: Fix glfwSetWindowMonitor not flushing buffer 2019-01-02 21:55:30 +01:00
Camilla Löwy
cde0aaaab1 X11: Fix glfwSetWindowMonitor not updating hints
This makes glfwSetWindowMonitor update the WM_NORMAL_HINTS when resizing
non-user-resizable windowed mode windows.
2019-01-02 21:55:30 +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
Vallentin
e29882523e Fix typos
Closes #1402.
2018-12-26 15:00:39 +01:00
Camilla Löwy
3531c320af Fix glfwSetGamma generating ramps of invalid sizes
This makes glfwSetGamma generate a gamma ramp of the same size as the
monitor's current ramp, which will avoid failure on non-256 entry
monitors on X11 and avoid ramp interpolation on macOS.

Closes #1387.
Fixes #1388.
2018-12-26 15:00:39 +01:00
Camilla Löwy
52c7a4fc7f Fix glfwGetGammaRamp error handling
This makes glfwGetGammaRamp return NULL on platform error as specified.

Related to #1387.
2018-12-26 15:00:39 +01:00
Camilla Löwy
3201eedc34 Cleanup
We have a usable fminf now.
2018-12-26 14:59:51 +01:00
Alexander Monakov
064dfaa549 Wayland: Remove gamma-related TODOs
Commit 9c513346ad ("Gamma will never be
supported on Wayland") made it clear that it cannot be implemented, so
this removes the TODO markers and rewords the error messages.

Related to #1387.
2018-12-26 14:50:22 +01:00
Camilla Löwy
751c6f9a27 Fix assertions for glfwSetGamma value
The NaN assert was implicit in the other ones.  The lower bound assert
incorrectly allowed a value of zero.

Related to #1387.
2018-12-26 14:48:40 +01:00
Camilla Löwy
8c611fd5d0 Win32: Fix build on older versions of Visual C++
Older versions did not provide fmin or fmax.  This adds internal
versions of fminf and fmaxf that should not be confused with
standards compliant implementations.
2018-12-26 14:45:40 +01:00
Camilla Löwy
a59315ed6a Win32: Fix joystick element info memory leak
The array was freed on failure but not on success.

Fixes #1396.
2018-12-26 14:43:33 +01:00
Keith Bauer
c4903d9267 Cocoa: Fix half of all key events for Caps Lock
This adds reporting of those Caps Lock key events that cause the lock
state to change.

The full fix involving IOHID is being worked on in #1368.

Related to #1368.
Closes #1373.
2018-12-25 21:39:48 +01:00
Andrew Belt
cc621765e5 Cocoa: Accept focusing mouse click as input
This makes the behavior on macOS consistent with other platforms.

Fixes #1209.
Closes #1386.
2018-12-25 20:50:50 +01:00
Camilla Löwy
17a15a20f2 Cocoa: Move to modern Objective-C literals 2018-12-25 18:52:56 +01:00
Camilla Löwy
c3ed70a4b7 Cocoa: Add NSApplicationDelegate protocol 2018-12-25 18:35:09 +01:00
Camilla Löwy
88c5edb409 Cocoa: Remove subclassing of NSApplication
This removes the GLFW NSApplication subclass as a step towards better
coexistence with other libraries that touch Cocoa.

This moves application object creation to platform init to allow event
processing before window creation.

Related to #1317.
2018-12-25 18:13:59 +01:00
Rolf Eike Beer
f9923e9095 Use GNUInstallDirs for install destinations
This has the advantage that the user may override e.g. the include
location, and the correct libdir (lib, lib64, lib/something) is
automatically determined.

Closes #1367.
2018-12-03 19:28:31 +01:00
Camilla Löwy
f680001b95 Cocoa: Remove superfluous compatibility macro 2018-11-27 21:44:20 +01:00
Camilla Löwy
18145a7f3d Cocoa: Use NSURLs for drag and drop
Fixes #1377.
2018-11-27 21:44:20 +01:00
Dominique Martinet
62993d9391 x11 window: update cursor position on enter event
click events would have an incorrect position after changing workspace,
if the mouse didn't move in between.
(Another example where this matters is a new window, if it appears under
the cursor, clicking would lead the application to think the user clicked
at 0,0)
2018-11-03 14:17:39 +01:00
MrVallentin
85fd5aa6c4 Use HTTPS when possible 2018-11-03 11:57:47 +01:00
meditator
d9466050d9 X11: Fix missing check for NET_WM_STATE
Closes #1356.
2018-11-01 17:26:51 +01:00
Camilla Löwy
5595fa3ae6 Cocoa: Fix OpenGL rendering not being displayed
Fix based on information provided by @rcgordon.

Fixes #1334.
Closes #1346.
2018-10-26 16:24:16 +02:00
Camilla Löwy
6dfc12a439 Cocoa: Fix some macOS 10.14 deprecation warnings 2018-10-26 15:19:48 +02:00
Camilla Löwy
031a8f9583 Cocoa: Cleanup 2018-10-24 18:01:12 +02:00
Emmanuel Gil Peyrot
c08abffc50 Wayland: Implement clipboard copy 2018-10-24 14:03:08 +02:00
Emmanuel Gil Peyrot
8b54e28c4e Wayland: Implement clipboard paste 2018-10-24 14:03:08 +02:00
Emmanuel Gil Peyrot
3c4b9a7eef Wayland: Add boilerplate for clipboard handling 2018-10-24 14:03:08 +02:00
Ricardo Vieira
92b3fd02e5 wayland: save serial from all input sources 2018-10-24 14:03:08 +02:00
Camilla Löwy
0b3677c2b1 X11: Clarify comment 2018-10-22 00:51:08 +02: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
1725d1c4f5 Win32: Fix build on early Windows 10 SDKs
Related to #1320.
2018-10-22 00:51:08 +02:00
Camilla Löwy
6bd264244a WGL: Cleanup 2018-10-22 00:51:08 +02:00
emersion
5afcd0981b wayland: add support for XCURSOR_THEME and XCURSOR_SIZE
These can be set by the compositor or the user to configure the
xcursor theme and size.
2018-10-11 00:58:23 +02:00
Emmanuel Gil Peyrot
cc805c0963 Mir: Remove this experimental backend
As of the release of Mir 1.0, libmirclient has been deprecated[1] and
its developers recommend clients using it to switch to Wayland.  This
patch removes support for libmirclient and instruct users to use the
experimental Wayland backend instead.

[1] https://discourse.ubuntu.com/t/mir-news-28th-september-2018/8184
2018-10-05 11:59:26 +02:00
Emmanuel Gil Peyrot
e75af5f531 Linux: Include the null byte in joystick path
This potential bug was found thanks to gcc 8’s -Wstringop-truncation
warning.
2018-10-03 22:03:20 +02:00
Emmanuel Gil Peyrot
dcd2a19d90 Wayland: Add support for xdg-decoration
This allows compositors which prefer to draw the decorations around
clients to do so, rather than letting GLFW draw its own decorations.
The appearance is thus entirely subject to the compositor used, but
should generally be better than the current solid colour decorations we
have, which we continue to use when the compositor doesn’t support this
protocol or tells us to draw the decorations ourselves.

This new protocol has been tested against wlroots’s rootston compositor.

Fixes #1257.
2018-10-01 16:37:24 +02:00
Emmanuel Gil Peyrot
3e884aea46 Wayland: Use memfd_create() and seals if available
This allows the compositor to avoid having to setup and teardown a
SIGBUS signal handler whenever it needs to read from this surface, as it
knows we won’t be able to shrink the file and so doesn’t have to protect
against that.

This codepath will only be used on Linux ≥ 3.17 with glibc ≥ 2.27, and
possibly other kernels and libc.  The former code will continue to be
used as a fallback, either if memfd_create() fails or if it isn’t
available.
2018-10-01 13:13:19 +02:00
Emmanuel Gil Peyrot
ab16fcc8db Wayland: Check for buffer creation failure
This prevents unusable decoration objects from being created, and
invalid cursors from being returned to the user.
2018-09-29 22:59:02 +02:00
Emmanuel Gil Peyrot
754b7feaa1 Wayland: Rename handlers for more unicity 2018-09-29 21:01:03 +02:00
Emmanuel Gil Peyrot
4d3f0fb5df Wayland: Split long lines for function declaration 2018-09-29 18:11:13 +02:00
Emmanuel Gil Peyrot
15cad02235 Wayland: Use HiDPI cursors for standard cursors 2018-09-11 14:28:44 +02:00
Emmanuel Gil Peyrot
e0b83bbe8d Wayland: Use HiDPI cursors on decorations 2018-09-11 14:28:44 +02:00
Emmanuel Gil Peyrot
321062833a Wayland: Load a bigger cursor theme for HiDPI 2018-09-11 14:28:44 +02:00
Emmanuel Gil Peyrot
5ea6e6cda2 Wayland: Add support for animated standard cursors 2018-09-09 13:12:20 +02:00
Emmanuel Gil Peyrot
dede6d6886 Wayland: Add a timerfd for animated cursors 2018-09-09 13:12:20 +02:00
Emmanuel Gil Peyrot
685f2a5f91 Wayland: Close forgotten timerfd on terminate. 2018-09-09 13:12:20 +02:00
Camilla Löwy
eeac43c3f7 Win32: Fix symbol definition detection
Related to #1320.
2018-09-05 22:45:06 +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