From 96a5a9603791a717ab46c8aab6b0fd77f88486d0 Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Fri, 19 Jun 2020 20:13:03 +0100 Subject: [PATCH] Fix GTK window position when closed maximized GTK only sends one maximize event, and it happens after the window is maximized, so we shouldn't check for not being maximized. --- common/dialogs/dialog_color_picker.cpp | 8 ++++---- common/eda_base_frame.cpp | 28 ++++++++++++++------------ include/gal/color4d.h | 2 +- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/common/dialogs/dialog_color_picker.cpp b/common/dialogs/dialog_color_picker.cpp index 466d3753cb..4af923452e 100644 --- a/common/dialogs/dialog_color_picker.cpp +++ b/common/dialogs/dialog_color_picker.cpp @@ -171,12 +171,12 @@ void DIALOG_COLOR_PICKER::initDefinedColors( CUSTOM_COLORS_LIST* aPredefinedColo // Size of color swatches const int w = 32, h = 32; - // Colors are built from the g_ColorRefs table (size NBCOLORS). - // The look is better when g_ColorRefs order is displayed in a grid matrix + // Colors are built from the colorRefs() table (size NBCOLORS). + // The look is better when colorRefs() order is displayed in a grid matrix // of 6 row and 5 columns, first filling a row, and after the next column. // But the wxFlexGrid used here must be filled by columns, then next row - // the best interval g_ColorRefs from a matrix row to the next row is 6 - // So when have to reorder the index used to explore g_ColorRefs + // the best interval colorRefs() from a matrix row to the next row is 6 + // So when have to reorder the index used to explore colorRefs() int grid_col = 0; int grid_row = 0; int table_row_count = 6; diff --git a/common/eda_base_frame.cpp b/common/eda_base_frame.cpp index 996aa057a2..b1d9a98cbe 100644 --- a/common/eda_base_frame.cpp +++ b/common/eda_base_frame.cpp @@ -823,9 +823,11 @@ void EDA_BASE_FRAME::OnMaximize( wxMaximizeEvent& aEvent ) // When we maximize the window, we want to save the old information // so that we can add it to the settings on next window load. // Contrary to the documentation, this event seems to be generated - // when the window is also being unmaximized, so we only capture the - // size information when we maximize the window. + // when the window is also being unmaximized on OSX, so we only + // capture the size information when we maximize the window when on OSX. +#ifdef __WXOSX__ if( !IsMaximized() ) +#endif { m_NormalFrameSize = GetWindowSize(); m_NormalFramePos = GetPosition(); @@ -840,18 +842,18 @@ void EDA_BASE_FRAME::OnMaximize( wxMaximizeEvent& aEvent ) wxSize EDA_BASE_FRAME::GetWindowSize() { - #ifdef __WXGTK__ - // GTK includes the window decorations in the normal GetSize call, - // so we have to use a GTK-specific sizing call that returns the - // non-decorated window size. - int width = 0; - int height = 0; - GTKDoGetSize( &width, &height ); +#ifdef __WXGTK__ + // GTK includes the window decorations in the normal GetSize call, + // so we have to use a GTK-specific sizing call that returns the + // non-decorated window size. + int width = 0; + int height = 0; + GTKDoGetSize( &width, &height ); - wxSize winSize( width, height ); - #else - wxSize winSize = GetSize(); - #endif + wxSize winSize( width, height ); +#else + wxSize winSize = GetSize(); +#endif return winSize; } diff --git a/include/gal/color4d.h b/include/gal/color4d.h index a38e0d6c49..bfc17f552c 100644 --- a/include/gal/color4d.h +++ b/include/gal/color4d.h @@ -73,7 +73,7 @@ enum EDA_COLOR_T PUREYELLOW, NBCOLORS, ///< Number of colors HIGHLIGHT_FLAG = ( 1<<19 ), - MASKCOLOR = 31 ///< mask for color index into g_ColorRefs[] + MASKCOLOR = 31 ///< mask for color index into colorRefs()[] }; struct StructColors