Skip to content

Commit c88e2e2

Browse files
committed
stuff
1 parent d43ac4f commit c88e2e2

11 files changed

Lines changed: 775 additions & 698 deletions

File tree

src/ruisapp/glue/linux/wayland/application.hxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,7 @@ public:
131131
ruisapp::window_parameters{
132132
.dims = {1, 1},
133133
.title = {},
134-
.fullscreen = false,
135-
.visible = false
134+
.fullscreen = false
136135
},
137136
nullptr // no shared gl context
138137
)

src/ruisapp/glue/linux/xorg/glue.cxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,7 @@ class os_platform_glue : public utki::destructable
112112
ruisapp::window_parameters{
113113
.dims = {1, 1},
114114
.title = {},
115-
.fullscreen = false,
116-
.visible = false
115+
.fullscreen = false
117116
},
118117
nullptr
119118
)

src/ruisapp/glue/linux/xorg/window.hxx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,8 @@ class native_window : public ruis::render::native_window
277277
display_wrapper& display, //
278278
const ruisapp::window_parameters& window_params,
279279
xorg_color_map_wrapper& color_map,
280-
xorg_visual_info_wrapper& visual_info
280+
xorg_visual_info_wrapper& visual_info,
281+
bool visible
281282
) :
282283
display(display),
283284
window([&]() {
@@ -350,7 +351,7 @@ class native_window : public ruis::render::native_window
350351
);
351352
}
352353

