summaryrefslogtreecommitdiff
path: root/src/window.cc
diff options
context:
space:
mode:
authorFabrice <fabrice@schaub-dev.xyz>2026-02-10 13:39:19 +0100
committerFabrice <fabrice@schaub-dev.xyz>2026-02-10 13:39:19 +0100
commit93876c04b810b26a00b6c09e695e19242045ca62 (patch)
tree20b594e2e86c165e5db5a3b321fd4025fe11a8d3 /src/window.cc
parent949cceeaa87a76d647660d3585ef9338bfaa3781 (diff)
dont need commit
Diffstat (limited to 'src/window.cc')
-rw-r--r--src/window.cc38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/window.cc b/src/window.cc
index 1a59189..190eeb7 100644
--- a/src/window.cc
+++ b/src/window.cc
@@ -1,44 +1,46 @@
#include "window.h"
+
+#include <cstring>
+
#include "events.h"
#include "utils.h"
#include "vec.h"
#include "wlstate.h"
#include "xdg-shell.h"
-#include <cstring>
-static void wayc_surface_configure(void *data, struct xdg_surface *xdg_surface,
+static void wayc_surface_configure(void* data, struct xdg_surface* xdg_surface,
u32 serial) {
- struct window_s *window = (struct window_s *)data;
+ struct window_s* window = (struct window_s*)data;
wayc_notnull(window);
xdg_surface_ack_configure(xdg_surface, serial);
wl_surface_commit(window->surface);
}
-static void wayc_toplevel_configure(void *data,
- struct xdg_toplevel *xdg_toplevel,
+static void wayc_toplevel_configure(void* data,
+ struct xdg_toplevel* xdg_toplevel,
i32 width, i32 height,
- struct wl_array *states) {
+ struct wl_array* states) {
(void)xdg_toplevel;
(void)states;
- struct window_s *window = (struct window_s *)data;
+ struct window_s* window = (struct window_s*)data;
wayc_notnull(window);
- struct eventloop_s *loop = window->loop;
+ struct eventloop_s* loop = window->loop;
wayc_notnull(loop);
struct event_s event = WAYC_EVENT_RESIZE(window, width, height);
wayc_vec_push(&loop->events, &event);
}
-static void wayc_toplevel_close(void *data, struct xdg_toplevel *xdg_toplevel) {
+static void wayc_toplevel_close(void* data, struct xdg_toplevel* xdg_toplevel) {
(void)xdg_toplevel;
- struct window_s *window = (struct window_s *)data;
+ struct window_s* window = (struct window_s*)data;
wayc_notnull(window);
- struct eventloop_s *loop = window->loop;
+ struct eventloop_s* loop = window->loop;
wayc_notnull(loop);
struct event_s event = WAYC_EVENT_CLOSE(window);
@@ -52,17 +54,16 @@ static struct xdg_surface_listener WAYC_SURFACE_LISTENER = {
static struct xdg_toplevel_listener WAYC_TOPLEVEL_LISTENER = {
wayc_toplevel_configure, wayc_toplevel_close, nullptr, nullptr};
-bool wayc_window_init(struct window_s *window, const char *name,
- struct eventloop_s *loop) {
+bool wayc_window_init(struct window_s* window, const char* name,
+ struct eventloop_s* loop) {
wayc_notnull(window);
wayc_notnull(loop);
memset(window, 0, sizeof(*window));
- struct wlstate_s *wlstate = &loop->state;
+ struct wlstate_s* wlstate = &loop->state;
wl_surface_t surface = wl_compositor_create_surface(wlstate->compositor);
- if (surface == nullptr)
- return false;
+ if (surface == nullptr) return false;
xdg_surface_t xdg_surface =
xdg_wm_base_get_xdg_surface(wlstate->wm_base, surface);
@@ -92,7 +93,7 @@ bool wayc_window_init(struct window_s *window, const char *name,
return true;
}
-void wayc_window_deinit(struct window_s *window) {
+void wayc_window_deinit(struct window_s* window) {
wayc_notnull(window);
if (window->surface == nullptr || window->xdg_surface == nullptr ||
@@ -108,11 +109,10 @@ void wayc_window_deinit(struct window_s *window) {
window->surface = nullptr;
}
-void wayc_window_redraw(struct window_s *window, struct eventloop_s *loop) {
+void wayc_window_redraw(struct window_s* window, struct eventloop_s* loop) {
wayc_notnull(window);
wayc_notnull(loop);
struct event_s event = WAYC_EVENT_FRAME(window);
wayc_vec_push(&loop->events, &event);
- wl_surface_commit(window->surface);
} \ No newline at end of file