summaryrefslogtreecommitdiff
path: root/src/window/xcb.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/window/xcb.h')
-rw-r--r--src/window/xcb.h23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/window/xcb.h b/src/window/xcb.h
index e2928b6..53aac5f 100644
--- a/src/window/xcb.h
+++ b/src/window/xcb.h
@@ -6,11 +6,15 @@
#include "backends.h"
#include "device.h"
+#include "window.h"
+
+#include <map>
+
+#include <X11/Xlib-xcb.h>
+#include <X11/Xlib.h>
namespace saw {
namespace gfx {
-class window;
-
template<>
class device<backend::linux_xcb> final {
private:
@@ -23,9 +27,11 @@ private:
own<input_stream> async_notifier_;
conveyor_sink async_conveyor_;
- std::map<xcb_window_t, window *> windows_;
+ std::map<xcb_window_t, window<backend::linux_xcb> *> windows_;
std::vector<xcb_generic_event_t *> pending_events_;
+private:
+ own<window<backend::linux_xcb>> create_xcb_window(const video_mode& vid_mod, std::string_view title_view, int visual_id);
public:
device(::Display *display, int screen, xcb_connection_t *xcb_connection,
xcb_screen_t *xcb_screen, own<input_stream> && an);
@@ -35,16 +41,17 @@ public:
void xcb_window_was_destroyed(xcb_window_t window_id);
void handle_events();
- window<backend::linux_xcb> create_window(const video_mode& vid_mod, std::string_view title_view);
+ own<window<backend::linux_xcb>> create_window(const video_mode& vid_mod, std::string_view title_view);
void flush();
};
-error_or<device<backend::linux_xcb>> create_xcb_device();
+error_or<own<device<backend::linux_xcb>>> create_xcb_device(io_provider& provider);
-class window {
+template<>
+class window<backend::linux_xcb> final {
private:
- device *device_;
+ device<backend::linux_xcb> *device_;
xcb_window_t xcb_window_;
xcb_colormap_t xcb_colormap_;
@@ -54,7 +61,7 @@ private:
own<conveyor_feeder<data<schema::WindowEvents>>> event_feeder = nullptr;
public:
- window(device& dev_, xcb_window_t xcb_win, xcb_colormap_t xcb_colormap_, const video_mode& vid_mode_, std::string_view title_view_);
+ window(device<backend::linux_xcb>& dev_, xcb_window_t xcb_win, xcb_colormap_t xcb_colormap_, const video_mode& vid_mode_, std::string_view title_view_);
~window();