353-
if (window_params.visible) {
354+
if (visible) {
354355
XMapWindow(
355356
this->display.xorg_display.display, //
356357
this->window
@@ -640,7 +641,8 @@ public:
640641
this->display, //
641642
window_params,
642643
this->xorg_color_map,
643-
this->xorg_visual_info
644+
this->xorg_visual_info,
645+
shared_gl_context_native_window != nullptr
644646
),
645647
#ifdef RUISAPP_RENDER_OPENGL
646648
glx_context(

src/ruisapp/glue/windows/application.cxx

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,15 @@ application_glue::application_glue(const utki::version_duplet& gl_version) :
7979
)
8080
{}
8181

82-
void application_glue::render() {
82+
void application_glue::render()
83+
{
8384
for (auto& w : this->windows) {
8485
w.second.get().render();
8586
}
8687
}
8788

88-
app_window* application_glue::get_window(native_window::window_id_type id) {
89+
app_window* application_glue::get_window(native_window::window_id_type id)
90+
{
8991
auto i = this->windows.find(id);
9092
if (i == this->windows.end()) {
9193
return nullptr;
@@ -94,7 +96,8 @@ app_window* application_glue::get_window(native_window::window_id_type id) {
9496
return &i->second.get();
9597
}
9698

97-
ruisapp::window& application_glue::make_window(ruisapp::window_parameters window_params) {
99+
ruisapp::window& application_glue::make_window(ruisapp::window_parameters window_params)
100+
{
98101
auto ruis_native_window = utki::make_shared<native_window>(
99102
this->display,
100103
this->gl_version,
@@ -106,17 +109,15 @@ ruisapp::window& application_glue::make_window(ruisapp::window_parameters window
106109
.post_to_ui_thread_function =
107110
[this](std::function<void()> procedure) {
108111
if (PostMessage(
109-
NULL, // post message to UI thread's message queue
110-
WM_USER,
111-
0, // no wParam
112-
// NOLINTNEXTLINE(cppcoreguidelines-owning-memory, cppcoreguidelines-pro-type-reinterpret-cast)
113-
reinterpret_cast<LPARAM>(
114-
new std::remove_reference_t<decltype(procedure)>(std::move(procedure))
115-
)
116-
) == 0)
117-
{
118-
throw std::runtime_error("PostMessage(): failed");
119-
}
112+
NULL, // post message to UI thread's message queue
113+
WM_USER,
114+
0, // no wParam
115+
// NOLINTNEXTLINE(cppcoreguidelines-owning-memory, cppcoreguidelines-pro-type-reinterpret-cast)
116+
reinterpret_cast<LPARAM>(new std::remove_reference_t<decltype(procedure)>(std::move(procedure)))
117+
) == 0)
118+
{
119+
throw std::runtime_error("PostMessage(): failed");
120+
}
120121
},
121122
.updater = this->updater,
122123
.renderer = utki::make_shared<ruis::render::renderer>(
@@ -132,9 +133,9 @@ ruisapp::window& application_glue::make_window(ruisapp::window_parameters window
132133
),
133134
.style_provider = this->ruis_style_provider,
134135
.units = ruis::units(
135-
ruis_native_window.get().get_dots_per_inch(), //
136-
ruis_native_window.get().get_dots_per_pp()
137-
)
136+
ruis_native_window.get().get_dots_per_inch(), //
137+
ruis_native_window.get().get_dots_per_pp()
138+
)
138139
});
139140

140141
auto ruisapp_window = utki::make_shared<app_window>(
@@ -162,7 +163,8 @@ ruisapp::window& application_glue::make_window(ruisapp::window_parameters window
162163
return res.first->second.get();
163164
}
164165

165-
void application_glue::destroy_window(native_window::window_id_type id){
166+
void application_glue::destroy_window(native_window::window_id_type id)
167+
{
166168
auto i = this->windows.find(id);
167169
utki::assert(i != this->windows.end(), SL);
168170

@@ -178,20 +180,22 @@ ruisapp::application::application(parameters params) :
178180
)
179181
{}
180182

181-
void ruisapp::application::quit() noexcept{
183+
void ruisapp::application::quit() noexcept
184+
{
182185
auto& glue = get_glue(*this);
183186

184-
PostQuitMessage(
185-
0 // exit code
187+
PostQuitMessage(0 // exit code
186188
);
187189
}
188190

189-
ruisapp::window& ruisapp::application::make_window(ruisapp::window_parameters window_params) {
191+
ruisapp::window& ruisapp::application::make_window(ruisapp::window_parameters window_params)
192+
{
190193
auto& glue = get_glue(*this);
191194
return glue.make_window(std::move(window_params));
192195
}
193196

194-
void ruisapp::application::destroy_window(ruisapp::window& w) {
197+
void ruisapp::application::destroy_window(ruisapp::window& w)
198+
{
195199
auto& glue = get_glue(*this);
196200

197201
utki::assert(dynamic_cast<app_window*>(&w), SL);

src/ruisapp/glue/windows/application.hxx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
#include "window.hxx"
1010

1111
namespace {
12-
class app_window : public ruisapp::window{
12+
class app_window : public ruisapp::window
13+
{
1314
public:
1415
const utki::shared_ref<native_window> ruis_native_window;
1516

@@ -21,12 +22,12 @@ public:
2122
app_window(
2223
utki::shared_ref<ruis::context> ruis_context, //
2324
utki::shared_ref<native_window> ruis_native_window
24-
):
25+
) :
2526
ruisapp::window(std::move(ruis_context)),
2627
ruis_native_window(std::move(ruis_native_window))
2728
{}
2829
};
29-
}
30+
} // namespace
3031

3132
namespace {
3233
class application_glue : public utki::destructable
@@ -42,9 +43,8 @@ class application_glue : public utki::destructable
4243
const utki::shared_ref<ruis::resource_loader> ruis_resource_loader;
4344
const utki::shared_ref<ruis::style_provider> ruis_style_provider;
4445

45-
std::map<
46-
native_window::window_id_type,
47-
utki::shared_ref<app_window>> windows;
46+
std::map<native_window::window_id_type, utki::shared_ref<app_window>> windows;
47+
4848
public:
4949
std::atomic_bool quit_flag = false;
5050

0 commit comments

Comments
 (0)