executed clang-format
parent
e73e31e876
commit
7f5b37f3ef
|
@ -6,8 +6,8 @@
|
|||
|
||||
namespace saw {
|
||||
xcb_device::xcb_device(::Display *display, int screen,
|
||||
xcb_connection_t *xcb_connection, xcb_screen_t *xcb_screen,
|
||||
own<input_stream> &&an)
|
||||
xcb_connection_t *xcb_connection,
|
||||
xcb_screen_t *xcb_screen, own<input_stream> &&an)
|
||||
: display{display}, screen{screen}, xcb_connection{xcb_connection},
|
||||
xcb_screen{xcb_screen}, async_notifier{std::move(an)},
|
||||
async_conveyor{async_notifier->read_ready()
|
||||
|
@ -38,7 +38,8 @@ void xcb_device::handle_events() {
|
|||
auto find = windows.find(motion->event);
|
||||
if (find != windows.end()) {
|
||||
assert(find->second);
|
||||
find->second->mouse_move_event(motion->event_x, motion->event_y);
|
||||
find->second->mouse_move_event(motion->event_x,
|
||||
motion->event_y);
|
||||
}
|
||||
} break;
|
||||
case XCB_EXPOSE: {
|
||||
|
@ -129,8 +130,8 @@ void xcb_device::handle_events() {
|
|||
}
|
||||
|
||||
own<xcb_window> xcb_device::create_xcb_window(const video_mode &video_mode,
|
||||
std::string_view title_view,
|
||||
int visual_id) {
|
||||
std::string_view title_view,
|
||||
int visual_id) {
|
||||
assert(xcb_screen);
|
||||
assert(xcb_connection);
|
||||
|
||||
|
@ -158,15 +159,15 @@ own<xcb_window> xcb_device::create_xcb_window(const video_mode &video_mode,
|
|||
title_view.data());
|
||||
|
||||
xcb_flush(xcb_connection);
|
||||
auto window = heap<class xcb_window>(*this, xcb_window, xcb_colormap, video_mode,
|
||||
title_view);
|
||||
auto window = heap<class xcb_window>(*this, xcb_window, xcb_colormap,
|
||||
video_mode, title_view);
|
||||
windows[xcb_window] = window.get();
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
own<window> xcb_device::create_window(const video_mode &video_mode,
|
||||
std::string_view title_view) {
|
||||
std::string_view title_view) {
|
||||
assert(xcb_screen);
|
||||
return create_xcb_window(video_mode, title_view, xcb_screen->root_visual);
|
||||
}
|
||||
|
@ -211,7 +212,7 @@ own<xcb_device> create_xcb_device(io_provider &provider) {
|
|||
xcb_screen_t *xcb_screen = screen_iter.data;
|
||||
|
||||
return heap<xcb_device>(display, screen, xcb_connection, xcb_screen,
|
||||
std::move(fd_wrapped));
|
||||
std::move(fd_wrapped));
|
||||
}
|
||||
|
||||
own<device> createdevice(io_provider &provider) {
|
||||
|
|
|
@ -29,16 +29,17 @@ public:
|
|||
|
||||
public:
|
||||
xcb_device(::Display *display, int screen, xcb_connection_t *xcb_connection,
|
||||
xcb_screen_t *xcb_screen, own<input_stream> &&an);
|
||||
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);
|
||||
std::string_view title_view,
|
||||
int visual_id);
|
||||
own<window> create_window(const video_mode &video_mode,
|
||||
std::string_view title_view) override;
|
||||
std::string_view title_view) override;
|
||||
|
||||
void flush() override;
|
||||
};
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
|
||||
namespace saw {
|
||||
namespace {
|
||||
glx_library_extensions load_glx_library_extensions(const char *extension_string) {
|
||||
glx_library_extensions
|
||||
load_glx_library_extensions(const char *extension_string) {
|
||||
std::string_view extensions_view{extension_string};
|
||||
std::set<std::string_view> extensions;
|
||||
while (1) {
|
||||
|
@ -64,8 +65,8 @@ int translate_drawable_type_setting(GlSettings::DrawableType cmp) {
|
|||
} // namespace
|
||||
|
||||
xcb_gl_context::xcb_gl_context(const glx_library_extensions &ext_lib,
|
||||
own<xcb_device> &&dev, int visual_id,
|
||||
GLXContext context, GLXFBConfig fb_config)
|
||||
own<xcb_device> &&dev, int visual_id,
|
||||
GLXContext context, GLXFBConfig fb_config)
|
||||
: ext_lib{ext_lib}, device{std::move(dev)}, visual_id{visual_id},
|
||||
context{context}, fb_config{fb_config} {}
|
||||
|
||||
|
@ -80,7 +81,7 @@ xcb_gl_context::~xcb_gl_context() {
|
|||
}
|
||||
|
||||
own<gl_window> xcb_gl_context::create_window(const video_mode &video_mode,
|
||||
std::string_view title_view) {
|
||||
std::string_view title_view) {
|
||||
assert(device);
|
||||
if (!device) {
|
||||
return nullptr;
|
||||
|
@ -105,7 +106,7 @@ void xcb_gl_context::flush() {
|
|||
}
|
||||
|
||||
own<gl_context> creategl_context(io_provider &provider,
|
||||
const GlSettings &settings) {
|
||||
const GlSettings &settings) {
|
||||
own<xcb_device> device = create_xcb_device(provider);
|
||||
if (!device) {
|
||||
return nullptr;
|
||||
|
@ -145,7 +146,8 @@ own<gl_context> creategl_context(io_provider &provider,
|
|||
attributes.push_back(settings.double_buffer ? True : False);
|
||||
|
||||
attributes.push_back(GLX_DRAWABLE_TYPE);
|
||||
attributes.push_back(translate_drawable_type_setting(settings.drawable_type));
|
||||
attributes.push_back(
|
||||
translate_drawable_type_setting(settings.drawable_type));
|
||||
|
||||
attributes.push_back(GLX_X_VISUAL_TYPE);
|
||||
attributes.push_back(GLX_TRUE_COLOR);
|
||||
|
@ -193,7 +195,7 @@ own<gl_context> creategl_context(io_provider &provider,
|
|||
glXGetFBConfigAttrib(device->display, fb_config, GLX_VISUAL_ID,
|
||||
&visual_id);
|
||||
return heap<xcb_gl_context>(lib_ext, std::move(device), visual_id,
|
||||
context, fb_config);
|
||||
context, fb_config);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
|
||||
public:
|
||||
xcb_gl_context(const glx_library_extensions &, own<xcb_device> &&, int,
|
||||
GLXContext, GLXFBConfig);
|
||||
GLXContext, GLXFBConfig);
|
||||
~xcb_gl_context();
|
||||
|
||||
own<gl_window> create_window(const video_mode &, std::string_view) override;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
namespace saw {
|
||||
xcb_gl_window::xcb_gl_window(own<xcb_window> &&win, xcb_gl_context &ctx,
|
||||
::GLXWindow glx_win)
|
||||
::GLXWindow glx_win)
|
||||
: window{std::move(win)}, context{ctx}, glx_window{glx_win} {}
|
||||
|
||||
xcb_gl_window::~xcb_gl_window() {
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
namespace saw {
|
||||
xcb_window::xcb_window(xcb_device &dev, xcb_window_t xcb_win,
|
||||
xcb_colormap_t xcb_colmap, const video_mode &vid_mode,
|
||||
std::string_view title_view_)
|
||||
xcb_colormap_t xcb_colmap, const video_mode &vid_mode,
|
||||
std::string_view title_view_)
|
||||
: device_{dev}, xcb_window_{xcb_win}, xcb_colormap_{xcb_colmap},
|
||||
video_mode_{vid_mode}, window_title_{title_view_} {}
|
||||
|
||||
|
@ -61,7 +61,8 @@ void xcb_window::resizeevent(size_t x, size_t y, size_t width, size_t height) {
|
|||
}
|
||||
}
|
||||
|
||||
void xcb_window::mouseevent(int16_t x, int16_t y, uint16_t state, bool pressed) {
|
||||
void xcb_window::mouseevent(int16_t x, int16_t y, uint16_t state,
|
||||
bool pressed) {
|
||||
if (x < 0 || y < 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -71,8 +72,8 @@ void xcb_window::mouseevent(int16_t x, int16_t y, uint16_t state, bool pressed)
|
|||
return;
|
||||
}
|
||||
if (event_feeder) {
|
||||
event_feeder->feed(
|
||||
window::variant_event{window::event::mouse{state, pressed, ux, uy}});
|
||||
event_feeder->feed(window::variant_event{
|
||||
window::event::mouse{state, pressed, ux, uy}});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,7 +93,7 @@ void xcb_window::mouse_move_event(int16_t x, int16_t y) {
|
|||
}
|
||||
|
||||
void xcb_window::keyboardevent(int16_t x, int16_t y, uint32_t keycode,
|
||||
bool pressed, bool repeat) {
|
||||
bool pressed, bool repeat) {
|
||||
if (x < 0 || y < 0) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -24,8 +24,8 @@ public:
|
|||
|
||||
public:
|
||||
xcb_window(xcb_device &dev, xcb_window_t xcb_win,
|
||||
xcb_colormap_t xcb_colormap_, const video_mode &video_mode_,
|
||||
std::string_view title_view_);
|
||||
xcb_colormap_t xcb_colormap_, const video_mode &video_mode_,
|
||||
std::string_view title_view_);
|
||||
~xcb_window();
|
||||
|
||||
void show() override;
|
||||
|
|
|
@ -14,7 +14,7 @@ public:
|
|||
virtual ~device() = default;
|
||||
|
||||
virtual own<window> create_window(const video_mode &mode,
|
||||
std::string_view title_view) = 0;
|
||||
std::string_view title_view) = 0;
|
||||
virtual void flush() = 0;
|
||||
};
|
||||
|
||||
|
|
|
@ -51,7 +51,8 @@ class gl_context {
|
|||
public:
|
||||
virtual ~gl_context() = default;
|
||||
|
||||
virtual own<gl_window> create_window(const video_mode &, std::string_view) = 0;
|
||||
virtual own<gl_window> create_window(const video_mode &,
|
||||
std::string_view) = 0;
|
||||
|
||||
virtual void flush() = 0;
|
||||
};
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
};
|
||||
|
||||
using variant_event = std::variant<event::resize, event::keyboard,
|
||||
event::mouse, event::mouse_move>;
|
||||
event::mouse, event::mouse_move>;
|
||||
|
||||
virtual ~window() = default;
|
||||
|
||||
|
|
Loading…
Reference in New Issue