Fix reopening closed editor windows

This commit is contained in:
Robbert van der Helm
2020-04-19 20:36:39 +02:00
parent f29a859713
commit 1a6a094c2b
3 changed files with 26 additions and 5 deletions
+1 -2
View File
@@ -7,8 +7,7 @@ Yet Another way to use Windows VST2 plugins in Linux VST hosts.
There are a few things that should be done before releasing this, including:
- Fix implementation bugs:
- Fix hiding and showing of editor windows, closing a window with alt+f4
freezes the editor,
- Closing editor windows is slow, this can be improved,
- Polish GUIs even further. There are some todos left in
`src/wine-host/editor.{h,cpp}`.
- There are likely some minor issues left.
+9 -2
View File
@@ -30,18 +30,25 @@ xcb_window_t get_x11_handle(HWND win32_handle);
ATOM register_window_class(std::string window_class_name);
WindowClass::WindowClass(std::string name)
: atom(register_window_class(name)) {}
WindowClass::~WindowClass() {
UnregisterClass(reinterpret_cast<LPCSTR>(atom), GetModuleHandle(nullptr));
}
Editor::Editor(const std::string& window_class_name,
AEffect* effect,
std::mutex& effect_mutex,
const size_t parent_window_handle)
: window_class(register_window_class(window_class_name)),
: window_class(window_class_name),
// Create a window without any decoratiosn for easy embedding. The
// combination of `WS_EX_TOOLWINDOW` and `WS_POPUP` causes the window to
// be drawn without any decorations (making resizes behave as you'd
// expect) and also causes mouse coordinates to be relative to the window
// itself.
win32_handle(CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_ACCEPTFILES,
reinterpret_cast<LPCSTR>(window_class),
reinterpret_cast<LPCSTR>(window_class.atom),
"yabridge plugin",
WS_POPUP,
CW_USEDEFAULT,
+16 -1
View File
@@ -17,6 +17,21 @@
#include <optional>
#include <string>
/**
* A basic RAII wrapper around the Win32 window class system, for use in the
* Editor class below.
*/
class WindowClass {
public:
WindowClass(std::string name);
~WindowClass();
/**
* The Win32 window class registered for the windows window.
*/
const ATOM atom;
};
/**
* A wrapper around the win32 windowing API to create and destroy editor
* windows. We can embed this window into the window provided by the host, and a
@@ -74,7 +89,7 @@ class Editor {
/**
* The Win32 window class registered for the windows window.
*/
ATOM window_class;
WindowClass window_class;
public:
/**