aboutsummaryrefslogtreecommitdiff
path: root/include/window
diff options
context:
space:
mode:
Diffstat (limited to 'include/window')
-rw-r--r--include/window/window.h37
-rw-r--r--include/window/window_wayland.h8
-rw-r--r--include/window/window_x11.h10
3 files changed, 55 insertions, 0 deletions
diff --git a/include/window/window.h b/include/window/window.h
new file mode 100644
index 0000000..7839f6a
--- /dev/null
+++ b/include/window/window.h
@@ -0,0 +1,37 @@
+#ifndef GSR_WINDOW_H
+#define GSR_WINDOW_H
+
+#include "../utils.h"
+#include <stdbool.h>
+
+typedef union _XEvent XEvent;
+typedef struct gsr_window gsr_window;
+
+typedef enum {
+ GSR_DISPLAY_SERVER_X11,
+ GSR_DISPLAY_SERVER_WAYLAND
+} gsr_display_server;
+
+struct gsr_window {
+ void (*destroy)(gsr_window *self);
+ /* Returns true if an event is available */
+ bool (*process_event)(gsr_window *self);
+ XEvent* (*get_event_data)(gsr_window *self); /* can be NULL */
+ gsr_display_server (*get_display_server)(void);
+ void* (*get_display)(gsr_window *self);
+ void* (*get_window)(gsr_window *self);
+ void (*for_each_active_monitor_output_cached)(const gsr_window *self, active_monitor_callback callback, void *userdata);
+ void *priv;
+};
+
+void gsr_window_destroy(gsr_window *self);
+
+/* Returns true if an event is available */
+bool gsr_window_process_event(gsr_window *self);
+XEvent* gsr_window_get_event_data(gsr_window *self);
+gsr_display_server gsr_window_get_display_server(const gsr_window *self);
+void* gsr_window_get_display(gsr_window *self);
+void* gsr_window_get_window(gsr_window *self);
+void gsr_window_for_each_active_monitor_output_cached(const gsr_window *self, active_monitor_callback callback, void *userdata);
+
+#endif /* GSR_WINDOW_H */
diff --git a/include/window/window_wayland.h b/include/window/window_wayland.h
new file mode 100644
index 0000000..3535b0f
--- /dev/null
+++ b/include/window/window_wayland.h
@@ -0,0 +1,8 @@
+#ifndef GSR_WINDOW_WAYLAND_H
+#define GSR_WINDOW_WAYLAND_H
+
+#include "window.h"
+
+gsr_window* gsr_window_wayland_create(void);
+
+#endif /* GSR_WINDOW_WAYLAND_H */
diff --git a/include/window/window_x11.h b/include/window/window_x11.h
new file mode 100644
index 0000000..e0c2948
--- /dev/null
+++ b/include/window/window_x11.h
@@ -0,0 +1,10 @@
+#ifndef GSR_WINDOW_X11_H
+#define GSR_WINDOW_X11_H
+
+#include "window.h"
+
+typedef struct _XDisplay Display;
+
+gsr_window* gsr_window_x11_create(Display *display);
+
+#endif /* GSR_WINDOW_X11_H */