Commit Graph

202 Commits

Author SHA1 Message Date
Emmanuel Gil Peyrot
4e31dc5e6e Make it possible to toggle window decorations 2018-02-25 16:54:44 +01:00
Emmanuel Gil Peyrot
1f8ec20b55 Correctly destroy subsurfaces on window destroy 2018-02-25 16:54:44 +01:00
Emmanuel Gil Peyrot
4a42364a19 Return correct values for frame size 2018-02-25 16:54:44 +01:00
Emmanuel Gil Peyrot
9f7ec6b094 Implement window decorations 2018-02-25 16:54:44 +01:00
Emmanuel Gil Peyrot
9a7656364e Split shm buffer creation out of _glfwPlatformCreateCursor 2018-02-25 16:54:44 +01:00
Emmanuel Gil Peyrot
2de3605b4c Make createAnonymousFile static 2018-02-25 16:54:44 +01:00
Emmanuel Gil Peyrot
f67b610dd4 Wayland: Handle repeats which missed a timer 2018-02-24 21:06:25 +01:00
Emmanuel Gil Peyrot
90f5edc0b8 Wayland: Use a timerfd for key repeat 2018-02-24 21:06:25 +01:00
Emmanuel Gil Peyrot
f5d3954568 Stop checking for resizing
Fixes #1197
2018-02-06 12:57:17 +01:00
Emmanuel Gil Peyrot
eb7c9994bf Prevent auto-iconify from firing on window creation 2018-01-29 03:59:47 +01:00
Emmanuel Gil Peyrot
f2617a671f Add a roundtrip after creating the xdg-surface
The specification says we must not attach a buffer until we’ve received
a configure event.
2018-01-29 03:59:47 +01:00
Emmanuel Gil Peyrot
4778d02c67 Ignore _glfwPlatformShowWindow when already visible 2018-01-29 03:59:47 +01:00
Emmanuel Gil Peyrot
f710db6504 Ignore configure events of 0×0px 2018-01-29 03:59:47 +01:00
Emmanuel Gil Peyrot
0e759c9422 Don’t set min/max size on GLFW_DONT_CARE 2018-01-29 03:59:47 +01:00
Emmanuel Gil Peyrot
ae44a28125 Wayland: Add an alternate surface role using xdg-shell
This protocol matches desktops much better than the deprecated
wl_shell, fixing a bunch of race conditions, removing undefined
behaviour, adding missing features, and generally providing a much more
user-friendly experience.

Since most compositors don’t support it yet, the wl_shell_surface role
is kept as fallback for now.
2018-01-29 03:59:47 +01:00
Emmanuel Gil Peyrot
a199efae44 Wayland: Emit an error when wl_shell is absent or unusable 2018-01-29 03:59:47 +01:00
Emmanuel Gil Peyrot
407a3e2860 Load libwayland-cursor at runtime 2018-01-29 02:34:10 +01:00
Emmanuel Gil Peyrot
5fbf4ddde8 Load libwayland-egl at runtime 2018-01-29 02:34:10 +01:00
Camilla Löwy
973bf29622 Remove use of non-standard function strdup
Related to #873.
2018-01-17 11:56:35 +01:00
Emmanuel Gil Peyrot
6c421f131d Wayland: Implement scale callback
Closes #1181.
2018-01-09 22:39:35 +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
Emmanuel Gil Peyrot
65166858ff Wayland: Add support for the idle-inhibit protocol
Closes #955.
2017-11-20 22:27:37 +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
Camilla Löwy
31cbb20ba2 Deprecate window parameter of clipboard functions 2017-11-10 02:52:16 +01:00
Camilla Löwy
bf09dba95b Cleanup 2017-10-26 18:05:56 +02:00
Camilla Löwy
16bf872117 Add content scale queries
This adds glfwGetWindowContentScale and glfwGetMonitorContentScale for
querying the recommended drawing scale factor for DPI-aware rendering.

Parts of this patch are based on code by @ferreiradaselva.

Fixes #235.
Fixes #439.
Fixes #677.
Fixes #845.
Fixes #898.
2017-10-26 17:26:36 +02:00
Emmanuel Gil Peyrot
95e282d5a0 Wayland: Add transparency support
Closes #788.
2017-10-01 01:39:27 +01:00
Camilla Löwy
32e78aeb2e Add GLFW_TRANSPARENT attribute and documentation
This completes support for window framebuffer transparency on Windows,
macOS and X11.  Note that the hint/attribute may be renamed before
release to clarify its relationship to GLFW_OPACITY.

