userspace: Use SOCK_STREAM instead of SOCK_SEQPACKET for WindowServer
This makes more sense if we have longer packages
This commit is contained in:
@@ -16,6 +16,47 @@
|
||||
namespace LibGUI
|
||||
{
|
||||
|
||||
struct ReceivePacket
|
||||
{
|
||||
PacketType type;
|
||||
BAN::Vector<uint8_t> data_with_type;
|
||||
};
|
||||
|
||||
static BAN::ErrorOr<ReceivePacket> recv_packet(int socket)
|
||||
{
|
||||
uint32_t packet_size;
|
||||
|
||||
{
|
||||
const ssize_t nrecv = recv(socket, &packet_size, sizeof(uint32_t), 0);
|
||||
if (nrecv < 0)
|
||||
return BAN::Error::from_errno(errno);
|
||||
if (nrecv == 0)
|
||||
return BAN::Error::from_errno(ECONNRESET);
|
||||
}
|
||||
|
||||
if (packet_size < sizeof(uint32_t))
|
||||
return BAN::Error::from_literal("invalid packet, does not fit packet id");
|
||||
|
||||
BAN::Vector<uint8_t> packet_data;
|
||||
TRY(packet_data.resize(packet_size));
|
||||
|
||||
size_t total_recv = 0;
|
||||
while (total_recv < packet_size)
|
||||
{
|
||||
const ssize_t nrecv = recv(socket, packet_data.data() + total_recv, packet_size - total_recv, 0);
|
||||
if (nrecv < 0)
|
||||
return BAN::Error::from_errno(errno);
|
||||
if (nrecv == 0)
|
||||
return BAN::Error::from_errno(ECONNRESET);
|
||||
total_recv += nrecv;
|
||||
}
|
||||
|
||||
return ReceivePacket {
|
||||
*reinterpret_cast<PacketType*>(packet_data.data()),
|
||||
packet_data
|
||||
};
|
||||
}
|
||||
|
||||
Window::~Window()
|
||||
{
|
||||
munmap(m_framebuffer_smo, m_width * m_height * 4);
|
||||
@@ -24,13 +65,10 @@ namespace LibGUI
|
||||
|
||||
BAN::ErrorOr<BAN::UniqPtr<Window>> Window::create(uint32_t width, uint32_t height, BAN::StringView title)
|
||||
{
|
||||
if (title.size() >= sizeof(WindowCreatePacket::title))
|
||||
return BAN::Error::from_errno(EINVAL);
|
||||
|
||||
BAN::Vector<uint32_t> framebuffer;
|
||||
TRY(framebuffer.resize(width * height, 0xFF000000));
|
||||
|
||||
int server_fd = socket(AF_UNIX, SOCK_SEQPACKET, 0);
|
||||
int server_fd = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
if (server_fd == -1)
|
||||
return BAN::Error::from_errno(errno);
|
||||
BAN::ScopeGuard server_closer([server_fd] { close(server_fd); });
|
||||
@@ -61,31 +99,32 @@ namespace LibGUI
|
||||
nanosleep(&sleep_time, nullptr);
|
||||
}
|
||||
|
||||
WindowCreatePacket packet;
|
||||
packet.width = width;
|
||||
packet.height = height;
|
||||
strncpy(packet.title, title.data(), title.size());
|
||||
packet.title[title.size()] = '\0';
|
||||
if (send(server_fd, &packet, sizeof(packet), 0) != sizeof(packet))
|
||||
return BAN::Error::from_errno(errno);
|
||||
WindowPacket::WindowCreate create_packet;
|
||||
create_packet.width = width;
|
||||
create_packet.height = height;
|
||||
TRY(create_packet.title.append(title));
|
||||
TRY(create_packet.send_serialized(server_fd));
|
||||
|
||||
WindowCreateResponse response;
|
||||
if (recv(server_fd, &response, sizeof(response), 0) != sizeof(response))
|
||||
return BAN::Error::from_errno(errno);
|
||||
const auto [response_type, response_data ] = TRY(recv_packet(server_fd));
|
||||
if (response_type != PacketType::WindowCreateResponse)
|
||||
return BAN::Error::from_literal("Server responded with invalid packet");
|
||||
|
||||
void* framebuffer_addr = smo_map(response.framebuffer_smo_key);
|
||||
const auto create_response = TRY(WindowPacket::WindowCreateResponse::deserialize(response_data.span()));
|
||||
void* framebuffer_addr = smo_map(create_response.smo_key);
|
||||
if (framebuffer_addr == nullptr)
|
||||
return BAN::Error::from_errno(errno);
|
||||
|
||||
server_closer.disable();
|
||||
|
||||
return TRY(BAN::UniqPtr<Window>::create(
|
||||
auto window = TRY(BAN::UniqPtr<Window>::create(
|
||||
server_fd,
|
||||
static_cast<uint32_t*>(framebuffer_addr),
|
||||
BAN::move(framebuffer),
|
||||
width,
|
||||
height
|
||||
));
|
||||
|
||||
server_closer.disable();
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
void Window::fill_rect(int32_t x, int32_t y, uint32_t width, uint32_t height, uint32_t color)
|
||||
@@ -211,14 +250,23 @@ namespace LibGUI
|
||||
for (uint32_t i = 0; i < height; i++)
|
||||
memcpy(&m_framebuffer_smo[(y + i) * m_width + x], &m_framebuffer[(y + i) * m_width + x], width * sizeof(uint32_t));
|
||||
|
||||
WindowInvalidatePacket packet;
|
||||
WindowPacket::WindowInvalidate packet;
|
||||
packet.x = x;
|
||||
packet.y = y;
|
||||
packet.width = width;
|
||||
packet.height = height;
|
||||
return send(m_server_fd, &packet, sizeof(packet), 0) == sizeof(packet);
|
||||
|
||||
if (auto ret = packet.send_serialized(m_server_fd); ret.is_error())
|
||||
{
|
||||
dprintln("Failed to send packet: {}", ret.error().get_message());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#define TRY_OR_BREAK(...) ({ auto&& e = (__VA_ARGS__); if (e.is_error()) break; e.release_value(); })
|
||||
|
||||
void Window::poll_events()
|
||||
{
|
||||
for (;;)
|
||||
@@ -232,35 +280,38 @@ namespace LibGUI
|
||||
if (!FD_ISSET(m_server_fd, &fds))
|
||||
break;
|
||||
|
||||
EventPacket packet;
|
||||
if (recv(m_server_fd, &packet, sizeof(packet), 0) <= 0)
|
||||
auto packet_or_error = recv_packet(m_server_fd);
|
||||
if (packet_or_error.is_error())
|
||||
break;
|
||||
|
||||
switch (packet.type)
|
||||
const auto [packet_type, packet_data] = packet_or_error.release_value();
|
||||
switch (packet_type)
|
||||
{
|
||||
case EventPacket::Type::DestroyWindow:
|
||||
case PacketType::DestroyWindowEvent:
|
||||
exit(1);
|
||||
case EventPacket::Type::CloseWindow:
|
||||
case PacketType::CloseWindowEvent:
|
||||
if (m_close_window_event_callback)
|
||||
m_close_window_event_callback();
|
||||
else
|
||||
exit(0);
|
||||
break;
|
||||
case EventPacket::Type::KeyEvent:
|
||||
case PacketType::KeyEvent:
|
||||
if (m_key_event_callback)
|
||||
m_key_event_callback(packet.key_event);
|
||||
m_key_event_callback(TRY_OR_BREAK(EventPacket::KeyEvent::deserialize(packet_data.span())).event);
|
||||
break;
|
||||
case EventPacket::Type::MouseButtonEvent:
|
||||
case PacketType::MouseButtonEvent:
|
||||
if (m_mouse_button_event_callback)
|
||||
m_mouse_button_event_callback(packet.mouse_button_event);
|
||||
m_mouse_button_event_callback(TRY_OR_BREAK(EventPacket::MouseButtonEvent::deserialize(packet_data.span())).event);
|
||||
break;
|
||||
case EventPacket::Type::MouseMoveEvent:
|
||||
case PacketType::MouseMoveEvent:
|
||||
if (m_mouse_move_event_callback)
|
||||
m_mouse_move_event_callback(packet.mouse_move_event);
|
||||
m_mouse_move_event_callback(TRY_OR_BREAK(EventPacket::MouseMoveEvent::deserialize(packet_data.span())).event);
|
||||
break;
|
||||
case EventPacket::Type::MouseScrollEvent:
|
||||
case PacketType::MouseScrollEvent:
|
||||
if (m_mouse_scroll_event_callback)
|
||||
m_mouse_scroll_event_callback(packet.mouse_scroll_event);
|
||||
m_mouse_scroll_event_callback(TRY_OR_BREAK(EventPacket::MouseScrollEvent::deserialize(packet_data.span())).event);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
241
userspace/libraries/LibGUI/include/LibGUI/Packet.h
Normal file
241
userspace/libraries/LibGUI/include/LibGUI/Packet.h
Normal file
@@ -0,0 +1,241 @@
|
||||
#pragma once
|
||||
|
||||
#include <BAN/String.h>
|
||||
#include <BAN/StringView.h>
|
||||
#include <BAN/ByteSpan.h>
|
||||
|
||||
#include <LibInput/KeyEvent.h>
|
||||
#include <LibInput/MouseEvent.h>
|
||||
|
||||
#include <sys/banan-os.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#define FOR_EACH_0(macro)
|
||||
#define FOR_EACH_2(macro, type, name) macro(type, name)
|
||||
#define FOR_EACH_4(macro, type, name, ...) macro(type, name) FOR_EACH_2(macro, __VA_ARGS__)
|
||||
#define FOR_EACH_6(macro, type, name, ...) macro(type, name) FOR_EACH_4(macro, __VA_ARGS__)
|
||||
#define FOR_EACH_8(macro, type, name, ...) macro(type, name) FOR_EACH_6(macro, __VA_ARGS__)
|
||||
|
||||
#define CONCATENATE_2(arg1, arg2) arg1 ## arg2
|
||||
#define CONCATENATE_1(arg1, arg2) CONCATENATE_2(arg1, arg2)
|
||||
#define CONCATENATE(arg1, arg2) CONCATENATE_1(arg1, arg2)
|
||||
|
||||
#define FOR_EACH_NARG(...) FOR_EACH_NARG_(__VA_ARGS__ __VA_OPT__(,) FOR_EACH_RSEQ_N())
|
||||
#define FOR_EACH_NARG_(...) FOR_EACH_ARG_N(__VA_ARGS__)
|
||||
#define FOR_EACH_ARG_N(_1, _2, _3, _4, _5, _6, _7, _8, N, ...) N
|
||||
#define FOR_EACH_RSEQ_N() 8, 7, 6, 5, 4, 3, 2, 1, 0
|
||||
|
||||
#define FOR_EACH_(N, what, ...) CONCATENATE(FOR_EACH_, N)(what __VA_OPT__(,) __VA_ARGS__)
|
||||
#define FOR_EACH(what, ...) FOR_EACH_(FOR_EACH_NARG(__VA_ARGS__), what __VA_OPT__(,) __VA_ARGS__)
|
||||
|
||||
#define FIELD_DECL(type, name) type name;
|
||||
#define ADD_SERIALIZED_SIZE(type, name) serialized_size += Serialize::serialized_size_impl<type>(this->name);
|
||||
#define SEND_SERIALIZED(type, name) TRY(Serialize::send_serialized_impl<type>(socket, this->name));
|
||||
#define DESERIALIZE(type, name) value.name = TRY(Serialize::deserialize_impl<type>(buffer));
|
||||
|
||||
#define DEFINE_PACKET_EXTRA(name, extra, ...) \
|
||||
struct name \
|
||||
{ \
|
||||
static constexpr PacketType type = PacketType::name; \
|
||||
static constexpr uint32_t type_u32 = static_cast<uint32_t>(type); \
|
||||
\
|
||||
extra; \
|
||||
\
|
||||
FOR_EACH(FIELD_DECL, __VA_ARGS__) \
|
||||
\
|
||||
size_t serialized_size() \
|
||||
{ \
|
||||
size_t serialized_size = Serialize::serialized_size_impl<uint32_t>(type_u32); \
|
||||
FOR_EACH(ADD_SERIALIZED_SIZE, __VA_ARGS__) \
|
||||
return serialized_size; \
|
||||
} \
|
||||
\
|
||||
BAN::ErrorOr<void> send_serialized(int socket) \
|
||||
{ \
|
||||
const uint32_t serialized_size = this->serialized_size(); \
|
||||
TRY(Serialize::send_serialized_impl<uint32_t>(socket, serialized_size)); \
|
||||
TRY(Serialize::send_serialized_impl<uint32_t>(socket, type_u32)); \
|
||||
FOR_EACH(SEND_SERIALIZED, __VA_ARGS__) \
|
||||
return {}; \
|
||||
} \
|
||||
\
|
||||
static BAN::ErrorOr<name> deserialize(BAN::ConstByteSpan buffer) \
|
||||
{ \
|
||||
const uint32_t type_u32 = TRY(Serialize::deserialize_impl<uint32_t>(buffer)); \
|
||||
if (type_u32 != name::type_u32) \
|
||||
return BAN::Error::from_errno(EINVAL); \
|
||||
name value; \
|
||||
FOR_EACH(DESERIALIZE, __VA_ARGS__) \
|
||||
return value; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define DEFINE_PACKET(name, ...) DEFINE_PACKET_EXTRA(name, , __VA_ARGS__)
|
||||
|
||||
namespace LibGUI
|
||||
{
|
||||
|
||||
static constexpr BAN::StringView s_window_server_socket = "/tmp/window-server.socket"_sv;
|
||||
|
||||
namespace Serialize
|
||||
{
|
||||
|
||||
inline BAN::ErrorOr<void> send_raw_data(int socket, BAN::ConstByteSpan data)
|
||||
{
|
||||
size_t send_done = 0;
|
||||
while (send_done < data.size())
|
||||
{
|
||||
const ssize_t nsend = ::send(socket, data.data() + send_done, data.size() - send_done, 0);
|
||||
if (nsend < 0)
|
||||
return BAN::Error::from_errno(errno);
|
||||
if (nsend == 0)
|
||||
return BAN::Error::from_errno(ECONNRESET);
|
||||
send_done += nsend;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
template<typename T> requires BAN::is_pod_v<T>
|
||||
inline size_t serialized_size_impl(const T&)
|
||||
{
|
||||
return sizeof(T);
|
||||
}
|
||||
|
||||
template<typename T> requires BAN::is_pod_v<T>
|
||||
inline BAN::ErrorOr<void> send_serialized_impl(int socket, const T& value)
|
||||
{
|
||||
TRY(send_raw_data(socket, BAN::ConstByteSpan::from(value)));
|
||||
return {};
|
||||
}
|
||||
|
||||
template<typename T> requires BAN::is_pod_v<T>
|
||||
inline BAN::ErrorOr<T> deserialize_impl(BAN::ConstByteSpan& buffer)
|
||||
{
|
||||
if (buffer.size() < sizeof(T))
|
||||
return BAN::Error::from_errno(ENOBUFS);
|
||||
const T value = buffer.as<const T>();
|
||||
buffer = buffer.slice(sizeof(T));
|
||||
return value;
|
||||
}
|
||||
|
||||
template<typename T> requires BAN::is_same_v<T, BAN::String>
|
||||
inline size_t serialized_size_impl(const T& value)
|
||||
{
|
||||
return sizeof(uint32_t) + value.size();
|
||||
}
|
||||
|
||||
template<typename T> requires BAN::is_same_v<T, BAN::String>
|
||||
inline BAN::ErrorOr<void> send_serialized_impl(int socket, const T& value)
|
||||
{
|
||||
const uint32_t value_size = value.size();
|
||||
TRY(send_raw_data(socket, BAN::ConstByteSpan::from(value_size)));
|
||||
auto* u8_data = reinterpret_cast<const uint8_t*>(value.data());
|
||||
TRY(send_raw_data(socket, BAN::ConstByteSpan(u8_data, value.size())));
|
||||
return {};
|
||||
}
|
||||
|
||||
template<typename T> requires BAN::is_same_v<T, BAN::String>
|
||||
inline BAN::ErrorOr<T> deserialize_impl(BAN::ConstByteSpan& buffer)
|
||||
{
|
||||
if (buffer.size() < sizeof(uint32_t))
|
||||
return BAN::Error::from_errno(ENOBUFS);
|
||||
const uint32_t string_len = buffer.as<const uint32_t>();
|
||||
buffer = buffer.slice(sizeof(uint32_t));
|
||||
|
||||
if (buffer.size() < string_len)
|
||||
return BAN::Error::from_errno(ENOBUFS);
|
||||
|
||||
BAN::String string;
|
||||
TRY(string.resize(string_len));
|
||||
memcpy(string.data(), buffer.data(), string_len);
|
||||
buffer = buffer.slice(string_len);
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
enum class PacketType : uint32_t
|
||||
{
|
||||
WindowCreate,
|
||||
WindowCreateResponse,
|
||||
WindowInvalidate,
|
||||
|
||||
DestroyWindowEvent,
|
||||
CloseWindowEvent,
|
||||
KeyEvent,
|
||||
MouseButtonEvent,
|
||||
MouseMoveEvent,
|
||||
MouseScrollEvent,
|
||||
};
|
||||
|
||||
namespace WindowPacket
|
||||
{
|
||||
|
||||
DEFINE_PACKET(WindowCreate,
|
||||
uint32_t, width,
|
||||
uint32_t, height,
|
||||
BAN::String, title
|
||||
);
|
||||
|
||||
DEFINE_PACKET(WindowCreateResponse,
|
||||
long, smo_key
|
||||
);
|
||||
|
||||
DEFINE_PACKET(WindowInvalidate,
|
||||
uint32_t, x,
|
||||
uint32_t, y,
|
||||
uint32_t, width,
|
||||
uint32_t, height
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
namespace EventPacket
|
||||
{
|
||||
|
||||
DEFINE_PACKET(
|
||||
DestroyWindowEvent
|
||||
);
|
||||
|
||||
DEFINE_PACKET(
|
||||
CloseWindowEvent
|
||||
);
|
||||
|
||||
DEFINE_PACKET_EXTRA(
|
||||
KeyEvent,
|
||||
using event_t = LibInput::KeyEvent,
|
||||
event_t, event
|
||||
);
|
||||
|
||||
DEFINE_PACKET_EXTRA(
|
||||
MouseButtonEvent,
|
||||
struct event_t {
|
||||
LibInput::MouseButton button;
|
||||
bool pressed;
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
},
|
||||
event_t, event
|
||||
);
|
||||
|
||||
DEFINE_PACKET_EXTRA(
|
||||
MouseMoveEvent,
|
||||
struct event_t {
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
},
|
||||
event_t, event
|
||||
);
|
||||
|
||||
DEFINE_PACKET_EXTRA(
|
||||
MouseScrollEvent,
|
||||
struct event_t {
|
||||
int32_t scroll;
|
||||
},
|
||||
event_t, event
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,100 +4,13 @@
|
||||
#include <BAN/StringView.h>
|
||||
#include <BAN/UniqPtr.h>
|
||||
|
||||
#include <LibInput/KeyEvent.h>
|
||||
#include <LibInput/MouseEvent.h>
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
#include <LibGUI/Packet.h>
|
||||
|
||||
namespace LibFont { class Font; }
|
||||
|
||||
namespace LibGUI
|
||||
{
|
||||
|
||||
static constexpr BAN::StringView s_window_server_socket = "/tmp/window-server.socket"_sv;
|
||||
|
||||
enum WindowPacketType : uint8_t
|
||||
{
|
||||
INVALID,
|
||||
CreateWindow,
|
||||
Invalidate,
|
||||
COUNT
|
||||
};
|
||||
|
||||
struct WindowCreatePacket
|
||||
{
|
||||
WindowPacketType type = WindowPacketType::CreateWindow;
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
char title[52];
|
||||
};
|
||||
|
||||
struct WindowInvalidatePacket
|
||||
{
|
||||
WindowPacketType type = WindowPacketType::Invalidate;
|
||||
uint32_t x;
|
||||
uint32_t y;
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
};
|
||||
|
||||
struct WindowCreateResponse
|
||||
{
|
||||
long framebuffer_smo_key;
|
||||
};
|
||||
|
||||
struct WindowPacket
|
||||
{
|
||||
WindowPacket()
|
||||
: type(WindowPacketType::INVALID)
|
||||
{ }
|
||||
|
||||
union
|
||||
{
|
||||
WindowPacketType type;
|
||||
WindowCreatePacket create;
|
||||
WindowInvalidatePacket invalidate;
|
||||
};
|
||||
};
|
||||
|
||||
struct EventPacket
|
||||
{
|
||||
enum class Type : uint8_t
|
||||
{
|
||||
DestroyWindow,
|
||||
CloseWindow,
|
||||
KeyEvent,
|
||||
MouseButtonEvent,
|
||||
MouseMoveEvent,
|
||||
MouseScrollEvent,
|
||||
};
|
||||
using KeyEvent = LibInput::KeyEvent;
|
||||
using MouseButton = LibInput::MouseButton;
|
||||
struct MouseButtonEvent
|
||||
{
|
||||
MouseButton button;
|
||||
bool pressed;
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
};
|
||||
struct MouseMoveEvent
|
||||
{
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
};
|
||||
using MouseScrollEvent = LibInput::MouseScrollEvent;
|
||||
|
||||
Type type;
|
||||
union
|
||||
{
|
||||
KeyEvent key_event;
|
||||
MouseButtonEvent mouse_button_event;
|
||||
MouseMoveEvent mouse_move_event;
|
||||
MouseScrollEvent mouse_scroll_event;
|
||||
};
|
||||
};
|
||||
|
||||
class Window
|
||||
{
|
||||
public:
|
||||
@@ -140,11 +53,11 @@ namespace LibGUI
|
||||
uint32_t height() const { return m_height; }
|
||||
|
||||
void poll_events();
|
||||
void set_close_window_event_callback(BAN::Function<void()> callback) { m_close_window_event_callback = callback; }
|
||||
void set_key_event_callback(BAN::Function<void(EventPacket::KeyEvent)> callback) { m_key_event_callback = callback; }
|
||||
void set_mouse_button_event_callback(BAN::Function<void(EventPacket::MouseButtonEvent)> callback) { m_mouse_button_event_callback = callback; }
|
||||
void set_mouse_move_event_callback(BAN::Function<void(EventPacket::MouseMoveEvent)> callback) { m_mouse_move_event_callback = callback; }
|
||||
void set_mouse_scroll_event_callback(BAN::Function<void(EventPacket::MouseScrollEvent)> callback) { m_mouse_scroll_event_callback = callback; }
|
||||
void set_close_window_event_callback(BAN::Function<void()> callback) { m_close_window_event_callback = callback; }
|
||||
void set_key_event_callback(BAN::Function<void(EventPacket::KeyEvent::event_t)> callback) { m_key_event_callback = callback; }
|
||||
void set_mouse_button_event_callback(BAN::Function<void(EventPacket::MouseButtonEvent::event_t)> callback) { m_mouse_button_event_callback = callback; }
|
||||
void set_mouse_move_event_callback(BAN::Function<void(EventPacket::MouseMoveEvent::event_t)> callback) { m_mouse_move_event_callback = callback; }
|
||||
void set_mouse_scroll_event_callback(BAN::Function<void(EventPacket::MouseScrollEvent::event_t)> callback) { m_mouse_scroll_event_callback = callback; }
|
||||
|
||||
int server_fd() const { return m_server_fd; }
|
||||
|
||||
@@ -167,11 +80,11 @@ namespace LibGUI
|
||||
uint32_t m_width;
|
||||
uint32_t m_height;
|
||||
|
||||
BAN::Function<void()> m_close_window_event_callback;
|
||||
BAN::Function<void(EventPacket::KeyEvent)> m_key_event_callback;
|
||||
BAN::Function<void(EventPacket::MouseButtonEvent)> m_mouse_button_event_callback;
|
||||
BAN::Function<void(EventPacket::MouseMoveEvent)> m_mouse_move_event_callback;
|
||||
BAN::Function<void(EventPacket::MouseScrollEvent)> m_mouse_scroll_event_callback;
|
||||
BAN::Function<void()> m_close_window_event_callback;
|
||||
BAN::Function<void(EventPacket::KeyEvent::event_t)> m_key_event_callback;
|
||||
BAN::Function<void(EventPacket::MouseButtonEvent::event_t)> m_mouse_button_event_callback;
|
||||
BAN::Function<void(EventPacket::MouseMoveEvent::event_t)> m_mouse_move_event_callback;
|
||||
BAN::Function<void(EventPacket::MouseScrollEvent::event_t)> m_mouse_scroll_event_callback;
|
||||
|
||||
friend class BAN::UniqPtr<Window>;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user