Commit Graph

412 Commits

Author SHA1 Message Date
Camilla Löwy
aa5e313561 X11: Fix BadMatch focusing a window on non-EWMH WM
When the WM does not support EWMH or there is no WM running, GLFW falls
back to XSetInputFocus, which will emit BadMatch if the window is not
viewable, which will terminate the program.

Bug spotted on IRC.
2020-01-06 22:45:56 +01:00
Camilla Löwy
fe57e3c292 X11: Fix no window position events during resize
A window resize action that also resulting in the window being moved did
not emit any window positions events, as the position of real
ConfigureNotify events was ignored.  The real events use parent
coordinates instead of root coordinates so this adds parent tracking and
conditional translation.

Fixes #1613.
2020-01-01 16:56:32 +01:00
Camilla Löwy
a3d28ef52c X11: Fix IC event mask not being added to our window 2019-12-26 16:31:42 +01:00
Camilla Löwy
8149a5fc00 X11: Cleanup
We can use C99 now and also we will need the event mask below.
2019-12-26 16:31:41 +01:00
Camilla Löwy
73a8ebb691 X11: Cleanup
This is technically valid but misleading and may inspire future bugs
like the one fixed by 0b652a44d2.
2019-12-17 02:17:31 +01:00
Camilla Löwy
4e70c95aa3 X11: Cleanup
The window state action is not an atom.
2019-12-17 01:53:48 +01:00
Camilla Löwy
9db156421f X11: Fix updating GLFW_FLOATING on a hidden window 2019-12-17 01:53:40 +01:00
Camilla Löwy
0b652a44d2 X11: Fix invalid read when clearing GLFW_FLOATING 2019-12-17 01:51:35 +01:00
Camilla Löwy
9b6d68ec70 X11: Fix missing checks for EWMH attention atoms 2019-12-16 16:22:22 +01:00
Camilla Löwy
4837b78ffe X11: Fix maximization of hidden windows
This fixes glfwMaximizeWindow having no effect on hidden windows by
manually appending the maximization states to the EWMH state property.
2019-12-16 16:22:15 +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
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
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
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
Camilla Löwy
1f508530f0 X11: Let the language initialize XEvent structs 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
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
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
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
2a27eb95e4 X11: Fix system cursor used for GLFW_HAND_CURSOR
Fixes #1432.
2019-02-14 00:04:39 +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
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
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
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
meditator
d9466050d9 X11: Fix missing check for NET_WM_STATE
Closes #1356.
2018-11-01 17:26:51 +01: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
338afe3c6d X11: Clean up cursor shape translation 2018-08-30 13:47:54 +02:00
Camilla Löwy
b1b21292b9 X11: Clean up context lookup 2018-08-30 13:47:54 +02:00
Camilla Löwy
8d1a64c831 X11: Make event polling more robust
This makes X11 event polling less likely to block if the application
uses the display via native access.

Fixes #1225.
2018-05-17 14:41:16 +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
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
Camilla Löwy
973bf29622 Remove use of non-standard function strdup
Related to #873.
2018-01-17 11:56: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
Camilla Löwy
6158801aeb Change glfwInitHintString to glfwWindowHintString
Fixes #1139.
2017-12-19 15:08:27 +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
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
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
Wolfgang Draxinger
019609b6cd Add GLFW_TRANSPARENT and X11 implementation
This is a squashed extract of several commits, minimally edited to
ensure it compiles.

Related to #197.
Related to #715.
2017-09-27 21:33:03 +02:00
Camilla Löwy
e3be6b8ae0 Cleanup
Break up some overly long lines.
2017-09-17 15:14:22 +02:00
Camilla Löwy
3d110d2e1b X11: Fix selection error nomenclature
[ci skip]
2017-09-17 13:54:17 +02:00