projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Correct sorting in wxDataViewTreeStore, fixes #11436, part II
[wxWidgets.git]
/
src
/
gtk1
/
window.cpp
diff --git
a/src/gtk1/window.cpp
b/src/gtk1/window.cpp
index a2e39a0d661ed67d2203506e8152b5fdb8afa2b6..2618e11b8c69eee42ec3e6dee37fa58df1bd70bc 100644
(file)
--- a/
src/gtk1/window.cpp
+++ b/
src/gtk1/window.cpp
@@
-49,7
+49,7
@@
#include "wx/fontutil.h"
#include "wx/fontutil.h"
-#if
def __WXDEBUG__
+#if
wxDEBUG_LEVEL
#include "wx/thread.h"
#endif
#include "wx/thread.h"
#endif
@@
-207,19
+207,19
@@
static GdkGC *g_eraseGC = NULL;
// mouse capture state: the window which has it and if the mouse is currently
// inside it
// mouse capture state: the window which has it and if the mouse is currently
// inside it
-static wxWindowGTK *g_captureWindow =
(wxWindowGTK*)
NULL;
+static wxWindowGTK *g_captureWindow = NULL;
static bool g_captureWindowHasMouse = false;
static bool g_captureWindowHasMouse = false;
-wxWindowGTK *g_focusWindow =
(wxWindowGTK*)
NULL;
+wxWindowGTK *g_focusWindow = NULL;
// the last window which had the focus - this is normally never NULL (except
// if we never had focus at all) as even when g_focusWindow is NULL it still
// keeps its previous value
// the last window which had the focus - this is normally never NULL (except
// if we never had focus at all) as even when g_focusWindow is NULL it still
// keeps its previous value
-wxWindowGTK *g_focusWindowLast =
(wxWindowGTK*)
NULL;
+wxWindowGTK *g_focusWindowLast = NULL;
// If a window get the focus set but has not been realized
// yet, defer setting the focus to idle time.
// If a window get the focus set but has not been realized
// yet, defer setting the focus to idle time.
-wxWindowGTK *g_delayedFocus =
(wxWindowGTK*)
NULL;
+wxWindowGTK *g_delayedFocus = NULL;
// hack: we need something to pass to gtk_menu_popup, so we store the time of
// the last click here (extern: used from gtk/menu.cpp)
// hack: we need something to pass to gtk_menu_popup, so we store the time of
// the last click here (extern: used from gtk/menu.cpp)
@@
-227,7
+227,7
@@
guint32 wxGtkTimeLastClick = 0;
// global variables because GTK+ DnD want to have the
// mouse event that caused it
// global variables because GTK+ DnD want to have the
// mouse event that caused it
-GdkEvent *g_lastMouseEvent =
(GdkEvent*)
NULL;
+GdkEvent *g_lastMouseEvent = NULL;
int g_lastButtonNumber = 0;
extern bool g_mainThreadLocked;
int g_lastButtonNumber = 0;
extern bool g_mainThreadLocked;
@@
-236,19
+236,16
@@
extern bool g_mainThreadLocked;
// debug
//-----------------------------------------------------------------------------
// debug
//-----------------------------------------------------------------------------
-#ifdef __WXDEBUG__
-
#if wxUSE_THREADS
#if wxUSE_THREADS
-# define DEBUG_MAIN_THREAD if (wxThread::IsMain() && g_mainThreadLocked) printf("gui reentrance");
+# define DEBUG_MAIN_THREAD \
+ wxASSERT_MSG( !g_mainThreadLocked || !wxThread::IsMain(), \
+ "GUI reentrancy detected" );
#else
# define DEBUG_MAIN_THREAD
#endif
#else
# define DEBUG_MAIN_THREAD
#endif
-#else
-#define DEBUG_MAIN_THREAD
-#endif // Debug
// the trace mask used for the focus debugging messages
// the trace mask used for the focus debugging messages
-#define TRACE_FOCUS
_
T("focus")
+#define TRACE_FOCUS
wx
T("focus")
//-----------------------------------------------------------------------------
// missing gdk functions
//-----------------------------------------------------------------------------
// missing gdk functions
@@
-294,7
+291,7
@@
wxWindow *wxFindFocusedChild(wxWindowGTK *win)
{
wxWindow *winFocus = wxWindowGTK::FindFocus();
if ( !winFocus )
{
wxWindow *winFocus = wxWindowGTK::FindFocus();
if ( !winFocus )
- return
(wxWindow *)
NULL;
+ return NULL;
if ( winFocus == win )
return (wxWindow *)win;
if ( winFocus == win )
return (wxWindow *)win;
@@
-308,7
+305,7
@@
wxWindow *wxFindFocusedChild(wxWindowGTK *win)
return child;
}
return child;
}
- return
(wxWindow *)
NULL;
+ return NULL;
}
static void draw_frame( GtkWidget *widget, wxWindowGTK *win )
}
static void draw_frame( GtkWidget *widget, wxWindowGTK *win )
@@
-611,7
+608,7
@@
static void gtk_window_draw_callback( GtkWidget *widget,
GdkRectangle child_area;
if (gtk_widget_intersect (child->widget, rect, &child_area))
{
GdkRectangle child_area;
if (gtk_widget_intersect (child->widget, rect, &child_area))
{
- gtk_widget_draw (child->widget, &child_area /*
(GdkRectangle*)
NULL*/ );
+ gtk_widget_draw (child->widget, &child_area /* NULL*/ );
}
}
#endif
}
}
#endif
@@
-623,7
+620,7
@@
static void gtk_window_draw_callback( GtkWidget *widget,
//-----------------------------------------------------------------------------
// set WXTRACE to this to see the key event codes on the console
//-----------------------------------------------------------------------------
// set WXTRACE to this to see the key event codes on the console
-#define TRACE_KEYS
_
T("keyevent")
+#define TRACE_KEYS
wx
T("keyevent")
// translates an X key symbol to WXK_XXX value
//
// translates an X key symbol to WXK_XXX value
//
@@
-923,7
+920,6
@@
static void wxFillOtherKeyEventFields(wxKeyEvent& event,
event.m_controlDown = (gdk_event->state & GDK_CONTROL_MASK) != 0;
event.m_altDown = (gdk_event->state & GDK_MOD1_MASK) != 0;
event.m_metaDown = (gdk_event->state & GDK_MOD2_MASK) != 0;
event.m_controlDown = (gdk_event->state & GDK_CONTROL_MASK) != 0;
event.m_altDown = (gdk_event->state & GDK_MOD1_MASK) != 0;
event.m_metaDown = (gdk_event->state & GDK_MOD2_MASK) != 0;
- event.m_scanCode = gdk_event->keyval;
event.m_rawCode = (wxUint32) gdk_event->keyval;
event.m_rawFlags = 0;
#if wxUSE_UNICODE
event.m_rawCode = (wxUint32) gdk_event->keyval;
event.m_rawFlags = 0;
#if wxUSE_UNICODE
@@
-958,9
+954,9
@@
wxTranslateGTKKeyEventToWx(wxKeyEvent& event,
KeySym keysym = gdk_event->keyval;
KeySym keysym = gdk_event->keyval;
- wxLogTrace(TRACE_KEYS,
_
T("Key %s event: keysym = %ld"),
- event.GetEventType() == wxEVT_KEY_UP ?
_
T("release")
- :
_
T("press"),
+ wxLogTrace(TRACE_KEYS,
wx
T("Key %s event: keysym = %ld"),
+ event.GetEventType() == wxEVT_KEY_UP ?
wx
T("release")
+ :
wx
T("press"),
keysym);
long key_code = wxTranslateKeySymToWXKey(keysym, false /* !isChar */);
keysym);
long key_code = wxTranslateKeySymToWXKey(keysym, false /* !isChar */);
@@
-989,7
+985,7
@@
wxTranslateGTKKeyEventToWx(wxKeyEvent& event,
Display *dpy = (Display *)wxGetDisplay();
KeyCode keycode = XKeysymToKeycode(dpy, keysym);
Display *dpy = (Display *)wxGetDisplay();
KeyCode keycode = XKeysymToKeycode(dpy, keysym);
- wxLogTrace(TRACE_KEYS,
_
T("\t-> keycode %d"), keycode);
+ wxLogTrace(TRACE_KEYS,
wx
T("\t-> keycode %d"), keycode);
KeySym keysymNormalized = XKeycodeToKeysym(dpy, keycode, 0);
KeySym keysymNormalized = XKeycodeToKeysym(dpy, keycode, 0);
@@
-1028,7
+1024,7
@@
wxTranslateGTKKeyEventToWx(wxKeyEvent& event,
}
}
}
}
- wxLogTrace(TRACE_KEYS,
_
T("\t-> wxKeyCode %ld"), key_code);
+ wxLogTrace(TRACE_KEYS,
wx
T("\t-> wxKeyCode %ld"), key_code);
// sending unknown key events doesn't really make sense
if ( !key_code )
// sending unknown key events doesn't really make sense
if ( !key_code )
@@
-1180,7
+1176,7
@@
static gint gtk_window_key_press_callback( GtkWidget *widget,
if ( key_code )
{
if ( key_code )
{
- wxLogTrace(TRACE_KEYS,
_
T("Char event: %ld"), key_code);
+ wxLogTrace(TRACE_KEYS,
wx
T("Char event: %ld"), key_code);
event.m_keyCode = key_code;
event.m_keyCode = key_code;
@@
-1433,7
+1429,7
@@
wxWindowGTK *FindWindowForMouseEvent(wxWindowGTK *win, wxCoord& x, wxCoord& y)
}
else
{
}
else
{
- if ((child->m_wxwindow ==
(GtkWidget*)
NULL) &&
+ if ((child->m_wxwindow == NULL) &&
(child->m_x <= xx) &&
(child->m_y <= yy) &&
(child->m_x+child->m_width >= xx) &&
(child->m_x <= xx) &&
(child->m_y <= yy) &&
(child->m_x+child->m_width >= xx) &&
@@
-1824,7
+1820,7
@@
static gint gtk_window_focus_in_callback( GtkWidget *widget,
g_focusWindow = win;
wxLogTrace(TRACE_FOCUS,
g_focusWindow = win;
wxLogTrace(TRACE_FOCUS,
-
_
T("%s: focus in"), win->GetName().c_str());
+
wx
T("%s: focus in"), win->GetName().c_str());
#ifdef HAVE_XIM
if (win->m_ic)
#ifdef HAVE_XIM
if (win->m_ic)
@@
-1872,14
+1868,14
@@
static gint gtk_window_focus_out_callback( GtkWidget *WXUNUSED(widget),
wxapp_install_idle_handler();
wxLogTrace( TRACE_FOCUS,
wxapp_install_idle_handler();
wxLogTrace( TRACE_FOCUS,
-
_
T("%s: focus out"), win->GetName().c_str() );
+
wx
T("%s: focus out"), win->GetName().c_str() );
wxWindowGTK *winFocus = wxFindFocusedChild(win);
if ( winFocus )
win = winFocus;
wxWindowGTK *winFocus = wxFindFocusedChild(win);
if ( winFocus )
win = winFocus;
- g_focusWindow =
(wxWindowGTK *)
NULL;
+ g_focusWindow = NULL;
#ifdef HAVE_XIM
if (win->m_ic)
#ifdef HAVE_XIM
if (win->m_ic)
@@
-2424,9
+2420,9
@@
wxMouseState wxGetMouseState()
void wxWindowGTK::Init()
{
// GTK specific
void wxWindowGTK::Init()
{
// GTK specific
- m_widget =
(GtkWidget *)
NULL;
- m_wxwindow =
(GtkWidget *)
NULL;
- m_focusWidget =
(GtkWidget *)
NULL;
+ m_widget = NULL;
+ m_wxwindow = NULL;
+ m_focusWidget = NULL;
// position/size
m_x = 0;
// position/size
m_x = 0;
@@
-2437,7
+2433,6
@@
void wxWindowGTK::Init()
m_sizeSet = false;
m_hasVMT = false;
m_needParent = true;
m_sizeSet = false;
m_hasVMT = false;
m_needParent = true;
- m_isBeingDeleted = false;
m_noExpose = false;
m_nativeSizeEvent = false;
m_noExpose = false;
m_nativeSizeEvent = false;
@@
-2445,8
+2440,8
@@
void wxWindowGTK::Init()
m_hasScrolling = false;
m_isScrolling = false;
m_hasScrolling = false;
m_isScrolling = false;
- m_hAdjust =
(GtkAdjustment*)
NULL;
- m_vAdjust =
(GtkAdjustment*)
NULL;
+ m_hAdjust = NULL;
+ m_vAdjust = NULL;
m_oldHorizontalPos =
m_oldVerticalPos = 0.0;
m_oldClientWidth =
m_oldHorizontalPos =
m_oldVerticalPos = 0.0;
m_oldClientWidth =
@@
-2466,8
+2461,8
@@
void wxWindowGTK::Init()
m_cursor = *wxSTANDARD_CURSOR;
#ifdef HAVE_XIM
m_cursor = *wxSTANDARD_CURSOR;
#ifdef HAVE_XIM
- m_ic =
(GdkIC*)
NULL;
- m_icattr =
(GdkICAttr*)
NULL;
+ m_ic = NULL;
+ m_icattr = NULL;
#endif
}
#endif
}
@@
-2509,7
+2504,7
@@
bool wxWindowGTK::Create( wxWindow *parent,
m_insertCallback = wxInsertChildInWindow;
m_insertCallback = wxInsertChildInWindow;
- m_widget = gtk_scrolled_window_new(
(GtkAdjustment *) NULL, (GtkAdjustment *)
NULL );
+ m_widget = gtk_scrolled_window_new(
NULL,
NULL );
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
GtkScrolledWindow *scrolledWindow = GTK_SCROLLED_WINDOW(m_widget);
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
GtkScrolledWindow *scrolledWindow = GTK_SCROLLED_WINDOW(m_widget);
@@
-2613,7
+2608,6
@@
wxWindowGTK::~wxWindowGTK()
if ( g_delayedFocus == this )
g_delayedFocus = NULL;
if ( g_delayedFocus == this )
g_delayedFocus = NULL;
- m_isBeingDeleted = true;
m_hasVMT = false;
// destroy children before destroying this window itself
m_hasVMT = false;
// destroy children before destroying this window itself
@@
-2642,13
+2636,13
@@
wxWindowGTK::~wxWindowGTK()
if (m_wxwindow)
{
gtk_widget_destroy( m_wxwindow );
if (m_wxwindow)
{
gtk_widget_destroy( m_wxwindow );
- m_wxwindow =
(GtkWidget*)
NULL;
+ m_wxwindow = NULL;
}
if (m_widget)
{
gtk_widget_destroy( m_widget );
}
if (m_widget)
{
gtk_widget_destroy( m_widget );
- m_widget =
(GtkWidget*)
NULL;
+ m_widget = NULL;
}
}
}
}
@@
-2968,7
+2962,7
@@
void wxWindowGTK::OnInternalIdle()
}
}
}
}
- if (wxUpdateUIEvent::CanUpdate(this) && IsShown())
+ if (wxUpdateUIEvent::CanUpdate(this) && IsShown
OnScreen
())
UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
}
UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
}
@@
-3138,7
+3132,7
@@
void wxWindowGTK::DoClientToScreen( int *x, int *y ) const
if (!m_widget->window) return;
if (!m_widget->window) return;
- GdkWindow *source =
(GdkWindow *)
NULL;
+ GdkWindow *source = NULL;
if (m_wxwindow)
source = GTK_PIZZA(m_wxwindow)->bin_window;
else
if (m_wxwindow)
source = GTK_PIZZA(m_wxwindow)->bin_window;
else
@@
-3167,7
+3161,7
@@
void wxWindowGTK::DoScreenToClient( int *x, int *y ) const
if (!m_widget->window) return;
if (!m_widget->window) return;
- GdkWindow *source =
(GdkWindow *)
NULL;
+ GdkWindow *source = NULL;
if (m_wxwindow)
source = GTK_PIZZA(m_wxwindow)->bin_window;
else
if (m_wxwindow)
source = GTK_PIZZA(m_wxwindow)->bin_window;
else
@@
-3246,12
+3240,12
@@
int wxWindowGTK::GetCharWidth() const
return gdk_string_width( gfont, "g" );
}
return gdk_string_width( gfont, "g" );
}
-void wxWindowGTK::
GetTextExtent(
const wxString& string,
- int *x,
- int *y,
- int *descent,
- int *externalLeading,
-
const wxFont *theFont
) const
+void wxWindowGTK::
DoGetTextExtent(
const wxString& string,
+
int *x,
+
int *y,
+
int *descent,
+
int *externalLeading,
+
const wxFont *theFont
) const
{
wxFont fontToUse = theFont ? *theFont : GetFont();
{
wxFont fontToUse = theFont ? *theFont : GetFont();
@@
-3298,7
+3292,7
@@
void wxWindowGTK::SetFocus()
// it should be focused and will do it later, during the idle
// time, as soon as we can
wxLogTrace(TRACE_FOCUS,
// it should be focused and will do it later, during the idle
// time, as soon as we can
wxLogTrace(TRACE_FOCUS,
-
_
T("Delaying setting focus to %s(%s)"),
+
wx
T("Delaying setting focus to %s(%s)"),
GetClassInfo()->GetClassName(), GetLabel().c_str());
g_delayedFocus = this;
GetClassInfo()->GetClassName(), GetLabel().c_str());
g_delayedFocus = this;
@@
-3306,7
+3300,7
@@
void wxWindowGTK::SetFocus()
else
{
wxLogTrace(TRACE_FOCUS,
else
{
wxLogTrace(TRACE_FOCUS,
-
_
T("Setting focus to %s(%s)"),
+
wx
T("Setting focus to %s(%s)"),
GetClassInfo()->GetClassName(), GetLabel().c_str());
gtk_widget_grab_focus (m_widget);
GetClassInfo()->GetClassName(), GetLabel().c_str());
gtk_widget_grab_focus (m_widget);
@@
-3320,7
+3314,7
@@
void wxWindowGTK::SetFocus()
else
{
wxLogTrace(TRACE_FOCUS,
else
{
wxLogTrace(TRACE_FOCUS,
-
_
T("Can't set focus to %s(%s)"),
+
wx
T("Can't set focus to %s(%s)"),
GetClassInfo()->GetClassName(), GetLabel().c_str());
}
}
GetClassInfo()->GetClassName(), GetLabel().c_str());
}
}
@@
-3431,7
+3425,7
@@
void wxWindowGTK::WarpPointer( int x, int y )
// We provide this function ourselves as it is
// missing in GDK (top of this file).
// We provide this function ourselves as it is
// missing in GDK (top of this file).
- GdkWindow *window =
(GdkWindow*)
NULL;
+ GdkWindow *window = NULL;
if (m_wxwindow)
window = GTK_PIZZA(m_wxwindow)->bin_window;
else
if (m_wxwindow)
window = GTK_PIZZA(m_wxwindow)->bin_window;
else
@@
-3505,7
+3499,7
@@
void wxWindowGTK::Refresh( bool eraseBackground, const wxRect *rect )
}
else
{
}
else
{
- gtk_widget_draw( m_widget,
(GdkRectangle*)
NULL );
+ gtk_widget_draw( m_widget, NULL );
}
}
}
}
}
}
@@
-3583,15
+3577,11
@@
void wxWindowGTK::GtkSendPaintEvents()
}
}
}
}
}
}
- else
-
- // if (!m_clearRegion.IsEmpty()) // Always send an erase event under GTK 1.2
+ else // Always send an erase event under GTK 1.2
{
wxWindowDC dc( (wxWindow*)this );
{
wxWindowDC dc( (wxWindow*)this );
- if (m_clearRegion.IsEmpty())
- dc.SetClippingRegion( m_updateRegion );
- else
- dc.SetClippingRegion( m_clearRegion );
+ dc.SetDeviceClippingRegion( m_clearRegion.IsEmpty() ? m_updateRegion
+ : m_clearRegion );
wxEraseEvent erase_event( GetId(), &dc );
erase_event.SetEventObject( this );
wxEraseEvent erase_event( GetId(), &dc );
erase_event.SetEventObject( this );
@@
-3699,7
+3689,7
@@
void wxWindowGTK::DoSetToolTip( wxToolTip *tip )
void wxWindowGTK::ApplyToolTip( GtkTooltips *tips, const wxChar *tip )
{
wxString tmp( tip );
void wxWindowGTK::ApplyToolTip( GtkTooltips *tips, const wxChar *tip )
{
wxString tmp( tip );
- gtk_tooltips_set_tip( tips, GetConnectWidget(), wxGTK_CONV(tmp),
(gchar*)
NULL );
+ gtk_tooltips_set_tip( tips, GetConnectWidget(), wxGTK_CONV(tmp), NULL );
}
#endif // wxUSE_TOOLTIPS
}
#endif // wxUSE_TOOLTIPS
@@
-3833,7
+3823,7
@@
bool wxWindowGTK::SetBackgroundStyle(wxBackgroundStyle style)
if (style == wxBG_STYLE_CUSTOM)
{
if (style == wxBG_STYLE_CUSTOM)
{
- GdkWindow *window =
(GdkWindow*)
NULL;
+ GdkWindow *window = NULL;
if (m_wxwindow)
window = GTK_PIZZA(m_wxwindow)->bin_window;
else
if (m_wxwindow)
window = GTK_PIZZA(m_wxwindow)->bin_window;
else
@@
-3917,13
+3907,13
@@
void wxWindowGTK::DoCaptureMouse()
{
wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
{
wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
- GdkWindow *window =
(GdkWindow*)
NULL;
+ GdkWindow *window = NULL;
if (m_wxwindow)
window = GTK_PIZZA(m_wxwindow)->bin_window;
else
window = GetConnectWidget()->window;
if (m_wxwindow)
window = GTK_PIZZA(m_wxwindow)->bin_window;
else
window = GetConnectWidget()->window;
- wxCHECK_RET( window,
_
T("CaptureMouse() failed") );
+ wxCHECK_RET( window,
wx
T("CaptureMouse() failed") );
const wxCursor* cursor = &m_cursor;
if (!cursor->Ok())
const wxCursor* cursor = &m_cursor;
if (!cursor->Ok())
@@
-3935,7
+3925,7
@@
void wxWindowGTK::DoCaptureMouse()
GDK_BUTTON_RELEASE_MASK |
GDK_POINTER_MOTION_HINT_MASK |
GDK_POINTER_MOTION_MASK),
GDK_BUTTON_RELEASE_MASK |
GDK_POINTER_MOTION_HINT_MASK |
GDK_POINTER_MOTION_MASK),
-
(GdkWindow *)
NULL,
+ NULL,
cursor->GetCursor(),
(guint32)GDK_CURRENT_TIME );
g_captureWindow = this;
cursor->GetCursor(),
(guint32)GDK_CURRENT_TIME );
g_captureWindow = this;
@@
-3948,9
+3938,9
@@
void wxWindowGTK::DoReleaseMouse()
wxCHECK_RET( g_captureWindow, wxT("can't release mouse - not captured") );
wxCHECK_RET( g_captureWindow, wxT("can't release mouse - not captured") );
- g_captureWindow =
(wxWindowGTK*)
NULL;
+ g_captureWindow = NULL;
- GdkWindow *window =
(GdkWindow*)
NULL;
+ GdkWindow *window = NULL;
if (m_wxwindow)
window = GTK_PIZZA(m_wxwindow)->bin_window;
else
if (m_wxwindow)
window = GTK_PIZZA(m_wxwindow)->bin_window;
else