X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/52802b07274af0595617ce37c871b71e3eb75189..133506215101bd8cffbf81e6c36944f7d5e2f8db:/src/gtk/toplevel.cpp diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp index e0118f9dea..5a77576b0a 100644 --- a/src/gtk/toplevel.cpp +++ b/src/gtk/toplevel.cpp @@ -358,6 +358,15 @@ gtk_frame_map_callback( GtkWidget*, eventShow.SetEventObject(win); win->GetEventHandler()->ProcessEvent(eventShow); } + +#if GTK_CHECK_VERSION(2,6,0) + if (!gtk_check_version(2,6,0)) + { + // restore focus-on-map setting in case ShowWithoutActivating() was called + gtk_window_set_focus_on_map(GTK_WINDOW(win->m_widget), true); + } +#endif // GTK+ 2.6+ + return false; } } @@ -372,7 +381,9 @@ gtk_frame_unmap_callback( GtkWidget * WXUNUSED(widget), GdkEvent * WXUNUSED(event), wxTopLevelWindow *win ) { - win->SetIconizeState(true); + // hiding the window doesn't count as minimizing it + if (win->IsShown()) + win->SetIconizeState(true); return false; } } @@ -537,6 +548,8 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, { gtk_window_set_keep_above(GTK_WINDOW(m_widget), TRUE); } + if (style & wxMAXIMIZE) + gtk_window_maximize(GTK_WINDOW(m_widget)); #if 0 if (!name.empty()) @@ -556,7 +569,7 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, gtk_container_add( GTK_CONTAINER(m_widget), m_mainWidget ); // m_wxwindow is the client area - m_wxwindow = wxPizza::New(0,this); + m_wxwindow = wxPizza::New(); gtk_widget_show( m_wxwindow ); gtk_container_add( GTK_CONTAINER(m_mainWidget), m_wxwindow ); @@ -876,7 +889,7 @@ bool wxTopLevelWindowGTK::Show( bool show ) HandleWindowEvent(event); } - bool change = wxTopLevelWindowBase::Show(show); + bool change = base_type::Show(show); if (change && !show) { @@ -891,8 +904,15 @@ bool wxTopLevelWindowGTK::Show( bool show ) void wxTopLevelWindowGTK::ShowWithoutActivating() { - gtk_window_set_focus_on_map(GTK_WINDOW(m_widget), false); - Show(true); + if (!m_isShown) + { +#if GTK_CHECK_VERSION(2,6,0) + if (!gtk_check_version(2,6,0)) + gtk_window_set_focus_on_map(GTK_WINDOW(m_widget), false); +#endif // GTK+ 2.6+ + + Show(true); + } } void wxTopLevelWindowGTK::Raise() @@ -986,10 +1006,12 @@ void wxTopLevelWindowGTK::DoSetSize( int x, int y, int width, int height, int si void wxTopLevelWindowGTK::DoSetClientSize(int width, int height) { + base_type::DoSetClientSize(width, height); + // Since client size is being explicitly set, don't change it later + // Has to be done after calling base because it calls SetSize, + // which sets this true m_deferShowAllowed = false; - - wxTopLevelWindowBase::DoSetClientSize(width, height); } void wxTopLevelWindowGTK::DoGetClientSize( int *width, int *height ) const @@ -1015,7 +1037,7 @@ void wxTopLevelWindowGTK::DoSetSizeHints( int minW, int minH, int maxW, int maxH, int incW, int incH ) { - wxTopLevelWindowBase::DoSetSizeHints( minW, minH, maxW, maxH, incW, incH ); + base_type::DoSetSizeHints(minW, minH, maxW, maxH, incW, incH); const wxSize minSize = GetMinSize(); const wxSize maxSize = GetMaxSize(); @@ -1157,7 +1179,7 @@ void wxTopLevelWindowGTK::SetIcons( const wxIconBundle &icons ) { wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") ); - wxTopLevelWindowBase::SetIcons( icons ); + base_type::SetIcons(icons); // Setting icons before window is realized can cause a GTK assertion if // another TLW is realized before this one, and it has this one as it's @@ -1399,7 +1421,7 @@ bool wxTopLevelWindowGTK::SetTransparent(wxByte alpha) bool wxTopLevelWindowGTK::CanSetTransparent() { // allow to override automatic detection as it's far from perfect - static const wxChar *SYSOPT_TRANSPARENT = wxT("gtk.tlw.can-set-transparent"); + const wxString SYSOPT_TRANSPARENT = "gtk.tlw.can-set-transparent"; if ( wxSystemOptions::HasOption(SYSOPT_TRANSPARENT) ) { return wxSystemOptions::GetOptionInt(SYSOPT_TRANSPARENT) != 0;