X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/da7f8ac4dde063341f7914213cc06b54777cc145..36af0bc423a1c7bd50d7454f11f439b1628631ca:/src/gtk/window.cpp diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index f8b92ef534..74ab35d9c7 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -108,7 +108,9 @@ void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle *rect, //----------------------------------------------------------------------------- // size -// I don't any longer intercept GTK's internal resize events (except frames) +// I don't any longer intercept GTK's internal resize events, except +// for frames and from within MDI and tabbed windows (client area +// size determined internally by GTK, not wxWin). /* void gtk_window_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxWindow *win ) @@ -414,9 +416,9 @@ gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_e //----------------------------------------------------------------------------- // focus_in -void gtk_window_focus_in_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxWindow *win ) +gint gtk_window_focus_in_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxWindow *win ) { - if (g_blockEventsOnDrag) return; + if (g_blockEventsOnDrag) return FALSE; if (win->m_wxwindow) { if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow)) @@ -431,7 +433,7 @@ void gtk_window_focus_in_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUS }; }; - if (!win->HasVMT()) return; + if (!win->HasVMT()) return FALSE; /* printf( "OnSetFocus from " ); @@ -444,22 +446,22 @@ void gtk_window_focus_in_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUS wxFocusEvent event( wxEVT_SET_FOCUS, win->GetId() ); event.SetEventObject( win ); - win->ProcessEvent( event ); + return win->ProcessEvent( event ); }; //----------------------------------------------------------------------------- // focus out -void gtk_window_focus_out_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxWindow *win ) +gint gtk_window_focus_out_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxWindow *win ) { - if (g_blockEventsOnDrag) return; + if (g_blockEventsOnDrag) return FALSE; if (win->m_wxwindow) { if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow)) GTK_WIDGET_UNSET_FLAGS (win->m_wxwindow, GTK_HAS_FOCUS); }; - if (!win->HasVMT()) return; + if (!win->HasVMT()) return FALSE; /* printf( "OnKillFocus from " ); @@ -470,7 +472,7 @@ void gtk_window_focus_out_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNU wxFocusEvent event( wxEVT_KILL_FOCUS, win->GetId() ); event.SetEventObject( win ); - win->ProcessEvent( event ); + return win->ProcessEvent( event ); }; //----------------------------------------------------------------------------- @@ -648,27 +650,35 @@ bool gtk_window_destroy_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSE //----------------------------------------------------------------------------- // enter -bool gtk_window_enter_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win ) +bool gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win ) { + if (widget->window != gdk_event->window) return TRUE; + if (g_blockEventsOnDrag) return FALSE; if (widget->window) gdk_window_set_cursor( widget->window, win->m_cursor->GetCursor() ); - return TRUE; + wxMouseEvent event( wxEVT_ENTER_WINDOW ); + event.SetEventObject( win ); + return win->ProcessEvent( event ); }; //----------------------------------------------------------------------------- // leave -bool gtk_window_leave_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *WXUNUSED(win) ) +bool gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win ) { + if (widget->window != gdk_event->window) return TRUE; + if (g_blockEventsOnDrag) return FALSE; if (widget->window) gdk_window_set_cursor( widget->window, wxSTANDARD_CURSOR->GetCursor() ); - return TRUE; + wxMouseEvent event( wxEVT_LEAVE_WINDOW ); + event.SetEventObject( win ); + return win->ProcessEvent( event ); }; //----------------------------------------------------------------------------- @@ -722,6 +732,7 @@ wxWindow::wxWindow() m_drawingOffsetX = 0; m_drawingOffsetY = 0; m_pDropTarget = NULL; + m_resizing = FALSE; }; wxWindow::wxWindow( wxWindow *parent, wxWindowID id, @@ -905,6 +916,7 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id, m_drawingOffsetX = 0; m_drawingOffsetY = 0; m_pDropTarget = NULL; + m_resizing = FALSE; } void wxWindow::PostCreation(void) @@ -1051,6 +1063,9 @@ void wxWindow::ImplementSetPosition(void) void wxWindow::SetSize( int x, int y, int width, int height, int sizeFlags ) { + if (m_resizing) return; // I don't like recursions + m_resizing = TRUE; + int newX = x; int newY = y; int newW = width; @@ -1091,6 +1106,8 @@ void wxWindow::SetSize( int x, int y, int width, int height, int sizeFlags ) wxSizeEvent event( wxSize(m_width,m_height), GetId() ); event.SetEventObject( this ); ProcessEvent( event ); + + m_resizing = FALSE; }; void wxWindow::SetSize( int width, int height ) @@ -1105,8 +1122,8 @@ void wxWindow::Move( int x, int y ) void wxWindow::GetSize( int *width, int *height ) const { - (*width) = m_width; - (*height) = m_height; + if (width) (*width) = m_width; + if (height) (*height) = m_height; }; void wxWindow::SetClientSize( int width, int height ) @@ -1415,6 +1432,8 @@ void wxWindow::AddChild( wxWindow *child ) }; }; + // wxNotebooks are very special, so they have their own AddChild + if (IsKindOf(CLASSINFO(wxNotebook))) { wxNotebook *tab = (wxNotebook*)this; @@ -1820,7 +1839,7 @@ void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible, m_vAdjust->page_increment = (float)(wxMax(fthumb-2,0)); m_vAdjust->page_size = fthumb; }; - + if (m_wxwindow->window) { if (orient == wxHORIZONTAL) @@ -1828,7 +1847,7 @@ void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible, else gtk_signal_emit_by_name( GTK_OBJECT(m_vAdjust), "changed" ); -// gtk_widget_set_usize( m_widget, m_width, m_height ); + gtk_widget_set_usize( m_widget, m_width, m_height ); }; };