Fixes #197.
Closes #1079.
Related to #663.
Related to #715.
Related to #723.
Related to #1078.
2017-09-27 21:54:04 +02:00
Camilla Löwy
e3be6b8ae0 Cleanup
Break up some overly long lines.
2017-09-17 15:14:22 +02:00
Camilla Löwy
82284b86eb Cleanup
Thanks to glfwGetKeyScancode we can now pass only a scancode to the
platform layer for glfwGetKeyName.
2017-07-13 01:26:06 +02:00
Camilla Löwy
baa9cd8968 Cleanup
Closes #988.
2017-05-11 20:10:04 +02:00
Felipe Ferreira da Silva
412eb6a611 Add glfwRequestWindowAttention
Related to #988.
2017-05-11 13:36:39 +02:00
Emmanuel Gil Peyrot
0e0862cfc7 Wayland: Fix broken build
Regression caused by e9560ef021.
2017-03-03 17:51:40 +00:00
Emmanuel Gil Peyrot
f4c5e6568e Wayland: Commit shell surface creation
This fixes any program using hidden windows, like tests/windows.c.
2017-01-26 18:13:15 +00:00
Camilla Löwy
9e56099edd Add glfwSetWindowAttrib
This function allows updating the GLFW_DECORATED, GLFW_RESIZABLE,
GLFW_FLOATING and GLFW_AUTO_ICONIFY attributes for existing windows.

Fixes #537.
2016-12-06 15:59:18 +01:00
Emmanuel Gil Peyrot
a49601ba87 Wayland: Rename snake_case identifiers to camelCase for consistency 2016-10-12 14:13:52 +01:00
Camilla Berglund
e6a32db7b9 Cleanup 2016-09-07 16:49:29 +02:00
Camilla Berglund
bb3cb8f233 Cleanup
Clean up code and documentation for glfwGetKeyScancode and add
implementation for Wayland and Mir.

Related to #830.
2016-09-07 16:46:48 +02:00
Michael Stocker
e745b0dd47 Add glfwGetKeyScancode
Allows retrieval of platform scancode from GLFW_KEY_*.  Implemented for
Win32, Cocoa and X11.  Stubs for Mir and Wayland.

Closes #830.
2016-09-07 16:38:22 +02:00
Camilla Berglund
5ff7d9505f Simplify Vulkan extension checks
Related to #478.
2016-09-07 16:31:18 +02:00
Camilla Berglund
53fafad915 Start 3.3 2016-08-18 23:55:49 +02:00
Camilla Berglund
fcdef1d0a0 Fix potential context resource leaks
There is a gap between the creation of the context and the call to
_glfwRefreshContextAttribs.
2016-08-05 11:23:05 +02:00
Camilla Berglund
d5e00e6b0f Initialize context creation APIs on demand 2016-07-20 13:10:51 +02:00
Camilla Berglund
bda031f4ac Cleanup 2016-05-29 15:34:08 +02:00
Camilla Berglund
797ee8d8e3 Move all cursor positioning to platform code
Due to Wayland, shared code cannot rely on cursor positioning being
supported by the underlying platform.

This implicitly fixes #617 as it moves cursor centering into
_glfwPlatformSetCursorMode, thus separating it from the stale value of
_glfw.cursorWindow.

Fixes #617.
2016-05-29 15:33:49 +02:00
linkmauve
a502152075 wayland: Always make the window surface opaque 2016-05-05 14:15:44 +02:00
Camilla Berglund
ef80beab81 Add run-time context creation API selection
Fixes #145.
2016-05-04 17:00:07 +02:00
Emmanuel Gil Peyrot
1e82832737 wayland: Report unsupported operations as errors 2016-05-02 21:49:57 +02:00
Emmanuel Gil Peyrot
c301a1e51a wayland: Implement remaining attribute getters 2016-05-02 21:49:31 +02:00
Emmanuel Gil Peyrot
e673bdc617 wayland: Implement maximized state 2016-05-02 21:49:27 +02:00
Emmanuel Gil Peyrot
71cedc6cfe wayland: Implement glfwSetWindowMonitor 2016-05-02 21:49:23 +02:00
Emmanuel Gil Peyrot
5034c6c65e wayland: Handle hidden window as no shell surface 2016-05-02 21:47:21 +02:00
Emmanuel Gil Peyrot
f0f5d9f644 wayland: Implement size limits and aspect ratio 2016-05-02 21:47:00 +02:00
Camilla Berglund
7ab7d8b4b1 Make use of uint32_t where appropriate
This change does not affect the ABI.
2016-03-28 12:34:57 +02:00
Camilla Berglund
6570d0c4b7 Add glfwSetWindowMonitor
This adds the ability to switch between windowed and full screen modes,
move a full screen window between monitors and update its desired
resolution and refresh rate.

