diff options
125 files changed, 1192 insertions, 475 deletions
@@ -1,7 +1,56 @@ +Sun May 3 13:38:22 1998 Owen Taylor <otaylor@gtk.org> + + * configure.in acheader.h gdk/gdkwindow.c + Check for Shape extension both on the client and server + side. (And, more importantly, check for the shape extension + so we may include -lXext even when compiling with --disable-xshm) + + Don't set override_redirect on all shaped windows. It isn't + necessary. + + * gdk/gdkwindow.c: Set ->colormap to NULL for root + and foreign windows. Use this to check if we + need to get the colormap from X. + +Fri May 1 22:32:47 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkbutton.c (gtk_button_paint): Draw the areas + between the default and the button always in GTK_STATE_NORMAL. + + * gtk/gtkrange.c (gtk_range_style_set): Added a style_set + callback. + +Fri May 1 16:40:57 1998 Owen Taylor <otaylor@gtk.org> + + * gdk/gdkpixmap.c (gdk_pixmap_colormap_create_from_xpmp[_d]): + Fix a buffer overflow on pixmaps that claim to have + more than 31 characters per pixel. + + (gdk_pixmap_read_string): Don't wrap around strings longer + than half of address space ;-) + + * gtk/gtk[vh]ruler.c gtk/gtkinputdialog.c: Expand some buffers + that were used for printing integers. + + * */* (almost): + + Style: All + int foo () { ... } + changed to + int foo (void) { ... } + + Even where there were proper prototypes elsewhere. + + * gdk/gxid.c (handle_claim_device): Some extra checks. + It isn't safe against being fed bad X id's, but at + least it should be safe against deleting all your + files. + Sun May 3 19:45:09 1998 Tim Janik <timj@gtk.org> * gtk/gtkadjustment.c (gtk_adjustment_assimilate_value): new function to set the adjustments value when there is no current emissioin. + [ Removed by mutual agreement owt 5/3/1998 ] * gtk/gtksignal.c: added new functions to retrive the number of existing emissions for a certain signal. @@ -50,6 +99,7 @@ Sat May 2 20:19:03 1998 Tim Janik <timj@gtk.org> (gtk_adjustment_set_value): new function to emit the "value_changed" signal. +>>>>>>> 1.372 Fri May 1 12:28:35 1998 Owen Taylor <otaylor@gtk.org> * gtk/gtkcombo.c: Further changes to the way the window diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index ef4775597..8c83c622b 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,7 +1,56 @@ +Sun May 3 13:38:22 1998 Owen Taylor <otaylor@gtk.org> + + * configure.in acheader.h gdk/gdkwindow.c + Check for Shape extension both on the client and server + side. (And, more importantly, check for the shape extension + so we may include -lXext even when compiling with --disable-xshm) + + Don't set override_redirect on all shaped windows. It isn't + necessary. + + * gdk/gdkwindow.c: Set ->colormap to NULL for root + and foreign windows. Use this to check if we + need to get the colormap from X. + +Fri May 1 22:32:47 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkbutton.c (gtk_button_paint): Draw the areas + between the default and the button always in GTK_STATE_NORMAL. + + * gtk/gtkrange.c (gtk_range_style_set): Added a style_set + callback. + +Fri May 1 16:40:57 1998 Owen Taylor <otaylor@gtk.org> + + * gdk/gdkpixmap.c (gdk_pixmap_colormap_create_from_xpmp[_d]): + Fix a buffer overflow on pixmaps that claim to have + more than 31 characters per pixel. + + (gdk_pixmap_read_string): Don't wrap around strings longer + than half of address space ;-) + + * gtk/gtk[vh]ruler.c gtk/gtkinputdialog.c: Expand some buffers + that were used for printing integers. + + * */* (almost): + + Style: All + int foo () { ... } + changed to + int foo (void) { ... } + + Even where there were proper prototypes elsewhere. + + * gdk/gxid.c (handle_claim_device): Some extra checks. + It isn't safe against being fed bad X id's, but at + least it should be safe against deleting all your + files. + Sun May 3 19:45:09 1998 Tim Janik <timj@gtk.org> * gtk/gtkadjustment.c (gtk_adjustment_assimilate_value): new function to set the adjustments value when there is no current emissioin. + [ Removed by mutual agreement owt 5/3/1998 ] * gtk/gtksignal.c: added new functions to retrive the number of existing emissions for a certain signal. @@ -50,6 +99,7 @@ Sat May 2 20:19:03 1998 Tim Janik <timj@gtk.org> (gtk_adjustment_set_value): new function to emit the "value_changed" signal. +>>>>>>> 1.372 Fri May 1 12:28:35 1998 Owen Taylor <otaylor@gtk.org> * gtk/gtkcombo.c: Further changes to the way the window diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index ef4775597..8c83c622b 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,7 +1,56 @@ +Sun May 3 13:38:22 1998 Owen Taylor <otaylor@gtk.org> + + * configure.in acheader.h gdk/gdkwindow.c + Check for Shape extension both on the client and server + side. (And, more importantly, check for the shape extension + so we may include -lXext even when compiling with --disable-xshm) + + Don't set override_redirect on all shaped windows. It isn't + necessary. + + * gdk/gdkwindow.c: Set ->colormap to NULL for root + and foreign windows. Use this to check if we + need to get the colormap from X. + +Fri May 1 22:32:47 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkbutton.c (gtk_button_paint): Draw the areas + between the default and the button always in GTK_STATE_NORMAL. + + * gtk/gtkrange.c (gtk_range_style_set): Added a style_set + callback. + +Fri May 1 16:40:57 1998 Owen Taylor <otaylor@gtk.org> + + * gdk/gdkpixmap.c (gdk_pixmap_colormap_create_from_xpmp[_d]): + Fix a buffer overflow on pixmaps that claim to have + more than 31 characters per pixel. + + (gdk_pixmap_read_string): Don't wrap around strings longer + than half of address space ;-) + + * gtk/gtk[vh]ruler.c gtk/gtkinputdialog.c: Expand some buffers + that were used for printing integers. + + * */* (almost): + + Style: All + int foo () { ... } + changed to + int foo (void) { ... } + + Even where there were proper prototypes elsewhere. + + * gdk/gxid.c (handle_claim_device): Some extra checks. + It isn't safe against being fed bad X id's, but at + least it should be safe against deleting all your + files. + Sun May 3 19:45:09 1998 Tim Janik <timj@gtk.org> * gtk/gtkadjustment.c (gtk_adjustment_assimilate_value): new function to set the adjustments value when there is no current emissioin. + [ Removed by mutual agreement owt 5/3/1998 ] * gtk/gtksignal.c: added new functions to retrive the number of existing emissions for a certain signal. @@ -50,6 +99,7 @@ Sat May 2 20:19:03 1998 Tim Janik <timj@gtk.org> (gtk_adjustment_set_value): new function to emit the "value_changed" signal. +>>>>>>> 1.372 Fri May 1 12:28:35 1998 Owen Taylor <otaylor@gtk.org> * gtk/gtkcombo.c: Further changes to the way the window diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index ef4775597..8c83c622b 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,7 +1,56 @@ +Sun May 3 13:38:22 1998 Owen Taylor <otaylor@gtk.org> + + * configure.in acheader.h gdk/gdkwindow.c + Check for Shape extension both on the client and server + side. (And, more importantly, check for the shape extension + so we may include -lXext even when compiling with --disable-xshm) + + Don't set override_redirect on all shaped windows. It isn't + necessary. + + * gdk/gdkwindow.c: Set ->colormap to NULL for root + and foreign windows. Use this to check if we + need to get the colormap from X. + +Fri May 1 22:32:47 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkbutton.c (gtk_button_paint): Draw the areas + between the default and the button always in GTK_STATE_NORMAL. + + * gtk/gtkrange.c (gtk_range_style_set): Added a style_set + callback. + +Fri May 1 16:40:57 1998 Owen Taylor <otaylor@gtk.org> + + * gdk/gdkpixmap.c (gdk_pixmap_colormap_create_from_xpmp[_d]): + Fix a buffer overflow on pixmaps that claim to have + more than 31 characters per pixel. + + (gdk_pixmap_read_string): Don't wrap around strings longer + than half of address space ;-) + + * gtk/gtk[vh]ruler.c gtk/gtkinputdialog.c: Expand some buffers + that were used for printing integers. + + * */* (almost): + + Style: All + int foo () { ... } + changed to + int foo (void) { ... } + + Even where there were proper prototypes elsewhere. + + * gdk/gxid.c (handle_claim_device): Some extra checks. + It isn't safe against being fed bad X id's, but at + least it should be safe against deleting all your + files. + Sun May 3 19:45:09 1998 Tim Janik <timj@gtk.org> * gtk/gtkadjustment.c (gtk_adjustment_assimilate_value): new function to set the adjustments value when there is no current emissioin. + [ Removed by mutual agreement owt 5/3/1998 ] * gtk/gtksignal.c: added new functions to retrive the number of existing emissions for a certain signal. @@ -50,6 +99,7 @@ Sat May 2 20:19:03 1998 Tim Janik <timj@gtk.org> (gtk_adjustment_set_value): new function to emit the "value_changed" signal. +>>>>>>> 1.372 Fri May 1 12:28:35 1998 Owen Taylor <otaylor@gtk.org> * gtk/gtkcombo.c: Further changes to the way the window diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index ef4775597..8c83c622b 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,7 +1,56 @@ +Sun May 3 13:38:22 1998 Owen Taylor <otaylor@gtk.org> + + * configure.in acheader.h gdk/gdkwindow.c + Check for Shape extension both on the client and server + side. (And, more importantly, check for the shape extension + so we may include -lXext even when compiling with --disable-xshm) + + Don't set override_redirect on all shaped windows. It isn't + necessary. + + * gdk/gdkwindow.c: Set ->colormap to NULL for root + and foreign windows. Use this to check if we + need to get the colormap from X. + +Fri May 1 22:32:47 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkbutton.c (gtk_button_paint): Draw the areas + between the default and the button always in GTK_STATE_NORMAL. + + * gtk/gtkrange.c (gtk_range_style_set): Added a style_set + callback. + +Fri May 1 16:40:57 1998 Owen Taylor <otaylor@gtk.org> + + * gdk/gdkpixmap.c (gdk_pixmap_colormap_create_from_xpmp[_d]): + Fix a buffer overflow on pixmaps that claim to have + more than 31 characters per pixel. + + (gdk_pixmap_read_string): Don't wrap around strings longer + than half of address space ;-) + + * gtk/gtk[vh]ruler.c gtk/gtkinputdialog.c: Expand some buffers + that were used for printing integers. + + * */* (almost): + + Style: All + int foo () { ... } + changed to + int foo (void) { ... } + + Even where there were proper prototypes elsewhere. + + * gdk/gxid.c (handle_claim_device): Some extra checks. + It isn't safe against being fed bad X id's, but at + least it should be safe against deleting all your + files. + Sun May 3 19:45:09 1998 Tim Janik <timj@gtk.org> * gtk/gtkadjustment.c (gtk_adjustment_assimilate_value): new function to set the adjustments value when there is no current emissioin. + [ Removed by mutual agreement owt 5/3/1998 ] * gtk/gtksignal.c: added new functions to retrive the number of existing emissions for a certain signal. @@ -50,6 +99,7 @@ Sat May 2 20:19:03 1998 Tim Janik <timj@gtk.org> (gtk_adjustment_set_value): new function to emit the "value_changed" signal. +>>>>>>> 1.372 Fri May 1 12:28:35 1998 Owen Taylor <otaylor@gtk.org> * gtk/gtkcombo.c: Further changes to the way the window diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index ef4775597..8c83c622b 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,7 +1,56 @@ +Sun May 3 13:38:22 1998 Owen Taylor <otaylor@gtk.org> + + * configure.in acheader.h gdk/gdkwindow.c + Check for Shape extension both on the client and server + side. (And, more importantly, check for the shape extension + so we may include -lXext even when compiling with --disable-xshm) + + Don't set override_redirect on all shaped windows. It isn't + necessary. + + * gdk/gdkwindow.c: Set ->colormap to NULL for root + and foreign windows. Use this to check if we + need to get the colormap from X. + +Fri May 1 22:32:47 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkbutton.c (gtk_button_paint): Draw the areas + between the default and the button always in GTK_STATE_NORMAL. + + * gtk/gtkrange.c (gtk_range_style_set): Added a style_set + callback. + +Fri May 1 16:40:57 1998 Owen Taylor <otaylor@gtk.org> + + * gdk/gdkpixmap.c (gdk_pixmap_colormap_create_from_xpmp[_d]): + Fix a buffer overflow on pixmaps that claim to have + more than 31 characters per pixel. + + (gdk_pixmap_read_string): Don't wrap around strings longer + than half of address space ;-) + + * gtk/gtk[vh]ruler.c gtk/gtkinputdialog.c: Expand some buffers + that were used for printing integers. + + * */* (almost): + + Style: All + int foo () { ... } + changed to + int foo (void) { ... } + + Even where there were proper prototypes elsewhere. + + * gdk/gxid.c (handle_claim_device): Some extra checks. + It isn't safe against being fed bad X id's, but at + least it should be safe against deleting all your + files. + Sun May 3 19:45:09 1998 Tim Janik <timj@gtk.org> * gtk/gtkadjustment.c (gtk_adjustment_assimilate_value): new function to set the adjustments value when there is no current emissioin. + [ Removed by mutual agreement owt 5/3/1998 ] * gtk/gtksignal.c: added new functions to retrive the number of existing emissions for a certain signal. @@ -50,6 +99,7 @@ Sat May 2 20:19:03 1998 Tim Janik <timj@gtk.org> (gtk_adjustment_set_value): new function to emit the "value_changed" signal. +>>>>>>> 1.372 Fri May 1 12:28:35 1998 Owen Taylor <otaylor@gtk.org> * gtk/gtkcombo.c: Further changes to the way the window diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index ef4775597..8c83c622b 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,7 +1,56 @@ +Sun May 3 13:38:22 1998 Owen Taylor <otaylor@gtk.org> + + * configure.in acheader.h gdk/gdkwindow.c + Check for Shape extension both on the client and server + side. (And, more importantly, check for the shape extension + so we may include -lXext even when compiling with --disable-xshm) + + Don't set override_redirect on all shaped windows. It isn't + necessary. + + * gdk/gdkwindow.c: Set ->colormap to NULL for root + and foreign windows. Use this to check if we + need to get the colormap from X. + +Fri May 1 22:32:47 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkbutton.c (gtk_button_paint): Draw the areas + between the default and the button always in GTK_STATE_NORMAL. + + * gtk/gtkrange.c (gtk_range_style_set): Added a style_set + callback. + +Fri May 1 16:40:57 1998 Owen Taylor <otaylor@gtk.org> + + * gdk/gdkpixmap.c (gdk_pixmap_colormap_create_from_xpmp[_d]): + Fix a buffer overflow on pixmaps that claim to have + more than 31 characters per pixel. + + (gdk_pixmap_read_string): Don't wrap around strings longer + than half of address space ;-) + + * gtk/gtk[vh]ruler.c gtk/gtkinputdialog.c: Expand some buffers + that were used for printing integers. + + * */* (almost): + + Style: All + int foo () { ... } + changed to + int foo (void) { ... } + + Even where there were proper prototypes elsewhere. + + * gdk/gxid.c (handle_claim_device): Some extra checks. + It isn't safe against being fed bad X id's, but at + least it should be safe against deleting all your + files. + Sun May 3 19:45:09 1998 Tim Janik <timj@gtk.org> * gtk/gtkadjustment.c (gtk_adjustment_assimilate_value): new function to set the adjustments value when there is no current emissioin. + [ Removed by mutual agreement owt 5/3/1998 ] * gtk/gtksignal.c: added new functions to retrive the number of existing emissions for a certain signal. @@ -50,6 +99,7 @@ Sat May 2 20:19:03 1998 Tim Janik <timj@gtk.org> (gtk_adjustment_set_value): new function to emit the "value_changed" signal. +>>>>>>> 1.372 Fri May 1 12:28:35 1998 Owen Taylor <otaylor@gtk.org> * gtk/gtkcombo.c: Further changes to the way the window diff --git a/acconfig.h b/acconfig.h index f4393880c..703d7a3af 100644 --- a/acconfig.h +++ b/acconfig.h @@ -17,8 +17,8 @@ /* Other stuff */ #undef HAVE_IPC_H #undef HAVE_SHM_H -#undef HAVE_XPM #undef HAVE_XSHM_H +#undef HAVE_SHAPE_EXT #undef HAVE_SYS_SELECT_H #undef IPC_RMID_DEFERRED_RELEASE diff --git a/config.h.in b/config.h.in index 8121d09d1..5b9bc422c 100644 --- a/config.h.in +++ b/config.h.in @@ -18,8 +18,8 @@ /* Other stuff */ #undef HAVE_IPC_H #undef HAVE_SHM_H -#undef HAVE_XPM #undef HAVE_XSHM_H +#undef HAVE_SHAPE_EXT #undef HAVE_SYS_SELECT_H #undef IPC_RMID_DEFERRED_RELEASE diff --git a/configure.in b/configure.in index dcaf86264..fa0d741d7 100644 --- a/configure.in +++ b/configure.in @@ -118,6 +118,14 @@ if test "x$enable_shm" = "xyes"; then $x_libs) fi +# Check for shaped window extension + +AC_CHECK_LIB(Xext, XShapeCombineMask, + if test -z "`echo $x_libs | grep "\-lXext" 2> /dev/null`"; then + $x_libs="-lXext $x_libs" + fi + AC_DEFINE(HAVE_SHAPE_EXT)) + x_cflags="$X_CFLAGS" x_ldflags="$X_LDFLAGS $X_LIBS" @@ -625,7 +625,7 @@ gdk_exit (int errorcode) */ gchar* -gdk_set_locale () +gdk_set_locale (void) { if (!setlocale (LC_ALL,"")) g_print ("locale not supported by C library\n"); @@ -663,7 +663,7 @@ gdk_set_locale () */ gint -gdk_events_pending () +gdk_events_pending (void) { gint result; GList *tmp_list; @@ -1023,13 +1023,13 @@ gdk_set_use_xshm (gint use_xshm) } gint -gdk_get_show_events () +gdk_get_show_events (void) { return gdk_debug_flags & GDK_DEBUG_EVENTS; } gint -gdk_get_use_xshm () +gdk_get_use_xshm (void) { return gdk_use_xshm; } @@ -1055,7 +1055,7 @@ gdk_get_use_xshm () */ guint32 -gdk_time_get () +gdk_time_get (void) { struct timeval end; struct timeval elapsed; @@ -1094,7 +1094,7 @@ gdk_time_get () */ guint32 -gdk_timer_get () +gdk_timer_get (void) { return timer_val; } @@ -1129,13 +1129,13 @@ gdk_timer_set (guint32 milliseconds) } void -gdk_timer_enable () +gdk_timer_enable (void) { timerp = &timer; } void -gdk_timer_disable () +gdk_timer_disable (void) { timerp = NULL; } @@ -1463,7 +1463,7 @@ gdk_keyboard_ungrab (guint32 time) */ gint -gdk_screen_width () +gdk_screen_width (void) { gint return_val; @@ -1488,7 +1488,7 @@ gdk_screen_width () */ gint -gdk_screen_height () +gdk_screen_height (void) { gint return_val; @@ -1498,13 +1498,13 @@ gdk_screen_height () } void -gdk_key_repeat_disable () +gdk_key_repeat_disable (void) { XAutoRepeatOff (gdk_display); } void -gdk_key_repeat_restore () +gdk_key_repeat_restore (void) { if (autorepeat) XAutoRepeatOn (gdk_display); @@ -1531,14 +1531,14 @@ gdk_key_repeat_restore () *-------------------------------------------------------------- */ -void gdk_flush () +void gdk_flush (void) { XSync (gdk_display, False); } void -gdk_beep () +gdk_beep (void) { XBell(gdk_display, 100); } @@ -1562,7 +1562,7 @@ gdk_beep () */ static gint -gdk_event_wait () +gdk_event_wait (void) { GList *list; GdkInput *input; @@ -3028,7 +3028,7 @@ gdk_synthesize_click (GdkEvent *event, */ static void -gdk_exit_func () +gdk_exit_func (void) { static gboolean in_gdk_exit_func = FALSE; diff --git a/gdk/gdkimage.c b/gdk/gdkimage.c index 82c542122..c31ab4e5b 100644 --- a/gdk/gdkimage.c +++ b/gdk/gdkimage.c @@ -64,7 +64,7 @@ static GList *image_list = NULL; void -gdk_image_exit () +gdk_image_exit (void) { GdkImage *image; @@ -131,7 +131,7 @@ gdk_image_check_xshm(Display *display) } void -gdk_image_init () +gdk_image_init (void) { if (gdk_use_xshm) { diff --git a/gdk/gdkinput.c b/gdk/gdkinput.c index e47f2205f..491131ca2 100644 --- a/gdk/gdkinput.c +++ b/gdk/gdkinput.c @@ -70,7 +70,7 @@ static GList *gdk_input_windows; #include "gdkinputgxi.h" GList * -gdk_input_list_devices () +gdk_input_list_devices (void) { return gdk_input_devices; } diff --git a/gdk/gdkinputnone.h b/gdk/gdkinputnone.h index 44bd8d037..aa0cc0b0b 100644 --- a/gdk/gdkinputnone.h +++ b/gdk/gdkinputnone.h @@ -29,7 +29,7 @@ static void gdk_input_none_get_pointer (GdkWindow *window, GdkModifierType *mask); void -gdk_input_init () +gdk_input_init (void) { gdk_input_vtable.set_mode = NULL; gdk_input_vtable.set_axes = NULL; diff --git a/gdk/gdkinputxfree.h b/gdk/gdkinputxfree.h index efc728cb0..c0411a4fe 100644 --- a/gdk/gdkinputxfree.h +++ b/gdk/gdkinputxfree.h @@ -22,7 +22,7 @@ /* forward declarations */ static gint gdk_input_xfree_set_mode (guint32 deviceid, GdkInputMode mode); -static void gdk_input_check_proximity(); +static void gdk_input_check_proximity (void); static void gdk_input_xfree_configure_event (XConfigureEvent *xevent, GdkWindow *window); static void gdk_input_xfree_enter_event (XCrossingEvent *xevent, @@ -115,7 +115,7 @@ gdk_input_xfree_set_mode (guint32 deviceid, GdkInputMode mode) } static void -gdk_input_check_proximity() +gdk_input_check_proximity (void) { gint new_proximity = 0; GList *tmp_list = gdk_input_devices; diff --git a/gdk/gdkpixmap.c b/gdk/gdkpixmap.c index a1af21542..2f2cdea4c 100644 --- a/gdk/gdkpixmap.c +++ b/gdk/gdkpixmap.c @@ -256,8 +256,14 @@ gdk_pixmap_read_string (FILE *infile, { if (cnt == (*buffer_size)) { - (*buffer_size) *= 2; - (*buffer) = (gchar *) g_realloc ((*buffer), *buffer_size); } + guint new_size = (*buffer_size) * 2; + if (new_size > (*buffer_size)) + *buffer_size = new_size; + else + return FALSE; + + (*buffer) = (gchar *) g_realloc ((*buffer), *buffer_size); + } if (c != '"') (*buffer)[cnt++] = c; @@ -399,6 +405,11 @@ gdk_pixmap_colormap_create_from_xpm (GdkWindow *window, gdk_pixmap_read_string (infile, &buffer, &buffer_size); sscanf (buffer,"%d %d %d %d", &width, &height, &num_cols, &cpp); + if (cpp >= 32) + { + g_warning ("Pixmap has more than 31 characters per color\n"); + return NULL; + } colors = g_new(_GdkPixmapColor, num_cols); @@ -574,6 +585,11 @@ gdk_pixmap_colormap_create_from_xpm_d (GdkWindow *window, i = 0; buffer = data[i++]; sscanf (buffer,"%d %d %d %d", &width, &height, &num_cols, &cpp); + if (cpp >= 32) + { + g_warning ("Pixmap has more than 31 characters per color\n"); + return NULL; + } colors = g_new(_GdkPixmapColor, num_cols); diff --git a/gdk/gdkvisual.c b/gdk/gdkvisual.c index 90ca5cfe7..a6a8b2b13 100644 --- a/gdk/gdkvisual.c +++ b/gdk/gdkvisual.c @@ -58,7 +58,7 @@ static gchar* visual_names[] = static GHashTable *visual_hash = NULL; void -gdk_visual_init () +gdk_visual_init (void) { static gint possible_depths[6] = { 32, 24, 16, 15, 8, 1 }; static GdkVisualType possible_types[6] = @@ -263,25 +263,25 @@ gdk_visual_unref (GdkVisual *visual) } gint -gdk_visual_get_best_depth () +gdk_visual_get_best_depth (void) { return available_depths[0]; } GdkVisualType -gdk_visual_get_best_type () +gdk_visual_get_best_type (void) { return available_types[0]; } GdkVisual* -gdk_visual_get_system () +gdk_visual_get_system (void) { return ((GdkVisual*) system_visual); } GdkVisual* -gdk_visual_get_best () +gdk_visual_get_best (void) { return ((GdkVisual*) &(visuals[0])); } diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c index 6df4e07b3..7836f2707 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -20,7 +20,6 @@ #include <X11/Xlib.h> #include <X11/Xutil.h> #include <X11/Xatom.h> -#include <X11/extensions/shape.h> #include <netinet/in.h> #include "gdk.h" #include "../config.h" @@ -30,6 +29,10 @@ #include <stdlib.h> #include <stdio.h> +#ifdef HAVE_SHAPE_EXT +#include <X11/extensions/shape.h> +#endif + int nevent_masks = 17; int event_mask_table[19] = { @@ -172,7 +175,7 @@ gdk_window_xid_at_coords(gint x, gint y, GList *excludes, gboolean excl_child) } void -gdk_window_init () +gdk_window_init (void) { XWindowAttributes xattributes; unsigned int width; @@ -192,6 +195,7 @@ gdk_window_init () gdk_root_parent.width = width; gdk_root_parent.height = height; gdk_root_parent.children = NULL; + gdk_root_parent.colormap = NULL; } GdkWindow* @@ -472,6 +476,7 @@ gdk_window_foreign_new (guint32 anid) private->destroyed = FALSE; private->extension_events = 0; + private->colormap = NULL; private->dnd_drag_data_type = None; private->dnd_drag_data_typesavail = @@ -1195,8 +1200,7 @@ gdk_window_get_visual (GdkWindow *window) if (window_private && !window_private->destroyed) { - if ((window_private->window_type == GDK_WINDOW_FOREIGN)|| - (window_private->xwindow==DefaultRootWindow(window_private->xdisplay))) + if (window_private->colormap == NULL) { XGetWindowAttributes (window_private->xdisplay, window_private->xwindow, @@ -1222,8 +1226,7 @@ gdk_window_get_colormap (GdkWindow *window) g_return_val_if_fail (window_private->window_type != GDK_WINDOW_PIXMAP, NULL); if (!window_private->destroyed) { - if ((window_private->window_type == GDK_WINDOW_FOREIGN)|| - (window_private->xwindow==DefaultRootWindow(window_private->xdisplay))) + if (window_private->colormap == NULL) { XGetWindowAttributes (window_private->xdisplay, window_private->xwindow, @@ -1479,8 +1482,7 @@ gdk_window_add_colormap_windows (GdkWindow *window) /* * This needs the X11 shape extension. - * If not available, simply remove the call to - * XShapeCombineMask. Shaped windows will look + * If not available, shaped windows will look * ugly, but programs still work. Stefan Wille */ void @@ -1488,38 +1490,53 @@ gdk_window_shape_combine_mask (GdkWindow *window, GdkBitmap *mask, gint x, gint y) { + enum { UNKNOWN, NO, YES }; + + static gint have_shape = UNKNOWN; + GdkWindowPrivate *window_private; Pixmap pixmap; g_return_if_fail (window != NULL); - /* This is needed, according to raster */ - gdk_window_set_override_redirect(window, TRUE); - - window_private = (GdkWindowPrivate*) window; - if (window_private->destroyed) - return; - - if (mask) +#ifdef HAVE_SHAPE_EXT + if (have_shape == UNKNOWN) { - GdkWindowPrivate *pixmap_private; - - pixmap_private = (GdkWindowPrivate*) mask; - pixmap = (Pixmap) pixmap_private->xwindow; + int ignore; + if (XQueryExtension(gdk_display, "SHAPE", &ignore, &ignore, &ignore)) + have_shape = YES; + else + have_shape = NO; } - else + + if (have_shape == YES) { - x = 0; - y = 0; - pixmap = None; + window_private = (GdkWindowPrivate*) window; + if (window_private->destroyed) + return; + + if (mask) + { + GdkWindowPrivate *pixmap_private; + + pixmap_private = (GdkWindowPrivate*) mask; + pixmap = (Pixmap) pixmap_private->xwindow; + } + else + { + x = 0; + y = 0; + pixmap = None; + } + + XShapeCombineMask (window_private->xdisplay, + window_private->xwindow, + ShapeBounding, + x, y, + pixmap, + ShapeSet); } - - XShapeCombineMask (window_private->xdisplay, - window_private->xwindow, - ShapeBounding, - x, y, - pixmap, - ShapeSet); +#endif /* HAVE_SHAPE_EXT */ } void diff --git a/gdk/gxid.c b/gdk/gxid.c index 219c08bfe..40b48fa31 100644 --- a/gdk/gxid.c +++ b/gdk/gxid.c @@ -61,7 +61,7 @@ handler(int signal) } void -init_socket() +init_socket(void) { struct sockaddr_in sin; @@ -130,7 +130,7 @@ enable_device(GxidDevice *dev) /* switch the core pointer from whatever it is now to something else, return true on success, false otherwise */ static int -switch_core_pointer() +switch_core_pointer(void) { GxidDevice *old_pointer = 0; GxidDevice *new_pointer = 0; @@ -222,7 +222,7 @@ init_device(XDeviceInfo *xdevice) } void -init_xinput() +init_xinput(void) { char **extensions; XDeviceInfo *xdevices; @@ -279,12 +279,22 @@ int handle_claim_device(GxidClaimDevice *msg) { int i,j; - XID devid = ntohl(msg->device); - XID winid = ntohl(msg->window); - int exclusive = ntohl(msg->exclusive); + XID devid; + XID winid; + int exclusive; GxidDevice *device = NULL; GxidWindow *window = NULL; + if (msg->length != sizeof(GxidClaimDevice)) + { + fprintf(stderr,"Bad length for ClaimDevice message\n"); + return GXID_RETURN_ERROR; + } + + devid = ntohl(msg->device); + winid = ntohl(msg->window); + exclusive = ntohl(msg->exclusive); + #ifdef DEBUG_CLIENTS fprintf(stderr,"device %ld claimed (window 0x%lx)\n",devid,winid); #endif @@ -397,11 +407,20 @@ int handle_release_device(GxidReleaseDevice *msg) { int i,j; - XID devid = ntohl(msg->device); - XID winid = ntohl(msg->window); + XID devid; + XID winid; GxidDevice *device = NULL; + if (msg->length != sizeof(GxidReleaseDevice)) + { + fprintf(stderr,"Bad length for ReleaseDevice message\n"); + return GXID_RETURN_ERROR; + } + + devid = ntohl(msg->device); + winid = ntohl(msg->window); + #ifdef DEBUG_CLIENTS fprintf(stderr,"device %ld released (window 0x%lx)\n",devid,winid); #endif @@ -460,11 +479,11 @@ handle_release_device(GxidReleaseDevice *msg) } void -handle_connection() +handle_connection (void) { GxidMessage msg; GxidU32 type; - int length; + GxidU32 length; GxidI32 retval; int conn_fd; @@ -496,7 +515,7 @@ handle_connection() /* read rest of message */ - if (length > sizeof(GxidMessage)) + if ((length > sizeof(GxidMessage)) || (length < 2*sizeof(GxidU32))) { fprintf(stderr,"%s: Bad message length\n", program_name); @@ -689,7 +708,7 @@ handle_destroy_notify(XDestroyWindowEvent *event) } void -handle_xevent() +handle_xevent(void) { int i; XEvent event; @@ -743,7 +762,7 @@ handle_xevent() } void -usage() +usage(void) { fprintf(stderr,"Usage: %s [-d display] [-p --gxid-port port]\n", program_name); @@ -833,7 +852,7 @@ main(int argc, char **argv) } if (FD_ISSET(socket_fd,&readfds)) - handle_connection(socket_fd); + handle_connection(); while (XPending(dpy)) handle_xevent(); diff --git a/gdk/x11/gdkimage-x11.c b/gdk/x11/gdkimage-x11.c index 82c542122..c31ab4e5b 100644 --- a/gdk/x11/gdkimage-x11.c +++ b/gdk/x11/gdkimage-x11.c @@ -64,7 +64,7 @@ static GList *image_list = NULL; void -gdk_image_exit () +gdk_image_exit (void) { GdkImage *image; @@ -131,7 +131,7 @@ gdk_image_check_xshm(Display *display) } void -gdk_image_init () +gdk_image_init (void) { if (gdk_use_xshm) { diff --git a/gdk/x11/gdkinput-none.c b/gdk/x11/gdkinput-none.c index 44bd8d037..aa0cc0b0b 100644 --- a/gdk/x11/gdkinput-none.c +++ b/gdk/x11/gdkinput-none.c @@ -29,7 +29,7 @@ static void gdk_input_none_get_pointer (GdkWindow *window, GdkModifierType *mask); void -gdk_input_init () +gdk_input_init (void) { gdk_input_vtable.set_mode = NULL; gdk_input_vtable.set_axes = NULL; diff --git a/gdk/x11/gdkinput-xfree.c b/gdk/x11/gdkinput-xfree.c index efc728cb0..c0411a4fe 100644 --- a/gdk/x11/gdkinput-xfree.c +++ b/gdk/x11/gdkinput-xfree.c @@ -22,7 +22,7 @@ /* forward declarations */ static gint gdk_input_xfree_set_mode (guint32 deviceid, GdkInputMode mode); -static void gdk_input_check_proximity(); +static void gdk_input_check_proximity (void); static void gdk_input_xfree_configure_event (XConfigureEvent *xevent, GdkWindow *window); static void gdk_input_xfree_enter_event (XCrossingEvent *xevent, @@ -115,7 +115,7 @@ gdk_input_xfree_set_mode (guint32 deviceid, GdkInputMode mode) } static void -gdk_input_check_proximity() +gdk_input_check_proximity (void) { gint new_proximity = 0; GList *tmp_list = gdk_input_devices; diff --git a/gdk/x11/gdkinput.c b/gdk/x11/gdkinput.c index e47f2205f..491131ca2 100644 --- a/gdk/x11/gdkinput.c +++ b/gdk/x11/gdkinput.c @@ -70,7 +70,7 @@ static GList *gdk_input_windows; #include "gdkinputgxi.h" GList * -gdk_input_list_devices () +gdk_input_list_devices (void) { return gdk_input_devices; } diff --git a/gdk/x11/gdkmain-x11.c b/gdk/x11/gdkmain-x11.c index 30b11087b..68e9b98a2 100644 --- a/gdk/x11/gdkmain-x11.c +++ b/gdk/x11/gdkmain-x11.c @@ -625,7 +625,7 @@ gdk_exit (int errorcode) */ gchar* -gdk_set_locale () +gdk_set_locale (void) { if (!setlocale (LC_ALL,"")) g_print ("locale not supported by C library\n"); @@ -663,7 +663,7 @@ gdk_set_locale () */ gint -gdk_events_pending () +gdk_events_pending (void) { gint result; GList *tmp_list; @@ -1023,13 +1023,13 @@ gdk_set_use_xshm (gint use_xshm) } gint -gdk_get_show_events () +gdk_get_show_events (void) { return gdk_debug_flags & GDK_DEBUG_EVENTS; } gint -gdk_get_use_xshm () +gdk_get_use_xshm (void) { return gdk_use_xshm; } @@ -1055,7 +1055,7 @@ gdk_get_use_xshm () */ guint32 -gdk_time_get () +gdk_time_get (void) { struct timeval end; struct timeval elapsed; @@ -1094,7 +1094,7 @@ gdk_time_get () */ guint32 -gdk_timer_get () +gdk_timer_get (void) { return timer_val; } @@ -1129,13 +1129,13 @@ gdk_timer_set (guint32 milliseconds) } void -gdk_timer_enable () +gdk_timer_enable (void) { timerp = &timer; } void -gdk_timer_disable () +gdk_timer_disable (void) { timerp = NULL; } @@ -1463,7 +1463,7 @@ gdk_keyboard_ungrab (guint32 time) */ gint -gdk_screen_width () +gdk_screen_width (void) { gint return_val; @@ -1488,7 +1488,7 @@ gdk_screen_width () */ gint -gdk_screen_height () +gdk_screen_height (void) { gint return_val; @@ -1498,13 +1498,13 @@ gdk_screen_height () } void -gdk_key_repeat_disable () +gdk_key_repeat_disable (void) { XAutoRepeatOff (gdk_display); } void -gdk_key_repeat_restore () +gdk_key_repeat_restore (void) { if (autorepeat) XAutoRepeatOn (gdk_display); @@ -1531,14 +1531,14 @@ gdk_key_repeat_restore () *-------------------------------------------------------------- */ -void gdk_flush () +void gdk_flush (void) { XSync (gdk_display, False); } void -gdk_beep () +gdk_beep (void) { XBell(gdk_display, 100); } @@ -1562,7 +1562,7 @@ gdk_beep () */ static gint -gdk_event_wait () +gdk_event_wait (void) { GList *list; GdkInput *input; @@ -3028,7 +3028,7 @@ gdk_synthesize_click (GdkEvent *event, */ static void -gdk_exit_func () +gdk_exit_func (void) { static gboolean in_gdk_exit_func = FALSE; diff --git a/gdk/x11/gdkpixmap-x11.c b/gdk/x11/gdkpixmap-x11.c index a1af21542..2f2cdea4c 100644 --- a/gdk/x11/gdkpixmap-x11.c +++ b/gdk/x11/gdkpixmap-x11.c @@ -256,8 +256,14 @@ gdk_pixmap_read_string (FILE *infile, { if (cnt == (*buffer_size)) { - (*buffer_size) *= 2; - (*buffer) = (gchar *) g_realloc ((*buffer), *buffer_size); } + guint new_size = (*buffer_size) * 2; + if (new_size > (*buffer_size)) + *buffer_size = new_size; + else + return FALSE; + + (*buffer) = (gchar *) g_realloc ((*buffer), *buffer_size); + } if (c != '"') (*buffer)[cnt++] = c; @@ -399,6 +405,11 @@ gdk_pixmap_colormap_create_from_xpm (GdkWindow *window, gdk_pixmap_read_string (infile, &buffer, &buffer_size); sscanf (buffer,"%d %d %d %d", &width, &height, &num_cols, &cpp); + if (cpp >= 32) + { + g_warning ("Pixmap has more than 31 characters per color\n"); + return NULL; + } colors = g_new(_GdkPixmapColor, num_cols); @@ -574,6 +585,11 @@ gdk_pixmap_colormap_create_from_xpm_d (GdkWindow *window, i = 0; buffer = data[i++]; sscanf (buffer,"%d %d %d %d", &width, &height, &num_cols, &cpp); + if (cpp >= 32) + { + g_warning ("Pixmap has more than 31 characters per color\n"); + return NULL; + } colors = g_new(_GdkPixmapColor, num_cols); diff --git a/gdk/x11/gdkvisual-x11.c b/gdk/x11/gdkvisual-x11.c index 90ca5cfe7..a6a8b2b13 100644 --- a/gdk/x11/gdkvisual-x11.c +++ b/gdk/x11/gdkvisual-x11.c @@ -58,7 +58,7 @@ static gchar* visual_names[] = static GHashTable *visual_hash = NULL; void -gdk_visual_init () +gdk_visual_init (void) { static gint possible_depths[6] = { 32, 24, 16, 15, 8, 1 }; static GdkVisualType possible_types[6] = @@ -263,25 +263,25 @@ gdk_visual_unref (GdkVisual *visual) } gint -gdk_visual_get_best_depth () +gdk_visual_get_best_depth (void) { return available_depths[0]; } GdkVisualType -gdk_visual_get_best_type () +gdk_visual_get_best_type (void) { return available_types[0]; } GdkVisual* -gdk_visual_get_system () +gdk_visual_get_system (void) { return ((GdkVisual*) system_visual); } GdkVisual* -gdk_visual_get_best () +gdk_visual_get_best (void) { return ((GdkVisual*) &(visuals[0])); } diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c index 6df4e07b3..7836f2707 100644 --- a/gdk/x11/gdkwindow-x11.c +++ b/gdk/x11/gdkwindow-x11.c @@ -20,7 +20,6 @@ #include <X11/Xlib.h> #include <X11/Xutil.h> #include <X11/Xatom.h> -#include <X11/extensions/shape.h> #include <netinet/in.h> #include "gdk.h" #include "../config.h" @@ -30,6 +29,10 @@ #include <stdlib.h> #include <stdio.h> +#ifdef HAVE_SHAPE_EXT +#include <X11/extensions/shape.h> +#endif + int nevent_masks = 17; int event_mask_table[19] = { @@ -172,7 +175,7 @@ gdk_window_xid_at_coords(gint x, gint y, GList *excludes, gboolean excl_child) } void -gdk_window_init () +gdk_window_init (void) { XWindowAttributes xattributes; unsigned int width; @@ -192,6 +195,7 @@ gdk_window_init () gdk_root_parent.width = width; gdk_root_parent.height = height; gdk_root_parent.children = NULL; + gdk_root_parent.colormap = NULL; } GdkWindow* @@ -472,6 +476,7 @@ gdk_window_foreign_new (guint32 anid) private->destroyed = FALSE; private->extension_events = 0; + private->colormap = NULL; private->dnd_drag_data_type = None; private->dnd_drag_data_typesavail = @@ -1195,8 +1200,7 @@ gdk_window_get_visual (GdkWindow *window) if (window_private && !window_private->destroyed) { - if ((window_private->window_type == GDK_WINDOW_FOREIGN)|| - (window_private->xwindow==DefaultRootWindow(window_private->xdisplay))) + if (window_private->colormap == NULL) { XGetWindowAttributes (window_private->xdisplay, window_private->xwindow, @@ -1222,8 +1226,7 @@ gdk_window_get_colormap (GdkWindow *window) g_return_val_if_fail (window_private->window_type != GDK_WINDOW_PIXMAP, NULL); if (!window_private->destroyed) { - if ((window_private->window_type == GDK_WINDOW_FOREIGN)|| - (window_private->xwindow==DefaultRootWindow(window_private->xdisplay))) + if (window_private->colormap == NULL) { XGetWindowAttributes (window_private->xdisplay, window_private->xwindow, @@ -1479,8 +1482,7 @@ gdk_window_add_colormap_windows (GdkWindow *window) /* * This needs the X11 shape extension. - * If not available, simply remove the call to - * XShapeCombineMask. Shaped windows will look + * If not available, shaped windows will look * ugly, but programs still work. Stefan Wille */ void @@ -1488,38 +1490,53 @@ gdk_window_shape_combine_mask (GdkWindow *window, GdkBitmap *mask, gint x, gint y) { + enum { UNKNOWN, NO, YES }; + + static gint have_shape = UNKNOWN; + GdkWindowPrivate *window_private; Pixmap pixmap; g_return_if_fail (window != NULL); - /* This is needed, according to raster */ - gdk_window_set_override_redirect(window, TRUE); - - window_private = (GdkWindowPrivate*) window; - if (window_private->destroyed) - return; - - if (mask) +#ifdef HAVE_SHAPE_EXT + if (have_shape == UNKNOWN) { - GdkWindowPrivate *pixmap_private; - - pixmap_private = (GdkWindowPrivate*) mask; - pixmap = (Pixmap) pixmap_private->xwindow; + int ignore; + if (XQueryExtension(gdk_display, "SHAPE", &ignore, &ignore, &ignore)) + have_shape = YES; + else + have_shape = NO; } - else + + if (have_shape == YES) { - x = 0; - y = 0; - pixmap = None; + window_private = (GdkWindowPrivate*) window; + if (window_private->destroyed) + return; + + if (mask) + { + GdkWindowPrivate *pixmap_private; + + pixmap_private = (GdkWindowPrivate*) mask; + pixmap = (Pixmap) pixmap_private->xwindow; + } + else + { + x = 0; + y = 0; + pixmap = None; + } + + XShapeCombineMask (window_private->xdisplay, + window_private->xwindow, + ShapeBounding, + x, y, + pixmap, + ShapeSet); } - - XShapeCombineMask (window_private->xdisplay, - window_private->xwindow, - ShapeBounding, - x, y, - pixmap, - ShapeSet); +#endif /* HAVE_SHAPE_EXT */ } void diff --git a/gdk/x11/gxid.c b/gdk/x11/gxid.c index 219c08bfe..40b48fa31 100644 --- a/gdk/x11/gxid.c +++ b/gdk/x11/gxid.c @@ -61,7 +61,7 @@ handler(int signal) } void -init_socket() +init_socket(void) { struct sockaddr_in sin; @@ -130,7 +130,7 @@ enable_device(GxidDevice *dev) /* switch the core pointer from whatever it is now to something else, return true on success, false otherwise */ static int -switch_core_pointer() +switch_core_pointer(void) { GxidDevice *old_pointer = 0; GxidDevice *new_pointer = 0; @@ -222,7 +222,7 @@ init_device(XDeviceInfo *xdevice) } void -init_xinput() +init_xinput(void) { char **extensions; XDeviceInfo *xdevices; @@ -279,12 +279,22 @@ int handle_claim_device(GxidClaimDevice *msg) { int i,j; - XID devid = ntohl(msg->device); - XID winid = ntohl(msg->window); - int exclusive = ntohl(msg->exclusive); + XID devid; + XID winid; + int exclusive; GxidDevice *device = NULL; GxidWindow *window = NULL; + if (msg->length != sizeof(GxidClaimDevice)) + { + fprintf(stderr,"Bad length for ClaimDevice message\n"); + return GXID_RETURN_ERROR; + } + + devid = ntohl(msg->device); + winid = ntohl(msg->window); + exclusive = ntohl(msg->exclusive); + #ifdef DEBUG_CLIENTS fprintf(stderr,"device %ld claimed (window 0x%lx)\n",devid,winid); #endif @@ -397,11 +407,20 @@ int handle_release_device(GxidReleaseDevice *msg) { int i,j; - XID devid = ntohl(msg->device); - XID winid = ntohl(msg->window); + XID devid; + XID winid; GxidDevice *device = NULL; + if (msg->length != sizeof(GxidReleaseDevice)) + { + fprintf(stderr,"Bad length for ReleaseDevice message\n"); + return GXID_RETURN_ERROR; + } + + devid = ntohl(msg->device); + winid = ntohl(msg->window); + #ifdef DEBUG_CLIENTS fprintf(stderr,"device %ld released (window 0x%lx)\n",devid,winid); #endif @@ -460,11 +479,11 @@ handle_release_device(GxidReleaseDevice *msg) } void -handle_connection() +handle_connection (void) { GxidMessage msg; GxidU32 type; - int length; + GxidU32 length; GxidI32 retval; int conn_fd; @@ -496,7 +515,7 @@ handle_connection() /* read rest of message */ - if (length > sizeof(GxidMessage)) + if ((length > sizeof(GxidMessage)) || (length < 2*sizeof(GxidU32))) { fprintf(stderr,"%s: Bad message length\n", program_name); @@ -689,7 +708,7 @@ handle_destroy_notify(XDestroyWindowEvent *event) } void -handle_xevent() +handle_xevent(void) { int i; XEvent event; @@ -743,7 +762,7 @@ handle_xevent() } void -usage() +usage(void) { fprintf(stderr,"Usage: %s [-d display] [-p --gxid-port port]\n", program_name); @@ -833,7 +852,7 @@ main(int argc, char **argv) } if (FD_ISSET(socket_fd,&readfds)) - handle_connection(socket_fd); + handle_connection(); while (XPending(dpy)) handle_xevent(); diff --git a/glib/ChangeLog b/glib/ChangeLog index 1eda6f5c6..d33e7e97c 100644 --- a/glib/ChangeLog +++ b/glib/ChangeLog @@ -1,3 +1,10 @@ +Fri May 1 16:36:08 1998 Owen Taylor <otaylor@gtk.org> + + * gutils.c: (g_strcasecmp). Check for isupper before + taking tolower, and account for macroized tolower. + + * gutils.c (g_error): Check for recursion. + 1998-04-27 Elliot Lee <sopwith@cuc.ml.org> * glist.c (g_list_position): New function to find the position of diff --git a/glib/glist.c b/glib/glist.c index fffe0ed29..bd0c29bcf 100644 --- a/glib/glist.c +++ b/glib/glist.c @@ -33,7 +33,7 @@ static GRealListAllocator *current_allocator = NULL; GListAllocator* -g_list_allocator_new () +g_list_allocator_new (void) { GRealListAllocator* allocator = g_new (GRealListAllocator, 1); @@ -80,7 +80,7 @@ g_list_set_allocator (GListAllocator* fallocator) GList* -g_list_alloc () +g_list_alloc (void) { GList *new_list; diff --git a/glib/gmem.c b/glib/gmem.c index b1498f936..1f4ae285e 100644 --- a/glib/gmem.c +++ b/glib/gmem.c @@ -326,7 +326,7 @@ g_free (gpointer mem) void -g_mem_profile () +g_mem_profile (void) { #ifdef MEM_PROFILE gint i; @@ -749,7 +749,7 @@ g_mem_chunk_print (GMemChunk *mem_chunk) } void -g_mem_chunk_info () +g_mem_chunk_info (void) { GRealMemChunk *mem_chunk; gint count; @@ -773,7 +773,7 @@ g_mem_chunk_info () } void -g_blow_chunks () +g_blow_chunks (void) { GRealMemChunk *mem_chunk; diff --git a/glib/gslist.c b/glib/gslist.c index 7045687ca..e98c0ae5a 100644 --- a/glib/gslist.c +++ b/glib/gslist.c @@ -57,7 +57,7 @@ g_slist_set_allocator (GListAllocator* fallocator) GSList* -g_slist_alloc () +g_slist_alloc (void) { GSList *new_list; diff --git a/glib/gtimer.c b/glib/gtimer.c index 860c76cff..47946b39b 100644 --- a/glib/gtimer.c +++ b/glib/gtimer.c @@ -32,7 +32,7 @@ struct _GRealTimer GTimer* -g_timer_new () +g_timer_new (void) { GRealTimer *timer; diff --git a/glib/gutils.c b/glib/gutils.c index e23280ff6..089c204b0 100644 --- a/glib/gutils.c +++ b/glib/gutils.c @@ -22,6 +22,7 @@ #include <string.h> #include <locale.h> #include <ctype.h> /* For tolower() */ +#include <unistd.h> #include "glib.h" @@ -675,7 +676,14 @@ g_error (gchar *format, ...) { va_list args, args2; char *buf; + static gboolean errored = 0; + if (errored++) + { + write (2, "g_error: recursed!\n", 19); + return; + } + va_start (args, format); va_start (args2, format); buf = g_vsprintf (format, &args, &args2); @@ -688,9 +696,10 @@ g_error (gchar *format, ...) } else { - fputs ("\n** ERROR **: ", stderr); - fputs (buf, stderr); - fputc ('\n', stderr); + /* Use write() here because we might be out of memory */ + write (2, "\n** ERROR **: ", 14); + write (2, buf, strlen(buf)); + write (2, "\n", 1); } abort (); @@ -855,9 +864,14 @@ g_strcasecmp (const gchar *s1, const gchar *s2) while (*s1 && *s2) { - c1 = tolower((guchar)(*s1++)); c2 = tolower((guchar)(*s2++)); + /* According to A. Cox, some platforms have islower's that + * don't work right on non-uppercase + */ + c1 = isupper ((guchar)*s1) ? tolower ((guchar)*s1) : *s1; + c2 = isupper ((guchar)*s2) ? tolower ((guchar)*s2) : *s2; if (c1 != c2) return (c1 - c2); + s1++; s2++; } return (((gint)(guchar) *s1) - ((gint)(guchar) *s2)); diff --git a/gtk/gtkaccelerator.c b/gtk/gtkaccelerator.c index 8e529efd2..984142840 100644 --- a/gtk/gtkaccelerator.c +++ b/gtk/gtkaccelerator.c @@ -44,7 +44,7 @@ static guint actable_key_id = 0; GtkAcceleratorTable* -gtk_accelerator_table_new () +gtk_accelerator_table_new (void) { GtkAcceleratorTable *table; diff --git a/gtk/gtkadjustment.c b/gtk/gtkadjustment.c index d8661c8fd..9488df263 100644 --- a/gtk/gtkadjustment.c +++ b/gtk/gtkadjustment.c @@ -35,7 +35,7 @@ static guint adjustment_signals[LAST_SIGNAL] = { 0 }; GtkType -gtk_adjustment_get_type () +gtk_adjustment_get_type (void) { static GtkType adjustment_type = 0; @@ -137,18 +137,6 @@ gtk_adjustment_set_value (GtkAdjustment *adjustment, } void -gtk_adjustment_assimilate_value (GtkAdjustment *adjustment, - gfloat value) -{ - g_return_if_fail (adjustment != NULL); - g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment)); - - if (gtk_signal_n_emissions (GTK_OBJECT (adjustment), - adjustment_signals[VALUE_CHANGED]) == 0) - gtk_adjustment_set_value (adjustment, value); -} - -void gtk_adjustment_changed (GtkAdjustment *adjustment) { g_return_if_fail (adjustment != NULL); diff --git a/gtk/gtkalignment.c b/gtk/gtkalignment.c index b4c624e43..938bad77e 100644 --- a/gtk/gtkalignment.c +++ b/gtk/gtkalignment.c @@ -28,7 +28,7 @@ static void gtk_alignment_size_allocate (GtkWidget *widget, guint -gtk_alignment_get_type () +gtk_alignment_get_type (void) { static guint alignment_type = 0; diff --git a/gtk/gtkarrow.c b/gtk/gtkarrow.c index 69c93926d..26878c7f4 100644 --- a/gtk/gtkarrow.c +++ b/gtk/gtkarrow.c @@ -29,7 +29,7 @@ static gint gtk_arrow_expose (GtkWidget *widget, guint -gtk_arrow_get_type () +gtk_arrow_get_type (void) { static guint arrow_type = 0; diff --git a/gtk/gtkaspectframe.c b/gtk/gtkaspectframe.c index 2a534ef5b..b19977ca5 100644 --- a/gtk/gtkaspectframe.c +++ b/gtk/gtkaspectframe.c @@ -38,7 +38,7 @@ static void gtk_aspect_frame_size_allocate (GtkWidget *widget, #define MIN_RATIO 0.0001 guint -gtk_aspect_frame_get_type () +gtk_aspect_frame_get_type (void) { static guint aspect_frame_type = 0; diff --git a/gtk/gtkbbox.c b/gtk/gtkbbox.c index 74dba193e..14b617712 100644 --- a/gtk/gtkbbox.c +++ b/gtk/gtkbbox.c @@ -30,7 +30,7 @@ static gint default_child_ipad_y = 0; guint -gtk_button_box_get_type () +gtk_button_box_get_type (void) { static guint button_box_type = 0; diff --git a/gtk/gtkbin.c b/gtk/gtkbin.c index c1e07766d..c0ba64fca 100644 --- a/gtk/gtkbin.c +++ b/gtk/gtkbin.c @@ -40,7 +40,7 @@ static GtkContainerClass *parent_class = NULL; guint -gtk_bin_get_type () +gtk_bin_get_type (void) { static guint bin_type = 0; diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c index 0a58ca046..2d0353400 100644 --- a/gtk/gtkbox.c +++ b/gtk/gtkbox.c @@ -51,7 +51,7 @@ static GtkContainerClass *parent_class = NULL; guint -gtk_box_get_type () +gtk_box_get_type (void) { static guint box_type = 0; diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c index 6263d4b76..7bed40f52 100644 --- a/gtk/gtkbutton.c +++ b/gtk/gtkbutton.c @@ -41,7 +41,7 @@ enum { ARG_0, ARG_LABEL }; - + static void gtk_button_class_init (GtkButtonClass *klass); @@ -94,7 +94,7 @@ static guint button_signals[LAST_SIGNAL] = { 0 }; guint -gtk_button_get_type () +gtk_button_get_type (void) { static guint button_type = 0; @@ -219,16 +219,16 @@ gtk_button_set_arg (GtkButton *button, { case ARG_LABEL: gtk_container_disable_resize (GTK_CONTAINER (button)); - + if (button->child) { gtk_widget_unparent (button->child); button->child = NULL; } - + label = gtk_label_new (GTK_VALUE_STRING(*arg)); gtk_widget_show (label); - + gtk_container_add (GTK_CONTAINER (button), label); gtk_container_enable_resize (GTK_CONTAINER (button)); break; @@ -239,7 +239,7 @@ gtk_button_set_arg (GtkButton *button, } GtkWidget* -gtk_button_new () +gtk_button_new (void) { return GTK_WIDGET (gtk_type_new (gtk_button_get_type ())); } @@ -433,9 +433,9 @@ gtk_button_size_allocate (GtkWidget *widget, DEFAULT_LEFT_POS); child_allocation.y += (GTK_WIDGET (widget)->style->klass->ythickness + DEFAULT_TOP_POS); - child_allocation.width = MAX (1, child_allocation.width - + child_allocation.width = MAX (1, child_allocation.width - (GTK_WIDGET (widget)->style->klass->xthickness * 2 + DEFAULT_SPACING)); - child_allocation.height = MAX (1, child_allocation.height - + child_allocation.height = MAX (1, child_allocation.height - (GTK_WIDGET (widget)->style->klass->xthickness * 2 + DEFAULT_SPACING)); } @@ -443,25 +443,60 @@ gtk_button_size_allocate (GtkWidget *widget, } } +/* + * +------------------------------------------------+ + * | BORDER | + * | +------------------------------------------+ | + * | |\\\\\\\\\\\\\\\\DEFAULT\\\\\\\\\\\\\\\\\ | | + * | |\\+------------------------------------+ | | + * | |\\| | SPACING 3 | | | | + * | |\\| +--------------------------------+ | | | + * | |\\| |########## FOCUS ###############| | | | + * | |\\| |#+----------------------------+#| | | | + * | |\\| |#| RELIEF \|#| | | | + * | |\\| |#| +-----------------------+\|#| | | | + * | |\\|1|#| + THE TEXT +\|#|2| | | + * | |\\| |#| +-----------------------+\|#| | | | + * | |\\| |#| \\\\\ ythickness \\\\\\\\\\|#| | | | + * | |\\| |#+----------------------------+#| | | | + * | |\\| |########### 1 ##################| | | | + * | |\\| +--------------------------------+ | | | + * | |\\| | default spacing 4 | | | | + * | |\\+------------------------------------+ | | + * | |\ ythickness | | + * | +------------------------------------------+ | + * | border_width | + * +------------------------------------------------+ + */ + static void gtk_button_paint (GtkWidget *widget, GdkRectangle *area) { GdkRectangle restrict_area; + GdkRectangle outer_area; + GdkRectangle tmp_area; GdkRectangle new_area; + gint xthickness; + gint ythickness; g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_BUTTON (widget)); + xthickness = widget->style->klass->xthickness; + ythickness = widget->style->klass->ythickness; + if (GTK_WIDGET_DRAWABLE (widget)) { - restrict_area.x = GTK_WIDGET (widget)->style->klass->xthickness; - restrict_area.y = GTK_WIDGET (widget)->style->klass->ythickness; - restrict_area.width = GTK_WIDGET (widget)->allocation.width - + restrict_area.x = xthickness; + restrict_area.y = ythickness; + restrict_area.width = GTK_WIDGET (widget)->allocation.width - restrict_area.x * 2 - GTK_CONTAINER (widget)->border_width * 2; - restrict_area.height = GTK_WIDGET (widget)->allocation.height - + restrict_area.height = GTK_WIDGET (widget)->allocation.height - restrict_area.y * 2 - GTK_CONTAINER (widget)->border_width * 2; + outer_area = restrict_area; + if (GTK_WIDGET_CAN_DEFAULT (widget)) { restrict_area.x += DEFAULT_LEFT_POS; @@ -477,6 +512,49 @@ gtk_button_paint (GtkWidget *widget, new_area.x, new_area.y, new_area.width, new_area.height); } + + if (GTK_WIDGET_CAN_DEFAULT (widget)) + { + /* Now fill spacing area between the default border and the button */ + + /* 1 */ tmp_area = outer_area; + tmp_area.width = restrict_area.x - outer_area.x; + if (gdk_rectangle_intersect (area, &tmp_area, &new_area)) + gdk_draw_rectangle (widget->window, + widget->style->bg_gc[GTK_STATE_NORMAL], + TRUE, + new_area.x, new_area.y, + new_area.width, new_area.height); + + /* 2 */ tmp_area.x = restrict_area.x + restrict_area.width; + + if (gdk_rectangle_intersect (area, &tmp_area, &new_area)) + gdk_draw_rectangle (widget->window, + widget->style->bg_gc[GTK_STATE_NORMAL], + TRUE, + new_area.x, new_area.y, + new_area.width, new_area.height); + + /* 3 */ tmp_area.width = restrict_area.width; + tmp_area.height = restrict_area.y - outer_area.y; + tmp_area.x = restrict_area.x; + + if (gdk_rectangle_intersect (area, &tmp_area, &new_area)) + gdk_draw_rectangle (widget->window, + widget->style->bg_gc[GTK_STATE_NORMAL], + TRUE, + new_area.x, new_area.y, + new_area.width, new_area.height); + + /* 4 */ tmp_area.y = restrict_area.y + restrict_area.height; + + if (gdk_rectangle_intersect (area, &tmp_area, &new_area)) + gdk_draw_rectangle (widget->window, + widget->style->bg_gc[GTK_STATE_NORMAL], + TRUE, + new_area.x, new_area.y, + new_area.width, new_area.height); + } } } @@ -790,12 +868,12 @@ gtk_button_add (GtkContainer *container, if (GTK_WIDGET_REALIZED (widget->parent) && !GTK_WIDGET_REALIZED (widget)) gtk_widget_realize (widget); - + if (GTK_WIDGET_MAPPED (widget->parent) && !GTK_WIDGET_MAPPED (widget)) gtk_widget_map (widget); } - + button->child = widget; if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (container)) diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c index b1ef96664..45a57896f 100644 --- a/gtk/gtkcheckbutton.c +++ b/gtk/gtkcheckbutton.c @@ -47,7 +47,7 @@ static GtkToggleButtonClass *parent_class = NULL; guint -gtk_check_button_get_type () +gtk_check_button_get_type (void) { static guint check_button_type = 0; @@ -96,7 +96,7 @@ gtk_check_button_init (GtkCheckButton *check_button) } GtkWidget* -gtk_check_button_new () +gtk_check_button_new (void) { return GTK_WIDGET (gtk_type_new (gtk_check_button_get_type ())); } diff --git a/gtk/gtkcheckmenuitem.c b/gtk/gtkcheckmenuitem.c index eae915cc2..834faa685 100644 --- a/gtk/gtkcheckmenuitem.c +++ b/gtk/gtkcheckmenuitem.c @@ -48,7 +48,7 @@ static guint check_menu_item_signals[LAST_SIGNAL] = { 0 }; guint -gtk_check_menu_item_get_type () +gtk_check_menu_item_get_type (void) { static guint check_menu_item_type = 0; @@ -72,7 +72,7 @@ gtk_check_menu_item_get_type () } GtkWidget* -gtk_check_menu_item_new () +gtk_check_menu_item_new (void) { return GTK_WIDGET (gtk_type_new (gtk_check_menu_item_get_type ())); } diff --git a/gtk/gtkclist.c b/gtk/gtkclist.c index bf61c60d8..d50a22624 100644 --- a/gtk/gtkclist.c +++ b/gtk/gtkclist.c @@ -281,7 +281,7 @@ static guint clist_signals[LAST_SIGNAL] = {0}; GtkType -gtk_clist_get_type () +gtk_clist_get_type (void) { static GtkType clist_type = 0; diff --git a/gtk/gtkcolorsel.c b/gtk/gtkcolorsel.c index 97fb5717b..33f7a1252 100644 --- a/gtk/gtkcolorsel.c +++ b/gtk/gtkcolorsel.c @@ -191,7 +191,7 @@ scale_val_type scale_vals[NUM_CHANNELS] = }; guint -gtk_color_selection_get_type () +gtk_color_selection_get_type (void) { static guint color_selection_type = 0; @@ -1428,7 +1428,7 @@ gtk_color_selection_rgb_to_hsv (gdouble r, gdouble g, gdouble b, /***************************/ guint -gtk_color_selection_dialog_get_type () +gtk_color_selection_dialog_get_type (void) { static guint color_selection_dialog_type = 0; diff --git a/gtk/gtkcombo.c b/gtk/gtkcombo.c index 638399eac..0c2f7ccd4 100644 --- a/gtk/gtkcombo.c +++ b/gtk/gtkcombo.c @@ -671,7 +671,7 @@ gtk_combo_init (GtkCombo * combo) } guint -gtk_combo_get_type () +gtk_combo_get_type (void) { static guint combo_type = 0; @@ -693,7 +693,7 @@ gtk_combo_get_type () } GtkWidget * -gtk_combo_new () +gtk_combo_new (void) { return GTK_WIDGET (gtk_type_new (gtk_combo_get_type ())); } diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c index 2265826f2..de7b350a0 100644 --- a/gtk/gtkcontainer.c +++ b/gtk/gtkcontainer.c @@ -116,7 +116,7 @@ static const gchar *hadjustment_key = "gtk-hadjustment"; static guint hadjustment_key_id = 0; GtkType -gtk_container_get_type () +gtk_container_get_type (void) { static GtkType container_type = 0; diff --git a/gtk/gtkctree.c b/gtk/gtkctree.c index 9c820417c..e9c2070dc 100644 --- a/gtk/gtkctree.c +++ b/gtk/gtkctree.c @@ -196,7 +196,7 @@ static guint ctree_signals[LAST_SIGNAL] = {0}; GtkType -gtk_ctree_get_type () +gtk_ctree_get_type (void) { static GtkType ctree_type = 0; diff --git a/gtk/gtkdata.c b/gtk/gtkdata.c index cb408f130..6196b92c8 100644 --- a/gtk/gtkdata.c +++ b/gtk/gtkdata.c @@ -33,7 +33,7 @@ static guint data_signals[LAST_SIGNAL] = { 0 }; guint -gtk_data_get_type () +gtk_data_get_type (void) { static guint data_type = 0; diff --git a/gtk/gtkdialog.c b/gtk/gtkdialog.c index 8b7fb872f..e89d180a4 100644 --- a/gtk/gtkdialog.c +++ b/gtk/gtkdialog.c @@ -28,7 +28,7 @@ static void gtk_dialog_init (GtkDialog *dialog); guint -gtk_dialog_get_type () +gtk_dialog_get_type (void) { static guint dialog_type = 0; @@ -76,7 +76,7 @@ gtk_dialog_init (GtkDialog *dialog) } GtkWidget* -gtk_dialog_new () +gtk_dialog_new (void) { return GTK_WIDGET (gtk_type_new (gtk_dialog_get_type ())); } diff --git a/gtk/gtkdrawingarea.c b/gtk/gtkdrawingarea.c index 5895bb835..0b6691999 100644 --- a/gtk/gtkdrawingarea.c +++ b/gtk/gtkdrawingarea.c @@ -28,7 +28,7 @@ static void gtk_drawing_area_send_configure (GtkDrawingArea *darea); guint -gtk_drawing_area_get_type () +gtk_drawing_area_get_type (void) { static guint drawing_area_type = 0; @@ -72,7 +72,7 @@ gtk_drawing_area_init (GtkDrawingArea *darea) GtkWidget* -gtk_drawing_area_new () +gtk_drawing_area_new (void) { return GTK_WIDGET (gtk_type_new (gtk_drawing_area_get_type ())); } diff --git a/gtk/gtkeditable.c b/gtk/gtkeditable.c index 30d19e085..b4e45b5aa 100644 --- a/gtk/gtkeditable.c +++ b/gtk/gtkeditable.c @@ -60,7 +60,7 @@ static GdkAtom text_atom = GDK_NONE; static GdkAtom clipboard_atom = GDK_NONE; guint -gtk_editable_get_type () +gtk_editable_get_type (void) { static guint editable_type = 0; diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 3848e642a..105643948 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -181,7 +181,7 @@ static GtkTextFunction alt_keys[26] = guint -gtk_entry_get_type () +gtk_entry_get_type (void) { static guint entry_type = 0; @@ -267,7 +267,7 @@ gtk_entry_init (GtkEntry *entry) } GtkWidget* -gtk_entry_new () +gtk_entry_new (void) { return GTK_WIDGET (gtk_type_new (gtk_entry_get_type ())); } diff --git a/gtk/gtkeventbox.c b/gtk/gtkeventbox.c index 584b2ecdf..fb19db7b5 100644 --- a/gtk/gtkeventbox.c +++ b/gtk/gtkeventbox.c @@ -34,7 +34,7 @@ static gint gtk_event_box_expose (GtkWidget *widget, guint -gtk_event_box_get_type () +gtk_event_box_get_type (void) { static guint event_box_type = 0; @@ -79,7 +79,7 @@ gtk_event_box_init (GtkEventBox *event_box) } GtkWidget* -gtk_event_box_new () +gtk_event_box_new (void) { return GTK_WIDGET ( gtk_type_new (gtk_event_box_get_type ())); } diff --git a/gtk/gtkfilesel.c b/gtk/gtkfilesel.c index 376ef764c..beb906c21 100644 --- a/gtk/gtkfilesel.c +++ b/gtk/gtkfilesel.c @@ -318,7 +318,7 @@ static GtkWindowClass *parent_class = NULL; static gint cmpl_errno; guint -gtk_file_selection_get_type () +gtk_file_selection_get_type (void) { static guint file_selection_type = 0; diff --git a/gtk/gtkfixed.c b/gtk/gtkfixed.c index e598f687a..b3d04c159 100644 --- a/gtk/gtkfixed.c +++ b/gtk/gtkfixed.c @@ -47,7 +47,7 @@ static GtkContainerClass *parent_class = NULL; guint -gtk_fixed_get_type () +gtk_fixed_get_type (void) { static guint fixed_type = 0; @@ -106,7 +106,7 @@ gtk_fixed_init (GtkFixed *fixed) } GtkWidget* -gtk_fixed_new () +gtk_fixed_new (void) { GtkFixed *fixed; diff --git a/gtk/gtkframe.c b/gtk/gtkframe.c index bc41c7a5f..624b3d33b 100644 --- a/gtk/gtkframe.c +++ b/gtk/gtkframe.c @@ -55,7 +55,7 @@ static GtkBinClass *parent_class = NULL; guint -gtk_frame_get_type () +gtk_frame_get_type (void) { static guint frame_type = 0; diff --git a/gtk/gtkgc.c b/gtk/gtkgc.c index 20dcc9033..72f207b37 100644 --- a/gtk/gtkgc.c +++ b/gtk/gtkgc.c @@ -91,7 +91,7 @@ gtk_gc_release (GdkGC *gc) static void -gtk_gc_init () +gtk_gc_init (void) { initialize = FALSE; diff --git a/gtk/gtkhbbox.c b/gtk/gtkhbbox.c index da01c759b..28a7afb14 100644 --- a/gtk/gtkhbbox.c +++ b/gtk/gtkhbbox.c @@ -31,7 +31,7 @@ static gint default_spacing = 30; static gint default_layout_style = GTK_BUTTONBOX_EDGE; guint -gtk_hbutton_box_get_type () +gtk_hbutton_box_get_type (void) { static guint hbutton_box_type = 0; @@ -72,7 +72,7 @@ gtk_hbutton_box_init (GtkHButtonBox *hbutton_box) } GtkWidget* -gtk_hbutton_box_new () +gtk_hbutton_box_new (void) { GtkHButtonBox *hbutton_box; diff --git a/gtk/gtkhbox.c b/gtk/gtkhbox.c index 486f3fd4d..98a4843b0 100644 --- a/gtk/gtkhbox.c +++ b/gtk/gtkhbox.c @@ -28,7 +28,7 @@ static void gtk_hbox_size_allocate (GtkWidget *widget, guint -gtk_hbox_get_type () +gtk_hbox_get_type (void) { static guint hbox_type = 0; diff --git a/gtk/gtkhpaned.c b/gtk/gtkhpaned.c index 596cbb7b1..3131f6914 100644 --- a/gtk/gtkhpaned.c +++ b/gtk/gtkhpaned.c @@ -37,7 +37,7 @@ static gint gtk_hpaned_motion (GtkWidget *widget, GdkEventMotion *event); guint -gtk_hpaned_get_type () +gtk_hpaned_get_type (void) { static guint hpaned_type = 0; @@ -81,7 +81,7 @@ gtk_hpaned_init (GtkHPaned *hpaned) } GtkWidget* -gtk_hpaned_new () +gtk_hpaned_new (void) { GtkHPaned *hpaned; diff --git a/gtk/gtkhruler.c b/gtk/gtkhruler.c index 6ea762d3c..1180ecab1 100644 --- a/gtk/gtkhruler.c +++ b/gtk/gtkhruler.c @@ -39,7 +39,7 @@ static void gtk_hruler_draw_pos (GtkRuler *ruler); guint -gtk_hruler_get_type () +gtk_hruler_get_type (void) { static guint hruler_type = 0; @@ -89,7 +89,7 @@ gtk_hruler_init (GtkHRuler *hruler) GtkWidget* -gtk_hruler_new () +gtk_hruler_new (void) { return GTK_WIDGET (gtk_type_new (gtk_hruler_get_type ())); } @@ -136,7 +136,7 @@ gtk_hruler_draw_ticks (GtkRuler *ruler) gfloat step_incr; gfloat increment; gfloat start, end, cur; - gchar unit_str[12]; + gchar unit_str[32]; gint text_height; gint digit_height; gint pos; diff --git a/gtk/gtkhscale.c b/gtk/gtkhscale.c index 0cfdb2300..0180e3209 100644 --- a/gtk/gtkhscale.c +++ b/gtk/gtkhscale.c @@ -46,7 +46,7 @@ static gint gtk_hscale_trough_keys (GtkRange *range, GtkTroughType *pos); guint -gtk_hscale_get_type () +gtk_hscale_get_type (void) { static guint hscale_type = 0; diff --git a/gtk/gtkhscrollbar.c b/gtk/gtkhscrollbar.c index 3e3b88e1b..3bc1f7614 100644 --- a/gtk/gtkhscrollbar.c +++ b/gtk/gtkhscrollbar.c @@ -42,7 +42,7 @@ static gint gtk_hscrollbar_trough_keys (GtkRange *range, guint -gtk_hscrollbar_get_type () +gtk_hscrollbar_get_type (void) { static guint hscrollbar_type = 0; diff --git a/gtk/gtkhseparator.c b/gtk/gtkhseparator.c index bc08cc37a..18e1aef3f 100644 --- a/gtk/gtkhseparator.c +++ b/gtk/gtkhseparator.c @@ -26,7 +26,7 @@ static gint gtk_hseparator_expose (GtkWidget *widget, guint -gtk_hseparator_get_type () +gtk_hseparator_get_type (void) { static guint hseparator_type = 0; @@ -67,7 +67,7 @@ gtk_hseparator_init (GtkHSeparator *hseparator) } GtkWidget* -gtk_hseparator_new () +gtk_hseparator_new (void) { return GTK_WIDGET (gtk_type_new (gtk_hseparator_get_type ())); } diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c index edf6489f2..bb4c747cb 100644 --- a/gtk/gtkimage.c +++ b/gtk/gtkimage.c @@ -27,7 +27,7 @@ static gint gtk_image_expose (GtkWidget *widget, guint -gtk_image_get_type () +gtk_image_get_type (void) { static guint image_type = 0; diff --git a/gtk/gtkinputdialog.c b/gtk/gtkinputdialog.c index f0b41dcfc..9612f6dac 100644 --- a/gtk/gtkinputdialog.c +++ b/gtk/gtkinputdialog.c @@ -128,7 +128,7 @@ gtk_input_dialog_get_device_info(guint32 deviceid) } guint -gtk_input_dialog_get_type () +gtk_input_dialog_get_type (void) { static guint input_dialog_type = 0; @@ -650,7 +650,7 @@ gtk_input_dialog_fill_keys(GtkInputDialog *inputd, GdkDeviceInfo *info) GtkWidget *label; GtkWidget *button; - char buffer[16]; + char buffer[32]; /* remove all the old items */ if (inputd->keys_list) diff --git a/gtk/gtkitem.c b/gtk/gtkitem.c index 0b6b5f5e9..5e8a3b0d0 100644 --- a/gtk/gtkitem.c +++ b/gtk/gtkitem.c @@ -43,7 +43,7 @@ static guint item_signals[LAST_SIGNAL] = { 0 }; guint -gtk_item_get_type () +gtk_item_get_type (void) { static guint item_type = 0; diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index 7bd3687c7..412f83a45 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -50,7 +50,7 @@ static GtkMiscClass *parent_class = NULL; guint -gtk_label_get_type () +gtk_label_get_type (void) { static guint label_type = 0; diff --git a/gtk/gtklist.c b/gtk/gtklist.c index c7531d5df..9300b7765 100644 --- a/gtk/gtklist.c +++ b/gtk/gtklist.c @@ -80,7 +80,7 @@ static guint list_signals[LAST_SIGNAL] = { 0 }; GtkType -gtk_list_get_type () +gtk_list_get_type (void) { static guint list_type = 0; @@ -179,7 +179,7 @@ gtk_list_init (GtkList *list) } GtkWidget* -gtk_list_new () +gtk_list_new (void) { return GTK_WIDGET (gtk_type_new (gtk_list_get_type ())); } diff --git a/gtk/gtklistitem.c b/gtk/gtklistitem.c index b33e3c56e..3cf336db4 100644 --- a/gtk/gtklistitem.c +++ b/gtk/gtklistitem.c @@ -47,7 +47,7 @@ static GtkItemClass *parent_class = NULL; guint -gtk_list_item_get_type () +gtk_list_item_get_type (void) { static guint list_item_type = 0; @@ -103,7 +103,7 @@ gtk_list_item_init (GtkListItem *list_item) } GtkWidget* -gtk_list_item_new () +gtk_list_item_new (void) { return GTK_WIDGET (gtk_type_new (gtk_list_item_get_type ())); } diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c index 30957f4bf..a4c4497be 100644 --- a/gtk/gtkmain.c +++ b/gtk/gtkmain.c @@ -377,13 +377,13 @@ gtk_exit (int errorcode) } gchar* -gtk_set_locale () +gtk_set_locale (void) { return gdk_set_locale (); } void -gtk_main () +gtk_main (void) { GList *tmp_list; GList *functions; @@ -454,7 +454,7 @@ gtk_main_level (void) } void -gtk_main_quit () +gtk_main_quit (void) { iteration_done = TRUE; } @@ -498,7 +498,7 @@ gtk_events_pending (void) } gint -gtk_main_iteration () +gtk_main_iteration (void) { return gtk_main_iteration_do (TRUE); } @@ -1314,7 +1314,7 @@ gtk_input_remove (guint tag) } GdkEvent * -gtk_get_current_event () +gtk_get_current_event (void) { if (current_events) return gdk_event_copy ((GdkEvent *) current_events->data); @@ -1335,7 +1335,7 @@ gtk_get_event_widget (GdkEvent *event) } static void -gtk_exit_func () +gtk_exit_func (void) { if (initialized) { @@ -1430,7 +1430,7 @@ gtk_handle_current_timeouts (guint32 the_time) } static void -gtk_handle_timeouts () +gtk_handle_timeouts (void) { guint32 the_time; GList *tmp_list; @@ -1512,7 +1512,7 @@ gtk_idle_invoke_function (GtkIdleFunction *idlef) } static void -gtk_handle_current_idles () +gtk_handle_current_idles (void) { GList *tmp_list; GList *tmp_list2; @@ -1574,7 +1574,7 @@ gtk_handle_current_idles () } static void -gtk_handle_idle () +gtk_handle_idle (void) { /* Caller must already have called gtk_handle_current_idles if * necessary @@ -1608,7 +1608,7 @@ gtk_handle_idle () } static void -gtk_handle_timer () +gtk_handle_timer (void) { GtkTimeoutFunction *timeoutf; diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c index fba06826c..82a60310c 100644 --- a/gtk/gtkmenu.c +++ b/gtk/gtkmenu.c @@ -66,7 +66,7 @@ static const gchar *attach_data_key = "gtk-menu-attach-data"; guint -gtk_menu_get_type () +gtk_menu_get_type (void) { static guint menu_type = 0; @@ -244,7 +244,7 @@ gtk_menu_detach (GtkMenu *menu) } GtkWidget* -gtk_menu_new () +gtk_menu_new (void) { return GTK_WIDGET (gtk_type_new (gtk_menu_get_type ())); } diff --git a/gtk/gtkmenubar.c b/gtk/gtkmenubar.c index 86bde152b..4decd6761 100644 --- a/gtk/gtkmenubar.c +++ b/gtk/gtkmenubar.c @@ -39,7 +39,7 @@ static gint gtk_menu_bar_expose (GtkWidget *widget, guint -gtk_menu_bar_get_type () +gtk_menu_bar_get_type (void) { static guint menu_bar_type = 0; @@ -85,7 +85,7 @@ gtk_menu_bar_init (GtkMenuBar *menu_bar) } GtkWidget* -gtk_menu_bar_new () +gtk_menu_bar_new (void) { return GTK_WIDGET (gtk_type_new (gtk_menu_bar_get_type ())); } diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c index dfefb7c1e..98e046d49 100644 --- a/gtk/gtkmenuitem.c +++ b/gtk/gtkmenuitem.c @@ -70,7 +70,7 @@ static guint menu_item_signals[LAST_SIGNAL] = { 0 }; guint -gtk_menu_item_get_type () +gtk_menu_item_get_type (void) { static guint menu_item_type = 0; @@ -159,7 +159,7 @@ gtk_menu_item_init (GtkMenuItem *menu_item) } GtkWidget* -gtk_menu_item_new () +gtk_menu_item_new (void) { return GTK_WIDGET (gtk_type_new (gtk_menu_item_get_type ())); } diff --git a/gtk/gtkmenushell.c b/gtk/gtkmenushell.c index 58a0226fe..c3476d2fd 100644 --- a/gtk/gtkmenushell.c +++ b/gtk/gtkmenushell.c @@ -63,7 +63,7 @@ static guint menu_shell_signals[LAST_SIGNAL] = { 0 }; guint -gtk_menu_shell_get_type () +gtk_menu_shell_get_type (void) { static guint menu_shell_type = 0; diff --git a/gtk/gtkmisc.c b/gtk/gtkmisc.c index 833f587e6..0fdea1619 100644 --- a/gtk/gtkmisc.c +++ b/gtk/gtkmisc.c @@ -40,7 +40,7 @@ static void gtk_misc_get_arg (GtkMisc *misc, guint -gtk_misc_get_type () +gtk_misc_get_type (void) { static guint misc_type = 0; diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index 6518f4719..b5c19f0cf 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -144,7 +144,7 @@ static GtkContainerClass *parent_class = NULL; static guint notebook_signals[LAST_SIGNAL] = { 0 }; guint -gtk_notebook_get_type () +gtk_notebook_get_type (void) { static guint notebook_type = 0; @@ -243,7 +243,7 @@ gtk_notebook_init (GtkNotebook *notebook) } GtkWidget* -gtk_notebook_new () +gtk_notebook_new (void) { return GTK_WIDGET (gtk_type_new (gtk_notebook_get_type ())); } diff --git a/gtk/gtkobject.c b/gtk/gtkobject.c index cd852d3bd..346d90d40 100644 --- a/gtk/gtkobject.c +++ b/gtk/gtkobject.c @@ -135,7 +135,7 @@ gtk_object_pointer_hash (const gpointer v) ****************************************************/ void -gtk_object_init_type () +gtk_object_init_type (void) { GtkType object_type = 0; GtkTypeInfo object_info = @@ -159,7 +159,7 @@ gtk_object_init_type () } GtkType -gtk_object_get_type () +gtk_object_get_type (void) { return GTK_TYPE_OBJECT; } @@ -1171,7 +1171,7 @@ gtk_object_data_destroy (GtkObjectData *odata) } static guint* -gtk_object_data_id_alloc () +gtk_object_data_id_alloc (void) { static guint next_id = 1; guint *ids; diff --git a/gtk/gtkoptionmenu.c b/gtk/gtkoptionmenu.c index 984e0f877..4b3f798cb 100644 --- a/gtk/gtkoptionmenu.c +++ b/gtk/gtkoptionmenu.c @@ -63,7 +63,7 @@ static GtkButtonClass *parent_class = NULL; guint -gtk_option_menu_get_type () +gtk_option_menu_get_type (void) { static guint option_menu_type = 0; @@ -123,7 +123,7 @@ gtk_option_menu_init (GtkOptionMenu *option_menu) } GtkWidget* -gtk_option_menu_new () +gtk_option_menu_new (void) { return GTK_WIDGET (gtk_type_new (gtk_option_menu_get_type ())); } diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c index 9fbf23ef1..c1d8780b3 100644 --- a/gtk/gtkpaned.c +++ b/gtk/gtkpaned.c @@ -40,7 +40,7 @@ static GtkContainerClass *parent_class = NULL; guint -gtk_paned_get_type () +gtk_paned_get_type (void) { static guint paned_type = 0; diff --git a/gtk/gtkpixmap.c b/gtk/gtkpixmap.c index 014a2dbf0..06e9aa731 100644 --- a/gtk/gtkpixmap.c +++ b/gtk/gtkpixmap.c @@ -29,7 +29,7 @@ static void gtk_pixmap_finalize (GtkObject *object); static GtkWidgetClass *parent_class; guint -gtk_pixmap_get_type () +gtk_pixmap_get_type (void) { static guint pixmap_type = 0; diff --git a/gtk/gtkpreview.c b/gtk/gtkpreview.c index 6172f3ecb..a1ab0da4b 100644 --- a/gtk/gtkpreview.c +++ b/gtk/gtkpreview.c @@ -126,7 +126,7 @@ static gint install_cmap = FALSE; guint -gtk_preview_get_type () +gtk_preview_get_type (void) { static guint preview_type = 0; @@ -287,7 +287,7 @@ gtk_preview_init (GtkPreview *preview) } void -gtk_preview_uninit () +gtk_preview_uninit (void) { GtkPreviewProp *prop; GdkAtom property; @@ -674,7 +674,7 @@ gtk_preview_set_reserved (gint nreserved) } GdkVisual* -gtk_preview_get_visual () +gtk_preview_get_visual (void) { if (!preview_class) preview_class = gtk_type_class (gtk_preview_get_type ()); @@ -683,7 +683,7 @@ gtk_preview_get_visual () } GdkColormap* -gtk_preview_get_cmap () +gtk_preview_get_cmap (void) { if (!preview_class) preview_class = gtk_type_class (gtk_preview_get_type ()); @@ -692,7 +692,7 @@ gtk_preview_get_cmap () } GtkPreviewInfo* -gtk_preview_get_info () +gtk_preview_get_info (void) { if (!preview_class) preview_class = gtk_type_class (gtk_preview_get_type ()); diff --git a/gtk/gtkprogressbar.c b/gtk/gtkprogressbar.c index 8e799b576..eae5bfa8e 100644 --- a/gtk/gtkprogressbar.c +++ b/gtk/gtkprogressbar.c @@ -35,7 +35,7 @@ static void gtk_progress_bar_paint (GtkProgressBar *pbar); guint -gtk_progress_bar_get_type () +gtk_progress_bar_get_type (void) { static guint progress_bar_type = 0; @@ -83,7 +83,7 @@ gtk_progress_bar_init (GtkProgressBar *pbar) GtkWidget* -gtk_progress_bar_new () +gtk_progress_bar_new (void) { return GTK_WIDGET (gtk_type_new (gtk_progress_bar_get_type ())); } diff --git a/gtk/gtkradiobutton.c b/gtk/gtkradiobutton.c index bf9ead5a7..7f3c11409 100644 --- a/gtk/gtkradiobutton.c +++ b/gtk/gtkradiobutton.c @@ -36,7 +36,7 @@ static GtkCheckButtonClass *parent_class = NULL; guint -gtk_radio_button_get_type () +gtk_radio_button_get_type (void) { static guint radio_button_type = 0; diff --git a/gtk/gtkradiomenuitem.c b/gtk/gtkradiomenuitem.c index 229716119..9e00fef26 100644 --- a/gtk/gtkradiomenuitem.c +++ b/gtk/gtkradiomenuitem.c @@ -28,7 +28,7 @@ static void gtk_radio_menu_item_draw_indicator (GtkCheckMenuItem *check_men guint -gtk_radio_menu_item_get_type () +gtk_radio_menu_item_get_type (void) { static guint radio_menu_item_type = 0; diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c index a4c50e067..999e1888c 100644 --- a/gtk/gtkrange.c +++ b/gtk/gtkrange.c @@ -54,6 +54,9 @@ static gint gtk_range_focus_in (GtkWidget *widget, GdkEventFocus *event); static gint gtk_range_focus_out (GtkWidget *widget, GdkEventFocus *event); +static void gtk_range_style_set (GtkWidget *widget, + GtkStyle *previous_style); + static void gtk_real_range_draw_trough (GtkRange *range); static void gtk_real_range_draw_slider (GtkRange *range); static gint gtk_real_range_timer (GtkRange *range); @@ -79,7 +82,7 @@ static GtkWidgetClass *parent_class = NULL; guint -gtk_range_get_type () +gtk_range_get_type (void) { static guint range_type = 0; @@ -127,6 +130,7 @@ gtk_range_class_init (GtkRangeClass *class) widget_class->leave_notify_event = gtk_range_leave_notify; widget_class->focus_in_event = gtk_range_focus_in; widget_class->focus_out_event = gtk_range_focus_out; + widget_class->style_set = gtk_range_style_set; class->slider_width = 11; class->stepper_size = 11; @@ -1455,3 +1459,39 @@ gtk_range_trough_vdims (GtkRange *range, *bottom = tbottom; } +static void +gtk_range_style_set (GtkWidget *widget, + GtkStyle *previous_style) +{ + GtkRange *range; + + g_return_if_fail (widget != NULL); + g_return_if_fail (GTK_IS_RANGE (widget)); + + range = GTK_RANGE (widget); + + if (GTK_WIDGET_REALIZED (widget) && + !GTK_WIDGET_NO_WINDOW (widget)) + { + if (range->trough) + { + gtk_style_set_background (widget->style, range->trough, GTK_STATE_ACTIVE); + if (GTK_WIDGET_DRAWABLE (widget)) + gdk_window_clear (range->trough); + } + /* The draw will take care of the slider */ + + if (range->step_forw) + { + gtk_style_set_background (widget->style, range->step_forw, GTK_STATE_ACTIVE); + if (GTK_WIDGET_DRAWABLE (widget)) + gdk_window_clear (range->step_forw); + } + if (range->step_back) + { + gtk_style_set_background (widget->style, range->step_back, GTK_STATE_ACTIVE); + if (GTK_WIDGET_DRAWABLE (widget)) + gdk_window_clear (range->step_back); + } + } +} diff --git a/gtk/gtkrc.c b/gtk/gtkrc.c index c0657d89d..a929e9935 100644 --- a/gtk/gtkrc.c +++ b/gtk/gtkrc.c @@ -18,6 +18,8 @@ */ #include <ctype.h> #include <unistd.h> +#include <sys/stat.h> +#include <sys/param.h> #include <fcntl.h> #include <string.h> #include <stdio.h> @@ -64,6 +66,7 @@ enum { typedef struct _GtkRcStyle GtkRcStyle; typedef struct _GtkRcSet GtkRcSet; typedef struct _GtkRcNode GtkRcNode; +typedef struct _GtkRcFile GtkRcFile; struct _GtkRcNode { @@ -87,6 +90,13 @@ struct _GtkRcSet GtkRcStyle *rc_style; }; +struct _GtkRcFile +{ + time_t mtime; + gchar *name; + gchar *canonical_name; + gboolean reload; +}; static guint gtk_rc_style_hash (const char *name); static gint gtk_rc_style_compare (const char *a, @@ -98,6 +108,9 @@ static gint gtk_rc_style_match (const char *set, const char *path); static GtkStyle* gtk_rc_style_init (GtkRcStyle *rc_style, GdkColormap *cmap); +static void gtk_rc_parse_file (const gchar *filename, + gboolean reload); + static void gtk_rc_parse_any (const gchar *input_name, gint input_fd, const gchar *input_string); @@ -131,6 +144,11 @@ static gint gtk_rc_parse_widget_style (GScanner *scanner); static gint gtk_rc_parse_widget_class_style (GScanner *scanner); static char* gtk_rc_widget_path (GtkWidget *widget); static char* gtk_rc_widget_class_path (GtkWidget *widget); +static void gtk_rc_clear_hash_node (gpointer key, + gpointer data, + gpointer user_data); +static void gtk_rc_clear_styles (void); + static GScannerConfig gtk_rc_scanner_config = @@ -208,10 +226,10 @@ static GSList *widget_class_sets = NULL; static gchar *pixmap_path[GTK_RC_MAX_PIXMAP_PATHS]; /* The files we have parsed, to reread later if necessary */ -GSList *rc_files; +GSList *rc_files = NULL; void -gtk_rc_init () +gtk_rc_init (void) { rc_style_ht = g_hash_table_new ((GHashFunc) gtk_rc_style_hash, (GCompareFunc) gtk_rc_style_compare); @@ -225,25 +243,88 @@ gtk_rc_parse_string (const gchar *rc_string) gtk_rc_parse_any ("-", -1, rc_string); } -void -gtk_rc_parse (const gchar *filename) +static void +gtk_rc_parse_file (const gchar *filename, gboolean reload) { - gint fd; + GtkRcFile *rc_file = NULL; + struct stat statbuf; + GSList *tmp_list; g_return_if_fail (filename != NULL); - rc_files = g_slist_append (rc_files, g_strdup (filename)); + tmp_list = rc_files; + while (tmp_list) + { + rc_file = tmp_list->data; + if (!strcmp (rc_file->name, filename)) + break; + + tmp_list = tmp_list->next; + } + + if (!tmp_list) + { + rc_file = g_new (GtkRcFile, 1); + rc_file->name = g_strdup (filename); + rc_file->canonical_name = NULL; + rc_file->mtime = 0; + rc_file->reload = reload; + + rc_files = g_slist_append (rc_files, rc_file); + } + + if (!rc_file->canonical_name) + { + /* Get the absolute pathname */ + + if (rc_file->name[0] == '/') + rc_file->canonical_name = rc_file->name; + else + { + GString *str; + gchar buffer[MAXPATHLEN]; + +#if defined(sun) && !defined(__SVR4) + if(!getwd(buffer)) +#else + if(!getcwd(buffer, MAXPATHLEN)) +#endif + return; + + str = g_string_new (buffer); + g_string_append_c (str, '/'); + g_string_append (str, rc_file->name); + + rc_file->canonical_name = str->str; + g_string_free (str, FALSE); + } + } + + if (!stat (rc_file->canonical_name, &statbuf)) + { + gint fd; + + rc_file->mtime = statbuf.st_mtime; - fd = open (filename, O_RDONLY); - if (fd < 0) - return; + fd = open (rc_file->canonical_name, O_RDONLY); + if (fd < 0) + return; - gtk_rc_parse_any (filename, fd, NULL); + gtk_rc_parse_any (filename, fd, NULL); - close (fd); + close (fd); + } } void +gtk_rc_parse (const gchar *filename) +{ + g_return_if_fail (filename != NULL); + + gtk_rc_parse_file (filename, TRUE); +} + +static void gtk_rc_clear_hash_node (gpointer key, gpointer data, gpointer user_data) @@ -276,10 +357,10 @@ gtk_rc_clear_hash_node (gpointer key, g_free (rc_style); } -void -gtk_rc_reparse_all (void) +static void +gtk_rc_clear_styles (void) { - GSList *tmp_list, *tmp_files; + GSList *tmp_list; GtkRcSet *rc_set; /* Clear out all old rc_styles */ @@ -312,22 +393,52 @@ gtk_rc_reparse_all (void) g_slist_free (widget_class_sets); widget_class_sets = NULL; - /* Now read the RC's again */ - gtk_rc_init (); +} - tmp_files = rc_files; - rc_files = NULL; +gboolean +gtk_rc_reparse_all (void) +{ + GSList *tmp_list; + gboolean mtime_modified = FALSE; + GtkRcFile *rc_file; + + struct stat statbuf; - tmp_list = tmp_files; + /* Check through and see if any of the RC's have had their + * mtime modified. If so, reparse everything. + */ + tmp_list = rc_files; while (tmp_list) { - gtk_rc_parse ((gchar *)tmp_list->data); - g_free (tmp_list->data); + rc_file = tmp_list->data; + + if (!stat (rc_file->name, &statbuf) && + (statbuf.st_mtime > rc_file->mtime)) + { + mtime_modified = TRUE; + break; + } tmp_list = tmp_list->next; } - g_slist_free (tmp_files); + + if (mtime_modified) + { + gtk_rc_clear_styles(); + + tmp_list = rc_files; + while (tmp_list) + { + rc_file = tmp_list->data; + if (rc_file->reload) + gtk_rc_parse_file (rc_file->name, FALSE); + + tmp_list = tmp_list->next; + } + } + + return mtime_modified; } GtkStyle* @@ -680,7 +791,7 @@ gtk_rc_parse_statement (GScanner *scanner) if (token != G_TOKEN_STRING) return PARSE_ERROR; - gtk_rc_parse (scanner->value.v_string); + gtk_rc_parse_file (scanner->value.v_string, FALSE); return PARSE_OK; } diff --git a/gtk/gtkrc.h b/gtk/gtkrc.h index 335448668..d1a7e1cdf 100644 --- a/gtk/gtkrc.h +++ b/gtk/gtkrc.h @@ -32,7 +32,7 @@ extern "C" { void gtk_rc_init (void); void gtk_rc_parse (const gchar *filename); void gtk_rc_parse_string (const gchar *rc_string); -void gtk_rc_reparse_all (void); +gboolean gtk_rc_reparse_all (void); GtkStyle* gtk_rc_get_style (GtkWidget *widget); void gtk_rc_add_widget_name_style (GtkStyle *style, const gchar *pattern); diff --git a/gtk/gtkruler.c b/gtk/gtkruler.c index c1c997f48..b4af977ad 100644 --- a/gtk/gtkruler.c +++ b/gtk/gtkruler.c @@ -41,7 +41,7 @@ static GtkRulerMetric ruler_metrics[] = guint -gtk_ruler_get_type () +gtk_ruler_get_type (void) { static guint ruler_type = 0; diff --git a/gtk/gtkscale.c b/gtk/gtkscale.c index 17a0a23ca..f1e162729 100644 --- a/gtk/gtkscale.c +++ b/gtk/gtkscale.c @@ -33,7 +33,7 @@ static GtkRangeClass *parent_class = NULL; guint -gtk_scale_get_type () +gtk_scale_get_type (void) { static guint scale_type = 0; diff --git a/gtk/gtkscrollbar.c b/gtk/gtkscrollbar.c index 26aa00bfc..f765269ac 100644 --- a/gtk/gtkscrollbar.c +++ b/gtk/gtkscrollbar.c @@ -22,7 +22,7 @@ static void gtk_scrollbar_class_init (GtkScrollbarClass *klass); static void gtk_scrollbar_init (GtkScrollbar *scrollbar); guint -gtk_scrollbar_get_type () +gtk_scrollbar_get_type (void) { static guint scrollbar_type = 0; diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c index f3f1ceb2a..5160eca54 100644 --- a/gtk/gtkscrolledwindow.c +++ b/gtk/gtkscrolledwindow.c @@ -52,7 +52,7 @@ static GtkContainerClass *parent_class = NULL; guint -gtk_scrolled_window_get_type () +gtk_scrolled_window_get_type (void) { static guint scrolled_window_type = 0; diff --git a/gtk/gtkseparator.c b/gtk/gtkseparator.c index e2c7eea5e..1fffc270e 100644 --- a/gtk/gtkseparator.c +++ b/gtk/gtkseparator.c @@ -24,7 +24,7 @@ static void gtk_separator_init (GtkSeparator *separator); guint -gtk_separator_get_type () +gtk_separator_get_type (void) { static guint separator_type = 0; diff --git a/gtk/gtksignal.c b/gtk/gtksignal.c index 35c47fcc5..dd83e63e5 100644 --- a/gtk/gtksignal.c +++ b/gtk/gtksignal.c @@ -1026,7 +1026,7 @@ gtk_signal_set_funcs (GtkSignalMarshal marshal_func, static void -gtk_signal_init () +gtk_signal_init (void) { if (initialize) { @@ -1066,7 +1066,7 @@ gtk_signal_info_compare (GtkSignalInfo *a, } static GtkHandler* -gtk_signal_handler_new () +gtk_signal_handler_new (void) { GtkHandler *handler; @@ -1371,7 +1371,7 @@ gtk_signal_connect_by_type (GtkObject *object, } static GtkEmission* -gtk_emission_new () +gtk_emission_new (void) { GtkEmission *emission; diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c index 38431070d..6692cb1f6 100644 --- a/gtk/gtkspinbutton.c +++ b/gtk/gtkspinbutton.c @@ -89,7 +89,7 @@ static GtkWidgetClass *parent_class = NULL; guint -gtk_spin_button_get_type () +gtk_spin_button_get_type (void) { static guint spin_button_type = 0; diff --git a/gtk/gtkstatusbar.c b/gtk/gtkstatusbar.c index e02c209e3..b0b8f87e3 100644 --- a/gtk/gtkstatusbar.c +++ b/gtk/gtkstatusbar.c @@ -48,7 +48,7 @@ static GtkContainerClass *parent_class; static guint statusbar_signals[SIGNAL_LAST] = { 0 }; guint -gtk_statusbar_get_type () +gtk_statusbar_get_type (void) { static guint statusbar_type = 0; @@ -157,7 +157,7 @@ gtk_statusbar_init (GtkStatusbar *statusbar) } GtkWidget* -gtk_statusbar_new () +gtk_statusbar_new (void) { return gtk_type_new (gtk_statusbar_get_type ()); } diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c index ed009558d..62d90302a 100644 --- a/gtk/gtkstyle.c +++ b/gtk/gtkstyle.c @@ -186,7 +186,7 @@ gtk_style_copy (GtkStyle *style) } GtkStyle* -gtk_style_new () +gtk_style_new (void) { GtkStyle *style; gint i; @@ -607,7 +607,7 @@ gtk_style_init (GtkStyle *style) } static void -gtk_styles_init () +gtk_styles_init (void) { if (initialize) { diff --git a/gtk/gtktable.c b/gtk/gtktable.c index 9140a6af5..f77e405ec 100644 --- a/gtk/gtktable.c +++ b/gtk/gtktable.c @@ -54,7 +54,7 @@ static GtkContainerClass *parent_class = NULL; guint -gtk_table_get_type () +gtk_table_get_type (void) { static guint table_type = 0; diff --git a/gtk/gtktext.c b/gtk/gtktext.c index ecf16562b..843fa465c 100644 --- a/gtk/gtktext.c +++ b/gtk/gtktext.c @@ -418,7 +418,7 @@ static GtkTextFunction alt_keys[26] = /**********************************************************************/ guint -gtk_text_get_type () +gtk_text_get_type (void) { static guint text_type = 0; diff --git a/gtk/gtktogglebutton.c b/gtk/gtktogglebutton.c index 4e4da236e..fc5e1f8e9 100644 --- a/gtk/gtktogglebutton.c +++ b/gtk/gtktogglebutton.c @@ -46,7 +46,7 @@ static guint toggle_button_signals[LAST_SIGNAL] = { 0 }; guint -gtk_toggle_button_get_type () +gtk_toggle_button_get_type (void) { static guint toggle_button_type = 0; @@ -112,7 +112,7 @@ gtk_toggle_button_init (GtkToggleButton *toggle_button) GtkWidget* -gtk_toggle_button_new () +gtk_toggle_button_new (void) { return GTK_WIDGET (gtk_type_new (gtk_toggle_button_get_type ())); } diff --git a/gtk/gtktooltips.c b/gtk/gtktooltips.c index 22f8b7be7..f91a826bf 100644 --- a/gtk/gtktooltips.c +++ b/gtk/gtktooltips.c @@ -50,7 +50,7 @@ static GtkDataClass *parent_class; static const gchar *tooltips_data_key = "_GtkTooltipsData"; guint -gtk_tooltips_get_type () +gtk_tooltips_get_type (void) { static guint tooltips_type = 0; @@ -100,7 +100,7 @@ gtk_tooltips_init (GtkTooltips *tooltips) } GtkTooltips * -gtk_tooltips_new () +gtk_tooltips_new (void) { return gtk_type_new (gtk_tooltips_get_type ()); } diff --git a/gtk/gtktree.c b/gtk/gtktree.c index faed8e60e..ad14599b5 100644 --- a/gtk/gtktree.c +++ b/gtk/gtktree.c @@ -74,7 +74,7 @@ static GtkContainerClass *parent_class = NULL; static guint tree_signals[LAST_SIGNAL] = { 0 }; guint -gtk_tree_get_type () +gtk_tree_get_type (void) { static guint tree_type = 0; @@ -175,7 +175,7 @@ gtk_tree_init (GtkTree *tree) } GtkWidget* -gtk_tree_new () +gtk_tree_new (void) { return GTK_WIDGET (gtk_type_new (gtk_tree_get_type ())); } diff --git a/gtk/gtktreeitem.c b/gtk/gtktreeitem.c index 3b2cb072b..d4bffcd86 100644 --- a/gtk/gtktreeitem.c +++ b/gtk/gtktreeitem.c @@ -93,7 +93,7 @@ static GtkContainerClass *container_class = NULL; static guint tree_item_signals[LAST_SIGNAL] = { 0 }; guint -gtk_tree_item_get_type () +gtk_tree_item_get_type (void) { static guint tree_item_type = 0; @@ -261,7 +261,7 @@ gtk_tree_item_init (GtkTreeItem *tree_item) GtkWidget* -gtk_tree_item_new () +gtk_tree_item_new (void) { GtkWidget *tree_item; diff --git a/gtk/gtktypeutils.c b/gtk/gtktypeutils.c index 9fdcad4f0..855337247 100644 --- a/gtk/gtktypeutils.c +++ b/gtk/gtktypeutils.c @@ -55,7 +55,7 @@ static GHashTable *name_hash_table = NULL; void -gtk_type_init () +gtk_type_init (void) { if (initialize) { @@ -249,6 +249,19 @@ gtk_type_describe_tree (GtkType type, indent = old_indent; } +static gint type_isas[512]; + +static void +show_isas (void) +{ + int i; + + for (i=0;i<512;i++) + if (type_isas[i]) + g_print ("%s: %d\n",gtk_type_name(GTK_TYPE_MAKE(GTK_TYPE_OBJECT,i)), + type_isas[i]); +} + gint gtk_type_is_a (GtkType type, GtkType is_a_type) @@ -258,6 +271,8 @@ gtk_type_is_a (GtkType type, if (initialize) gtk_type_init (); + type_isas[GTK_TYPE_SEQNO(is_a_type)]++; + node = g_hash_table_lookup (type_hash_table, &type); while (node) @@ -452,7 +467,7 @@ extern void gtk_object_init_type (void); GtkType gtk_type_builtins[GTK_TYPE_NUM_BUILTINS]; static void -gtk_type_init_builtin_types () +gtk_type_init_builtin_types (void) { /* GTK_TYPE_INVALID has typeid 0. The first type id returned by gtk_type_unique is 1, which is GTK_TYPE_NONE. And so on. */ @@ -509,4 +524,6 @@ gtk_type_init_builtin_types () gtk_type_register_builtin (builtin_info[i].name, builtin_info[i].parent); } + + ATEXIT(show_isas); } diff --git a/gtk/gtkvbbox.c b/gtk/gtkvbbox.c index cadbabbd8..8c9860ecb 100644 --- a/gtk/gtkvbbox.c +++ b/gtk/gtkvbbox.c @@ -30,7 +30,7 @@ static gint default_spacing = 10; static GtkButtonBoxStyle default_layout_style = GTK_BUTTONBOX_EDGE; guint -gtk_vbutton_box_get_type () +gtk_vbutton_box_get_type (void) { static guint vbutton_box_type = 0; @@ -71,7 +71,7 @@ gtk_vbutton_box_init (GtkVButtonBox *vbutton_box) } GtkWidget* -gtk_vbutton_box_new () +gtk_vbutton_box_new (void) { GtkVButtonBox *vbutton_box; diff --git a/gtk/gtkvbox.c b/gtk/gtkvbox.c index 15b5eb3c2..4e9cc7921 100644 --- a/gtk/gtkvbox.c +++ b/gtk/gtkvbox.c @@ -28,7 +28,7 @@ static void gtk_vbox_size_allocate (GtkWidget *widget, guint -gtk_vbox_get_type () +gtk_vbox_get_type (void) { static guint vbox_type = 0; diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c index bbfd69eb8..c91b00d07 100644 --- a/gtk/gtkviewport.c +++ b/gtk/gtkviewport.c @@ -48,7 +48,7 @@ static void gtk_viewport_adjustment_value_changed (GtkAdjustment *adjustment, static GtkBinClass *parent_class; guint -gtk_viewport_get_type () +gtk_viewport_get_type (void) { static guint viewport_type = 0; diff --git a/gtk/gtkvpaned.c b/gtk/gtkvpaned.c index b1d43aa23..5b5b67017 100644 --- a/gtk/gtkvpaned.c +++ b/gtk/gtkvpaned.c @@ -37,7 +37,7 @@ static gint gtk_vpaned_motion (GtkWidget *widget, GdkEventMotion *event); guint -gtk_vpaned_get_type () +gtk_vpaned_get_type (void) { static guint vpaned_type = 0; @@ -81,7 +81,7 @@ gtk_vpaned_init (GtkVPaned *vpaned) } GtkWidget* -gtk_vpaned_new () +gtk_vpaned_new (void) { GtkVPaned *vpaned; diff --git a/gtk/gtkvruler.c b/gtk/gtkvruler.c index 66143ba4f..e75995379 100644 --- a/gtk/gtkvruler.c +++ b/gtk/gtkvruler.c @@ -39,7 +39,7 @@ static void gtk_vruler_draw_pos (GtkRuler *ruler); guint -gtk_vruler_get_type () +gtk_vruler_get_type (void) { static guint vruler_type = 0; @@ -88,7 +88,7 @@ gtk_vruler_init (GtkVRuler *vruler) } GtkWidget* -gtk_vruler_new () +gtk_vruler_new (void) { return GTK_WIDGET (gtk_type_new (gtk_vruler_get_type ())); } @@ -136,7 +136,7 @@ gtk_vruler_draw_ticks (GtkRuler *ruler) gfloat step_incr; gfloat increment; gfloat start, end, cur; - gchar unit_str[12]; + gchar unit_str[32]; gchar digit_str[2] = { '\0', '\0' }; gint text_height; gint digit_height; diff --git a/gtk/gtkvscale.c b/gtk/gtkvscale.c index 501a4eef1..57ad90ef6 100644 --- a/gtk/gtkvscale.c +++ b/gtk/gtkvscale.c @@ -47,7 +47,7 @@ static gint gtk_vscale_trough_keys (GtkRange *range, guint -gtk_vscale_get_type () +gtk_vscale_get_type (void) { static guint vscale_type = 0; diff --git a/gtk/gtkvscrollbar.c b/gtk/gtkvscrollbar.c index eb166d8c4..ba42df24a 100644 --- a/gtk/gtkvscrollbar.c +++ b/gtk/gtkvscrollbar.c @@ -41,7 +41,7 @@ static gint gtk_vscrollbar_trough_keys (GtkRange *range, GtkTroughType *pos); guint -gtk_vscrollbar_get_type () +gtk_vscrollbar_get_type (void) { static guint vscrollbar_type = 0; diff --git a/gtk/gtkvseparator.c b/gtk/gtkvseparator.c index 7a5256631..567332087 100644 --- a/gtk/gtkvseparator.c +++ b/gtk/gtkvseparator.c @@ -26,7 +26,7 @@ static gint gtk_vseparator_expose (GtkWidget *widget, guint -gtk_vseparator_get_type () +gtk_vseparator_get_type (void) { static guint vseparator_type = 0; @@ -67,7 +67,7 @@ gtk_vseparator_init (GtkVSeparator *vseparator) } GtkWidget* -gtk_vseparator_new () +gtk_vseparator_new (void) { return GTK_WIDGET (gtk_type_new (gtk_vseparator_get_type ())); } diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 3f317289c..47ab7bd32 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -257,7 +257,7 @@ static const gchar *visual_key = "gtk-visual"; *****************************************/ GtkType -gtk_widget_get_type () +gtk_widget_get_type (void) { static GtkType widget_type = 0; @@ -2681,7 +2681,7 @@ gtk_widget_set_default_style (GtkStyle *style) } GtkStyle* -gtk_widget_get_default_style () +gtk_widget_get_default_style (void) { if (!default_style) { @@ -2702,7 +2702,7 @@ gtk_widget_push_style (GtkStyle *style) } static GtkStyle* -gtk_widget_peek_style () +gtk_widget_peek_style (void) { if (style_stack) return (GtkStyle*) style_stack->data; @@ -2711,7 +2711,7 @@ gtk_widget_peek_style () } void -gtk_widget_pop_style () +gtk_widget_pop_style (void) { GSList *tmp; @@ -3209,7 +3209,7 @@ gtk_widget_push_visual (GdkVisual *visual) *****************************************/ void -gtk_widget_pop_colormap () +gtk_widget_pop_colormap (void) { GSList *tmp; @@ -3230,7 +3230,7 @@ gtk_widget_pop_colormap () *****************************************/ void -gtk_widget_pop_visual () +gtk_widget_pop_visual (void) { GSList *tmp; @@ -3286,7 +3286,7 @@ gtk_widget_set_default_visual (GdkVisual *visual) *****************************************/ GdkColormap* -gtk_widget_get_default_colormap () +gtk_widget_get_default_colormap (void) { if (!default_colormap) default_colormap = gdk_colormap_get_system (); @@ -3303,7 +3303,7 @@ gtk_widget_get_default_colormap () *****************************************/ GdkVisual* -gtk_widget_get_default_visual () +gtk_widget_get_default_visual (void) { if (!default_visual) default_visual = gdk_visual_get_system (); @@ -3832,7 +3832,7 @@ gtk_widget_real_size_allocate (GtkWidget *widget, *****************************************/ static GdkColormap* -gtk_widget_peek_colormap () +gtk_widget_peek_colormap (void) { if (colormap_stack) return (GdkColormap*) colormap_stack->data; @@ -3848,7 +3848,7 @@ gtk_widget_peek_colormap () *****************************************/ static GdkVisual* -gtk_widget_peek_visual () +gtk_widget_peek_visual (void) { if (visual_stack) return (GdkVisual*) visual_stack->data; @@ -3962,7 +3962,7 @@ gtk_widget_draw_children_recurse (GtkWidget *widget, *****************************************/ static GtkWidgetAuxInfo* -gtk_widget_aux_info_new () +gtk_widget_aux_info_new (void) { GtkWidgetAuxInfo *aux_info; diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index b0a7c6e05..80021a68e 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -116,7 +116,7 @@ static guint window_signals[LAST_SIGNAL] = { 0 }; guint -gtk_window_get_type () +gtk_window_get_type (void) { static guint window_type = 0; diff --git a/gtk/simple.c b/gtk/simple.c index 47893772f..a246ac57c 100644 --- a/gtk/simple.c +++ b/gtk/simple.c @@ -3,7 +3,7 @@ void -hello () +hello (void) { g_print ("hello world\n"); } diff --git a/gtk/testgtk.c b/gtk/testgtk.c index 2d532b955..28802eb2f 100644 --- a/gtk/testgtk.c +++ b/gtk/testgtk.c @@ -75,7 +75,7 @@ button_window (GtkWidget *widget, } static void -create_buttons () +create_buttons (void) { static GtkWidget *window = NULL; GtkWidget *box1; @@ -212,7 +212,7 @@ create_buttons () } static void -create_toggle_buttons () +create_toggle_buttons (void) { static GtkWidget *window = NULL; GtkWidget *box1; @@ -284,7 +284,7 @@ create_toggle_buttons () } static void -create_check_buttons () +create_check_buttons (void) { static GtkWidget *window = NULL; GtkWidget *box1; @@ -356,7 +356,7 @@ create_check_buttons () } static void -create_radio_buttons () +create_radio_buttons (void) { static GtkWidget *window = NULL; GtkWidget *box1; @@ -506,7 +506,7 @@ create_bbox_window (gint horizontal, } static void -test_hbbox () +test_hbbox (void) { create_bbox_window (TRUE, "Spread", 50, 40, 85, 28, GTK_BUTTONBOX_SPREAD); create_bbox_window (TRUE, "Edge", 200, 40, 85, 25, GTK_BUTTONBOX_EDGE); @@ -515,7 +515,7 @@ test_hbbox () } static void -test_vbbox () +test_vbbox (void) { create_bbox_window (FALSE, "Spread", 50, 40, 85, 25, GTK_BUTTONBOX_SPREAD); create_bbox_window (FALSE, "Edge", 250, 40, 85, 28, GTK_BUTTONBOX_EDGE); @@ -524,7 +524,7 @@ test_vbbox () } static void -create_button_box () +create_button_box (void) { static GtkWidget* window = NULL; GtkWidget* bbox; @@ -878,7 +878,7 @@ statusbar_dump_stack (GtkWidget *button, } static void -create_statusbar () +create_statusbar (void) { static GtkWidget *window = NULL; GtkWidget *box1; @@ -1489,7 +1489,7 @@ create_tree_mode_window(void) /* end of function used by tree demos */ static void -create_handle_box () +create_handle_box (void) { static GtkWidget* window = NULL; GtkWidget *handle_box; @@ -1616,7 +1616,7 @@ set_parent_signal (GtkWidget *child, } static void -create_reparent () +create_reparent (void) { static GtkWidget *window = NULL; GtkWidget *box1; @@ -1723,7 +1723,7 @@ create_reparent () } static void -create_pixmap () +create_pixmap (void) { static GtkWidget *window = NULL; GtkWidget *box1; @@ -1838,7 +1838,7 @@ tips_query_widget_selected (GtkWidget *tips_query, } static void -create_tooltips () +create_tooltips (void) { static GtkWidget *window = NULL; GtkWidget *box1; @@ -2009,7 +2009,7 @@ create_menu (int depth) } static void -create_menus () +create_menus (void) { static GtkWidget *window = NULL; GtkWidget *box1; @@ -2133,7 +2133,7 @@ scrolled_windows_remove (GtkWidget *widget, GtkWidget *scrollwin) * GtkScrolledWindow */ static void -create_scrolled_windows () +create_scrolled_windows (void) { static GtkWidget *window; GtkWidget *scrolled_window; @@ -2225,7 +2225,7 @@ entry_toggle_editable (GtkWidget *checkbutton, } static void -create_entry () +create_entry (void) { static GtkWidget *window = NULL; GtkWidget *box1; @@ -2364,7 +2364,7 @@ get_value (GtkWidget *widget, gint data) } static void -create_spins () +create_spins (void) { static GtkWidget *window = NULL; GtkWidget *frame; @@ -2627,7 +2627,7 @@ cursor_event (GtkWidget *widget, } static void -create_cursors () +create_cursors (void) { static GtkWidget *window = NULL; GtkWidget *frame; @@ -2779,7 +2779,7 @@ list_clear (GtkWidget *widget, } static void -create_list () +create_list (void) { static GtkWidget *window = NULL; static char *list_items[] = @@ -3166,7 +3166,7 @@ clist_warning_test (GtkWidget *button, } static void -create_clist () +create_clist (void) { gint i; static GtkWidget *window = NULL; @@ -3840,7 +3840,7 @@ void rebuild_tree (GtkWidget *widget, GtkCTree *ctree) after_press (ctree, NULL); } -void create_ctree () +void create_ctree (void) { static GtkWidget *window = NULL; GtkTooltips *tooltips; @@ -4229,7 +4229,7 @@ color_selection_changed (GtkWidget *w, } void -create_color_selection () +create_color_selection (void) { static GtkWidget *window = NULL; @@ -4299,7 +4299,7 @@ file_selection_ok (GtkWidget *w, } void -create_file_selection () +create_file_selection (void) { static GtkWidget *window = NULL; GtkWidget *button; @@ -4376,7 +4376,7 @@ label_toggle (GtkWidget *widget, } void -create_dialog () +create_dialog (void) { static GtkWidget *label; GtkWidget *button; @@ -4422,7 +4422,7 @@ create_dialog () * GtkRange */ void -create_range_controls () +create_range_controls (void) { static GtkWidget *window = NULL; GtkWidget *box1; @@ -4505,7 +4505,7 @@ create_range_controls () * GtkRulers */ void -create_rulers () +create_rulers (void) { static GtkWidget *window = NULL; GtkWidget *table; @@ -4586,7 +4586,7 @@ text_toggle_word_wrap (GtkWidget *checkbutton, * GtkText */ void -create_text () +create_text (void) { static GtkWidget *window = NULL; GtkWidget *box1; @@ -4923,7 +4923,7 @@ notebook_popup (GtkToggleButton *button, } static void -create_notebook () +create_notebook (void) { static GtkWidget *window = NULL; GtkWidget *box1; @@ -5061,7 +5061,7 @@ create_notebook () * GtkPanes */ void -create_panes () +create_panes (void) { static GtkWidget *window = NULL; GtkWidget *frame; @@ -5197,7 +5197,7 @@ dnd_drag_request (GtkWidget *button, GdkEvent *event) } void -create_dnd () +create_dnd (void) { static GtkWidget *window = NULL; GtkWidget *box1; @@ -5468,7 +5468,7 @@ shape_create_icon (char *xpm_file, } void -create_shapes () +create_shapes (void) { /* Variables used by the Drag/Drop and Shape Window demos */ static GtkWidget *modeller = NULL; @@ -5516,7 +5516,7 @@ create_shapes () } void -create_wmhints () +create_wmhints (void) { static GtkWidget *window = NULL; GtkWidget *label; @@ -5621,7 +5621,7 @@ destroy_progress (GtkWidget *widget, } void -create_progress_bar () +create_progress_bar (void) { static GtkWidget *window = NULL; GtkWidget *button; @@ -5725,7 +5725,7 @@ color_preview_destroy (GtkWidget *widget, } void -create_color_preview () +create_color_preview (void) { static GtkWidget *window = NULL; GtkWidget *preview; @@ -5815,7 +5815,7 @@ gray_preview_destroy (GtkWidget *widget, } void -create_gray_preview () +create_gray_preview (void) { static GtkWidget *window = NULL; GtkWidget *preview; @@ -5928,7 +5928,7 @@ selection_test_get_targets (GtkWidget *widget, GtkWidget *list) } void -create_selection_test () +create_selection_test (void) { static GtkWidget *window = NULL; GtkWidget *button; @@ -6005,7 +6005,7 @@ create_selection_test () * Gamma Curve */ void -create_gamma_curve () +create_gamma_curve (void) { static GtkWidget *window = NULL, *curve; static int count = 0; @@ -6166,7 +6166,7 @@ scroll_test_adjustment_changed (GtkAdjustment *adj, GtkWidget *widget) void -create_scroll_test () +create_scroll_test (void) { static GtkWidget *window = NULL; GtkWidget *hbox; @@ -6281,7 +6281,7 @@ destroy_timeout_test (GtkWidget *widget, } void -create_timeout_test () +create_timeout_test (void) { static GtkWidget *window = NULL; GtkWidget *button; @@ -6388,7 +6388,7 @@ destroy_idle_test (GtkWidget *widget, } void -create_idle_test () +create_idle_test (void) { static GtkWidget *window = NULL; GtkWidget *button; @@ -6451,25 +6451,25 @@ reload_rc_file (void) { GList *toplevels; - gtk_rc_reparse_all (); - - toplevels = gdk_window_get_toplevels(); - while (toplevels) + if (gtk_rc_reparse_all ()) { - GtkWidget *widget; - gdk_window_get_user_data (toplevels->data, (gpointer *)&widget); - - if (widget) - gtk_widget_reset_rc_styles (widget); - - toplevels = toplevels->next; + toplevels = gdk_window_get_toplevels(); + while (toplevels) + { + GtkWidget *widget; + gdk_window_get_user_data (toplevels->data, (gpointer *)&widget); + + if (widget) + gtk_widget_reset_rc_styles (widget); + + toplevels = toplevels->next; + } + g_list_free (toplevels); } - - g_list_free (toplevels); } void -create_rc_file () +create_rc_file (void) { static GtkWidget *window = NULL; GtkWidget *button; @@ -6523,7 +6523,7 @@ mainloop_destroyed (GtkWidget *w, GtkWidget **window) } void -create_mainloop () +create_mainloop (void) { static GtkWidget *window = NULL; GtkWidget *label; @@ -6584,7 +6584,7 @@ do_exit (GtkWidget *widget, GtkWidget *window) } void -create_main_window () +create_main_window (void) { struct { char *label; diff --git a/gtk/testinput.c b/gtk/testinput.c index a414eaec4..874d76c81 100644 --- a/gtk/testinput.c +++ b/gtk/testinput.c @@ -35,7 +35,7 @@ static guint32 current_device = GDK_CORE_POINTER; /* Check to see if we need to draw a cursor for current device */ static void -check_cursor () +check_cursor (void) { GList *tmp_list; @@ -271,7 +271,7 @@ input_dialog_destroy (GtkWidget *w, gpointer data) } void -create_input_dialog () +create_input_dialog (void) { static GtkWidget *inputd = NULL; @@ -301,7 +301,7 @@ create_input_dialog () } void -quit () +quit (void) { gtk_exit (0); } diff --git a/gtk/testselection.c b/gtk/testselection.c index 8f361c562..6dd7c34b0 100644 --- a/gtk/testselection.c +++ b/gtk/testselection.c @@ -102,7 +102,7 @@ GtkWidget *selection_button; GString *selection_string = NULL; static void -init_atoms () +init_atoms (void) { int i; @@ -356,7 +356,7 @@ paste (GtkWidget *widget, GtkWidget *entry) } void -quit () +quit (void) { gtk_exit (0); } diff --git a/tests/simple.c b/tests/simple.c index 47893772f..a246ac57c 100644 --- a/tests/simple.c +++ b/tests/simple.c @@ -3,7 +3,7 @@ void -hello () +hello (void) { g_print ("hello world\n"); } diff --git a/tests/testgtk.c b/tests/testgtk.c index 2d532b955..28802eb2f 100644 --- a/tests/testgtk.c +++ b/tests/testgtk.c @@ -75,7 +75,7 @@ button_window (GtkWidget *widget, } static void -create_buttons () +create_buttons (void) { static GtkWidget *window = NULL; GtkWidget *box1; @@ -212,7 +212,7 @@ create_buttons () } static void -create_toggle_buttons () +create_toggle_buttons (void) { static GtkWidget *window = NULL; GtkWidget *box1; @@ -284,7 +284,7 @@ create_toggle_buttons () } static void -create_check_buttons () +create_check_buttons (void) { static GtkWidget *window = NULL; GtkWidget *box1; @@ -356,7 +356,7 @@ create_check_buttons () } static void -create_radio_buttons () +create_radio_buttons (void) { static GtkWidget *window = NULL; GtkWidget *box1; @@ -506,7 +506,7 @@ create_bbox_window (gint horizontal, } static void -test_hbbox () +test_hbbox (void) { create_bbox_window (TRUE, "Spread", 50, 40, 85, 28, GTK_BUTTONBOX_SPREAD); create_bbox_window (TRUE, "Edge", 200, 40, 85, 25, GTK_BUTTONBOX_EDGE); @@ -515,7 +515,7 @@ test_hbbox () } static void -test_vbbox () +test_vbbox (void) { create_bbox_window (FALSE, "Spread", 50, 40, 85, 25, GTK_BUTTONBOX_SPREAD); create_bbox_window (FALSE, "Edge", 250, 40, 85, 28, GTK_BUTTONBOX_EDGE); @@ -524,7 +524,7 @@ test_vbbox () } static void -create_button_box () +create_button_box (void) { static GtkWidget* window = NULL; GtkWidget* bbox; @@ -878,7 +878,7 @@ statusbar_dump_stack (GtkWidget *button, } static void -create_statusbar () +create_statusbar (void) { static GtkWidget *window = NULL; GtkWidget *box1; @@ -1489,7 +1489,7 @@ create_tree_mode_window(void) /* end of function used by tree demos */ static void -create_handle_box () +create_handle_box (void) { static GtkWidget* window = NULL; GtkWidget *handle_box; @@ -1616,7 +1616,7 @@ set_parent_signal (GtkWidget *child, } static void -create_reparent () +create_reparent (void) { static GtkWidget *window = NULL; GtkWidget *box1; @@ -1723,7 +1723,7 @@ create_reparent () } static void -create_pixmap () +create_pixmap (void) { static GtkWidget *window = NULL; GtkWidget *box1; @@ -1838,7 +1838,7 @@ tips_query_widget_selected (GtkWidget *tips_query, } static void -create_tooltips () +create_tooltips (void) { static GtkWidget *window = NULL; GtkWidget *box1; @@ -2009,7 +2009,7 @@ create_menu (int depth) } static void -create_menus () +create_menus (void) { static GtkWidget *window = NULL; GtkWidget *box1; @@ -2133,7 +2133,7 @@ scrolled_windows_remove (GtkWidget *widget, GtkWidget *scrollwin) * GtkScrolledWindow */ static void -create_scrolled_windows () +create_scrolled_windows (void) { static GtkWidget *window; GtkWidget *scrolled_window; @@ -2225,7 +2225,7 @@ entry_toggle_editable (GtkWidget *checkbutton, } static void -create_entry () +create_entry (void) { static GtkWidget *window = NULL; GtkWidget *box1; @@ -2364,7 +2364,7 @@ get_value (GtkWidget *widget, gint data) } static void -create_spins () +create_spins (void) { static GtkWidget *window = NULL; GtkWidget *frame; @@ -2627,7 +2627,7 @@ cursor_event (GtkWidget *widget, } static void -create_cursors () +create_cursors (void) { static GtkWidget *window = NULL; GtkWidget *frame; @@ -2779,7 +2779,7 @@ list_clear (GtkWidget *widget, } static void -create_list () +create_list (void) { static GtkWidget *window = NULL; static char *list_items[] = @@ -3166,7 +3166,7 @@ clist_warning_test (GtkWidget *button, } static void -create_clist () +create_clist (void) { gint i; static GtkWidget *window = NULL; @@ -3840,7 +3840,7 @@ void rebuild_tree (GtkWidget *widget, GtkCTree *ctree) after_press (ctree, NULL); } -void create_ctree () +void create_ctree (void) { static GtkWidget *window = NULL; GtkTooltips *tooltips; @@ -4229,7 +4229,7 @@ color_selection_changed (GtkWidget *w, } void -create_color_selection () +create_color_selection (void) { static GtkWidget *window = NULL; @@ -4299,7 +4299,7 @@ file_selection_ok (GtkWidget *w, } void -create_file_selection () +create_file_selection (void) { static GtkWidget *window = NULL; GtkWidget *button; @@ -4376,7 +4376,7 @@ label_toggle (GtkWidget *widget, } void -create_dialog () +create_dialog (void) { static GtkWidget *label; GtkWidget *button; @@ -4422,7 +4422,7 @@ create_dialog () * GtkRange */ void -create_range_controls () +create_range_controls (void) { static GtkWidget *window = NULL; GtkWidget *box1; @@ -4505,7 +4505,7 @@ create_range_controls () * GtkRulers */ void -create_rulers () +create_rulers (void) { static GtkWidget *window = NULL; GtkWidget *table; @@ -4586,7 +4586,7 @@ text_toggle_word_wrap (GtkWidget *checkbutton, * GtkText */ void -create_text () +create_text (void) { static GtkWidget *window = NULL; GtkWidget *box1; @@ -4923,7 +4923,7 @@ notebook_popup (GtkToggleButton *button, } static void -create_notebook () +create_notebook (void) { static GtkWidget *window = NULL; GtkWidget *box1; @@ -5061,7 +5061,7 @@ create_notebook () * GtkPanes */ void -create_panes () +create_panes (void) { static GtkWidget *window = NULL; GtkWidget *frame; @@ -5197,7 +5197,7 @@ dnd_drag_request (GtkWidget *button, GdkEvent *event) } void -create_dnd () +create_dnd (void) { static GtkWidget *window = NULL; GtkWidget *box1; @@ -5468,7 +5468,7 @@ shape_create_icon (char *xpm_file, } void -create_shapes () +create_shapes (void) { /* Variables used by the Drag/Drop and Shape Window demos */ static GtkWidget *modeller = NULL; @@ -5516,7 +5516,7 @@ create_shapes () } void -create_wmhints () +create_wmhints (void) { static GtkWidget *window = NULL; GtkWidget *label; @@ -5621,7 +5621,7 @@ destroy_progress (GtkWidget *widget, } void -create_progress_bar () +create_progress_bar (void) { static GtkWidget *window = NULL; GtkWidget *button; @@ -5725,7 +5725,7 @@ color_preview_destroy (GtkWidget *widget, } void -create_color_preview () +create_color_preview (void) { static GtkWidget *window = NULL; GtkWidget *preview; @@ -5815,7 +5815,7 @@ gray_preview_destroy (GtkWidget *widget, } void -create_gray_preview () +create_gray_preview (void) { static GtkWidget *window = NULL; GtkWidget *preview; @@ -5928,7 +5928,7 @@ selection_test_get_targets (GtkWidget *widget, GtkWidget *list) } void -create_selection_test () +create_selection_test (void) { static GtkWidget *window = NULL; GtkWidget *button; @@ -6005,7 +6005,7 @@ create_selection_test () * Gamma Curve */ void -create_gamma_curve () +create_gamma_curve (void) { static GtkWidget *window = NULL, *curve; static int count = 0; @@ -6166,7 +6166,7 @@ scroll_test_adjustment_changed (GtkAdjustment *adj, GtkWidget *widget) void -create_scroll_test () +create_scroll_test (void) { static GtkWidget *window = NULL; GtkWidget *hbox; @@ -6281,7 +6281,7 @@ destroy_timeout_test (GtkWidget *widget, } void -create_timeout_test () +create_timeout_test (void) { static GtkWidget *window = NULL; GtkWidget *button; @@ -6388,7 +6388,7 @@ destroy_idle_test (GtkWidget *widget, } void -create_idle_test () +create_idle_test (void) { static GtkWidget *window = NULL; GtkWidget *button; @@ -6451,25 +6451,25 @@ reload_rc_file (void) { GList *toplevels; - gtk_rc_reparse_all (); - - toplevels = gdk_window_get_toplevels(); - while (toplevels) + if (gtk_rc_reparse_all ()) { - GtkWidget *widget; - gdk_window_get_user_data (toplevels->data, (gpointer *)&widget); - - if (widget) - gtk_widget_reset_rc_styles (widget); - - toplevels = toplevels->next; + toplevels = gdk_window_get_toplevels(); + while (toplevels) + { + GtkWidget *widget; + gdk_window_get_user_data (toplevels->data, (gpointer *)&widget); + + if (widget) + gtk_widget_reset_rc_styles (widget); + + toplevels = toplevels->next; + } + g_list_free (toplevels); } - - g_list_free (toplevels); } void -create_rc_file () +create_rc_file (void) { static GtkWidget *window = NULL; GtkWidget *button; @@ -6523,7 +6523,7 @@ mainloop_destroyed (GtkWidget *w, GtkWidget **window) } void -create_mainloop () +create_mainloop (void) { static GtkWidget *window = NULL; GtkWidget *label; @@ -6584,7 +6584,7 @@ do_exit (GtkWidget *widget, GtkWidget *window) } void -create_main_window () +create_main_window (void) { struct { char *label; diff --git a/tests/testinput.c b/tests/testinput.c index a414eaec4..874d76c81 100644 --- a/tests/testinput.c +++ b/tests/testinput.c @@ -35,7 +35,7 @@ static guint32 current_device = GDK_CORE_POINTER; /* Check to see if we need to draw a cursor for current device */ static void -check_cursor () +check_cursor (void) { GList *tmp_list; @@ -271,7 +271,7 @@ input_dialog_destroy (GtkWidget *w, gpointer data) } void -create_input_dialog () +create_input_dialog (void) { static GtkWidget *inputd = NULL; @@ -301,7 +301,7 @@ create_input_dialog () } void -quit () +quit (void) { gtk_exit (0); } diff --git a/tests/testselection.c b/tests/testselection.c index 8f361c562..6dd7c34b0 100644 --- a/tests/testselection.c +++ b/tests/testselection.c @@ -102,7 +102,7 @@ GtkWidget *selection_button; GString *selection_string = NULL; static void -init_atoms () +init_atoms (void) { int i; @@ -356,7 +356,7 @@ paste (GtkWidget *widget, GtkWidget *entry) } void -quit () +quit (void) { gtk_exit (0); } |