mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-13 07:17:13 -06: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:
@@ -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 )
|
||||
|
||||
Reference in New Issue
Block a user