Fixes #43.
2016-03-18 11:13:24 +01:00
Camilla Berglund
ea888114fa Remove monitor from _GLFWwndconfig 2016-03-16 16:16:02 +01:00
Camilla Berglund
b823f7151e Add glfwSetWindowIcon
Adds support for setting window icons programmatically on platforms
where this makes sense.

Fixes #453.
Closes #467.
2016-03-10 17:26:26 +01:00
Camilla Berglund
5620895e88 Add glfwWaitEventsTimeout
This function will put the calling thread to sleep until an event
arrives or until the specified timeout has elapsed.
2016-03-06 17:28:40 +01:00
Camilla Berglund
baf574494d Add glfwFocusWindow
This removes the (undocumented) behavior where glfwShowWindow would
bring the window to front and set input focus.  That function now
does what it says.
2016-02-25 21:37:40 +01:00
Camilla Berglund
93b4c828c1 Fix VC++ build failure
Regression caused by 71c72db1e3.
2016-02-23 11:49:42 +01:00
Jonas Ådahl
71c72db1e3 wayland: Pre-multiply custom cursor image alpha
Since the Wayland SHM buffer format is implicitly premultiplied and the
GLFWimage pixels are defined to be non-premultiplied, we need to
convert the non-premultiplied pixels to premultiplied when filling the
buffer.

Related to #707.
2016-02-22 12:45:05 +01:00
Jonas Ådahl
cb08dc574c wayland: Implement 'DISABLED' cursor mode
This implements support for the 'DISABLED' cursor mode, which
effectively means locking the pointer to the surface. The cursor is also
explicitly hidden.

This adds two new build dependencies: wayland-scanner and
wayland-protocols.

Closes #708.
2016-02-22 12:36:34 +01:00
Camilla Berglund
7669ade19c Make instance extension count unsigned
Fixes #714.
2016-02-22 10:44:43 +01:00
Camilla Berglund
a10caa4631 Add glfwMaximizeWindow and GLFW_MAXIMIZED
Fixes #266.
2016-02-21 15:32:26 +01:00
Camilla Berglund
c56af32bb7 Fix use of undeclared constant 2016-02-18 14:22:11 +01:00
Camilla Berglund
9b75bffc88 Add basic Vulkan support
Added GLFW_INCLUDE_VULKAN.  Added glfwVulkanSupported,
glfwGetRequiredInstanceExtensions, glfwGetInstanceProcAddress,
glfwGetPhysicalDevicePresentationSupport and glfwCreateWindowSurface.
Added port of LunarG SDK tri example.
2016-02-16 14:58:58 +01:00
Jonas Ådahl
cf6c11cfaa wayland: Only set surface buffer scale when supported
Although very unlikely, the wl_compositor version might not support
wl_surface.set_buffer_scale while the wl_output emits a wl_output.scale
that is larger than 1. So for correctness, bail on changing the buffer
scale if we won't be able to set it later.
2015-12-27 10:46:23 +08:00
Emmanuel Gil Peyrot
06479ba535 Wayland: Implement HiDPI support
Windows now keep track of the monitors they are on, so we can calculate
the best scaling factor for them, by using the maximum of each of the
monitors.

The compositor scales down the buffer automatically when it is on a
lower density monitor, instead of the previous way where it was scaling
up the buffer on higher density monitors, which makes the application
look much better on those ones.
2015-12-27 10:35:46 +08:00
Camilla Berglund
12b6c56903 Add suffixes to platform specific helper functions
Also merge win32_tls.h into win32_platform.h.
2015-12-13 14:50:59 +01:00
Emmanuel Gil Peyrot
9ac9c61433 Wayland: Make sure the cursor buffer is valid
Fixes #645.
2015-11-17 00:13:44 +01:00
Camilla Berglund
9c315412e1 Add glfwGetKeyName
Fixes #464.
2015-11-09 14:46:09 +01:00
Emmanuel Gil Peyrot
4c06426d46 Wayland: Create the surface before the context
This fixes a regression introduced in 496f559c where a context would be
created for a NULL egl_surface, which subsequently fails.

