fixes for the compilation warnings with Sun CC:

1. some fixes for "String literal to char * conversion" warnings (many
   more left in the *.xpm files)
2. fixes for "assignment of function to extern "C" function"
3. a few other miscellaneous ones


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13478 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2002-01-09 12:49:12 +00:00
parent 53fd33dcf1
commit 903506828b
43 changed files with 387 additions and 247 deletions

View File

@@ -706,8 +706,10 @@ int WXDLLEXPORT wxDbConnectionsInUse(void);
// Writes a message to the wxLog window (stdout usually) when an internal error // Writes a message to the wxLog window (stdout usually) when an internal error
// situation occurs. This function only works in DEBUG builds // situation occurs. This function only works in DEBUG builds
const wxChar WXDLLEXPORT *wxDbLogExtendedErrorMsg(const wxChar *userText, wxDb *pDb, const wxChar WXDLLEXPORT *wxDbLogExtendedErrorMsg(const wxChar *userText,
wxChar *ErrFile, int ErrLine); wxDb *pDb,
const wxChar *ErrFile,
int ErrLine);
// This function sets the sql log state for all open wxDb objects // This function sets the sql log state for all open wxDb objects

View File

@@ -235,16 +235,19 @@ typedef int wxWindowID;
#define wxCALLBACK #define wxCALLBACK
#endif // platform #endif // platform
// callling convention for the qsort(3) callback // generic calling convention for the extern "C" functions
#if defined(__VISUALC__) #if defined(__VISUALC__)
#define wxCMPFUNC_CONV _cdecl #define wxC_CALLING_CONV _cdecl
#elif defined(__VISAGECPP__) #elif defined(__VISAGECPP__)
#define wxCMPFUNC_CONV _Optlink #define wxC_CALLING_CONV _Optlink
#else // !Visual C++ #else // !Visual C++
#define wxCMPFUNC_CONV #define wxC_CALLING_CONV
#endif // compiler #endif // compiler
// callling convention for the qsort(3) callback
#define wxCMPFUNC_CONV wxC_CALLING_CONV
// compatibility :-( // compatibility :-(
#define CMPFUNC_CONV wxCMPFUNC_CONV #define CMPFUNC_CONV wxCMPFUNC_CONV

View File

