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

@@ -61,14 +61,15 @@ static GtkWidget *gs_RootWindow = (GtkWidget*) NULL;
// local functions
//-----------------------------------------------------------------------------
/* forward declaration */
gint wxapp_idle_callback( gpointer WXUNUSED(data) );
gint wxapp_pending_callback( gpointer WXUNUSED(data) );
void wxapp_install_idle_handler();
extern "C"
{
gint wxapp_idle_callback( gpointer WXUNUSED(data) );
gint wxapp_pending_callback( gpointer WXUNUSED(data) );
}
#if wxUSE_THREADS
gint wxapp_wakeup_timerout_callback( gpointer WXUNUSED(data) );
#endif
void wxapp_install_thread_wakeup();
void wxapp_uninstall_thread_wakeup();
void wxapp_install_idle_handler();
//-----------------------------------------------------------------------------
// wxExit
@@ -163,6 +164,28 @@ void wxWakeUpIdle()
// 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) )
{
if (!wxTheApp) return TRUE;
@@ -230,51 +253,8 @@ gint wxapp_idle_callback( gpointer WXUNUSED(data) )
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
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) )
{
// when getting called from GDK's time-out handler
@@ -307,6 +287,37 @@ gint wxapp_wakeup_timerout_callback( gpointer WXUNUSED(data) )
#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
//-----------------------------------------------------------------------------

View File

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

View File

@@ -322,7 +322,7 @@ bool wxMenuBar::GtkAppend(wxMenu *menu, const wxString& title)
entry.accelerator = (gchar*) NULL;
entry.callback = (GtkItemFactoryCallback) NULL;
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 ? */
/* 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)
{
GtkItemFactoryEntry entry;
entry.path = "/tearoff";
entry.path = (char *)"/tearoff";
entry.callback = (GtkItemFactoryCallback) NULL;
entry.callback_action = 0;
entry.item_type = "<Tearoff>";
entry.item_type = (char *)"<Tearoff>";
entry.accelerator = (gchar*) NULL;
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" );
@@ -923,10 +923,10 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem)
{
#if (GTK_MINOR_VERSION > 0)
GtkItemFactoryEntry entry;
entry.path = "/sep";
entry.path = (char *)"/sep";
entry.callback = (GtkItemFactoryCallback) NULL;
entry.callback_action = 0;
entry.item_type = "<Separator>";
entry.item_type = (char *)"<Separator>";
entry.accelerator = (gchar*) NULL;
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.callback = (GtkItemFactoryCallback) 0;
entry.callback_action = 0;
entry.item_type = "<Branch>";
entry.item_type = (char *)"<Branch>";
entry.accelerator = (gchar*) NULL;
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_action = 0;
if ( mitem->IsCheckable() )
entry.item_type = "<CheckItem>";
entry.item_type = (char *)"<CheckItem>";
else
entry.item_type = "<Item>";
entry.item_type = (char *)"<Item>";
entry.accelerator = (gchar*) NULL;
#if wxUSE_ACCEL
@@ -1251,6 +1251,9 @@ static wxString GetHotKey( const wxMenuItem& item )
#include <gtk/gtkmenu.h>
#include <gtk/gtkcontainer.h>
extern "C"
{
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_draw (GtkWidget *widget,
@@ -1276,6 +1279,8 @@ static void changed_have_pixmap_status (GtkPixmapMenuItem *menu_item);
static GtkMenuItemClass *parent_class = NULL;
}
#define BORDER_SPACING 3
#define PMAP_WIDTH 20
@@ -1288,7 +1293,7 @@ gtk_pixmap_menu_item_get_type (void)
{
GtkTypeInfo pixmap_menu_item_info =
{
"GtkPixmapMenuItem",
(char *)"GtkPixmapMenuItem",
sizeof (GtkPixmapMenuItem),
sizeof (GtkPixmapMenuItemClass),
(GtkClassInitFunc) gtk_pixmap_menu_item_class_init,

View File

@@ -270,7 +270,7 @@ static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxMiniFram
// wxMiniFrame
//-----------------------------------------------------------------------------
static char *cross_xpm[] = {
static const char *cross_xpm[] = {
/* columns rows colors chars-per-pixel */
"5 5 16 1",
" 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)))
{
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 );
gdk_bitmap_unref( mask );

View File

@@ -26,7 +26,7 @@
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject)
static gint timeout_callback( gpointer data )
extern "C" gint timeout_callback( gpointer 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);
gtk_paint_flat_box (win->m_widget->style, pizza->bin_window, GTK_STATE_NORMAL,
GTK_SHADOW_NONE, &gdk_event->area, win->m_widget, "base", 0, 0, -1, -1);
gtk_paint_flat_box (win->m_widget->style,
pizza->bin_window, GTK_STATE_NORMAL,
GTK_SHADOW_NONE,
&gdk_event->area,
win->m_widget,
(char *)"base",
0, 0, -1, -1);
return TRUE;
}
@@ -260,8 +265,13 @@ static void gtk_window_draw_callback( GtkWidget *widget, GdkRectangle *rect, wxW
{
GtkPizza *pizza = GTK_PIZZA(widget);
gtk_paint_flat_box (win->m_widget->style, pizza->bin_window, GTK_STATE_NORMAL,
GTK_SHADOW_NONE, rect, win->m_widget, "base", 0, 0, -1, -1);
gtk_paint_flat_box (win->m_widget->style,
pizza->bin_window, GTK_STATE_NORMAL,
GTK_SHADOW_NONE,
rect,
win->m_widget,
(char *)"base",
0, 0, -1, -1);
}
// ----------------------------------------------------------------------------

View File

@@ -139,8 +139,9 @@ wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
// subprocess routines
// ----------------------------------------------------------------------------
static void GTK_EndProcessDetector(gpointer data, gint source,
GdkInputCondition WXUNUSED(condition) )
extern "C"
void GTK_EndProcessDetector(gpointer data, gint source,
GdkInputCondition WXUNUSED(condition) )
{
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 (GTK_IS_PIZZA (container));
g_return_if_fail (callback != NULL);
g_return_if_fail (callback != (GtkCallback)NULL);
pizza = GTK_PIZZA (container);

View File

@@ -785,8 +785,14 @@ static int gtk_window_expose_callback( GtkWidget *widget,
if (!parent)
parent = win;
gtk_paint_flat_box (parent->m_widget->style, pizza->bin_window, GTK_STATE_NORMAL,
GTK_SHADOW_NONE, &gdk_event->area, parent->m_widget, "base", 0, 0, -1, -1);
gtk_paint_flat_box (parent->m_widget->style,
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,
@@ -928,8 +934,14 @@ static void gtk_window_draw_callback( GtkWidget *widget,
if (!parent)
parent = win;
gtk_paint_flat_box (parent->m_widget->style, pizza->bin_window, GTK_STATE_NORMAL,
GTK_SHADOW_NONE, rect, parent->m_widget, "base", 0, 0, -1, -1);
gtk_paint_flat_box (parent->m_widget->style,
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
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;
}
@@ -3775,8 +3788,10 @@ bool wxWindowGTK::DoPopupMenu( wxMenu *menu, int x, int y )
bool is_waiting = TRUE;
gtk_signal_connect( GTK_OBJECT(menu->m_menu), "hide",
GTK_SIGNAL_FUNC(gtk_pop_hide_callback), (gpointer)&is_waiting );
gtk_signal_connect( GTK_OBJECT(menu->m_menu),
"hide",
GTK_SIGNAL_FUNC(gtk_pop_hide_callback),
(gpointer)&is_waiting );
gtk_menu_popup(
GTK_MENU(menu->m_menu),