UI rewrite 3rd attempt
This commit is contained in:
parent
c9fd1b1585
commit
1f5697326c
48 changed files with 2155 additions and 6190 deletions
|
|
@ -106,9 +106,19 @@ export namespace Crafter {
|
|||
void Resize(std::uint32_t width, std::uint32_t height);
|
||||
void Render();
|
||||
void Update();
|
||||
void UpdateCursorImage();
|
||||
void SetCusorImage(std::uint16_t sizeX, std::uint16_t sizeY);
|
||||
void SetCusorImageDefault();
|
||||
// Replace the system cursor with a custom image. `pixels` is
|
||||
// `width*height*4` bytes in R8G8B8A8 memory order (matching
|
||||
// stb_image's STBI_rgb_alpha output) with straight (non-premultiplied)
|
||||
// alpha — the conversion to the compositor's expected format is
|
||||
// handled internally. The hotspot is in image-pixel coordinates.
|
||||
// Re-callable at any time.
|
||||
void SetCursorImage(std::uint16_t width, std::uint16_t height,
|
||||
std::uint16_t hotspotX, std::uint16_t hotspotY,
|
||||
const std::uint8_t* pixels);
|
||||
|
||||
// Restore the default system cursor (releases any previously-uploaded
|
||||
// cursor pixel buffer).
|
||||
void SetDefaultCursor();
|
||||
|
||||
#ifdef CRAFTER_TIMING
|
||||
std::chrono::nanoseconds totalUpdate;
|
||||
|
|
@ -139,6 +149,15 @@ export namespace Crafter {
|
|||
wl_surface* cursorSurface = nullptr;
|
||||
wl_buffer* cursorWlBuffer = nullptr;
|
||||
std::uint32_t cursorBufferOldSize = 0;
|
||||
// mmap'd view of the SHM cursor buffer — the user-supplied pixels
|
||||
// are written here in BGRA8888 order. Lifetime matches cursorWlBuffer.
|
||||
std::uint8_t* cursorMmap_ = nullptr;
|
||||
std::uint16_t cursorHotspotX_ = 0;
|
||||
std::uint16_t cursorHotspotY_ = 0;
|
||||
// Most recent serial from a wl_pointer.enter on this window's surface.
|
||||
// Needed so `SetCursorImage` can re-issue `wl_pointer_set_cursor`
|
||||
// mid-session (the hotspot only updates when set_cursor is recalled).
|
||||
std::uint32_t lastPointerSerial_ = 0;
|
||||
|
||||
static void xdg_surface_handle_preferred_scale(void* data, wp_fractional_scale_v1*, std::uint32_t scale);
|
||||
static void wl_surface_frame_done(void *data, wl_callback *cb, uint32_t time);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue