X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/347918966970177f4ee7b70fcf29041c193d972d..88e3652fd0c13feb4fcd843bd0d1167ab84041c1:/src/gtk1/window.cpp diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index 9ca920d581..d9e5d422b1 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -8,15 +8,17 @@ ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "window.h" #endif +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + #ifdef __VMS #define XWarpPointer XWARPPOINTER #endif -#include "wx/defs.h" #include "wx/window.h" #include "wx/dcclient.h" #include "wx/frame.h" @@ -255,6 +257,10 @@ wxWindowGTK *g_delayedFocus = (wxWindowGTK*) NULL; // send any activate events at all static int g_sendActivateEvent = -1; +// hack: we need something to pass to gtk_menu_popup, so we store the time of +// the last click here +static guint32 gs_timeLastClick = 0; + extern bool g_mainThreadLocked; //----------------------------------------------------------------------------- @@ -522,6 +528,18 @@ static int gtk_window_expose_callback( GtkWidget *widget, (int)gdk_event->area.width, (int)gdk_event->area.height ); } + + gtk_paint_box + ( + win->m_wxwindow->style, + pizza->bin_window, + GTK_STATE_NORMAL, + GTK_SHADOW_OUT, + (GdkRectangle*) NULL, + win->m_wxwindow, + (char *)"button", // const_cast + 20,20,24,24 + ); #endif win->GetUpdateRegion() = wxRegion( gdk_event->region ); @@ -593,10 +611,11 @@ static void gtk_window_draw_callback( GtkWidget *widget, if (g_isIdle) wxapp_install_idle_handler(); - // The wxNO_FULL_REPAINT_ON_RESIZE flag only works if - // there are no child windows. - if ((win->HasFlag(wxNO_FULL_REPAINT_ON_RESIZE)) && - (win->GetChildren().GetCount() == 0)) + // if there are any children we must refresh everything + // + // VZ: why? + if ( !win->HasFlag(wxFULL_REPAINT_ON_RESIZE) && + win->GetChildren().IsEmpty() ) { return; } @@ -1242,8 +1261,8 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, #ifdef __WXGTK20__ static void gtk_wxwindow_commit_cb (GtkIMContext *context, - const gchar *str, - wxWindow *window) + const gchar *str, + wxWindow *window) { bool ret = FALSE; @@ -1503,7 +1522,8 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEvent *peek_event = gdk_event_peek(); if (peek_event) { - if (peek_event->type == GDK_2BUTTON_PRESS) + if ((peek_event->type == GDK_2BUTTON_PRESS) || + (peek_event->type == GDK_3BUTTON_PRESS)) { gdk_event_free( peek_event ); return TRUE; @@ -1523,6 +1543,7 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, { case GDK_BUTTON_PRESS: event_type = wxEVT_LEFT_DOWN; break; case GDK_2BUTTON_PRESS: event_type = wxEVT_LEFT_DCLICK; break; + case GDK_3BUTTON_PRESS: return FALSE; default: break; } } @@ -1582,6 +1603,8 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, if ( !g_captureWindow ) win = FindWindowForMouseEvent(win, event.m_x, event.m_y); + gs_timeLastClick = gdk_event->time; + /* wxPrintf( wxT("2) OnButtonPress from ") ); if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) @@ -2645,9 +2668,6 @@ wxWindowGTK::~wxWindowGTK() DestroyChildren(); - if (m_parent) - m_parent->RemoveChild( this ); - #ifdef HAVE_XIM if (m_ic) gdk_ic_destroy (m_ic); @@ -2729,13 +2749,13 @@ void wxWindowGTK::PostCreation() gtk_signal_connect( GTK_OBJECT(m_wxwindow), "draw", GTK_SIGNAL_FUNC(gtk_window_draw_callback), (gpointer)this ); - if (HasFlag(wxNO_FULL_REPAINT_ON_RESIZE)) + if (!HasFlag(wxFULL_REPAINT_ON_RESIZE)) { gtk_signal_connect( GTK_OBJECT(m_wxwindow), "event", GTK_SIGNAL_FUNC(gtk_window_event_event_callback), (gpointer)this ); } #else - // gtk_widget_set_redraw_on_allocate( GTK_WIDGET(m_wxwindow), HasFlag( wxNO_FULL_REPAINT_ON_RESIZE ) ); + // gtk_widget_set_redraw_on_allocate( GTK_WIDGET(m_wxwindow), !HasFlag( wxFULL_REPAINT_ON_RESIZE ) ); #endif #ifdef __WXGTK20__ @@ -2864,9 +2884,9 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags int currentX, currentY; GetPosition(¤tX, ¤tY); - if (x == -1) + if (x == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE)) x = currentX; - if (y == -1) + if (y == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE)) y = currentY; AdjustForParentClientOrigin(x, y, sizeFlags); @@ -3854,7 +3874,7 @@ void wxWindowGTK::GtkSendPaintEvents() m_updateRegion.Clear(); } -void wxWindowGTK::Clear() +void wxWindowGTK::ClearBackground() { wxCHECK_RET( m_widget != NULL, wxT("invalid window") ); @@ -4214,7 +4234,7 @@ bool wxWindowGTK::DoPopupMenu( wxMenu *menu, int x, int y ) #ifdef __WXGTK20__ gtk_get_current_event_time() #else - GDK_CURRENT_TIME + gs_timeLastClick // the time of activation #endif );