Commit graph

92 commits

Author SHA1 Message Date
alexei-zebra
714567a06e
fix names 2026-10-10 12:34:52 +03:00
alexei-zebra
b5416d1219
Fix the issues found while reviewing the Wayland frame work
A review of the branch turned up a number of defects, gaps and leftovers;
this commit addresses all of them.

Defects:
- the shadow uniform array held seven entries while eight locations were
  written, so the last one landed outside the object;
- CursorShape::LAST stayed in the middle of the enum after the new corner
  shapes were appended, which made the GLFW cursor table read out of
  bounds; the extra shapes are now mapped onto the ones GLFW knows, and
  the table is only filled for those;
- GlStateGuard asked glIsEnabled for an attribute pname, so it always got
  GL_INVALID_ENUM and never restored the vertex attribute arrays;
- the early returns in wayland_window_initialize left the global window
  and input pointers dangling when falling back to GLFW;
- the icon textures were listed nowhere, so none of them ever loaded;
- a shader failure disabled the shadow after the surface had already been
  sized for it, and VOXEL_DECORATIONS outlived the switch cleanup.

Behavior:
- the keyboard now releases every pressed key when it loses focus, and a
  repeat rate of zero means no repeat;
- the fourth UTF-8 lead byte is decoded with the right mask, control
  characters no longer reach text fields, and a vanished clipboard offer
  clears the cached text;
- compositor side decorations disable ours again instead of leaving two
  titles, the window destructor releases the rest of the state, and the
  content inset is computed before the GUI acts so the HUD and the
  container never disagree for a frame; the HUD clamps it;
- the window controls fall back to minimize, maximize and close, and the
  icons are drawn from textures only.

Cleanups: one monotonic timer instead of three, one vertex shader shared
by both renderers with a link check, one button layout parser, the inset
rule moved into Screen, the scissor stack moved into the base Window
(about 110 duplicated lines), named shadow and evdev constants, trimmed
includes, a README note about the Wayland dependencies, and the long
lines introduced by this branch wrapped.
2026-10-10 12:23:42 +03:00
alexei-zebra
6a5e485bca
drop the environment switches
The backend, decoration and resize-logging switches were only used
while working on this, and undocumented ones should not stay:

- VOXEL_WINDOW_BACKEND: the backend is still chosen by WAYLAND_DISPLAY,
  and GLFW is used when it is not set;
- VOXEL_DECORATIONS: own decorations are always enabled when the
  compositor provides none;
- VOXEL_LOG_RESIZE: the resize statistics are removed together with the
  counters they needed.

WaylandDecorations.cpp replaces WaylandBar.cpp: drawing moved to the
engine, the file only holds the decoration behaviour now.
2026-10-10 12:23:31 +03:00
alexei-zebra
1e689e88b1
add native Wayland window backend
Wayland support was missing a proper windowing layer: the GLFW backend
leaves the known platform gaps (cursor themes, window icon, window
position, fullscreen output selection).

The new backend talks to the compositor directly:
- xdg-shell, EGL, xkbcommon (keyboard, repeat, layout) instead of GLFW;
- cursors through wp_cursor_shape_manager_v1, so no cursor theme lookup
  is required and no "standard cursor shape unavailable" errors appear;
- window icon and title are drawn by the engine itself, since Wayland
  has no window icon protocol and GNOME provides no server-side
  decorations;
- fullscreen requests the current output (set_fullscreen with NULL), so
  the window no longer jumps to another monitor;
- interactive resize presents a cached frame scaled to the new size
  while the pointer is down and refreshes the real frame when the drag
  pauses, keeping the window glued to the cursor.

libdecor is not used: libdecor_frame_commit() redraws the whole
decoration and acks the configure in the same call, and mutter sends
200-330 configures per second during an interactive resize, so the
decoration was redrawn hundreds of times per second (measured: 2 s of
work per second, loop stalls up to 6 s). The decorations are drawn by
the engine instead, which measured 2.3 ms average configure-to-present
latency during a real drag.

