X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/85a0a12a9c6fe2885c0de8801e91a2f6d6e4119a..38f833b10c071603eb8d7739ab31b1c07c4576f1:/src/gtk/toplevel.cpp diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp index f599caeab3..8a294525a4 100644 --- a/src/gtk/toplevel.cpp +++ b/src/gtk/toplevel.cpp @@ -25,22 +25,16 @@ #include "wx/toplevel.h" #ifndef WX_PRECOMP + #include "wx/frame.h" + #include "wx/icon.h" #include "wx/log.h" #include "wx/app.h" - #include "wx/dcclient.h" - #include "wx/dialog.h" - #include "wx/timer.h" - #include "wx/settings.h" - #include "wx/control.h" #endif #include "wx/gtk/private.h" #include "wx/evtloop.h" -#include -#include #include -#include #include #include "wx/gtk/win_gtk.h" @@ -117,8 +111,7 @@ static gboolean gtk_frame_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxTopLevelWindowGTK *win ) { - if (g_isIdle) - wxapp_install_idle_handler(); + // don't need to install idle handler, its done from "event" signal switch ( g_sendActivateEvent ) { @@ -179,8 +172,7 @@ static gboolean gtk_frame_focus_out_callback( GtkWidget *widget, GdkEventFocus *WXUNUSED(gdk_event), wxTopLevelWindowGTK *win ) { - if (g_isIdle) - wxapp_install_idle_handler(); + // don't need to install idle handler, its done from "event" signal // if the focus goes out of our app alltogether, OnIdle() will send // wxActivateEvent, otherwise gtk_window_focus_in_callback() will reset @@ -210,13 +202,14 @@ static gboolean gtk_frame_focus_out_callback( GtkWidget *widget, //----------------------------------------------------------------------------- extern "C" { -static gboolean gtk_frame_focus_callback( GtkWidget *widget, GtkDirectionType WXUNUSED(d), wxWindow *WXUNUSED(win) ) +static gboolean gtk_frame_focus_callback( GtkWidget *WXUNUSED(widget), + GtkDirectionType WXUNUSED(d), + wxWindow *WXUNUSED(win) ) { if (g_isIdle) wxapp_install_idle_handler(); // This disables GTK's tab traversal - g_signal_stop_emission_by_name (widget, "focus"); return TRUE; } } @@ -246,8 +239,10 @@ static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* (int)alloc->height ); */ + // Tell the wxWindow class about the new size win->m_width = alloc->width; win->m_height = alloc->height; + win->GtkUpdateSize(); } } @@ -263,8 +258,7 @@ gtk_frame_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxTopLevelWindowGTK *win ) { - if (g_isIdle) - wxapp_install_idle_handler(); + // don't need to install idle handler, its done from "event" signal if (win->IsEnabled() && (g_openDialogs == 0 || (win->GetExtraStyle() & wxTOPLEVEL_EX_DIALOG) || @@ -286,8 +280,7 @@ gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *WXUNUSED(event), wxTopLevelWindowGTK *win ) { - if (g_isIdle) - wxapp_install_idle_handler(); + // don't need to install idle handler, its done from "event" signal if (!win->m_hasVMT || !win->IsShown()) return FALSE; @@ -811,7 +804,7 @@ bool wxTopLevelWindowGTK::Show( bool show ) much ugly flicker or from within the size_allocate handler, because GTK 1.1.X forbids that. */ - GtkOnSize( m_x, m_y, m_width, m_height ); + GtkOnSize(); } // This seems no longer to be needed and the call @@ -863,7 +856,7 @@ void wxTopLevelWindowGTK::DoSetSize( int x, int y, int width, int height, int si } if (width != -1) m_width = width; if (height != -1) m_height = height; - + /* if ((sizeFlags & wxSIZE_AUTO_WIDTH) == wxSIZE_AUTO_WIDTH) { @@ -924,15 +917,17 @@ void wxTopLevelWindowGTK::DoGetClientSize( int *width, int *height ) const { wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") ); - wxWindow::DoGetClientSize( width, height ); if (height) { - // mini edge - *height -= m_miniEdge*2 + m_miniTitle; + *height = m_height - 2 * m_miniEdge + m_miniTitle; + if (*height < 0) + *height = 0; } if (width) { - *width -= m_miniEdge*2; + *width = m_width - 2 * m_miniEdge; + if (*width < 0) + *width = 0; } } @@ -944,22 +939,14 @@ void wxTopLevelWindowGTK::DoSetClientSize( int width, int height ) width + m_miniEdge*2, height + m_miniEdge*2 + m_miniTitle, 0); } -void wxTopLevelWindowGTK::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), - int width, int height ) +void wxTopLevelWindowGTK::GtkOnSize() { - // due to a bug in gtk, x,y are always 0 - // m_x = x; - // m_y = y; - // avoid recursions if (m_resizing) return; m_resizing = true; if ( m_wxwindow == NULL ) return; - m_width = width; - m_height = height; - /* wxMDIChildFrame derives from wxFrame but it _is_ a wxWindow as it uses wxWindow::Create to create it's GTK equivalent. m_mainWidget is only set in wxFrame::Create so it is used to check what kind of frame we @@ -1036,7 +1023,12 @@ void wxTopLevelWindowGTK::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int client_y = m_miniEdge + m_miniTitle; int client_w = m_width - 2*m_miniEdge; int client_h = m_height - 2*m_miniEdge - m_miniTitle; + if (client_w < 0) + client_w = 0; + if (client_h < 0) + client_h = 0; + // Let the parent perform the resize gtk_pizza_set_size( GTK_PIZZA(m_mainWidget), m_wxwindow, client_x, client_y, client_w, client_h ); @@ -1061,7 +1053,7 @@ void wxTopLevelWindowGTK::OnInternalIdle() { if (!m_sizeSet && GTK_WIDGET_REALIZED(m_wxwindow)) { - GtkOnSize( m_x, m_y, m_width, m_height ); + GtkOnSize(); // we'll come back later if (g_isIdle)