Commit graph

276 commits

Author SHA1 Message Date
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
6c2192b5d8
Draw the window title bar by the engine
The native Wayland backend had no window controls: no title, no close
button, no way to move or resize the window, and the fullscreen toggle
could throw the window to another monitor. GNOME does not implement
zxdg_decoration_manager_v1, so there is nobody to draw a frame for us:
the backend now falls back to its own decorations when the compositor
offers no server side ones, and the engine draws the visible part.

The bar itself is drawn by the engine (WindowBar.cpp) through the usual
batch and font, so it uses the same assets as the rest of the UI and the
backend only owns the behaviour: hit zones, cursor shapes, click
interception and the xdg-shell requests. Its geometry follows the
desktop's button layout, read and subscribed through
xdg-desktop-portal over sd-bus (libsystemd is an optional dependency,
gsettings is only a startup fallback).

Controls behave like they do elsewhere:
- pressing anywhere on the bar starts a move once the pointer leaves a
  5 px radius, so dragging works from the buttons as well;
- a button acts on release, only if the pointer stayed on it;
- a double click on the bar toggles maximize;
- the top edge and the top corners resize, the top 8 px of the sides,
  the sides and the bottom are 8 px wide resize strips;
- right and middle clicks and the scroll wheel over the bar never reach
  the game.

The in-game user interface is offset below the bar while menus keep the
whole window, so the translucent bar shows the menu background through
itself and never covers the HUD. The HUD lays its elements out against
the content height and the cursor is translated once, which fixes items
following the mouse one row above the pointer in game.

The window size is now written to the settings when the window is
resized in windowed mode and applied on the first configure, so the
window opens with the size it was left with, and leaving fullscreen or
borderless mode restores it instead of overwriting the settings with the
fullscreen size (an unconditional unmaximize made the compositor restore
the maximized geometry).

Measured: menu layout unchanged (706 bright pixels in the same place),
gui viewport 1123x751 in menus against 1123x721 in game, 1123x751 ->
2560x1080 -> 1123x751 round trip keeps the settings, a saved 1000x640
opens as 1000x640, no errors in the log.
2026-10-10 12:23:41 +03:00
Neveix
3b3bf8e878
Inventory enhancements #897: 2, 5, 9, 11, 12 (#931)
* implement a bit

* change shift to ctrl

* add enhancement #2

* add ctrl-interaction with content access

* fix libinventory.move bug (none checking)

* fix p.5

* move shareinv logic into inventory_utils

* add inventory utils

* small refactor

* fix iframe.src = ""

---------

Co-authored-by: MihailRis <mexaruc@gmail.com>
2026-08-14 21:25:42 +03:00
neveix
953a920e00 add middleclick item dropping/duping 2026-08-14 01:14:54 +05:00
neveix
c2f7f33bbf revert creation of clickOutside 2026-08-14 00:59:55 +05:00
neveix
7c97966377 switch to inventory drop area 2026-08-14 00:43:40 +05:00
MihailRis
089bcbbb64 fix document events & breaking: document events removed from 'events' library temporary 2026-06-03 21:50:36 +03:00
Xertis
e049f4ae0c
Merge branch 'MihailRis:main' into main 2026-03-16 00:54:38 +03:00
MihailRis
dbc7cd56bd feat: solid entity material support & minor refactor 2026-03-05 20:52:45 +03:00
Xertis
9ad21460a2 added hud.is_player_inventory_open 2026-02-28 22:34:52 +03:00
Xertis
cb1b113181 added hud.get_second_inventory 2026-02-28 22:23:47 +03:00
MihailRis
8468ab184d add gui.get_active_frame, set_active_frame & update cursor lock behavior 2026-02-06 14:16:30 +03:00
MihailRis
b8bf249d1b Merge branch 'main' into volume-renderer 2025-12-28 20:05:13 +03:00
clasher113
dba10805f8 fix: inventory interaction on "disablePlayerInventory = true" 2025-12-28 18:01:02 +02:00
clasher113
a1549983f8 Revert "fix: inventory interaction on "disablePlayerInventory = true""
This reverts commit a58ec5a29c.
2025-12-28 17:58:12 +02:00
clasher113
a58ec5a29c fix: inventory interaction on "disablePlayerInventory = true" 2025-12-28 17:08:06 +02:00
MihailRis
163a0a8c93 rename ImageFormat enum items 2025-12-21 19:05:14 +03:00
MihailRis
dfa9656871 add 'slotIndex' ui slot property 2025-12-10 21:58:08 +03:00
MihailRis
7abe552e3c fix UINode enums naming 2025-11-14 12:33:30 +03:00
MihailRis
371aaaa9f5 make exchange slot available as 'hud.exchange-slot' 2025-11-12 12:29:07 +03:00
MihailRis
db05527fcf add hud.is_open(layoutid) --> bool 2025-11-09 23:11:12 +03:00
clasher113
b72138cd15 fix: locked cursor in menu 2025-09-19 17:22:33 +03:00
MihailRis
dc0e388eec Merge branch 'dev' into more-about-projects 2025-08-16 13:57:51 +03:00
MihailRis
53ce219127 add 'is_new' argument to on_world_open 2025-08-15 23:48:04 +03:00
MihailRis
303346f5e5 fix: hud.close after hud.show_overlay bug 2025-08-11 23:58:00 +03:00
MihailRis
2783b0af7b possible hud.open bug fix 2025-08-11 23:53:49 +03:00
MihailRis
15a778299c limit chunks non-unloading zone to a circle 2025-07-13 15:57:57 +03:00
MihailRis
fc46b7c434 initial commit 2025-05-07 20:42:50 +03:00
clasher113
d888ddec4c
fix: pause menu on hudVisible=false (#512)
* fix: pause menu on hudVisible=false
2025-04-12 20:30:55 +03:00
MihailRis
881edb7b28 rename keycode, mousecode enumerations 2025-04-02 17:39:31 +03:00
MihailRis
9843a1fc27 remove Viewport class 2025-04-02 17:35:17 +03:00
MihailRis
7262119f5b refactor GLFWWindow 2025-04-02 15:01:24 +03:00
MihailRis
0b8d56afe1 cleanup 2025-04-02 14:59:53 +03:00
MihailRis
9694a59649 refactor: add Window interface 2025-04-02 14:59:53 +03:00
MihailRis
b3feb5945b reduce extra includes 2025-04-02 14:55:53 +03:00
MihailRis
bccdeec7b8 fix crosshair visibility 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
MihailRis
3d22de761f fix compiler warnings (GCC + Clang) 2025-03-20 22:04:29 +03:00
MihailRis
4c9019e03c small fixes 2025-03-11 00:39:59 +03:00
MihailRis
41a45fc432 rename hud_element_mode to HudElementMode 2025-02-12 00:09:44 +03:00
MihailRis
c1e9976d95 Merge branch 'main' into update-items 2025-02-11 23:52:06 +03:00
MihailRis
6500f9b6f3 fix textbox text offset & fix invisible alerts 2025-02-11 23:46:13 +03:00
MihailRis
4306573320 refactor 2025-02-06 20:26:06 +03:00
MihailRis
eaa64cbdd1 fix pause menu 2025-01-19 20:32:02 +03:00
MihailRis
2fa71b3bf0 feat: players interpolation & add hud.set_allow_pause(...) 2025-01-17 01:44:46 +03:00
MihailRis
a45487b3c7 move 'key:escape' handler to Lua 2025-01-16 23:11:00 +03:00
MihailRis
5130907192 fix hud 2025-01-12 23:09:41 +03:00
MihailRis
90fc559234 add hud.open inventory events support 2025-01-12 17:36:42 +03:00