Fix build with gcc14 and various warnings

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/16/head
Michele Calgaro 2 months ago
parent c2e3bfc5f6
commit 408a744039
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -66,6 +66,7 @@ TODO
#include <stdarg.h> #include <stdarg.h>
#include "connect.h" #include "connect.h"
#include "config.h" #include "config.h"
#include "ctype.h"
#define BLACKLIST_UNKNOWN_GTK_APPS 0 #define BLACKLIST_UNKNOWN_GTK_APPS 0
@ -187,7 +188,7 @@ typedef struct
static gpointer kdialogdMain(gpointer data) static gpointer kdialogdMain(gpointer data)
{ {
KGtkData *d=(struct KGtkData *)data; KGtkData *d=(KGtkData*)data;
char buffer[MAX_DATA_LEN+1]={'\0'}; char buffer[MAX_DATA_LEN+1]={'\0'};
int num=0; int num=0;
@ -247,7 +248,7 @@ static gboolean sendMessage(GtkWidget *widget, Operation op, GSList **res, gchar
#ifdef KGTK_DEBUG #ifdef KGTK_DEBUG
printf("KGTK::Dialog has a parent!\n"); printf("KGTK::Dialog has a parent!\n");
#endif #endif
xid=GDK_WINDOW_XID(gtk_widget_get_toplevel(widget->parent)); xid=GDK_WINDOW_XID(gtk_widget_get_toplevel(widget->parent)->window);
} }
/* /*
@ -283,6 +284,7 @@ static gboolean sendMessage(GtkWidget *widget, Operation op, GSList **res, gchar
GtkWidget *w=node->data; GtkWidget *w=node->data;
if(w && GTK_IS_WIDGET(w) && w->window) if(w && GTK_IS_WIDGET(w) && w->window)
{
if(gtk_window_has_toplevel_focus(GTK_WINDOW(w)) && if(gtk_window_has_toplevel_focus(GTK_WINDOW(w)) &&
gtk_window_is_active(GTK_WINDOW(w))) gtk_window_is_active(GTK_WINDOW(w)))
{ {
@ -296,7 +298,10 @@ static gboolean sendMessage(GtkWidget *widget, Operation op, GSList **res, gchar
break; break;
} }
else else
prevX=GDK_WINDOW_XID(w->window); {
prevX=GDK_WINDOW_XID(w->window);
}
}
} }
g_list_free(topWindows); g_list_free(topWindows);
} }
@ -331,7 +336,7 @@ static gboolean sendMessage(GtkWidget *widget, Operation op, GSList **res, gchar
gtk_window_set_skip_pager_hint(GTK_WINDOW(dlg), TRUE); gtk_window_set_skip_pager_hint(GTK_WINDOW(dlg), TRUE);
kdialogdLoop = g_main_loop_new (NULL, FALSE); kdialogdLoop = g_main_loop_new (NULL, FALSE);
kdialogdError=FALSE; kdialogdError=FALSE;
g_thread_create(&kdialogdMain, &d, FALSE, NULL); g_thread_new(NULL, &kdialogdMain, &d);
GDK_THREADS_LEAVE(); GDK_THREADS_LEAVE();
g_main_loop_run(kdialogdLoop); g_main_loop_run(kdialogdLoop);
@ -456,7 +461,7 @@ static gboolean isMozApp(const char *app, const char *check)
/* OK check for xulrunner-1.9 */ /* OK check for xulrunner-1.9 */
{ {
double dummy; double dummy;
if(app_len>(check_len+1) && 1==sscanf(&app[check_len+1], "%f", &dummy)) if(app_len>(check_len+1) && 1==sscanf(&app[check_len+1], "%lf", &dummy))
return TRUE; return TRUE;
} }
} }
@ -537,8 +542,6 @@ static gboolean kgtkInit(const char *appName)
{ {
determineAppName(); determineAppName();
if (((kgtkApp != APP_UNKNOWN) || (!BLACKLIST_UNKNOWN_GTK_APPS)) && (kgtkApp != APP_BLACKLISTED)) { if (((kgtkApp != APP_UNKNOWN) || (!BLACKLIST_UNKNOWN_GTK_APPS)) && (kgtkApp != APP_BLACKLISTED)) {
if(!g_threads_got_initialized)
g_thread_init(NULL);
atexit(&kgtkExit); atexit(&kgtkExit);
} }
} }
@ -695,12 +698,12 @@ kgtk_dialog_add_buttons_valist ( GtkDialog *dialog,
gboolean gtk_init_check(int *argc, char ***argv) gboolean gtk_init_check(int *argc, char ***argv)
{ {
static void * (*realFunction)() = NULL; static gboolean (*realFunction)() = NULL;
gboolean rv=FALSE; gboolean rv=FALSE;
if(!realFunction) if(!realFunction)
realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_init_check"); realFunction = (gboolean (*)()) real_dlsym(RTLD_NEXT, "gtk_init_check");
rv=realFunction(argc, argv); rv=realFunction(argc, argv);
#ifdef KGTK_DEBUG #ifdef KGTK_DEBUG
@ -1161,7 +1164,7 @@ void gtk_widget_hide(GtkWidget *widget)
realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_widget_hide"); realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_widget_hide");
determineAppName(); determineAppName();
if (((kgtkApp == APP_UNKNOWN) && BLACKLIST_UNKNOWN_GTK_APPS) || (kgtkApp == APP_BLACKLISTED) && realFunction) { if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED) && realFunction) {
#ifdef KGTK_DEBUG #ifdef KGTK_DEBUG
printf("KGTK::gtk_widget_hide Bypassing internal function\n"); fflush(stdout); printf("KGTK::gtk_widget_hide Bypassing internal function\n"); fflush(stdout);
#endif #endif
@ -1184,12 +1187,12 @@ void gtk_widget_hide(GtkWidget *widget)
gboolean gtk_file_chooser_get_do_overwrite_confirmation(GtkFileChooser *widget) gboolean gtk_file_chooser_get_do_overwrite_confirmation(GtkFileChooser *widget)
{ {
static void * (*realFunction)() = NULL; static gboolean (*realFunction)() = NULL;
gboolean rv=FALSE; gboolean rv=FALSE;
if(!realFunction) if(!realFunction)
realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_get_do_overwrite_confirmation"); realFunction = (gboolean (*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_get_do_overwrite_confirmation");
if(realFunction) if(realFunction)
{ {
@ -1200,12 +1203,12 @@ gboolean gtk_file_chooser_get_do_overwrite_confirmation(GtkFileChooser *widget)
if(!data->setOverWrite) if(!data->setOverWrite)
{ {
data->setOverWrite=TRUE; data->setOverWrite=TRUE;
data->doOverwrite=(gboolean) realFunction(widget); data->doOverwrite=realFunction(widget);
} }
rv=data->doOverwrite; rv=data->doOverwrite;
} }
else else
rv=(gboolean) realFunction(widget); rv=realFunction(widget);
} }
return rv; return rv;
@ -1248,16 +1251,16 @@ int gtk_combo_box_get_active(GtkComboBox *combo)
{ {
int rv=0; int rv=0;
if(APP_KINO==kgtkApp && isOnFileChooser(combo)) if(APP_KINO==kgtkApp && isOnFileChooser((GtkWidget*)combo))
return 1; return 1;
else else
{ {
static void * (*realFunction)() = NULL; static gint (*realFunction)(GtkComboBox*) = NULL;
if(!realFunction) if(!realFunction)
realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_combo_box_get_active"); realFunction = (gint (*)(GtkComboBox*)) real_dlsym(RTLD_NEXT, "gtk_combo_box_get_active");
rv=(int)realFunction(combo); rv=realFunction(combo);
} }
return rv; return rv;
@ -1265,13 +1268,13 @@ int gtk_combo_box_get_active(GtkComboBox *combo)
gint gtk_dialog_run(GtkDialog *dialog) gint gtk_dialog_run(GtkDialog *dialog)
{ {
static void * (*realFunction)() = NULL; static gint (*realFunction)(GtkDialog*) = NULL;
if(!realFunction) if(!realFunction)
realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_dialog_run"); realFunction = (gint (*)(GtkDialog*)) real_dlsym(RTLD_NEXT, "gtk_dialog_run");
determineAppName(); determineAppName();
if (((kgtkApp == APP_UNKNOWN) && BLACKLIST_UNKNOWN_GTK_APPS) || (kgtkApp == APP_BLACKLISTED) && realFunction) { if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED) && realFunction) {
#ifdef KGTK_DEBUG #ifdef KGTK_DEBUG
printf("KGTK::gtk_dialog_run Bypassing internal function\n"); fflush(stdout); printf("KGTK::gtk_dialog_run Bypassing internal function\n"); fflush(stdout);
#endif #endif
@ -1468,15 +1471,15 @@ gint gtk_dialog_run(GtkDialog *dialog)
g_signal_emit_by_name(dialog, "response", data->cancel); g_signal_emit_by_name(dialog, "response", data->cancel);
return data->cancel; return data->cancel;
} }
return realFunction(dialog); return (gint)realFunction(dialog);
} }
void gtk_widget_destroy(GtkWidget *widget) void gtk_widget_destroy(GtkWidget *widget)
{ {
static void * (*realFunction)() = NULL; static void (*realFunction)(GtkWidget*) = NULL;
if(!realFunction) if(!realFunction)
realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_widget_destroy"); realFunction = (void (*)(GtkWidget*)) real_dlsym(RTLD_NEXT, "gtk_widget_destroy");
if(fileDialogHash && GTK_IS_FILE_CHOOSER(widget)) if(fileDialogHash && GTK_IS_FILE_CHOOSER(widget))
freeHash(widget); freeHash(widget);
@ -1488,13 +1491,13 @@ gchar * gtk_file_chooser_get_filename(GtkFileChooser *chooser)
{ {
KGtkFileData *data=lookupHash(chooser, FALSE); KGtkFileData *data=lookupHash(chooser, FALSE);
static void * (*realFunction)() = NULL; static gchar * (*realFunction)(GtkFileChooser*) = NULL;
if(!realFunction) if(!realFunction)
realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_get_filename"); realFunction = (gchar *(*)(GtkFileChooser*)) real_dlsym(RTLD_NEXT, "gtk_file_chooser_get_filename");
determineAppName(); determineAppName();
if (((kgtkApp == APP_UNKNOWN) && BLACKLIST_UNKNOWN_GTK_APPS) || (kgtkApp == APP_BLACKLISTED) && realFunction) { if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED) && realFunction) {
#ifdef KGTK_DEBUG #ifdef KGTK_DEBUG
printf("KGTK::gtk_file_chooser_get_filename Bypassing internal function\n"); fflush(stdout); printf("KGTK::gtk_file_chooser_get_filename Bypassing internal function\n"); fflush(stdout);
#endif #endif
@ -1511,12 +1514,12 @@ gchar * gtk_file_chooser_get_filename(GtkFileChooser *chooser)
gboolean gtk_file_chooser_select_filename(GtkFileChooser *chooser, const char *filename) gboolean gtk_file_chooser_select_filename(GtkFileChooser *chooser, const char *filename)
{ {
KGtkFileData *data=lookupHash(chooser, TRUE); KGtkFileData *data=lookupHash(chooser, TRUE);
static void * (*realFunction)() = NULL; static gboolean (*realFunction)(GtkFileChooser*, const char*) = NULL;
if(!realFunction) if(!realFunction)
realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_select_filename"); realFunction = (gboolean (*)(GtkFileChooser*, const char*)) real_dlsym(RTLD_NEXT, "gtk_file_chooser_select_filename");
realFunction(chooser, filename); realFunction(chooser, filename);
if (((kgtkApp == APP_UNKNOWN) && BLACKLIST_UNKNOWN_GTK_APPS) || (kgtkApp == APP_BLACKLISTED) && realFunction) { if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED) && realFunction) {
return FALSE; return FALSE;
} }
@ -1538,7 +1541,7 @@ gboolean gtk_file_chooser_select_filename(GtkFileChooser *chooser, const char *f
data->files=g_slist_prepend(data->files, g_strdup(filename)); data->files=g_slist_prepend(data->files, g_strdup(filename));
if(folder && !data->folder || strcmp(folder, data->folder)) if(folder && (!data->folder || strcmp(folder, data->folder)))
{ {
gtk_file_chooser_set_current_folder(chooser, folder); gtk_file_chooser_set_current_folder(chooser, folder);
g_free(folder); g_free(folder);
@ -1557,7 +1560,7 @@ void gtk_file_chooser_unselect_all(GtkFileChooser *chooser)
if(!realFunction) if(!realFunction)
realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_unselect_all"); realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_unselect_all");
realFunction(chooser); realFunction(chooser);
if (((kgtkApp == APP_UNKNOWN) && BLACKLIST_UNKNOWN_GTK_APPS) || (kgtkApp == APP_BLACKLISTED) && realFunction) { if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED) && realFunction) {
return; return;
} }
@ -1580,7 +1583,7 @@ gboolean gtk_file_chooser_set_filename(GtkFileChooser *chooser, const char *file
if(!realFunction) if(!realFunction)
realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_set_filename"); realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_set_filename");
realFunction(chooser, filename); realFunction(chooser, filename);
if (((kgtkApp == APP_UNKNOWN) && BLACKLIST_UNKNOWN_GTK_APPS) || (kgtkApp == APP_BLACKLISTED) && realFunction) { if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED) && realFunction) {
return FALSE; return FALSE;
} }
@ -1621,15 +1624,14 @@ void gtk_file_chooser_set_current_name(GtkFileChooser *chooser, const char *file
GtkFileChooserAction act=gtk_file_chooser_get_action(chooser); GtkFileChooserAction act=gtk_file_chooser_get_action(chooser);
if ((GTK_FILE_CHOOSER_ACTION_SAVE==act || GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER==act) || if ((GTK_FILE_CHOOSER_ACTION_SAVE==act || GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER==act) ||
(((kgtkApp == APP_UNKNOWN) && BLACKLIST_UNKNOWN_GTK_APPS) || (kgtkApp == APP_BLACKLISTED)) ((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED))
)
{ {
static void * (*realFunction)() = NULL; static void * (*realFunction)() = NULL;
if(!realFunction) if(!realFunction)
realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_set_current_name"); realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_set_current_name");
realFunction(chooser, filename); realFunction(chooser, filename);
if (((kgtkApp == APP_UNKNOWN) && BLACKLIST_UNKNOWN_GTK_APPS) || (kgtkApp == APP_BLACKLISTED) && realFunction) { if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED) && realFunction) {
return; return;
} }
} }
@ -1657,7 +1659,7 @@ GSList * gtk_file_chooser_get_filenames(GtkFileChooser *chooser)
realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_get_filenames"); realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_get_filenames");
determineAppName(); determineAppName();
if (((kgtkApp == APP_UNKNOWN) && BLACKLIST_UNKNOWN_GTK_APPS) || (kgtkApp == APP_BLACKLISTED) && realFunction) { if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED) && realFunction) {
#ifdef KGTK_DEBUG #ifdef KGTK_DEBUG
printf("KGTK::gtk_file_chooser_get_filenames Bypassing internal function\n"); fflush(stdout); printf("KGTK::gtk_file_chooser_get_filenames Bypassing internal function\n"); fflush(stdout);
#endif #endif
@ -1694,7 +1696,7 @@ gboolean gtk_file_chooser_set_current_folder(GtkFileChooser *chooser, const gcha
if(!realFunction) if(!realFunction)
realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_set_current_folder"); realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_set_current_folder");
realFunction(chooser, folder); realFunction(chooser, folder);
if (((kgtkApp == APP_UNKNOWN) && BLACKLIST_UNKNOWN_GTK_APPS) || (kgtkApp == APP_BLACKLISTED) && realFunction) { if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED) && realFunction) {
return FALSE; return FALSE;
} }
@ -1723,7 +1725,7 @@ gchar * gtk_file_chooser_get_current_folder(GtkFileChooser *chooser)
realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_get_current_folder"); realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_get_current_folder");
determineAppName(); determineAppName();
if (((kgtkApp == APP_UNKNOWN) && BLACKLIST_UNKNOWN_GTK_APPS) || (kgtkApp == APP_BLACKLISTED) && realFunction) { if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED) && realFunction) {
#ifdef KGTK_DEBUG #ifdef KGTK_DEBUG
printf("KGTK::gtk_file_chooser_get_current_folder Bypassing internal function\n"); fflush(stdout); printf("KGTK::gtk_file_chooser_get_current_folder Bypassing internal function\n"); fflush(stdout);
#endif #endif
@ -1751,7 +1753,7 @@ gchar * gtk_file_chooser_get_uri(GtkFileChooser *chooser)
realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_get_uri"); realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_get_uri");
determineAppName(); determineAppName();
if (((kgtkApp == APP_UNKNOWN) && BLACKLIST_UNKNOWN_GTK_APPS) || (kgtkApp == APP_BLACKLISTED) && realFunction) { if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED) && realFunction) {
#ifdef KGTK_DEBUG #ifdef KGTK_DEBUG
printf("KGTK::gtk_file_chooser_get_uri Bypassing internal function\n"); fflush(stdout); printf("KGTK::gtk_file_chooser_get_uri Bypassing internal function\n"); fflush(stdout);
#endif #endif
@ -1776,13 +1778,13 @@ gchar * gtk_file_chooser_get_uri(GtkFileChooser *chooser)
gboolean gtk_file_chooser_set_uri(GtkFileChooser *chooser, const char *uri) gboolean gtk_file_chooser_set_uri(GtkFileChooser *chooser, const char *uri)
{ {
static void * (*realFunction)() = NULL; static gboolean (*realFunction)(GtkFileChooser*, const char *) = NULL;
if(!realFunction) if(!realFunction)
realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_set_uri"); realFunction = (gboolean (*)(GtkFileChooser*, const char *)) real_dlsym(RTLD_NEXT, "gtk_file_chooser_set_uri");
determineAppName(); determineAppName();
if (((kgtkApp == APP_UNKNOWN) && BLACKLIST_UNKNOWN_GTK_APPS) || (kgtkApp == APP_BLACKLISTED) && realFunction) { if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED) && realFunction) {
#ifdef KGTK_DEBUG #ifdef KGTK_DEBUG
printf("KGTK::gtk_file_chooser_set_uri Bypassing internal function\n"); fflush(stdout); printf("KGTK::gtk_file_chooser_set_uri Bypassing internal function\n"); fflush(stdout);
#endif #endif
@ -1813,7 +1815,7 @@ GSList * gtk_file_chooser_get_uris(GtkFileChooser *chooser)
realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_get_uris"); realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_get_uris");
determineAppName(); determineAppName();
if (((kgtkApp == APP_UNKNOWN) && BLACKLIST_UNKNOWN_GTK_APPS) || (kgtkApp == APP_BLACKLISTED) && realFunction) { if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED) && realFunction) {
#ifdef KGTK_DEBUG #ifdef KGTK_DEBUG
printf("KGTK::gtk_file_chooser_get_uris Bypassing internal function\n"); fflush(stdout); printf("KGTK::gtk_file_chooser_get_uris Bypassing internal function\n"); fflush(stdout);
#endif #endif
@ -1828,13 +1830,13 @@ GSList * gtk_file_chooser_get_uris(GtkFileChooser *chooser)
gboolean gtk_file_chooser_set_current_folder_uri(GtkFileChooser *chooser, const gchar *uri) gboolean gtk_file_chooser_set_current_folder_uri(GtkFileChooser *chooser, const gchar *uri)
{ {
static void * (*realFunction)() = NULL; static gboolean (*realFunction)(GtkFileChooser*, const gchar*) = NULL;
if(!realFunction) if(!realFunction)
realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_set_current_folder_uri"); realFunction = (gboolean (*)(GtkFileChooser*, const gchar*)) real_dlsym(RTLD_NEXT, "gtk_file_chooser_set_current_folder_uri");
determineAppName(); determineAppName();
if (((kgtkApp == APP_UNKNOWN) && BLACKLIST_UNKNOWN_GTK_APPS) || (kgtkApp == APP_BLACKLISTED) && realFunction) { if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED) && realFunction) {
#ifdef KGTK_DEBUG #ifdef KGTK_DEBUG
printf("KGTK::gtk_file_chooser_set_current_folder_uri Bypassing internal function\n"); fflush(stdout); printf("KGTK::gtk_file_chooser_set_current_folder_uri Bypassing internal function\n"); fflush(stdout);
#endif #endif
@ -1858,13 +1860,13 @@ gboolean gtk_file_chooser_set_current_folder_uri(GtkFileChooser *chooser, const
gchar * gtk_file_chooser_get_current_folder_uri(GtkFileChooser *chooser) gchar * gtk_file_chooser_get_current_folder_uri(GtkFileChooser *chooser)
{ {
static void * (*realFunction)() = NULL; static gchar * (*realFunction)(GtkFileChooser*) = NULL;
if(!realFunction) if(!realFunction)
realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_file_chooser_get_current_folder_uri"); realFunction = (gchar *(*)(GtkFileChooser*)) real_dlsym(RTLD_NEXT, "gtk_file_chooser_get_current_folder_uri");
determineAppName(); determineAppName();
if (((kgtkApp == APP_UNKNOWN) && BLACKLIST_UNKNOWN_GTK_APPS) || (kgtkApp == APP_BLACKLISTED) && realFunction) { if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED) && realFunction) {
#ifdef KGTK_DEBUG #ifdef KGTK_DEBUG
printf("KGTK::gtk_file_chooser_get_current_folder_uri Bypassing internal function\n"); fflush(stdout); printf("KGTK::gtk_file_chooser_get_current_folder_uri Bypassing internal function\n"); fflush(stdout);
#endif #endif
@ -1919,7 +1921,7 @@ GtkWidget * gtk_dialog_add_button(GtkDialog *dialog, const gchar *button_text, g
dlg = realFunction(dialog, button_text, response_id); dlg = realFunction(dialog, button_text, response_id);
determineAppName(); determineAppName();
if (((kgtkApp == APP_UNKNOWN) && BLACKLIST_UNKNOWN_GTK_APPS) || (kgtkApp == APP_BLACKLISTED) && realFunction) { if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED) && realFunction) {
#ifdef KGTK_DEBUG #ifdef KGTK_DEBUG
printf("KGTK::gtk_dialog_add_button Bypassing internal function\n"); fflush(stdout); printf("KGTK::gtk_dialog_add_button Bypassing internal function\n"); fflush(stdout);
#endif #endif
@ -1961,7 +1963,7 @@ void gtk_dialog_add_buttons(GtkDialog *dialog, const gchar *first_button_text, .
va_end(varargs); va_end(varargs);
determineAppName(); determineAppName();
if (((kgtkApp == APP_UNKNOWN) && BLACKLIST_UNKNOWN_GTK_APPS) || (kgtkApp == APP_BLACKLISTED)) { if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED)) {
#ifdef KGTK_DEBUG #ifdef KGTK_DEBUG
printf("KGTK::gtk_dialog_add_buttons Bypassing internal function\n"); fflush(stdout); printf("KGTK::gtk_dialog_add_buttons Bypassing internal function\n"); fflush(stdout);
#endif #endif
@ -2010,7 +2012,7 @@ GtkWidget * gtk_file_chooser_dialog_new(const gchar *title, GtkWindow *parent,
va_end(varargs); va_end(varargs);
determineAppName(); determineAppName();
if (((kgtkApp == APP_UNKNOWN) && BLACKLIST_UNKNOWN_GTK_APPS) || (kgtkApp == APP_BLACKLISTED)) { if (((kgtkApp == APP_UNKNOWN && BLACKLIST_UNKNOWN_GTK_APPS) || kgtkApp == APP_BLACKLISTED)) {
#ifdef KGTK_DEBUG #ifdef KGTK_DEBUG
printf("KGTK::gtk_file_chooser_dialog_new Bypassing internal function\n"); fflush(stdout); printf("KGTK::gtk_file_chooser_dialog_new Bypassing internal function\n"); fflush(stdout);
#endif #endif
@ -2052,7 +2054,7 @@ static void handleGtkFileChooserButtonClicked(GtkButton *button, gpointer user_d
#ifdef KGTK_DEBUG #ifdef KGTK_DEBUG
printf("KGTK::handleGtkFileChooserButtonClicked\n"); printf("KGTK::handleGtkFileChooserButtonClicked\n");
#endif #endif
gtk_dialog_run(GTK_FILE_CHOOSER_BUTTON(user_data)->priv->dialog); gtk_dialog_run((GtkDialog*)GTK_FILE_CHOOSER_BUTTON(user_data)->priv->dialog);
} }
static void handleGtkFileChooserComboChanged(GtkComboBox *combo_box, gpointer user_data) static void handleGtkFileChooserComboChanged(GtkComboBox *combo_box, gpointer user_data)
@ -2074,7 +2076,7 @@ static void handleGtkFileChooserComboChanged(GtkComboBox *combo_box, gpointer us
gtk_tree_model_get(priv->filter_model, &iter, TYPE_COLUMN, &type, -1); gtk_tree_model_get(priv->filter_model, &iter, TYPE_COLUMN, &type, -1);
if(ROW_TYPE_OTHER==type) if(ROW_TYPE_OTHER==type)
gtk_dialog_run(GTK_FILE_CHOOSER_BUTTON(user_data)->priv->dialog); gtk_dialog_run((GtkDialog*)GTK_FILE_CHOOSER_BUTTON(user_data)->priv->dialog);
else else
{ {
g_signal_handler_unblock(priv->combo_box, priv->combo_box_changed_id); g_signal_handler_unblock(priv->combo_box, priv->combo_box_changed_id);
@ -2103,7 +2105,7 @@ GtkWidget * gtk_file_chooser_button_new(const gchar *title, GtkFileChooserAction
{ {
GtkFileChooserButtonPrivate *priv=NULL; GtkFileChooserButtonPrivate *priv=NULL;
button=realFunction(title, action); button=(GtkWidget*)realFunction(title, action);
priv=GTK_FILE_CHOOSER_BUTTON(button)->priv; priv=GTK_FILE_CHOOSER_BUTTON(button)->priv;
if(priv->button) if(priv->button)
@ -2239,38 +2241,38 @@ void * PR_FindFunctionSymbol(struct PR_LoadLibrary *lib, const char *raw_name)
/* Overriding dlsym is required for SWT - which dlsym's the gtk_file_chooser functions! */ /* Overriding dlsym is required for SWT - which dlsym's the gtk_file_chooser functions! */
static void * real_dlsym(void *handle, const char *name) static void * real_dlsym(void *handle, const char *name)
{ {
static void * (*realFunction)() = NULL; static void * (*realFunction)() = NULL;
#ifdef KGTK_DEBUG_DLSYM #ifdef KGTK_DEBUG_DLSYM
printf("KGTK::real_dlsym : %s\n", name); printf("KGTK::real_dlsym : %s\n", name);
#endif #endif
if (!realFunction) if (!realFunction)
{ {
// Get the real dlsym function // Get the real dlsym function
#ifdef HAVE_DL_SYM #ifdef HAVE_DL_SYM
realFunction = _dl_sym(RTLD_NEXT, "dlsym", dlsym); realFunction = _dl_sym(RTLD_NEXT, "dlsym", dlsym);
#else #else
realFunction = dlvsym(RTLD_NEXT, "dlsym", "GLIBC_2.2.5"); realFunction = dlvsym(RTLD_NEXT, "dlsym", "GLIBC_2.2.5");
#endif #endif
} }
if (realFunction) if (realFunction)
return realFunction(handle, name); return realFunction(handle, name);
else else
{ {
printf("kgtk-qt3 gtk2 real_dlsymc() realFunction not found!!\n"); printf("kgtk-qt3 gtk2 real_dlsymc() realFunction not found!!\n");
return NULL; return NULL;
} }
} }
void * dlsym(void *handle, const char *name) void * dlsym(void *handle, const char *name)
{ {
// Need this so _dl_sym will be able to find the next dlsym, i.e. the real dlsym! // Need this so _dl_sym will be able to find the next dlsym, i.e. the real dlsym!
if (!strcmp(name, "dlsym")) if (!strcmp(name, "dlsym"))
{ {
return (void*)dlsym; return (void*)dlsym;
} }
void *rv=NULL; void *rv=NULL;

Loading…
Cancel
Save