GLFW stays the backend for X11 and Windows; VOXEL_WINDOW_BACKEND=x11
forces it on Wayland sessions.
2026-10-10 12:23:18 +03:00
MihailRis
9694a59649 refactor: add Window interface 2025-04-02 14:59:53 +03:00
MihailRis
cd5c6a889c fix and cleanup 2025-04-02 14:55:53 +03:00
MihailRis
b202d1455b refactor: replace references to Events with Input 2025-04-02 14:55:53 +03:00
MihailRis
4c48afbb90 refactor: add GUI instance reference to UI nodes 2025-04-02 14:55:53 +03:00
MihailRis
74a94f869c refactor: reduce Window references 2025-04-02 14:55:53 +03:00
boolean-false
0042d8a60c
add check for OpenGL Debug extension support (#498)
* Fix crash on Osx Arm
* Check OpenGL extension support safely
* Replace on cstring
* Moved to Window.cpp and added extensions cache
2025-04-02 12:34:12 +03:00
MihailRis
2fa71b3bf0 feat: players interpolation & add hud.set_allow_pause(...) 2025-01-17 01:44:46 +03:00
MihailRis
b5a266e1c1 enable GL debug output 2025-01-06 13:08:03 +03:00
MihailRis
cb9690ebc7 add 'cursor' ui property 2024-12-30 21:41:05 +03:00
MihailRis
d745a34657 refactor 2024-12-18 04:13:33 +03:00
MihailRis
3ea213e8d3 fix console position 2024-11-17 15:53:25 +03:00
MihailRis
283ac854a4
Development-related additions (#365) 2024-11-12 07:42:48 +03:00
opchik98
8e549fe806 Feature #152 and potential fix #320
- Added Lua scripts hud.open, inventory.create and inventory.remove
- Window now resizes even if it is not focused
2024-11-07 18:38:24 +02:00
ShadelessFox
3f531bbf98
Use high-resolution timer for a better frame time 2024-11-04 17:22:36 +01:00
MihailRis
85bea6f17d fix: toggle fullscreen GLFW invalid enum error 2024-10-04 20:51:14 +03:00
MihailRis
f43cc93cd2 update project includes format 2024-08-10 01:37:48 +03:00
InfiniteCoder
5d791b3cec Merge remote-tracking branch 'origin/main' 2024-08-05 21:24:27 +03:00
MihailRis
c7ce9a939f update version to 0.23 2024-08-05 20:11:37 +03:00
InfiniteCoder
5c9bc83bbd items/ + objects/ + util/ 2024-08-04 22:26:08 +03:00
InfiniteCoder
eb061bcaf4 graphics/ 2024-08-04 22:12:48 +03:00
InfiniteCoder
e6da3638f0 Logger.hpp 2024-08-04 12:46:03 +03:00
InfiniteCoder
d5dc68dd38 Root includes 2024-08-04 10:24:11 +03:00
Vyacheslav Ivanov
bbf33e8e4d
format: reformat project
Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
2024-08-03 19:53:48 +03:00
MihailRis
ba046a52c0
Revert "fix: optimization: Various PVS-Studio warnings" 2024-08-02 14:51:44 +03:00
Vyacheslav Ivanov
2c1103307f
fix: optimization: PVS-Studio warning V813
Passing large objects by const reference avoids unnecessary copying and enhances efficiency.

Reported by: PVS-Studio
Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
2024-08-02 05:35:55 +03:00
MihailRis
b021339a8a add window icon 2024-07-28 23:47:49 +03:00
MihailRis
c0ba5be458 add framerate control 2024-07-28 22:31:27 +03:00
MihailRis
a856b4f140 add framerate control (WIP) 2024-07-25 22:33:21 +03:00
MihailRis
fc34ca6875 ignore GLEW_ERROR_NO_GLX_DISPLAY (issue #240) 2024-06-12 12:21:18 +03:00
MihailRis
9522aedeec quick check with linters 2024-05-10 12:34:05 +03:00
MihailRis
1627e21c1d the final rename 2024-05-06 03:38:19 +03:00
MihailRis
7f8a86b740 minor refactor 2024-05-05 20:08:25 +03:00
MihailRis
f02edcf15a scripting.h fix + input library 2024-05-05 00:28:30 +03:00
MihailRis
c3b5576c02 toml::Wrapper removed 2024-04-28 17:23:52 +03:00
MihailRis
6650e27737 ObservableSetting 2024-04-26 02:43:10 +03:00
MihailRis
4861fedf1e fullscreen setting checkbox + smth 2024-04-26 00:34:15 +03:00
MihailRis
051f0b8c6a rename 2024-04-23 18:43:02 +03:00
MihailRis
9f2bceb039 just a minor refactor, nothing special 2024-04-23 02:00:03 +03:00
MihailRis
b9ea88b988 settings page completely moved to xml 2024-04-20 15:52:55 +03:00
MihailRis
eb70e1c0df refactor + auto max atlas resolution 2024-04-10 18:18:55 +03:00
MihailRis
0c411cf227 debug::Logger 2024-04-04 18:19:19 +03:00
MihailRis
a4960097f0 minor refactor 2024-03-29 12:24:02 +03:00
MihailRis
b56408a202 src/graphics moved to src/graphics/core 2024-03-18 20:47:35 +03:00
A-lex-Ra
77b36f45f2 remove redundant static_cast by changing Events::pressedKeys template parameter from int to keycode 2024-02-23 20:15:02 +06:00
MihailRis
19b3c34eb2 textbox text selection 2024-02-22 22:05:58 +03:00
MihailRis
6f88502cae glfw version output 2024-02-18 19:25:48 +03:00