projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Small warning fixes.
[wxWidgets.git]
/
src
/
x11
/
window.cpp
diff --git
a/src/x11/window.cpp
b/src/x11/window.cpp
index 5901a58e809e45f1dd8547ceb8ba89e72c3dbcbf..a76272ca40d3ada711eac133b9be0a736a060c1a 100644
(file)
--- a/
src/x11/window.cpp
+++ b/
src/x11/window.cpp
@@
-17,7
+17,7
@@
// headers
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
-#if
def __GNUG__
+#if
defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "window.h"
#endif
#pragma implementation "window.h"
#endif
@@
-62,8
+62,6
@@
// global variables for this module
// ----------------------------------------------------------------------------
// global variables for this module
// ----------------------------------------------------------------------------
-extern wxHashTable *wxWidgetHashTable;
-extern wxHashTable *wxClientWidgetHashTable;
static wxWindow* g_captureWindow = NULL;
static GC g_eraseGC;
static wxWindow* g_captureWindow = NULL;
static GC g_eraseGC;
@@
-99,9
+97,6
@@
END_EVENT_TABLE()
void wxWindowX11::Init()
{
void wxWindowX11::Init()
{
- // generic initializations first
- InitBase();
-
// X11-specific
m_mainWindow = (WXWindow) 0;
m_clientWindow = (WXWindow) 0;
// X11-specific
m_mainWindow = (WXWindow) 0;
m_clientWindow = (WXWindow) 0;
@@
-111,7
+106,6
@@
void wxWindowX11::Init()
m_winCaptured = FALSE;
m_needsInputFocus = FALSE;
m_isShown = TRUE;
m_winCaptured = FALSE;
m_needsInputFocus = FALSE;
m_isShown = TRUE;
- m_isBeingDeleted = FALSE;
m_lastTS = 0;
m_lastButton = 0;
}
m_lastTS = 0;
m_lastButton = 0;
}
@@
-123,7
+117,7
@@
bool wxWindowX11::Create(wxWindow *parent, wxWindowID id,
long style,
const wxString& name)
{
long style,
const wxString& name)
{
- wxCHECK_MSG( parent, FALSE,
"can't create wxWindow without parent"
);
+ wxCHECK_MSG( parent, FALSE,
wxT("can't create wxWindow without parent")
);
CreateBase(parent, id, pos, size, style, wxDefaultValidator, name);
CreateBase(parent, id, pos, size, style, wxDefaultValidator, name);
@@
-224,7
+218,7
@@
bool wxWindowX11::Create(wxWindow *parent, wxWindowID id,
KeymapStateMask | FocusChangeMask | ColormapChangeMask | StructureNotifyMask |
PropertyChangeMask | VisibilityChangeMask ;
KeymapStateMask | FocusChangeMask | ColormapChangeMask | StructureNotifyMask |
PropertyChangeMask | VisibilityChangeMask ;
- if (
HasFlag( wxNO_
FULL_REPAINT_ON_RESIZE ))
+ if (
!HasFlag( wx
FULL_REPAINT_ON_RESIZE ))
{
xattributes_mask |= CWBitGravity;
xattributes.bit_gravity = StaticGravity;
{
xattributes_mask |= CWBitGravity;
xattributes.bit_gravity = StaticGravity;
@@
-304,7
+298,7
@@
bool wxWindowX11::Create(wxWindow *parent, wxWindowID id,
KeymapStateMask | FocusChangeMask | ColormapChangeMask | StructureNotifyMask |
PropertyChangeMask | VisibilityChangeMask ;
KeymapStateMask | FocusChangeMask | ColormapChangeMask | StructureNotifyMask |
PropertyChangeMask | VisibilityChangeMask ;
- if (
HasFlag( wxNO_
FULL_REPAINT_ON_RESIZE ))
+ if (
!HasFlag( wx
FULL_REPAINT_ON_RESIZE ))
{
xattributes_mask |= CWBitGravity;
xattributes.bit_gravity = NorthWestGravity;
{
xattributes_mask |= CWBitGravity;
xattributes.bit_gravity = NorthWestGravity;
@@
-348,9
+342,6
@@
wxWindowX11::~wxWindowX11()
m_isBeingDeleted = TRUE;
m_isBeingDeleted = TRUE;
- if (m_parent)
- m_parent->RemoveChild( this );
-
DestroyChildren();
if (m_clientWindow != m_mainWindow)
DestroyChildren();
if (m_clientWindow != m_mainWindow)
@@
-403,7
+394,7
@@
void wxWindowX11::SetFocus()
}
// Get the window with the focus
}
// Get the window with the focus
-wxWindow *wxWindowBase::FindFocus()
+wxWindow *wxWindowBase::
Do
FindFocus()
{
Window xfocus = (Window) 0;
int revert = 0;
{
Window xfocus = (Window) 0;
int revert = 0;
@@
-471,7
+462,7
@@
void wxWindowX11::DoCaptureMouse()
{
if ((g_captureWindow != NULL) && (g_captureWindow != this))
{
{
if ((g_captureWindow != NULL) && (g_captureWindow != this))
{
- wxASSERT_MSG(FALSE,
"Trying to capture before mouse released."
);
+ wxASSERT_MSG(FALSE,
wxT("Trying to capture before mouse released.")
);
// Core dump now
int *tmp = NULL;
// Core dump now
int *tmp = NULL;
@@
-882,13
+873,6
@@
void wxWindowX11::DoSetClientSize(int width, int height)
}
}
}
}
-// For implementation purposes - sometimes decorations make the client area
-// smaller
-wxPoint wxWindowX11::GetClientAreaOrigin() const
-{
- return wxPoint(0, 0);
-}
-
void wxWindowX11::DoMoveWindow(int x, int y, int width, int height)
{
Window xwindow = (Window) m_mainWindow;
void wxWindowX11::DoMoveWindow(int x, int y, int width, int height)
{
Window xwindow = (Window) m_mainWindow;
@@
-949,7
+933,7
@@
void wxWindowX11::DoMoveWindow(int x, int y, int width, int height)
#endif
}
#endif
}
-void wxWindowX11::SetSizeHints(int minW, int minH, int maxW, int maxH, int incW, int incH)
+void wxWindowX11::
Do
SetSizeHints(int minW, int minH, int maxW, int maxH, int incW, int incH)
{
m_minWidth = minW;
m_minHeight = minH;
{
m_minWidth = minW;
m_minHeight = minH;
@@
-989,7
+973,7
@@
void wxWindowX11::SetSizeHints(int minW, int minH, int maxW, int maxH, int incW,
int wxWindowX11::GetCharHeight() const
{
int wxWindowX11::GetCharHeight() const
{
- wxCHECK_MSG( m_font.Ok(), 0,
"valid window font needed"
);
+ wxCHECK_MSG( m_font.Ok(), 0,
wxT("valid window font needed")
);
#if wxUSE_UNICODE
// There should be an easier way.
#if wxUSE_UNICODE
// There should be an easier way.
@@
-1016,7
+1000,7
@@
int wxWindowX11::GetCharHeight() const
int wxWindowX11::GetCharWidth() const
{
int wxWindowX11::GetCharWidth() const
{
- wxCHECK_MSG( m_font.Ok(), 0,
"valid window font needed"
);
+ wxCHECK_MSG( m_font.Ok(), 0,
wxT("valid window font needed")
);
#if wxUSE_UNICODE
// There should be an easier way.
#if wxUSE_UNICODE
// There should be an easier way.
@@
-1163,14
+1147,6
@@
void wxWindowX11::Update()
}
}
}
}
-void wxWindowX11::Clear()
-{
-// wxClientDC dc((wxWindow*) this);
-// wxBrush brush(GetBackgroundColour(), wxSOLID);
-// dc.SetBackground(brush);
-// dc.Clear();
-}
-
void wxWindowX11::SendEraseEvents()
{
if (m_clearRegion.IsEmpty()) return;
void wxWindowX11::SendEraseEvents()
{
if (m_clearRegion.IsEmpty()) return;
@@
-1261,7
+1237,7
@@
void wxWindowX11::SendNcPaintEvents()
// Responds to colour changes: passes event on to children.
void wxWindowX11::OnSysColourChanged(wxSysColourChangedEvent& event)
{
// Responds to colour changes: passes event on to children.
void wxWindowX11::OnSysColourChanged(wxSysColourChangedEvent& event)
{
- wxWindowList::
Node *
node = GetChildren().GetFirst();
+ wxWindowList::
compatibility_iterator
node = GetChildren().GetFirst();
while ( node )
{
// Only propagate to non-top-level windows
while ( node )
{
// Only propagate to non-top-level windows
@@
-1269,7
+1245,7
@@
void wxWindowX11::OnSysColourChanged(wxSysColourChangedEvent& event)
if ( win->GetParent() )
{
wxSysColourChangedEvent event2;
if ( win->GetParent() )
{
wxSysColourChangedEvent event2;
- event.
m_eventObject = win
;
+ event.
SetEventObject(win)
;
win->GetEventHandler()->ProcessEvent(event2);
}
win->GetEventHandler()->ProcessEvent(event2);
}
@@
-1287,7
+1263,8
@@
void wxWindowX11::OnInternalIdle()
// This calls the UI-update mechanism (querying windows for
// menu/toolbar/control state information)
// This calls the UI-update mechanism (querying windows for
// menu/toolbar/control state information)
- UpdateWindowUI();
+ if (wxUpdateUIEvent::CanUpdate((wxWindow*) this))
+ UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
// Set the input focus if couldn't do it before
if (m_needsInputFocus)
// Set the input focus if couldn't do it before
if (m_needsInputFocus)
@@
-1307,73
+1284,71
@@
void wxWindowX11::OnInternalIdle()
}
// ----------------------------------------------------------------------------
}
// ----------------------------------------------------------------------------
-// function which maintain the global hash table mapping Widgets to wxWi
ndow
s
+// function which maintain the global hash table mapping Widgets to wxWi
dget
s
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
-
bool wxAddWindowToTable(
Window w, wxWindow *win)
+
static bool DoAddWindowToTable(wxWindowHash *hash,
Window w, wxWindow *win)
{
{
- wxWindow *oldItem = NULL;
- if ((oldItem = (wxWindow *)wxWidgetHashTable->Get ((long) w)))
+ if ( !hash->insert(wxWindowHash::value_type(w, win)).second )
{
{
- wxLogDebug( wxT("Widget table clash: new widget is
%ld
, %s"),
- (
long
)w, win->GetClassInfo()->GetClassName());
+ wxLogDebug( wxT("Widget table clash: new widget is
0x%08x
, %s"),
+ (
unsigned int
)w, win->GetClassInfo()->GetClassName());
return FALSE;
}
return FALSE;
}
- wxWidgetHashTable->Put((long) w, win);
-
wxLogTrace( wxT("widget"), wxT("XWindow 0x%08x <-> window %p (%s)"),
(unsigned int) w, win, win->GetClassInfo()->GetClassName());
return TRUE;
}
wxLogTrace( wxT("widget"), wxT("XWindow 0x%08x <-> window %p (%s)"),
(unsigned int) w, win, win->GetClassInfo()->GetClassName());
return TRUE;
}
-
wxWindow *wxGetWindowFromTable(
Window w)
+
static inline wxWindow *DoGetWindowFromTable(wxWindowHash *hash,
Window w)
{
{
- return (wxWindow *)wxWidgetHashTable->Get((long) w);
+ wxWindowHash::iterator i = hash->find(w);
+ return i == hash->end() ? NULL : i->second;
}
}
-
void wxDeleteWindowFromTable(
Window w)
+
static inline void DoDeleteWindowFromTable(wxWindowHash *hash,
Window w)
{
{
- wxWidgetHashTable->Delete((long)w);
+ wxLogTrace( wxT("widget"), wxT("XWindow 0x%08x deleted"), (unsigned int) w);
+
+ hash->erase(w);
}
// ----------------------------------------------------------------------------
}
// ----------------------------------------------------------------------------
-//
function which maintain the global hash table mapping client widget
s
+//
public wrapper
s
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
-bool wxAdd
Client
WindowToTable(Window w, wxWindow *win)
+bool wxAddWindowToTable(Window w, wxWindow *win)
{
{
- wxWindow *oldItem = NULL;
- if ((oldItem = (wxWindow *)wxClientWidgetHashTable->Get ((long) w)))
- {
- wxLogDebug( wxT("Client window table clash: new window is %ld, %s"),
- (long)w, win->GetClassInfo()->GetClassName());
- return FALSE;
- }
+ return DoAddWindowToTable(wxWidgetHashTable, w, win);
+}
- wxClientWidgetHashTable->Put((long) w, win);
+wxWindow *wxGetWindowFromTable(Window w)
+{
+ return DoGetWindowFromTable(wxWidgetHashTable, w);
+}
- wxLogTrace( wxT("widget"), wxT("XWindow 0x%08x <-> window %p (%s)"),
- (unsigned int) w, win, win->GetClassInfo()->GetClassName());
+void wxDeleteWindowFromTable(Window w)
+{
+ DoDeleteWindowFromTable(wxWidgetHashTable, w);
+}
- return TRUE;
+bool wxAddClientWindowToTable(Window w, wxWindow *win)
+{
+ return DoAddWindowToTable(wxClientWidgetHashTable, w, win);
}
wxWindow *wxGetClientWindowFromTable(Window w)
{
}
wxWindow *wxGetClientWindowFromTable(Window w)
{
- return
(wxWindow *)wxClientWidgetHashTable->Get((long)
w);
+ return
DoGetWindowFromTable(wxClientWidgetHashTable,
w);
}
void wxDeleteClientWindowFromTable(Window w)
{
}
void wxDeleteClientWindowFromTable(Window w)
{
-
wxClientWidgetHashTable->Delete((long)
w);
+
DoDeleteWindowFromTable(wxClientWidgetHashTable,
w);
}
}
-// ----------------------------------------------------------------------------
-// add/remove window from the table
-// ----------------------------------------------------------------------------
-
// ----------------------------------------------------------------------------
// X11-specific accessors
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// X11-specific accessors
// ----------------------------------------------------------------------------
@@
-1593,7
+1568,7
@@
bool wxWindowX11::SetForegroundColour(const wxColour& col)
wxWindow *wxGetActiveWindow()
{
// TODO
wxWindow *wxGetActiveWindow()
{
// TODO
- wxFAIL_MSG(
"Not implemented"
);
+ wxFAIL_MSG(
wxT("Not implemented")
);
return NULL;
}
return NULL;
}