diff --git a/titlebar/native/TitlebarUtility.hx b/titlebar/native/TitlebarUtility.hx index a10ef77..2d62574 100644 --- a/titlebar/native/TitlebarUtility.hx +++ b/titlebar/native/TitlebarUtility.hx @@ -7,7 +7,7 @@ package titlebar.native; extern class TitlebarUtility { @:native('titlebar__initializeNewWndProc') private static function initialize():Void; - @:native('titlebar__registerFontFromPath') private static function registerFontFromPath(path:String):Void; + @:native('titlebar__registerFontFromPath') private static function registerFont(path:String):Void; @:native('titlebar__loadGDI') private static function loadGDI():Void; // customization @@ -41,10 +41,8 @@ extern class TitlebarUtility extern class TitlebarUtility { @:hlNative('titlebar', 'initializeNewWndProc') public static function initialize():Void; - public static function registerFont(path:String):Void { - trace(path); + public static inline function registerFont(path:String):Void { registerFontFromPath(path); - trace(path + "post"); } @:hlNative('titlebar', 'registerFontFromPath') public static function registerFontFromPath(path:String):Void; @:hlNative('titlebar', 'loadGDI') private static function loadGDI():Void; @@ -75,4 +73,5 @@ extern class TitlebarUtility @:hlNative('titlebar', 'redrawWindow') public static function redrawWindow():Void; @:hlNative('titlebar', 'setCenterTitle') public static function setCenterTitle(centerTitle:Bool):Void; } -#end \ No newline at end of file + +#end diff --git a/titlebar/native/hdlls/windows/titlebar.hdll b/titlebar/native/hdlls/windows/titlebar.hdll new file mode 100644 index 0000000..4dd6ac3 Binary files /dev/null and b/titlebar/native/hdlls/windows/titlebar.hdll differ diff --git a/titlebar/native/hdlls/windows/titlebar.hdll.hash b/titlebar/native/hdlls/windows/titlebar.hdll.hash new file mode 100644 index 0000000..6c650d3 --- /dev/null +++ b/titlebar/native/hdlls/windows/titlebar.hdll.hash @@ -0,0 +1 @@ +d31955f03f55d6becc7972b22327f1a5 \ No newline at end of file diff --git a/titlebar/native/obj/lib/titlebar.exp b/titlebar/native/obj/lib/titlebar.exp new file mode 100644 index 0000000..892131c Binary files /dev/null and b/titlebar/native/obj/lib/titlebar.exp differ diff --git a/titlebar/native/obj/lib/titlebar.lib b/titlebar/native/obj/lib/titlebar.lib new file mode 100644 index 0000000..ab8613f Binary files /dev/null and b/titlebar/native/obj/lib/titlebar.lib differ diff --git a/titlebar/native/obj/msvc1964/all_objs b/titlebar/native/obj/msvc1964/all_objs new file mode 100644 index 0000000..5840e73 --- /dev/null +++ b/titlebar/native/obj/msvc1964/all_objs @@ -0,0 +1 @@ +"obj/msvc1964/feab5bf7_TitlebarUtility_HL.obj" diff --git a/titlebar/native/obj/msvc1964/feab5bf7_TitlebarUtility_HL.obj b/titlebar/native/obj/msvc1964/feab5bf7_TitlebarUtility_HL.obj new file mode 100644 index 0000000..946ccf1 Binary files /dev/null and b/titlebar/native/obj/msvc1964/feab5bf7_TitlebarUtility_HL.obj differ diff --git a/titlebar/native/src/TitlebarUtility.cpp b/titlebar/native/src/TitlebarUtility.cpp index 4149fe6..776acf3 100644 --- a/titlebar/native/src/TitlebarUtility.cpp +++ b/titlebar/native/src/TitlebarUtility.cpp @@ -82,7 +82,7 @@ HBRUSH titlebar__secondaryButtonBrush = nullptr; HBRUSH titlebar__primaryButtonHoverBrush = CreateSolidBrush(RGB(55, 40, 42)); HBRUSH titlebar__secondaryButtonHoverBrush = CreateSolidBrush(RGB(223, 15, 16)); -int titlebar__buttonWidth = 32; +int titlebar__buttonWidth = 45; int titlebar__iconSize = 24; int titlebar__frameDimensions[4] = {GetSystemMetrics(SM_CXSIZEFRAME) + GetSystemMetrics(SM_CXPADDEDBORDER), GetSystemMetrics(SM_CYSIZEFRAME) + GetSystemMetrics(SM_CXPADDEDBORDER) + GetSystemMetrics(SM_CYCAPTION), GetSystemMetrics(SM_CXSIZEFRAME) + GetSystemMetrics(SM_CXPADDEDBORDER), GetSystemMetrics(SM_CYSIZEFRAME) + GetSystemMetrics(SM_CXPADDEDBORDER)}; int titlebar__zoomedFrameDimensions[4] = {GetSystemMetrics(SM_CXSIZEFRAME) + GetSystemMetrics(SM_CXPADDEDBORDER), GetSystemMetrics(SM_CYSIZEFRAME) + GetSystemMetrics(SM_CXPADDEDBORDER) + GetSystemMetrics(SM_CYCAPTION), GetSystemMetrics(SM_CXSIZEFRAME) + GetSystemMetrics(SM_CXPADDEDBORDER), GetSystemMetrics(SM_CYSIZEFRAME) + GetSystemMetrics(SM_CXPADDEDBORDER)}; @@ -447,6 +447,14 @@ void titlebar__initializeNewWndProc() HWND hwnd = GetActiveWindow(); titlebar__originalWndProc = (WNDPROC)SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)titlebar__wndProc); + // Tell DWM not to round the corners + DWM_WINDOW_CORNER_PREFERENCE preference = DWMWCP_DONOTROUND; + DwmSetWindowAttribute(hwnd, DWMWA_WINDOW_CORNER_PREFERENCE, &preference, sizeof(preference)); + + // This is the key one for Windows 10 - disable the rounded corners in the non-client area + BOOL enableRound = FALSE; + DwmSetWindowAttribute(hwnd, 33, &enableRound, sizeof(enableRound)); // 33 = DWMWA_USE_HOSTBACKDROPBRUSH (undocumented in some SDKs) + DwmExtendFrameIntoClientArea(hwnd, &titlebar__frameMargins); RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_ALLCHILDREN); diff --git a/titlebar/native/src/TitlebarUtility_HL.cpp b/titlebar/native/src/TitlebarUtility_HL.cpp index 69963e5..6b76b50 100644 --- a/titlebar/native/src/TitlebarUtility_HL.cpp +++ b/titlebar/native/src/TitlebarUtility_HL.cpp @@ -33,18 +33,6 @@ using namespace Gdiplus; #pragma comment(lib, "user32.lib") #pragma comment(lib, "msimg32.lib") -/*// whatever this thing is -extern "C" -{ -#ifdef _WIN32 - __declspec(dllexport) void titlebar__initializeNewWndProc(); - __declspec(dllexport) void titlebar__registerFontFromPath(vstring *fontPath); -#else - void titlebar__initializeNewWndProc(); - void titlebar__registerFontFromPath(vstring *fontPath); -#endif -}*/ - #ifdef _WIN32 enum Titlebar__HoverType { @@ -444,6 +432,14 @@ HL_PRIM void HL_NAME(initializeNewWndProc)(_NO_ARG) HWND hwnd = GetActiveWindow(); titlebar__originalWndProc = (WNDPROC)SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)titlebar__wndProc); + // Tell DWM not to round the corners + DWM_WINDOW_CORNER_PREFERENCE preference = DWMWCP_DONOTROUND; + DwmSetWindowAttribute(hwnd, DWMWA_WINDOW_CORNER_PREFERENCE, &preference, sizeof(preference)); + + // This is the key one for Windows 10 - disable the rounded corners in the non-client area + BOOL enableRound = FALSE; + DwmSetWindowAttribute(hwnd, 33, &enableRound, sizeof(enableRound)); // 33 = DWMWA_USE_HOSTBACKDROPBRUSH (undocumented in some SDKs) + MARGINS margins = {0}; DwmExtendFrameIntoClientArea(hwnd, &margins);