@@ -42,7 +42,10 @@
callback compare function for quick sort callback compare function for quick sort
must return negative value, 0 or positive value if pItem1 <, = or > pItem2 must return negative value, 0 or positive value if pItem1 <, = or > pItem2
*/ */
extern "C"
{
typedef int (wxCMPFUNC_CONV *CMPFUNC)(const void* pItem1, const void* pItem2); typedef int (wxCMPFUNC_CONV *CMPFUNC)(const void* pItem1, const void* pItem2);
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
/** /**

View File

@@ -97,16 +97,16 @@ public :
wxDouble m_y; wxDouble m_y;
}; };
wxPoint2DDouble operator+(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2); inline wxPoint2DDouble operator+(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2);
wxPoint2DDouble operator-(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2); inline wxPoint2DDouble operator-(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2);
wxPoint2DDouble operator*(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2); inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2);
wxPoint2DDouble operator*(wxDouble n , const wxPoint2DDouble& pt); inline wxPoint2DDouble operator*(wxDouble n , const wxPoint2DDouble& pt);
wxPoint2DDouble operator*(wxInt32 n , const wxPoint2DDouble& pt); inline wxPoint2DDouble operator*(wxInt32 n , const wxPoint2DDouble& pt);
wxPoint2DDouble operator*(const wxPoint2DDouble& pt , wxDouble n); inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt , wxDouble n);
wxPoint2DDouble operator*(const wxPoint2DDouble& pt , wxInt32 n); inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt , wxInt32 n);
wxPoint2DDouble operator/(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2); inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2);
wxPoint2DDouble operator/(const wxPoint2DDouble& pt , wxDouble n); inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt , wxDouble n);
wxPoint2DDouble operator/(const wxPoint2DDouble& pt , wxInt32 n); inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt , wxInt32 n);
inline wxPoint2DDouble::wxPoint2DDouble() inline wxPoint2DDouble::wxPoint2DDouble()
{ {

View File

@@ -107,7 +107,7 @@ public:
// (like sscanf() does) // (like sscanf() does)
// NOTE: unlike scanf family, this function only accepts // NOTE: unlike scanf family, this function only accepts
// *one* parameter ! // *one* parameter !
int ScanParam(const wxString& par, wxChar *format, void *param) const; int ScanParam(const wxString& par, const wxChar *format, void *param) const;
// Returns string containing all params. // Returns string containing all params.
wxString GetAllParams() const; wxString GetAllParams() const;

View File

@@ -64,7 +64,10 @@ enum wxKeyType
// type of compare function for list sort operation (as in 'qsort'): it should // type of compare function for list sort operation (as in 'qsort'): it should
// return a negative value, 0 or positive value if the first element is less // return a negative value, 0 or positive value if the first element is less
// than, equal or greater than the second // than, equal or greater than the second
extern "C"
{
typedef int (* LINKAGEMODE wxSortCompareFunction)(const void *elem1, const void *elem2); typedef int (* LINKAGEMODE wxSortCompareFunction)(const void *elem1, const void *elem2);
}
// //
typedef int (* LINKAGEMODE wxListIterateFunction)(void *current); typedef int (* LINKAGEMODE wxListIterateFunction)(void *current);

View File

@@ -218,7 +218,7 @@ bool wxContextHelp::DispatchEvent(wxWindow* win, const wxPoint& pt)
*/ */
#if !defined(__WXMSW__) #if !defined(__WXMSW__)
static char * csquery_xpm[] = { static const char * csquery_xpm[] = {
"12 11 2 1", "12 11 2 1",
" c None", " c None",
". c #000000", ". c #000000",

View File

@@ -3721,8 +3721,10 @@ int WXDLLEXPORT wxDbConnectionsInUse(void)
/********** wxDbLogExtendedErrorMsg() **********/ /********** wxDbLogExtendedErrorMsg() **********/
// DEBUG ONLY function // DEBUG ONLY function
const wxChar WXDLLEXPORT *wxDbLogExtendedErrorMsg(const wxChar *userText, wxDb *pDb, const wxChar WXDLLEXPORT *wxDbLogExtendedErrorMsg(const wxChar *userText,
wxChar *ErrFile, int ErrLine) wxDb *pDb,
const wxChar *ErrFile,
int ErrLine)
{ {
static wxString msg; static wxString msg;
msg = userText; msg = userText;

View File

@@ -54,7 +54,7 @@ typedef struct {
static int LINKAGEMODE CompareCharsetItems(const void *i1, const void *i2) extern "C" int LINKAGEMODE CompareCharsetItems(const void *i1, const void *i2)
{ {
return ( ((CharsetItem*)i1) -> u - ((CharsetItem*)i2) -> u ); return ( ((CharsetItem*)i1) -> u - ((CharsetItem*)i2) -> u );
} }

View File

@@ -58,6 +58,11 @@ extern "C"
#endif #endif
#endif #endif
// we can't use METHODDEF here as it includes static yet the functions must be
// extern "C" and these can't be used together!
#undef METHODDEF
#define METHODDEF(type) extern "C" wxC_CALLING_CONV type
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxJPEGHandler // wxJPEGHandler
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -125,6 +130,34 @@ METHODDEF(void) my_term_source ( j_decompress_ptr cinfo )
delete[] src->buffer; delete[] src->buffer;
} }
// JPEG error manager:
struct my_error_mgr {
struct jpeg_error_mgr pub; /* "public" fields */
jmp_buf setjmp_buffer; /* for return to caller */
};
typedef struct my_error_mgr * my_error_ptr;
/*
* Here's the routine that will replace the standard error_exit method:
*/
METHODDEF(void) my_error_exit (j_common_ptr cinfo)
{
/* cinfo->err really points to a my_error_mgr struct, so coerce pointer */
my_error_ptr myerr = (my_error_ptr) cinfo->err;
/* Always display the message. */
/* We could postpone this until after returning, if we chose. */
if (cinfo->err->output_message) (*cinfo->err->output_message) (cinfo);
/* Return control to the setjmp point */
longjmp(myerr->setjmp_buffer, 1);
}
void jpeg_wxio_src( j_decompress_ptr cinfo, wxInputStream& infile ) void jpeg_wxio_src( j_decompress_ptr cinfo, wxInputStream& infile )
{ {
my_src_ptr src; my_src_ptr src;
@@ -149,34 +182,6 @@ void jpeg_wxio_src( j_decompress_ptr cinfo, wxInputStream& infile )
} }
// JPEG error manager:
struct my_error_mgr {
struct jpeg_error_mgr pub; /* "public" fields */
jmp_buf setjmp_buffer; /* for return to caller */
};
typedef struct my_error_mgr * my_error_ptr;
/*
* Here's the routine that will replace the standard error_exit method:
*/
METHODDEF(void)
my_error_exit (j_common_ptr cinfo)
{
/* cinfo->err really points to a my_error_mgr struct, so coerce pointer */
my_error_ptr myerr = (my_error_ptr) cinfo->err;
/* Always display the message. */
/* We could postpone this until after returning, if we chose. */
if (cinfo->err->output_message) (*cinfo->err->output_message) (cinfo);
/* Return control to the setjmp point */
longjmp(myerr->setjmp_buffer, 1);
}
// temporarily disable the warning C4611 (interaction between '_setjmp' and // temporarily disable the warning C4611 (interaction between '_setjmp' and
// C++ object destruction is non-portable) - I don't see any dtors here // C++ object destruction is non-portable) - I don't see any dtors here
#ifdef __VISUALC__ #ifdef __VISUALC__

View File

@@ -60,12 +60,15 @@ IMPLEMENT_DYNAMIC_CLASS(wxPNGHandler,wxImageHandler)
#define PNGLINKAGEMODE LINKAGEMODE #define PNGLINKAGEMODE LINKAGEMODE
#endif #endif
static void PNGLINKAGEMODE _PNG_stream_reader( png_structp png_ptr, png_bytep data, png_size_t length ) extern "C"
{
void PNGLINKAGEMODE _PNG_stream_reader( png_structp png_ptr, png_bytep data, png_size_t length )
{ {
((wxInputStream*) png_get_io_ptr( png_ptr )) -> Read(data, length); ((wxInputStream*) png_get_io_ptr( png_ptr )) -> Read(data, length);
} }
static void PNGLINKAGEMODE _PNG_stream_writer( png_structp png_ptr, png_bytep data, png_size_t length ) void PNGLINKAGEMODE _PNG_stream_writer( png_structp png_ptr, png_bytep data, png_size_t length )
{ {
((wxOutputStream*) png_get_io_ptr( png_ptr )) -> Write(data, length); ((wxOutputStream*) png_get_io_ptr( png_ptr )) -> Write(data, length);
} }
@@ -91,6 +94,8 @@ PNGLINKAGEMODE png_silent_warning(png_structp WXUNUSED(png_ptr), png_const_charp
{ {
} }
} // extern "C"
// temporarily disable the warning C4611 (interaction between '_setjmp' and // temporarily disable the warning C4611 (interaction between '_setjmp' and
// C++ object destruction is non-portable) - I don't see any dtors here // C++ object destruction is non-portable) - I don't see any dtors here
#ifdef __VISUALC__ #ifdef __VISUALC__

View File

@@ -47,7 +47,10 @@ extern "C"
IMPLEMENT_DYNAMIC_CLASS(wxTIFFHandler,wxImageHandler) IMPLEMENT_DYNAMIC_CLASS(wxTIFFHandler,wxImageHandler)
static tsize_t TIFFLINKAGEMODE extern "C"
{
tsize_t TIFFLINKAGEMODE
_tiffNullProc(thandle_t WXUNUSED(handle), _tiffNullProc(thandle_t WXUNUSED(handle),
tdata_t WXUNUSED(buf), tdata_t WXUNUSED(buf),
tsize_t WXUNUSED(size)) tsize_t WXUNUSED(size))
@@ -55,7 +58,7 @@ _tiffNullProc(thandle_t WXUNUSED(handle),
return (tsize_t) -1; return (tsize_t) -1;
} }
static tsize_t TIFFLINKAGEMODE tsize_t TIFFLINKAGEMODE
_tiffReadProc(thandle_t handle, tdata_t buf, tsize_t size) _tiffReadProc(thandle_t handle, tdata_t buf, tsize_t size)
{ {
wxInputStream *stream = (wxInputStream*) handle; wxInputStream *stream = (wxInputStream*) handle;
@@ -63,7 +66,7 @@ _tiffReadProc(thandle_t handle, tdata_t buf, tsize_t size)
return stream->LastRead(); return stream->LastRead();
} }
static tsize_t TIFFLINKAGEMODE tsize_t TIFFLINKAGEMODE
_tiffWriteProc(thandle_t handle, tdata_t buf, tsize_t size) _tiffWriteProc(thandle_t handle, tdata_t buf, tsize_t size)
{ {
wxOutputStream *stream = (wxOutputStream*) handle; wxOutputStream *stream = (wxOutputStream*) handle;
@@ -71,7 +74,7 @@ _tiffWriteProc(thandle_t handle, tdata_t buf, tsize_t size)
return stream->LastWrite(); return stream->LastWrite();
} }
static toff_t TIFFLINKAGEMODE toff_t TIFFLINKAGEMODE
_tiffSeekIProc(thandle_t handle, toff_t off, int whence) _tiffSeekIProc(thandle_t handle, toff_t off, int whence)
{ {
wxInputStream *stream = (wxInputStream*) handle; wxInputStream *stream = (wxInputStream*) handle;
@@ -87,7 +90,7 @@ _tiffSeekIProc(thandle_t handle, toff_t off, int whence)
return (toff_t)stream->SeekI( (off_t)off, mode ); return (toff_t)stream->SeekI( (off_t)off, mode );
} }
static toff_t TIFFLINKAGEMODE toff_t TIFFLINKAGEMODE
_tiffSeekOProc(thandle_t handle, toff_t off, int whence) _tiffSeekOProc(thandle_t handle, toff_t off, int whence)
{ {
wxOutputStream *stream = (wxOutputStream*) handle; wxOutputStream *stream = (wxOutputStream*) handle;
@@ -103,20 +106,20 @@ _tiffSeekOProc(thandle_t handle, toff_t off, int whence)
return (toff_t)stream->SeekO( (off_t)off, mode ); return (toff_t)stream->SeekO( (off_t)off, mode );
} }
static int TIFFLINKAGEMODE int TIFFLINKAGEMODE
_tiffCloseProc(thandle_t WXUNUSED(handle)) _tiffCloseProc(thandle_t WXUNUSED(handle))
{ {
return 0; // ? return 0; // ?
} }
static toff_t TIFFLINKAGEMODE toff_t TIFFLINKAGEMODE
_tiffSizeProc(thandle_t handle) _tiffSizeProc(thandle_t handle)
{ {
wxStreamBase *stream = (wxStreamBase*) handle; wxStreamBase *stream = (wxStreamBase*) handle;
return (toff_t) stream->GetSize(); return (toff_t) stream->GetSize();
} }
static int TIFFLINKAGEMODE int TIFFLINKAGEMODE
_tiffMapProc(thandle_t WXUNUSED(handle), _tiffMapProc(thandle_t WXUNUSED(handle),
tdata_t* WXUNUSED(pbase), tdata_t* WXUNUSED(pbase),
toff_t* WXUNUSED(psize)) toff_t* WXUNUSED(psize))
@@ -124,13 +127,15 @@ _tiffMapProc(thandle_t WXUNUSED(handle),
return 0; return 0;
} }
static void TIFFLINKAGEMODE void TIFFLINKAGEMODE
_tiffUnmapProc(thandle_t WXUNUSED(handle), _tiffUnmapProc(thandle_t WXUNUSED(handle),
tdata_t WXUNUSED(base), tdata_t WXUNUSED(base),
toff_t WXUNUSED(size)) toff_t WXUNUSED(size))
{ {
} }
} // extern "C"
TIFF* TIFF*
TIFFwxOpen(wxInputStream &stream, const char* name, const char* mode) TIFFwxOpen(wxInputStream &stream, const char* name, const char* mode)
{ {

View File

@@ -640,7 +640,7 @@ bool wxStringList::Member(const wxChar *s) const
return FALSE; return FALSE;
} }
static int LINKAGEMODE extern "C" int LINKAGEMODE
wx_comparestrings(const void *arg1, const void *arg2) wx_comparestrings(const void *arg1, const void *arg2)
{ {
wxChar **s1 = (wxChar **) arg1; wxChar **s1 = (wxChar **) arg1;

View File

@@ -2049,7 +2049,7 @@ wxChar* wxResourceParseWord(wxChar*s, int *i)
struct wxResourceBitListStruct struct wxResourceBitListStruct
{ {
wxChar *word; const wxChar *word;
long bits; long bits;
}; };

View File

@@ -862,7 +862,8 @@ char *wxSocketBase::CallbackData(char *data)
// decoupled from wx_socket_callback and thus they suffer from a variety // decoupled from wx_socket_callback and thus they suffer from a variety
// of problems. Avoid them where possible and use events instead. // of problems. Avoid them where possible and use events instead.
static void LINKAGEMODE wx_socket_callback(GSocket * WXUNUSED(socket), extern "C"
void LINKAGEMODE wx_socket_callback(GSocket * WXUNUSED(socket),
GSocketEvent notification, GSocketEvent notification,
char *cdata) char *cdata)
{ {

View File

@@ -2240,7 +2240,8 @@ static wxArrayString::CompareFunction gs_compareFunction = NULL;
static bool gs_sortAscending = TRUE; static bool gs_sortAscending = TRUE;
// function which is called by quick sort // function which is called by quick sort
static int LINKAGEMODE wxStringCompareFunction(const void *first, const void *second) extern "C" int LINKAGEMODE
wxStringCompareFunction(const void *first, const void *second)
{ {
wxString *strFirst = (wxString *)first; wxString *strFirst = (wxString *)first;
wxString *strSecond = (wxString *)second; wxString *strSecond = (wxString *)second;

View File

@@ -1255,7 +1255,7 @@ void process_command(char * cexpr)
void syntax_error(char *WXUNUSED(s)) void syntax_error(char *WXUNUSED(s))
{ {
if (currentwxExprErrorHandler) if (currentwxExprErrorHandler)
(void)(*(currentwxExprErrorHandler))(WXEXPR_ERROR_SYNTAX, "syntax error"); (void)(*(currentwxExprErrorHandler))(WXEXPR_ERROR_SYNTAX, (char *)"syntax error");
if (thewxExprDatabase) thewxExprDatabase->noErrors += 1; if (thewxExprDatabase) thewxExprDatabase->noErrors += 1;
} }

View File

@@ -263,7 +263,7 @@ wxImage wxXPMDecoder::ReadFile(wxInputStream& stream)
typedef struct typedef struct
{ {
char *name; const char *name;
wxUint32 rgb; wxUint32 rgb;
} rgbRecord; } rgbRecord;

View File

@@ -90,7 +90,7 @@
#endif #endif
/* Closed folder */ /* Closed folder */
static char * icon1_xpm[] = { static const char * icon1_xpm[] = {
/* width height ncolors chars_per_pixel */ /* width height ncolors chars_per_pixel */
"16 16 6 1", "16 16 6 1",
/* colors */ /* colors */
@@ -119,7 +119,7 @@ static char * icon1_xpm[] = {
" "}; " "};
/* Open folder */ /* Open folder */
static char * icon2_xpm[] = { static const char * icon2_xpm[] = {
/* width height ncolors chars_per_pixel */ /* width height ncolors chars_per_pixel */
"16 16 6 1", "16 16 6 1",
/* colors */ /* colors */
@@ -148,7 +148,7 @@ static char * icon2_xpm[] = {
" "}; " "};
/* File */ /* File */
static char * icon3_xpm[] = { static const char * icon3_xpm[] = {
/* width height ncolors chars_per_pixel */ /* width height ncolors chars_per_pixel */
"16 16 3 1", "16 16 3 1",
/* colors */ /* colors */
@@ -174,7 +174,7 @@ static char * icon3_xpm[] = {
" "}; " "};
/* Computer */ /* Computer */
static char * icon4_xpm[] = { static const char * icon4_xpm[] = {
"16 16 7 1", "16 16 7 1",
" s None c None", " s None c None",
". c #808080", ". c #808080",
@@ -201,7 +201,7 @@ static char * icon4_xpm[] = {
"............o "}; "............o "};
/* Drive */ /* Drive */
static char * icon5_xpm[] = { static const char * icon5_xpm[] = {
"16 16 7 1", "16 16 7 1",
" s None c None", " s None c None",
". c #808080", ". c #808080",
@@ -228,7 +228,7 @@ static char * icon5_xpm[] = {
" "}; " "};
/* CD-ROM */ /* CD-ROM */
static char *icon6_xpm[] = { static const char *icon6_xpm[] = {
"16 16 10 1", "16 16 10 1",
" s None c None", " s None c None",
". c #808080", ". c #808080",
@@ -258,7 +258,7 @@ static char *icon6_xpm[] = {
" "}; " "};
/* Floppy */ /* Floppy */
static char * icon7_xpm[] = { static const char * icon7_xpm[] = {
"16 16 7 1", "16 16 7 1",
" s None c None", " s None c None",
". c #808080", ". c #808080",
@@ -285,7 +285,7 @@ static char * icon7_xpm[] = {
" "}; " "};
/* Removeable */ /* Removeable */
static char * icon8_xpm[] = { static const char * icon8_xpm[] = {
"16 16 7 1", "16 16 7 1",
" s None c None", " s None c None",
". c #808080", ". c #808080",

View File

@@ -1804,7 +1804,8 @@ void wxListHeaderWindow::DoDrawRect( wxDC *dc, int x, int y, int w, int h )
gtk_paint_box (m_wxwindow->style, GTK_PIZZA(m_wxwindow)->bin_window, gtk_paint_box (m_wxwindow->style, GTK_PIZZA(m_wxwindow)->bin_window,
state, GTK_SHADOW_OUT, state, GTK_SHADOW_OUT,
(GdkRectangle*) NULL, m_wxwindow, "button", (GdkRectangle*) NULL, m_wxwindow,
(char *)"button", // const_cast
x-1, y-1, w+2, h+2); x-1, y-1, w+2, h+2);
#elif defined( __WXMAC__ ) #elif defined( __WXMAC__ )
const int m_corner = 1; const int m_corner = 1;

View File

@@ -61,14 +61,15 @@ static GtkWidget *gs_RootWindow = (GtkWidget*) NULL;
// local functions // local functions
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
/* forward declaration */ extern "C"
gint wxapp_idle_callback( gpointer WXUNUSED(data) ); {
gint wxapp_pending_callback( gpointer WXUNUSED(data) ); gint wxapp_idle_callback( gpointer WXUNUSED(data) );
void wxapp_install_idle_handler(); gint wxapp_pending_callback( gpointer WXUNUSED(data) );
}
#if wxUSE_THREADS void wxapp_install_thread_wakeup();
gint wxapp_wakeup_timerout_callback( gpointer WXUNUSED(data) ); void wxapp_uninstall_thread_wakeup();
#endif void wxapp_install_idle_handler();
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxExit // wxExit
@@ -163,6 +164,28 @@ void wxWakeUpIdle()
// local functions // local functions
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void wxapp_install_idle_handler()
{
wxASSERT_MSG( wxTheApp->m_idleTag == 0, wxT("attempt to install idle handler twice") );
g_isIdle = FALSE;
if (g_pendingTag == 0)
g_pendingTag = gtk_idle_add_priority( 900, wxapp_pending_callback, (gpointer) NULL );
/* This routine gets called by all event handlers
indicating that the idle is over. It may also
get called from other thread for sending events
to the main thread (and processing these in
idle time). Very low priority. */
wxTheApp->m_idleTag = gtk_idle_add_priority( 1000, wxapp_idle_callback, (gpointer) NULL );
}
// the callback functions must be extern "C" to comply with GTK+ declarations
extern "C"
{
gint wxapp_pending_callback( gpointer WXUNUSED(data) ) gint wxapp_pending_callback( gpointer WXUNUSED(data) )
{ {
if (!wxTheApp) return TRUE; if (!wxTheApp) return TRUE;
@@ -230,51 +253,8 @@ gint wxapp_idle_callback( gpointer WXUNUSED(data) )
return FALSE; return FALSE;
} }
void wxapp_install_idle_handler()
{
wxASSERT_MSG( wxTheApp->m_idleTag == 0, wxT("attempt to install idle handler twice") );
g_isIdle = FALSE;
if (g_pendingTag == 0)
g_pendingTag = gtk_idle_add_priority( 900, wxapp_pending_callback, (gpointer) NULL );
/* This routine gets called by all event handlers
indicating that the idle is over. It may also
get called from other thread for sending events
to the main thread (and processing these in
idle time). Very low priority. */
wxTheApp->m_idleTag = gtk_idle_add_priority( 1000, wxapp_idle_callback, (gpointer) NULL );
}
#if wxUSE_THREADS #if wxUSE_THREADS
static int g_threadUninstallLevel = 0;
void wxapp_install_thread_wakeup()
{
g_threadUninstallLevel++;
if (g_threadUninstallLevel != 1) return;
if (wxTheApp->m_wakeUpTimerTag) return;
wxTheApp->m_wakeUpTimerTag = gtk_timeout_add( 50, wxapp_wakeup_timerout_callback, (gpointer) NULL );
}
void wxapp_uninstall_thread_wakeup()
{
g_threadUninstallLevel--;
if (g_threadUninstallLevel != 0) return;
if (!wxTheApp->m_wakeUpTimerTag) return;
gtk_timeout_remove( wxTheApp->m_wakeUpTimerTag );
wxTheApp->m_wakeUpTimerTag = 0;
}
gint wxapp_wakeup_timerout_callback( gpointer WXUNUSED(data) ) gint wxapp_wakeup_timerout_callback( gpointer WXUNUSED(data) )
{ {
// when getting called from GDK's time-out handler // when getting called from GDK's time-out handler
@@ -307,6 +287,37 @@ gint wxapp_wakeup_timerout_callback( gpointer WXUNUSED(data) )
#endif // wxUSE_THREADS #endif // wxUSE_THREADS
} // extern "C"
#if wxUSE_THREADS
static int g_threadUninstallLevel = 0;
void wxapp_install_thread_wakeup()
{
g_threadUninstallLevel++;
if (g_threadUninstallLevel != 1) return;
if (wxTheApp->m_wakeUpTimerTag) return;
wxTheApp->m_wakeUpTimerTag = gtk_timeout_add( 50, wxapp_wakeup_timerout_callback, (gpointer) NULL );
}
void wxapp_uninstall_thread_wakeup()
{
g_threadUninstallLevel--;
if (g_threadUninstallLevel != 0) return;
if (!wxTheApp->m_wakeUpTimerTag) return;
gtk_timeout_remove( wxTheApp->m_wakeUpTimerTag );
wxTheApp->m_wakeUpTimerTag = 0;
}
#endif // wxUSE_THREADS
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxApp // wxApp
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@@ -60,7 +60,7 @@ static const wxChar *TRACE_DND = _T("dnd");
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
/* XPM */ /* XPM */
static char * page_xpm[] = { static const char * page_xpm[] = {
/* width height ncolors chars_per_pixel */ /* width height ncolors chars_per_pixel */
"32 32 5 1", "32 32 5 1",
/* colors */ /* colors */

View File

@@ -322,7 +322,7 @@ bool wxMenuBar::GtkAppend(wxMenu *menu, const wxString& title)
entry.accelerator = (gchar*) NULL; entry.accelerator = (gchar*) NULL;
entry.callback = (GtkItemFactoryCallback) NULL; entry.callback = (GtkItemFactoryCallback) NULL;
entry.callback_action = 0; entry.callback_action = 0;
entry.item_type = "<Branch>"; entry.item_type = (char *)"<Branch>";
gtk_item_factory_create_item( m_factory, &entry, (gpointer) this, 2 ); /* what is 2 ? */ gtk_item_factory_create_item( m_factory, &entry, (gpointer) this, 2 ); /* what is 2 ? */
/* in order to get the pointer to the item we need the item text _without_ underscores */ /* in order to get the pointer to the item we need the item text _without_ underscores */
@@ -886,10 +886,10 @@ void wxMenu::Init()
if(m_style & wxMENU_TEAROFF) if(m_style & wxMENU_TEAROFF)
{ {
GtkItemFactoryEntry entry; GtkItemFactoryEntry entry;
entry.path = "/tearoff"; entry.path = (char *)"/tearoff";
entry.callback = (GtkItemFactoryCallback) NULL; entry.callback = (GtkItemFactoryCallback) NULL;
entry.callback_action = 0; entry.callback_action = 0;
entry.item_type = "<Tearoff>"; entry.item_type = (char *)"<Tearoff>";
entry.accelerator = (gchar*) NULL; entry.accelerator = (gchar*) NULL;
gtk_item_factory_create_item( m_factory, &entry, (gpointer) this, 2 ); /* what is 2 ? */ gtk_item_factory_create_item( m_factory, &entry, (gpointer) this, 2 ); /* what is 2 ? */
//GtkWidget *menuItem = gtk_item_factory_get_widget( m_factory, "<main>/tearoff" ); //GtkWidget *menuItem = gtk_item_factory_get_widget( m_factory, "<main>/tearoff" );
@@ -923,10 +923,10 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem)
{ {
#if (GTK_MINOR_VERSION > 0) #if (GTK_MINOR_VERSION > 0)
GtkItemFactoryEntry entry; GtkItemFactoryEntry entry;
entry.path = "/sep"; entry.path = (char *)"/sep";
entry.callback = (GtkItemFactoryCallback) NULL; entry.callback = (GtkItemFactoryCallback) NULL;
entry.callback_action = 0; entry.callback_action = 0;
entry.item_type = "<Separator>"; entry.item_type = (char *)"<Separator>";
entry.accelerator = (gchar*) NULL; entry.accelerator = (gchar*) NULL;
gtk_item_factory_create_item( m_factory, &entry, (gpointer) this, 2 ); /* what is 2 ? */ gtk_item_factory_create_item( m_factory, &entry, (gpointer) this, 2 ); /* what is 2 ? */
@@ -952,7 +952,7 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem)
entry.path = buf; entry.path = buf;
entry.callback = (GtkItemFactoryCallback) 0; entry.callback = (GtkItemFactoryCallback) 0;
entry.callback_action = 0; entry.callback_action = 0;
entry.item_type = "<Branch>"; entry.item_type = (char *)"<Branch>";
entry.accelerator = (gchar*) NULL; entry.accelerator = (gchar*) NULL;
gtk_item_factory_create_item( m_factory, &entry, (gpointer) this, 2 ); /* what is 2 ? */ gtk_item_factory_create_item( m_factory, &entry, (gpointer) this, 2 ); /* what is 2 ? */
@@ -1022,9 +1022,9 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem)
entry.callback = (GtkItemFactoryCallback) gtk_menu_clicked_callback; entry.callback = (GtkItemFactoryCallback) gtk_menu_clicked_callback;
entry.callback_action = 0; entry.callback_action = 0;
if ( mitem->IsCheckable() ) if ( mitem->IsCheckable() )
entry.item_type = "<CheckItem>"; entry.item_type = (char *)"<CheckItem>";
else else
entry.item_type = "<Item>"; entry.item_type = (char *)"<Item>";
entry.accelerator = (gchar*) NULL; entry.accelerator = (gchar*) NULL;
#if wxUSE_ACCEL #if wxUSE_ACCEL
@@ -1251,6 +1251,9 @@ static wxString GetHotKey( const wxMenuItem& item )
#include <gtk/gtkmenu.h> #include <gtk/gtkmenu.h>
#include <gtk/gtkcontainer.h> #include <gtk/gtkcontainer.h>
extern "C"
{
static void gtk_pixmap_menu_item_class_init (GtkPixmapMenuItemClass *klass); static void gtk_pixmap_menu_item_class_init (GtkPixmapMenuItemClass *klass);
static void gtk_pixmap_menu_item_init (GtkPixmapMenuItem *menu_item); static void gtk_pixmap_menu_item_init (GtkPixmapMenuItem *menu_item);
static void gtk_pixmap_menu_item_draw (GtkWidget *widget, static void gtk_pixmap_menu_item_draw (GtkWidget *widget,
@@ -1276,6 +1279,8 @@ static void changed_have_pixmap_status (GtkPixmapMenuItem *menu_item);
static GtkMenuItemClass *parent_class = NULL; static GtkMenuItemClass *parent_class = NULL;
}
#define BORDER_SPACING 3 #define BORDER_SPACING 3
#define PMAP_WIDTH 20 #define PMAP_WIDTH 20
@@ -1288,7 +1293,7 @@ gtk_pixmap_menu_item_get_type (void)
{ {
GtkTypeInfo pixmap_menu_item_info = GtkTypeInfo pixmap_menu_item_info =
{ {
"GtkPixmapMenuItem", (char *)"GtkPixmapMenuItem",
sizeof (GtkPixmapMenuItem), sizeof (GtkPixmapMenuItem),
sizeof (GtkPixmapMenuItemClass), sizeof (GtkPixmapMenuItemClass),
(GtkClassInitFunc) gtk_pixmap_menu_item_class_init, (GtkClassInitFunc) gtk_pixmap_menu_item_class_init,

View File

@@ -270,7 +270,7 @@ static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxMiniFram
// wxMiniFrame // wxMiniFrame
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static char *cross_xpm[] = { static const char *cross_xpm[] = {
/* columns rows colors chars-per-pixel */ /* columns rows colors chars-per-pixel */
"5 5 16 1", "5 5 16 1",
" c Gray0", " c Gray0",
@@ -321,7 +321,13 @@ bool wxMiniFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title
((style & wxCAPTION) || (style & wxTINY_CAPTION_HORIZ) || (style & wxTINY_CAPTION_VERT))) ((style & wxCAPTION) || (style & wxTINY_CAPTION_HORIZ) || (style & wxTINY_CAPTION_VERT)))
{ {
GdkBitmap *mask = (GdkBitmap*) NULL; GdkBitmap *mask = (GdkBitmap*) NULL;
GdkPixmap *pixmap = gdk_pixmap_create_from_xpm_d( wxGetRootWindow()->window, &mask, NULL, cross_xpm ); GdkPixmap *pixmap = gdk_pixmap_create_from_xpm_d
(
wxGetRootWindow()->window,
&mask,
NULL,
(char **)cross_xpm
);
GtkWidget *pw = gtk_pixmap_new( pixmap, mask ); GtkWidget *pw = gtk_pixmap_new( pixmap, mask );
gdk_bitmap_unref( mask ); gdk_bitmap_unref( mask );

View File

@@ -26,7 +26,7 @@
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject) IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject)
static gint timeout_callback( gpointer data ) extern "C" gint timeout_callback( gpointer data )
{ {
wxTimer *timer = (wxTimer*)data; wxTimer *timer = (wxTimer*)data;

View File

@@ -245,8 +245,13 @@ static int gtk_window_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_ev
{ {
GtkPizza *pizza = GTK_PIZZA(widget); GtkPizza *pizza = GTK_PIZZA(widget);
gtk_paint_flat_box (win->m_widget->style, pizza->bin_window, GTK_STATE_NORMAL, gtk_paint_flat_box (win->m_widget->style,
GTK_SHADOW_NONE, &gdk_event->area, win->m_widget, "base", 0, 0, -1, -1); pizza->bin_window, GTK_STATE_NORMAL,
GTK_SHADOW_NONE,
&gdk_event->area,
win->m_widget,
(char *)"base",
0, 0, -1, -1);
return TRUE; return TRUE;
} }
@@ -260,8 +265,13 @@ static void gtk_window_draw_callback( GtkWidget *widget, GdkRectangle *rect, wxW
{ {
GtkPizza *pizza = GTK_PIZZA(widget); GtkPizza *pizza = GTK_PIZZA(widget);
gtk_paint_flat_box (win->m_widget->style, pizza->bin_window, GTK_STATE_NORMAL, gtk_paint_flat_box (win->m_widget->style,
GTK_SHADOW_NONE, rect, win->m_widget, "base", 0, 0, -1, -1); pizza->bin_window, GTK_STATE_NORMAL,
GTK_SHADOW_NONE,
rect,
win->m_widget,
(char *)"base",
0, 0, -1, -1);
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -139,7 +139,8 @@ wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
// subprocess routines // subprocess routines
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
static void GTK_EndProcessDetector(gpointer data, gint source, extern "C"
void GTK_EndProcessDetector(gpointer data, gint source,
GdkInputCondition WXUNUSED(condition) ) GdkInputCondition WXUNUSED(condition) )
{ {
wxEndProcessData *proc_data = (wxEndProcessData *)data; wxEndProcessData *proc_data = (wxEndProcessData *)data;

View File

@@ -852,7 +852,7 @@ gtk_pizza_forall (GtkContainer *container,
g_return_if_fail (container != NULL); g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_PIZZA (container)); g_return_if_fail (GTK_IS_PIZZA (container));
g_return_if_fail (callback != NULL); g_return_if_fail (callback != (GtkCallback)NULL);
pizza = GTK_PIZZA (container); pizza = GTK_PIZZA (container);

View File

@@ -785,8 +785,14 @@ static int gtk_window_expose_callback( GtkWidget *widget,
if (!parent) if (!parent)
parent = win; parent = win;
gtk_paint_flat_box (parent->m_widget->style, pizza->bin_window, GTK_STATE_NORMAL, gtk_paint_flat_box (parent->m_widget->style,
GTK_SHADOW_NONE, &gdk_event->area, parent->m_widget, "base", 0, 0, -1, -1); pizza->bin_window,
GTK_STATE_NORMAL,
GTK_SHADOW_NONE,
&gdk_event->area,
parent->m_widget,
(char *)"base",
0, 0, -1, -1);
} }
win->GetUpdateRegion().Union( gdk_event->area.x, win->GetUpdateRegion().Union( gdk_event->area.x,
@@ -928,8 +934,14 @@ static void gtk_window_draw_callback( GtkWidget *widget,
if (!parent) if (!parent)
parent = win; parent = win;
gtk_paint_flat_box (parent->m_widget->style, pizza->bin_window, GTK_STATE_NORMAL, gtk_paint_flat_box (parent->m_widget->style,
GTK_SHADOW_NONE, rect, parent->m_widget, "base", 0, 0, -1, -1); pizza->bin_window,
GTK_STATE_NORMAL,
GTK_SHADOW_NONE,
rect,
parent->m_widget,
(char *)"base",
0, 0, -1, -1);
} }
@@ -3713,7 +3725,8 @@ void wxWindowGTK::ApplyWidgetStyle()
#if wxUSE_MENUS_NATIVE #if wxUSE_MENUS_NATIVE
static void gtk_pop_hide_callback( GtkWidget *WXUNUSED(widget), bool* is_waiting ) extern "C"
void gtk_pop_hide_callback( GtkWidget *WXUNUSED(widget), bool* is_waiting )
{ {
*is_waiting = FALSE; *is_waiting = FALSE;
} }
@@ -3775,8 +3788,10 @@ bool wxWindowGTK::DoPopupMenu( wxMenu *menu, int x, int y )
bool is_waiting = TRUE; bool is_waiting = TRUE;
gtk_signal_connect( GTK_OBJECT(menu->m_menu), "hide", gtk_signal_connect( GTK_OBJECT(menu->m_menu),
GTK_SIGNAL_FUNC(gtk_pop_hide_callback), (gpointer)&is_waiting ); "hide",
GTK_SIGNAL_FUNC(gtk_pop_hide_callback),
(gpointer)&is_waiting );
gtk_menu_popup( gtk_menu_popup(
GTK_MENU(menu->m_menu), GTK_MENU(menu->m_menu),

View File

@@ -61,14 +61,15 @@ static GtkWidget *gs_RootWindow = (GtkWidget*) NULL;
// local functions // local functions
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
/* forward declaration */ extern "C"
gint wxapp_idle_callback( gpointer WXUNUSED(data) ); {
gint wxapp_pending_callback( gpointer WXUNUSED(data) ); gint wxapp_idle_callback( gpointer WXUNUSED(data) );
void wxapp_install_idle_handler(); gint wxapp_pending_callback( gpointer WXUNUSED(data) );
}
#if wxUSE_THREADS void wxapp_install_thread_wakeup();
gint wxapp_wakeup_timerout_callback( gpointer WXUNUSED(data) ); void wxapp_uninstall_thread_wakeup();
#endif void wxapp_install_idle_handler();
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxExit // wxExit
@@ -163,6 +164,28 @@ void wxWakeUpIdle()
// local functions // local functions
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void wxapp_install_idle_handler()
{
wxASSERT_MSG( wxTheApp->m_idleTag == 0, wxT("attempt to install idle handler twice") );
g_isIdle = FALSE;
if (g_pendingTag == 0)
g_pendingTag = gtk_idle_add_priority( 900, wxapp_pending_callback, (gpointer) NULL );
/* This routine gets called by all event handlers
indicating that the idle is over. It may also
get called from other thread for sending events
to the main thread (and processing these in
idle time). Very low priority. */
wxTheApp->m_idleTag = gtk_idle_add_priority( 1000, wxapp_idle_callback, (gpointer) NULL );
}
// the callback functions must be extern "C" to comply with GTK+ declarations
extern "C"
{
gint wxapp_pending_callback( gpointer WXUNUSED(data) ) gint wxapp_pending_callback( gpointer WXUNUSED(data) )
{ {
if (!wxTheApp) return TRUE; if (!wxTheApp) return TRUE;
@@ -230,51 +253,8 @@ gint wxapp_idle_callback( gpointer WXUNUSED(data) )
return FALSE; return FALSE;
} }
void wxapp_install_idle_handler()
{
wxASSERT_MSG( wxTheApp->m_idleTag == 0, wxT("attempt to install idle handler twice") );
g_isIdle = FALSE;
if (g_pendingTag == 0)
g_pendingTag = gtk_idle_add_priority( 900, wxapp_pending_callback, (gpointer) NULL );
/* This routine gets called by all event handlers
indicating that the idle is over. It may also
get called from other thread for sending events
to the main thread (and processing these in
idle time). Very low priority. */
wxTheApp->m_idleTag = gtk_idle_add_priority( 1000, wxapp_idle_callback, (gpointer) NULL );
}
#if wxUSE_THREADS #if wxUSE_THREADS
static int g_threadUninstallLevel = 0;
void wxapp_install_thread_wakeup()
{
g_threadUninstallLevel++;
if (g_threadUninstallLevel != 1) return;
if (wxTheApp->m_wakeUpTimerTag) return;
wxTheApp->m_wakeUpTimerTag = gtk_timeout_add( 50, wxapp_wakeup_timerout_callback, (gpointer) NULL );
}
void wxapp_uninstall_thread_wakeup()
{
g_threadUninstallLevel--;
if (g_threadUninstallLevel != 0) return;
if (!wxTheApp->m_wakeUpTimerTag) return;
gtk_timeout_remove( wxTheApp->m_wakeUpTimerTag );
wxTheApp->m_wakeUpTimerTag = 0;
}
gint wxapp_wakeup_timerout_callback( gpointer WXUNUSED(data) ) gint wxapp_wakeup_timerout_callback( gpointer WXUNUSED(data) )
{ {
// when getting called from GDK's time-out handler // when getting called from GDK's time-out handler
@@ -307,6 +287,37 @@ gint wxapp_wakeup_timerout_callback( gpointer WXUNUSED(data) )
#endif // wxUSE_THREADS #endif // wxUSE_THREADS
} // extern "C"
#if wxUSE_THREADS
static int g_threadUninstallLevel = 0;
void wxapp_install_thread_wakeup()
{
g_threadUninstallLevel++;
if (g_threadUninstallLevel != 1) return;
if (wxTheApp->m_wakeUpTimerTag) return;
wxTheApp->m_wakeUpTimerTag = gtk_timeout_add( 50, wxapp_wakeup_timerout_callback, (gpointer) NULL );
}
void wxapp_uninstall_thread_wakeup()
{
g_threadUninstallLevel--;
if (g_threadUninstallLevel != 0) return;
if (!wxTheApp->m_wakeUpTimerTag) return;
gtk_timeout_remove( wxTheApp->m_wakeUpTimerTag );
wxTheApp->m_wakeUpTimerTag = 0;
}
#endif // wxUSE_THREADS
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxApp // wxApp
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@@ -60,7 +60,7 @@ static const wxChar *TRACE_DND = _T("dnd");
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
/* XPM */ /* XPM */
static char * page_xpm[] = { static const char * page_xpm[] = {
/* width height ncolors chars_per_pixel */ /* width height ncolors chars_per_pixel */
"32 32 5 1", "32 32 5 1",
/* colors */ /* colors */

View File

@@ -322,7 +322,7 @@ bool wxMenuBar::GtkAppend(wxMenu *menu, const wxString& title)
entry.accelerator = (gchar*) NULL; entry.accelerator = (gchar*) NULL;
entry.callback = (GtkItemFactoryCallback) NULL; entry.callback = (GtkItemFactoryCallback) NULL;
entry.callback_action = 0; entry.callback_action = 0;
entry.item_type = "<Branch>"; entry.item_type = (char *)"<Branch>";
gtk_item_factory_create_item( m_factory, &entry, (gpointer) this, 2 ); /* what is 2 ? */ gtk_item_factory_create_item( m_factory, &entry, (gpointer) this, 2 ); /* what is 2 ? */
/* in order to get the pointer to the item we need the item text _without_ underscores */ /* in order to get the pointer to the item we need the item text _without_ underscores */
@@ -886,10 +886,10 @@ void wxMenu::Init()
if(m_style & wxMENU_TEAROFF) if(m_style & wxMENU_TEAROFF)
{ {
GtkItemFactoryEntry entry; GtkItemFactoryEntry entry;
entry.path = "/tearoff"; entry.path = (char *)"/tearoff";
entry.callback = (GtkItemFactoryCallback) NULL; entry.callback = (GtkItemFactoryCallback) NULL;
entry.callback_action = 0; entry.callback_action = 0;
entry.item_type = "<Tearoff>"; entry.item_type = (char *)"<Tearoff>";
entry.accelerator = (gchar*) NULL; entry.accelerator = (gchar*) NULL;
gtk_item_factory_create_item( m_factory, &entry, (gpointer) this, 2 ); /* what is 2 ? */ gtk_item_factory_create_item( m_factory, &entry, (gpointer) this, 2 ); /* what is 2 ? */
//GtkWidget *menuItem = gtk_item_factory_get_widget( m_factory, "<main>/tearoff" ); //GtkWidget *menuItem = gtk_item_factory_get_widget( m_factory, "<main>/tearoff" );
@@ -923,10 +923,10 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem)
{ {
#if (GTK_MINOR_VERSION > 0) #if (GTK_MINOR_VERSION > 0)
GtkItemFactoryEntry entry; GtkItemFactoryEntry entry;
entry.path = "/sep"; entry.path = (char *)"/sep";
entry.callback = (GtkItemFactoryCallback) NULL; entry.callback = (GtkItemFactoryCallback) NULL;
entry.callback_action = 0; entry.callback_action = 0;
entry.item_type = "<Separator>"; entry.item_type = (char *)"<Separator>";
entry.accelerator = (gchar*) NULL; entry.accelerator = (gchar*) NULL;
gtk_item_factory_create_item( m_factory, &entry, (gpointer) this, 2 ); /* what is 2 ? */ gtk_item_factory_create_item( m_factory, &entry, (gpointer) this, 2 ); /* what is 2 ? */
@@ -952,7 +952,7 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem)
entry.path = buf; entry.path = buf;
entry.callback = (GtkItemFactoryCallback) 0; entry.callback = (GtkItemFactoryCallback) 0;
entry.callback_action = 0; entry.callback_action = 0;
entry.item_type = "<Branch>"; entry.item_type = (char *)"<Branch>";
entry.accelerator = (gchar*) NULL; entry.accelerator = (gchar*) NULL;
gtk_item_factory_create_item( m_factory, &entry, (gpointer) this, 2 ); /* what is 2 ? */ gtk_item_factory_create_item( m_factory, &entry, (gpointer) this, 2 ); /* what is 2 ? */
@@ -1022,9 +1022,9 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem)
entry.callback = (GtkItemFactoryCallback) gtk_menu_clicked_callback; entry.callback = (GtkItemFactoryCallback) gtk_menu_clicked_callback;
entry.callback_action = 0; entry.callback_action = 0;
if ( mitem->IsCheckable() ) if ( mitem->IsCheckable() )
entry.item_type = "<CheckItem>"; entry.item_type = (char *)"<CheckItem>";
else else
entry.item_type = "<Item>"; entry.item_type = (char *)"<Item>";
entry.accelerator = (gchar*) NULL; entry.accelerator = (gchar*) NULL;
#if wxUSE_ACCEL #if wxUSE_ACCEL
@@ -1251,6 +1251,9 @@ static wxString GetHotKey( const wxMenuItem& item )
#include <gtk/gtkmenu.h> #include <gtk/gtkmenu.h>
#include <gtk/gtkcontainer.h> #include <gtk/gtkcontainer.h>
extern "C"
{
static void gtk_pixmap_menu_item_class_init (GtkPixmapMenuItemClass *klass); static void gtk_pixmap_menu_item_class_init (GtkPixmapMenuItemClass *klass);
static void gtk_pixmap_menu_item_init (GtkPixmapMenuItem *menu_item); static void gtk_pixmap_menu_item_init (GtkPixmapMenuItem *menu_item);
static void gtk_pixmap_menu_item_draw (GtkWidget *widget, static void gtk_pixmap_menu_item_draw (GtkWidget *widget,
@@ -1276,6 +1279,8 @@ static void changed_have_pixmap_status (GtkPixmapMenuItem *menu_item);
static GtkMenuItemClass *parent_class = NULL; static GtkMenuItemClass *parent_class = NULL;
}
#define BORDER_SPACING 3 #define BORDER_SPACING 3
#define PMAP_WIDTH 20 #define PMAP_WIDTH 20
@@ -1288,7 +1293,7 @@ gtk_pixmap_menu_item_get_type (void)
{ {
GtkTypeInfo pixmap_menu_item_info = GtkTypeInfo pixmap_menu_item_info =
{ {
"GtkPixmapMenuItem", (char *)"GtkPixmapMenuItem",
sizeof (GtkPixmapMenuItem), sizeof (GtkPixmapMenuItem),
sizeof (GtkPixmapMenuItemClass), sizeof (GtkPixmapMenuItemClass),
(GtkClassInitFunc) gtk_pixmap_menu_item_class_init, (GtkClassInitFunc) gtk_pixmap_menu_item_class_init,

View File

@@ -270,7 +270,7 @@ static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxMiniFram
// wxMiniFrame // wxMiniFrame
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static char *cross_xpm[] = { static const char *cross_xpm[] = {
/* columns rows colors chars-per-pixel */ /* columns rows colors chars-per-pixel */
"5 5 16 1", "5 5 16 1",
" c Gray0", " c Gray0",
@@ -321,7 +321,13 @@ bool wxMiniFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title
((style & wxCAPTION) || (style & wxTINY_CAPTION_HORIZ) || (style & wxTINY_CAPTION_VERT))) ((style & wxCAPTION) || (style & wxTINY_CAPTION_HORIZ) || (style & wxTINY_CAPTION_VERT)))
{ {
GdkBitmap *mask = (GdkBitmap*) NULL; GdkBitmap *mask = (GdkBitmap*) NULL;
GdkPixmap *pixmap = gdk_pixmap_create_from_xpm_d( wxGetRootWindow()->window, &mask, NULL, cross_xpm ); GdkPixmap *pixmap = gdk_pixmap_create_from_xpm_d
(
wxGetRootWindow()->window,
&mask,
NULL,
(char **)cross_xpm
);
GtkWidget *pw = gtk_pixmap_new( pixmap, mask ); GtkWidget *pw = gtk_pixmap_new( pixmap, mask );
gdk_bitmap_unref( mask ); gdk_bitmap_unref( mask );

View File

@@ -26,7 +26,7 @@
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject) IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject)
static gint timeout_callback( gpointer data ) extern "C" gint timeout_callback( gpointer data )
{ {
wxTimer *timer = (wxTimer*)data; wxTimer *timer = (wxTimer*)data;

View File

@@ -245,8 +245,13 @@ static int gtk_window_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_ev
{ {
GtkPizza *pizza = GTK_PIZZA(widget); GtkPizza *pizza = GTK_PIZZA(widget);
gtk_paint_flat_box (win->m_widget->style, pizza->bin_window, GTK_STATE_NORMAL, gtk_paint_flat_box (win->m_widget->style,
GTK_SHADOW_NONE, &gdk_event->area, win->m_widget, "base", 0, 0, -1, -1); pizza->bin_window, GTK_STATE_NORMAL,
GTK_SHADOW_NONE,
&gdk_event->area,
win->m_widget,
(char *)"base",
0, 0, -1, -1);
return TRUE; return TRUE;
} }
@@ -260,8 +265,13 @@ static void gtk_window_draw_callback( GtkWidget *widget, GdkRectangle *rect, wxW
{ {
GtkPizza *pizza = GTK_PIZZA(widget); GtkPizza *pizza = GTK_PIZZA(widget);
gtk_paint_flat_box (win->m_widget->style, pizza->bin_window, GTK_STATE_NORMAL, gtk_paint_flat_box (win->m_widget->style,
GTK_SHADOW_NONE, rect, win->m_widget, "base", 0, 0, -1, -1); pizza->bin_window, GTK_STATE_NORMAL,
GTK_SHADOW_NONE,
rect,
win->m_widget,
(char *)"base",
0, 0, -1, -1);
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -139,7 +139,8 @@ wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
// subprocess routines // subprocess routines
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
static void GTK_EndProcessDetector(gpointer data, gint source, extern "C"
void GTK_EndProcessDetector(gpointer data, gint source,
GdkInputCondition WXUNUSED(condition) ) GdkInputCondition WXUNUSED(condition) )
{ {
wxEndProcessData *proc_data = (wxEndProcessData *)data; wxEndProcessData *proc_data = (wxEndProcessData *)data;

View File

@@ -852,7 +852,7 @@ gtk_pizza_forall (GtkContainer *container,
g_return_if_fail (container != NULL); g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_PIZZA (container)); g_return_if_fail (GTK_IS_PIZZA (container));
g_return_if_fail (callback != NULL); g_return_if_fail (callback != (GtkCallback)NULL);
pizza = GTK_PIZZA (container); pizza = GTK_PIZZA (container);

View File

@@ -785,8 +785,14 @@ static int gtk_window_expose_callback( GtkWidget *widget,
if (!parent) if (!parent)
parent = win; parent = win;
gtk_paint_flat_box (parent->m_widget->style, pizza->bin_window, GTK_STATE_NORMAL, gtk_paint_flat_box (parent->m_widget->style,
GTK_SHADOW_NONE, &gdk_event->area, parent->m_widget, "base", 0, 0, -1, -1); pizza->bin_window,
GTK_STATE_NORMAL,
GTK_SHADOW_NONE,
&gdk_event->area,
parent->m_widget,
(char *)"base",
0, 0, -1, -1);
} }
win->GetUpdateRegion().Union( gdk_event->area.x, win->GetUpdateRegion().Union( gdk_event->area.x,
@@ -928,8 +934,14 @@ static void gtk_window_draw_callback( GtkWidget *widget,
if (!parent) if (!parent)
parent = win; parent = win;
gtk_paint_flat_box (parent->m_widget->style, pizza->bin_window, GTK_STATE_NORMAL, gtk_paint_flat_box (parent->m_widget->style,
GTK_SHADOW_NONE, rect, parent->m_widget, "base", 0, 0, -1, -1); pizza->bin_window,
GTK_STATE_NORMAL,
GTK_SHADOW_NONE,
rect,
parent->m_widget,
(char *)"base",
0, 0, -1, -1);
} }
@@ -3713,7 +3725,8 @@ void wxWindowGTK::ApplyWidgetStyle()
#if wxUSE_MENUS_NATIVE #if wxUSE_MENUS_NATIVE
static void gtk_pop_hide_callback( GtkWidget *WXUNUSED(widget), bool* is_waiting ) extern "C"
void gtk_pop_hide_callback( GtkWidget *WXUNUSED(widget), bool* is_waiting )
{ {
*is_waiting = FALSE; *is_waiting = FALSE;
} }
@@ -3775,8 +3788,10 @@ bool wxWindowGTK::DoPopupMenu( wxMenu *menu, int x, int y )
bool is_waiting = TRUE; bool is_waiting = TRUE;
gtk_signal_connect( GTK_OBJECT(menu->m_menu), "hide", gtk_signal_connect( GTK_OBJECT(menu->m_menu),
GTK_SIGNAL_FUNC(gtk_pop_hide_callback), (gpointer)&is_waiting ); "hide",
GTK_SIGNAL_FUNC(gtk_pop_hide_callback),
(gpointer)&is_waiting );
gtk_menu_popup( gtk_menu_popup(
GTK_MENU(menu->m_menu), GTK_MENU(menu->m_menu),

View File

@@ -61,7 +61,8 @@ static char* ReadLine(char *line, char *buf)
static int LINKAGEMODE IndexCompareFunc(const void *a, const void *b) extern "C" int LINKAGEMODE
wxHtmlHelpIndexCompareFunc(const void *a, const void *b)
{ {
return wxStricmp(((wxHtmlContentsItem*)a)->m_Name, ((wxHtmlContentsItem*)b)->m_Name); return wxStricmp(((wxHtmlContentsItem*)a)->m_Name, ((wxHtmlContentsItem*)b)->m_Name);
} }
@@ -524,7 +525,7 @@ bool wxHtmlHelpData::AddBookParam(const wxFSFile& bookfile,
m_BookRecords.Add(bookr); m_BookRecords.Add(bookr);
if (m_IndexCnt > 0) if (m_IndexCnt > 0)
qsort(m_Index, m_IndexCnt, sizeof(wxHtmlContentsItem), IndexCompareFunc); qsort(m_Index, m_IndexCnt, sizeof(wxHtmlContentsItem), wxHtmlHelpIndexCompareFunc);
return TRUE; return TRUE;
} }

View File

@@ -491,7 +491,7 @@ struct wxHtmlEntityInfo
unsigned code; unsigned code;
}; };
static int LINKAGEMODE compar_entity(const void *key, const void *item) extern "C" int LINKAGEMODE wxHtmlEntityCompare(const void *key, const void *item)
{ {
return wxStrcmp((wxChar*)key, ((wxHtmlEntityInfo*)item)->name); return wxStrcmp((wxChar*)key, ((wxHtmlEntityInfo*)item)->name);
} }
@@ -801,7 +801,7 @@ wxChar wxHtmlEntitiesParser::GetEntityChar(const wxString& entity)
info = (wxHtmlEntityInfo*) bsearch(entity.c_str(), substitutions, info = (wxHtmlEntityInfo*) bsearch(entity.c_str(), substitutions,
substitutions_cnt, substitutions_cnt,
sizeof(wxHtmlEntityInfo), sizeof(wxHtmlEntityInfo),
compar_entity); wxHtmlEntityCompare);
if (info) if (info)
code = info->code; code = info->code;
} }

View File

@@ -332,7 +332,9 @@ wxString wxHtmlTag::GetParam(const wxString& par, bool with_commas) const
return m_ParamValues[index]; return m_ParamValues[index];
} }
int wxHtmlTag::ScanParam(const wxString& par, wxChar *format, void *param) const int wxHtmlTag::ScanParam(const wxString& par,
const wxChar *format,
void *param) const
{ {
wxString parval = GetParam(par); wxString parval = GetParam(par);
return wxSscanf(parval, format, param); return wxSscanf(parval, format, param);

View File

@@ -490,6 +490,13 @@ void wxCondition::Broadcast()
// wxThread (Posix implementation) // wxThread (Posix implementation)
//-------------------------------------------------------------------- //--------------------------------------------------------------------
#if HAVE_THREAD_CLEANUP_FUNCTIONS
// thread exit function
extern "C" void wxPthreadCleanup(void *ptr);
#endif // HAVE_THREAD_CLEANUP_FUNCTIONS
class wxThreadInternal class wxThreadInternal
{ {
public: public:
@@ -499,11 +506,6 @@ public:
// thread entry function // thread entry function
static void *PthreadStart(void *ptr); static void *PthreadStart(void *ptr);
#if HAVE_THREAD_CLEANUP_FUNCTIONS
// thread exit function
static void PthreadCleanup(void *ptr);
#endif
// thread actions // thread actions
// start the thread // start the thread
wxThreadError Run(); wxThreadError Run();
@@ -549,6 +551,11 @@ public:
// sometimes - tell the thread that it should do it // sometimes - tell the thread that it should do it
void Notify() { m_shouldBroadcast = TRUE; } void Notify() { m_shouldBroadcast = TRUE; }
#if HAVE_THREAD_CLEANUP_FUNCTIONS
// this is used by wxPthreadCleanup() only
static void Cleanup(wxThread *thread);
#endif // HAVE_THREAD_CLEANUP_FUNCTIONS
private: private:
pthread_t m_threadId; // id of the thread pthread_t m_threadId; // id of the thread
wxThreadState m_state; // see wxThreadState enum wxThreadState m_state; // see wxThreadState enum
@@ -615,7 +622,7 @@ void *wxThreadInternal::PthreadStart(void *ptr)
#if HAVE_THREAD_CLEANUP_FUNCTIONS #if HAVE_THREAD_CLEANUP_FUNCTIONS
// install the cleanup handler which will be called if the thread is // install the cleanup handler which will be called if the thread is
// cancelled // cancelled
pthread_cleanup_push(wxThreadInternal::PthreadCleanup, ptr); pthread_cleanup_push(wxPthreadCleanup, ptr);
#endif // HAVE_THREAD_CLEANUP_FUNCTIONS #endif // HAVE_THREAD_CLEANUP_FUNCTIONS
// wait for the condition to be signaled from Run() // wait for the condition to be signaled from Run()
@@ -645,7 +652,7 @@ void *wxThreadInternal::PthreadStart(void *ptr)
pthread->GetId()); pthread->GetId());
// change the state of the thread to "exited" so that // change the state of the thread to "exited" so that
// PthreadCleanup handler won't do anything from now (if it's // wxPthreadCleanup handler won't do anything from now (if it's
// called before we do pthread_cleanup_pop below) // called before we do pthread_cleanup_pop below)
pthread->SetState(STATE_EXITED); pthread->SetState(STATE_EXITED);
} }
@@ -679,10 +686,13 @@ void *wxThreadInternal::PthreadStart(void *ptr)
#if HAVE_THREAD_CLEANUP_FUNCTIONS #if HAVE_THREAD_CLEANUP_FUNCTIONS
// this handler is called when the thread is cancelled // this handler is called when the thread is cancelled
void wxThreadInternal::PthreadCleanup(void *ptr) extern "C" void wxPthreadCleanup(void *ptr)
{ {
wxThread *thread = (wxThread *) ptr; wxThreadInternal::Cleanup((wxThread *)ptr);
}
void wxThreadInternal::Cleanup(wxThread *thread)
{
{ {
wxCriticalSectionLocker lock(thread->m_critsect); wxCriticalSectionLocker lock(thread->m_critsect);
if ( thread->m_internal->GetState() == STATE_EXITED ) if ( thread->m_internal->GetState() == STATE_EXITED )
@@ -1284,7 +1294,7 @@ wxThreadError wxThread::Kill()
if ( m_isDetached ) if ( m_isDetached )
{ {
// if we use cleanup function, this will be done from // if we use cleanup function, this will be done from
// PthreadCleanup() // wxPthreadCleanup()
#if !HAVE_THREAD_CLEANUP_FUNCTIONS #if !HAVE_THREAD_CLEANUP_FUNCTIONS
ScheduleThreadForDeletion(); ScheduleThreadForDeletion();

View File

@@ -1093,7 +1093,7 @@ bool wxSetEnv(const wxString& variable, const wxChar *value)
#include <signal.h> #include <signal.h>
static void wxFatalSignalHandler(wxTYPE_SA_HANDLER) extern "C" void wxFatalSignalHandler(wxTYPE_SA_HANDLER)
{ {
if ( wxTheApp ) if ( wxTheApp )
{ {