Fixes #633.
2015-11-03 00:18:43 +01:00
Camilla Berglund
496f559c9a Add GLFW_NO_API for creating context-less windows 2015-10-26 00:30:30 +01:00
Camilla Berglund
efdbfd3883 Cleanup 2015-10-24 23:40:02 +02:00
Ricardo Vieira
e8f3de0f2e Implement glfwCreateStandardCursor for Wayland
Closes #620.
2015-10-24 23:31:11 +02:00
Camilla Berglund
d84772d620 Add size limits and aspect ratio functions
Fixes #555.
2015-10-18 17:18:29 +02:00
Camilla Berglund
a407a673dd Add native Wayland and Mir functions
Fixes #419.
2015-10-15 01:48:44 +02:00
Camilla Berglund
0eccf75f65 Replace GL booleans with public macros 2015-10-13 00:46:02 +02:00
Camilla Berglund
13fbb4748a Clean up cursor mode setting 2015-10-12 22:01:50 +02:00
Camilla Berglund
95a07f3340 Start 3.2 2015-10-12 21:59:49 +02:00
Camilla Berglund
1343ef5915 Replace stray malloc with calloc 2015-08-10 11:13:39 +02:00
Emmanuel Gil Peyrot
656666e722 wayland: Fix typo introduced in e253beaa.
Closes #502.
2015-04-20 22:34:30 +02:00
Emmanuel Gil Peyrot
e253beaa2b wayland: Implement glfwGetCursorPos
Closes #499.
2015-04-19 13:27:43 +02:00
Emmanuel Gil Peyrot
4974585d04 wayland: Handle disconnect properly
Merge code for PollEvents and WaitEvents, and handle disconnect properly.
2015-03-26 15:12:49 +08:00
Camilla Berglund
0fcbaeb596 Fixed broken Mir and Wayland builds.
Fixes #411.
2015-01-06 01:44:31 +01:00
Camilla Berglund
439417a22c Comment and string spell check pass. 2015-01-05 22:21:31 +01:00
Camilla Berglund
641761ddb0 Changed state attribs to direct access.
Changed the window states (focused, iconified and visible) to query the
system directly.

THIS IS A BREAKING CHANGE, although a fairly obscure one.  It affects
applications that both care about telling actual key events from
synthetic ones, and are implemented in a non-self-synchronizing way, and
that poll the GLFW_FOCUSED window attribute instead of using the window
focus callback.

If you maintain one of these, please feel free to drop me an email and
I'll help any way I can to transition your application to 3.1.

Fixes #189.
Fixes #204.
2015-01-04 16:53:32 +01:00
Camilla Berglund
2a1375e97c Added glfwCreateStandardCursor.
This function allows the creation of cursor objects using one of several
standard cursor shapes from the current system cursor theme.
2014-12-15 21:58:44 +01:00
Jonas Ådahl
4dd669661b wayland: Coding style cleanup
Fixes * positioning, indentation and newline inconsistencies.
2014-09-28 21:54:09 +02:00
Jonas Ådahl
cd51d285e6 wayland: Clean up anonymous file creation
It was a copy paste without fully updating the coding style. There were
also some autotools macros that were no longer valid. So far its assumed
that the needed functions exist. If better portability is needed, there
needs to be some detction added to the cmake build script.
2014-09-28 21:47:18 +02:00
Jonas Ådahl
6e8e94837d wayland: Don't check *alloc result 2014-09-28 21:46:16 +02:00
Camilla Berglund
e9c7314d50 Added GLFW_FOCUSED window hint.
Fixes #101.
2014-09-10 11:50:50 +02:00
Camilla Berglund
41d998eb3c Removed duplicate inclusion of client header. 2014-09-09 16:43:24 +02:00
Ricardo Vieira
25204b1ec7 wayland: Support for setting a cursor image
Closes #346.
2014-09-09 16:38:47 +02:00
Camilla Berglund
8d170c7f47 Merged clipboard code into input. 2014-09-09 16:36:41 +02:00
Camilla Berglund
b1fd3c00d0 Removed duplicate window position clearing. 2014-08-26 14:46:02 +02:00
Ricardo Vieira
a7c9ca3b43 wayland: Release input focus when window is destroyed
This fixes a seg. fault on the reopen test because events might occur
after the window is destroyed (for example leave events).
2014-07-26 21:55:43 +01:00
Ricardo Vieira
acf6bfb1f6 wayland: Destroy window context before clearing the egl surface 2014-07-10 22:10:15 +01:00
Ricardo Vieira
2c5c6a1ff5 wayland: Add support for resizing windows 2014-07-10 22:07:30 +01:00
Jonas Ådahl
a75cf5a163 wayland: Add basic input support 2014-06-29 23:18:40 +02:00
Camilla Berglund
5ea485e197 Added missing function stub. 2014-05-04 11:51:40 +02:00
Camilla Berglund
1127c0e6e5 Renamed Wayland files to match prefix. 2014-04-08 17:47:38 +02:00