Browse Source

Remove necessary #defines.

Added exception handling flag.
pull/139/head
weisj 5 years ago
parent
commit
3f74d6fdf9
  1. 3
      windows/build.gradle.kts
  2. 8
      windows/src/main/cpp/Decorations.cpp

3
windows/build.gradle.kts

@ -21,7 +21,8 @@ library {
binaries.configureEach {
compileTask.get().compilerArgs.addAll(
when (toolChain) {
is Gcc, is Clang, is VisualCpp -> listOf("--std=c++11")
is Gcc, is Clang -> listOf("--std=c++11")
is VisualCpp -> listOf("/EHsc")
else -> emptyList()
}
)

8
windows/src/main/cpp/Decorations.cpp

@ -28,8 +28,6 @@
#include <iostream>
#include <winuser.h>
#define GWL_WNDPROC -4
std::map<HWND, WindowWrapper *> wrapper_map = std::map<HWND, WindowWrapper *>();
LRESULT HitTestNCA(HWND hWnd, WPARAM wParam, LPARAM lParam, WindowWrapper *wrapper)
@ -244,13 +242,13 @@ bool InstallDecorations(HWND handle, bool is_popup)
SetupWindowStyle(handle);
ExtendClientFrame(handle);
WNDPROC proc = reinterpret_cast<WNDPROC>(GetWindowLongPtr(handle, GWL_WNDPROC));
WNDPROC proc = reinterpret_cast<WNDPROC>(GetWindowLongPtr(handle, GWLP_WNDPROC));
WindowWrapper *wrapper = new WindowWrapper();
wrapper->prev_proc = proc;
wrapper->popup_menu = is_popup;
wrapper_map[handle] = wrapper;
SetWindowLongPtr(handle, GWL_WNDPROC, (LONG_PTR)WindowWrapper::WindowProc);
SetWindowLongPtr(handle, GWLP_WNDPROC, (LONG_PTR)WindowWrapper::WindowProc);
UINT flags = SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED;
SetWindowPos(handle, NULL, 0, 0, 0, 0, flags);
return true;
@ -270,7 +268,7 @@ Java_com_github_weisj_darklaf_platform_windows_JNIDecorationsWindows_uninstallDe
auto wrap = wrapper_map[handle];
if (wrap)
{
SetWindowLongPtr(handle, GWL_WNDPROC, reinterpret_cast<LONG_PTR>(wrap->prev_proc));
SetWindowLongPtr(handle, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(wrap->prev_proc));
wrapper_map.erase(handle);
delete (wrap);
}

Loading…
Cancel
Save