49 lines
1.1 KiB
C++
49 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <X11/Xlib-xcb.h>
|
|
#include <X11/Xlib.h>
|
|
#include <forstio/io/io.h>
|
|
#include <xcb/xcb.h>
|
|
|
|
#include <map>
|
|
#include <vector>
|
|
|
|
#include "forstio/window/device.h"
|
|
#include "window_xcb.h"
|
|
|
|
namespace saw {
|
|
class xcb_device final : public device {
|
|
public:
|
|
::Display *display;
|
|
int screen;
|
|
|
|
xcb_connection_t *xcb_connection;
|
|
xcb_screen_t *xcb_screen;
|
|
|
|
own<input_stream> async_notifier;
|
|
conveyor_sink async_conveyor;
|
|
|
|
std::map<xcb_window_t, xcb_window *> windows;
|
|
|
|
std::vector<xcb_generic_event_t *> pending_events;
|
|
|
|
public:
|
|
xcb_device(::Display *display, int screen, xcb_connection_t *xcb_connection,
|
|
xcb_screen_t *xcb_screen, own<input_stream> &&an);
|
|
~xcb_device();
|
|
|
|
void window_destroyed(xcb_window_t window_id);
|
|
void handle_events();
|
|
|
|
own<xcb_window> create_xcb_window(const video_mode &mode,
|
|
std::string_view title_view,
|
|
int visual_id);
|
|
own<window> create_window(const video_mode &video_mode,
|
|
std::string_view title_view) override;
|
|
|
|
void flush() override;
|
|
};
|
|
|
|
own<xcb_device> create_xcb_device(io_provider &provider);
|
|
} // namespace saw
|