Rename init_proxy -> get_handle

This commit is contained in:
Robbert van der Helm
2021-07-10 15:16:20 +02:00
parent 1946693244
commit b47a6e034b
3 changed files with 6 additions and 5 deletions
+2 -2
View File
@@ -202,7 +202,7 @@ Editor::Editor(MainContext& main_context,
std::optional<fu2::unique_function<void()>> timer_proc)
: use_xembed(config.editor_xembed),
x11_connection(xcb_connect(nullptr, nullptr), xcb_disconnect),
dnd_proxy_handle(WineXdndProxy::init_proxy()),
dnd_proxy_handle(WineXdndProxy::get_handle()),
client_area(get_maximum_screen_dimensions(*x11_connection)),
// Create a window without any decoratiosn for easy embedding. The
// combination of `WS_EX_TOOLWINDOW` and `WS_POPUP` causes the window to
@@ -365,7 +365,7 @@ Editor::Editor(MainContext& main_context,
// Set up our proxy for translating Wine drag-and-drop events into XDND
// events
// TODO: We're going to need to store this somewhere to pass the events
WineXdndProxy::init_proxy();
WineXdndProxy::get_handle();
}
void Editor::handle_x11_events() const noexcept {
+3 -2
View File
@@ -180,7 +180,8 @@ void CALLBACK dnd_winevent_callback(HWINEVENTHOOK /*hWinEventHook*/,
// This shouldn't be possible, but you can never be too sure!
if (instance_reference_count <= 0 || !instance) {
std::cerr << "Drag-and-drop proxy wasn't initialized yet" << std::endl;
std::cerr << "Drag-and-drop proxy has not yet been initialized"
<< std::endl;
return;
}
}
@@ -213,7 +214,7 @@ WineXdndProxy::Handle::Handle(Handle&& o) noexcept : proxy(o.proxy) {
instance_reference_count += 1;
}
WineXdndProxy::Handle WineXdndProxy::init_proxy() {
WineXdndProxy::Handle WineXdndProxy::get_handle() {
// See the `instance` global above for an explanation on what's going on
// here.
if (instance_reference_count.fetch_add(1) == 0) {
+1 -1
View File
@@ -90,7 +90,7 @@ class WineXdndProxy {
* @note This function, like everything other GUI realted, should be called
* from the main thread that's running the Win32 message loop.
*/
static WineXdndProxy::Handle init_proxy();
static WineXdndProxy::Handle get_handle();
private:
std::unique_ptr<xcb_connection_t, decltype(&xcb_disconnect)> x11_connection;