mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-09 08:15:09 +03:00
Native window decorations: when resizing a window to the right or to the bottom, then first fill the new space with the window background color (instead of black) before the layout is updated (issue #339)
This commit is contained in:
@@ -73,8 +73,8 @@ library {
|
||||
|
||||
linkerArgs.addAll( toolChain.map {
|
||||
when( it ) {
|
||||
is Gcc, is Clang -> listOf( "-l${jawt}", "-lUser32", "-lshell32", "-lAdvAPI32", "-lKernel32" )
|
||||
is VisualCpp -> listOf( "${jawt}.lib", "User32.lib", "shell32.lib", "AdvAPI32.lib", "Kernel32.lib", "/NODEFAULTLIB" )
|
||||
is Gcc, is Clang -> listOf( "-l${jawt}", "-lUser32", "-lGdi32", "-lshell32", "-lAdvAPI32", "-lKernel32" )
|
||||
is VisualCpp -> listOf( "${jawt}.lib", "User32.lib", "Gdi32.lib", "shell32.lib", "AdvAPI32.lib", "Kernel32.lib", "/NODEFAULTLIB" )
|
||||
else -> emptyList()
|
||||
}
|
||||
} )
|
||||
|
||||
@@ -52,6 +52,13 @@ JNIEXPORT void JNICALL Java_com_formdev_flatlaf_ui_FlatWindowsNativeWindowBorder
|
||||
FlatWndProc::updateFrame( reinterpret_cast<HWND>( hwnd ), state );
|
||||
}
|
||||
|
||||
extern "C"
|
||||
JNIEXPORT void JNICALL Java_com_formdev_flatlaf_ui_FlatWindowsNativeWindowBorder_00024WndProc_setWindowBackground
|
||||
( JNIEnv* env, jobject obj, jlong hwnd, jint r, jint g, jint b )
|
||||
{
|
||||
FlatWndProc::setWindowBackground( reinterpret_cast<HWND>( hwnd ), r, g, b );
|
||||
}
|
||||
|
||||
extern "C"
|
||||
JNIEXPORT void JNICALL Java_com_formdev_flatlaf_ui_FlatWindowsNativeWindowBorder_00024WndProc_showWindow
|
||||
( JNIEnv* env, jobject obj, jlong hwnd, jint cmd )
|
||||
@@ -174,6 +181,17 @@ void FlatWndProc::updateFrame( HWND hwnd, int state ) {
|
||||
fwp->wmSizeWParam = -1;
|
||||
}
|
||||
|
||||
void FlatWndProc::setWindowBackground( HWND hwnd, int r, int g, int b ) {
|
||||
// delete old background brush
|
||||
HBRUSH oldBrush = (HBRUSH) ::GetClassLongPtr( hwnd, GCLP_HBRBACKGROUND );
|
||||
if( oldBrush != NULL )
|
||||
::DeleteObject( oldBrush );
|
||||
|
||||
// create new background brush
|
||||
HBRUSH brush = ::CreateSolidBrush( RGB( r, g, b ) );
|
||||
::SetClassLongPtr( hwnd, GCLP_HBRBACKGROUND, (LONG_PTR) brush );
|
||||
}
|
||||
|
||||
LRESULT CALLBACK FlatWndProc::StaticWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) {
|
||||
FlatWndProc* fwp = (FlatWndProc*) hwndMap->get( hwnd );
|
||||
if( fwp == NULL )
|
||||
|
||||
@@ -26,6 +26,7 @@ public:
|
||||
static HWND install( JNIEnv *env, jobject obj, jobject window );
|
||||
static void uninstall( JNIEnv *env, jobject obj, HWND hwnd );
|
||||
static void updateFrame( HWND hwnd, int state );
|
||||
static void setWindowBackground( HWND hwnd, int r, int g, int b );
|
||||
|
||||
private:
|
||||
static int initialized;
|
||||
|
||||
@@ -39,6 +39,14 @@ JNIEXPORT void JNICALL Java_com_formdev_flatlaf_ui_FlatWindowsNativeWindowBorder
|
||||
JNIEXPORT void JNICALL Java_com_formdev_flatlaf_ui_FlatWindowsNativeWindowBorder_00024WndProc_updateFrame
|
||||
(JNIEnv *, jobject, jlong, jint);
|
||||
|
||||
/*
|
||||
* Class: com_formdev_flatlaf_ui_FlatWindowsNativeWindowBorder_WndProc
|
||||
* Method: setWindowBackground
|
||||
* Signature: (JIII)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_formdev_flatlaf_ui_FlatWindowsNativeWindowBorder_00024WndProc_setWindowBackground
|
||||
(JNIEnv *, jobject, jlong, jint, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: com_formdev_flatlaf_ui_FlatWindowsNativeWindowBorder_WndProc
|
||||
* Method: showWindow
|
||||
|
||||
Reference in New Issue
Block a user