Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions titlebar/native/TitlebarUtility.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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

#end
Binary file added titlebar/native/hdlls/windows/titlebar.hdll
Binary file not shown.
1 change: 1 addition & 0 deletions titlebar/native/hdlls/windows/titlebar.hdll.hash
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
d31955f03f55d6becc7972b22327f1a5
Binary file added titlebar/native/obj/lib/titlebar.exp
Binary file not shown.
Binary file added titlebar/native/obj/lib/titlebar.lib
Binary file not shown.
1 change: 1 addition & 0 deletions titlebar/native/obj/msvc1964/all_objs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"obj/msvc1964/feab5bf7_TitlebarUtility_HL.obj"
Binary file not shown.
10 changes: 9 additions & 1 deletion titlebar/native/src/TitlebarUtility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)};
Expand Down Expand Up @@ -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);
Expand Down
20 changes: 8 additions & 12 deletions titlebar/native/src/TitlebarUtility_HL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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);

Expand Down