aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan D2010-07-05 11:17:12 +0200
committerJan D2010-07-05 11:17:12 +0200
commite4c8d29a32adbde811a109d5e19caa75fd9d042b (patch)
treeffaa67180bd87eae947408a76cddecaaa1c227b0
parent898b4c5c2cb4b4ae2fa2cd1631db63a9acff787a (diff)
downloademacs-e4c8d29a32adbde811a109d5e19caa75fd9d042b.tar.gz
emacs-e4c8d29a32adbde811a109d5e19caa75fd9d042b.zip
Fix some bad prototypes and formatting after conversion from K&R declaration.
* lwlib/lwlib-Xaw.c: Include <ctype.h> for isdigit. (fill_xft_data, set_text): Remove unused variable screen. (draw_text): Cast bp to FcChar8*. (find_xft_data): Return 0 if inst or xft_data is not set. (wm_delete_window): Correct prototype. Initialize widget to 0 and return if widget is still 0 after loop. * lwlib/xlwmenu.c (XlwMenuSetValues, XlwMenuInitialize): Correct prototype. (display_menu_item): Remove unused variable gi. (make_windows_if_needed): Remove unused variable screen. (XlwMenuRedisplay): Remove unused variable i. * src/gtkutil.c (xg_get_pixbuf_from_pix_and_mask) (xg_get_image_for_pixmap, create_dialog) (xg_get_file_with_selection, xg_get_file_name, update_cl_data) (menuitem_highlight_callback, make_menu_item) (xg_create_one_menuitem, create_menus, xg_update_menu_item) (xg_create_scroll_bar, xg_update_scrollbar_pos) (xg_set_toolkit_scroll_bar_thumb, xg_tool_bar_button_cb) (xg_tool_bar_proxy_help_callback, xg_tool_bar_detach_callback) (xg_tool_bar_attach_callback, xg_tool_bar_help_callback) (xg_tool_bar_item_expose_callback): Reformat prototype. (xg_update_menubar): GList *group => GSList *group. (xg_modify_menubar_widgets): Initialize witem to 0, check witem != 0 before use. (update_frame_tool_bar): 4:th param to xg_get_image_for_pixmap changed to GTK_IMAGE (wimage). * src/xsettings.c (something_changedCB, parse_settings) (apply_xft_settings): Reformat prototype. (something_changedCB, init_gconf): Remove unused variable i. (read_settings): Remove unused variable long_len. * src/xsmfns.c (SSDATA): New macro. (smc_save_yourself_CB, x_session_initialize): Use SSDATA for strings passed to strlen/strcpy/strcat. (create_client_leader_window): Surround with #ifndef USE_GTK. Cast 7:th arg to XChangeProperty to (unsigned char *)
-rw-r--r--lwlib/ChangeLog14
-rw-r--r--lwlib/lwlib-Xaw.c23
-rw-r--r--lwlib/xlwmenu.c17
-rw-r--r--src/ChangeLog29
-rw-r--r--src/gtkutil.c136
-rw-r--r--src/xsettings.c16
-rw-r--r--src/xsmfns.c22
7 files changed, 180 insertions, 77 deletions
diff --git a/lwlib/ChangeLog b/lwlib/ChangeLog
index e49eb99091c..2d0c6d8578c 100644
--- a/lwlib/ChangeLog
+++ b/lwlib/ChangeLog
@@ -1,3 +1,17 @@
12010-07-05 Jan Djärv <jan.h.d@swipnet.se>
2
3 * xlwmenu.c (XlwMenuSetValues, XlwMenuInitialize): Correct prototype.
4 (display_menu_item): Remove unused variable gi.
5 (make_windows_if_needed): Remove unused variable screen.
6 (XlwMenuRedisplay): Remove unused variable i.
7
8 * lwlib-Xaw.c: Include <ctype.h> for isdigit.
9 (fill_xft_data, set_text): Remove unused variable screen.
10 (draw_text): Cast bp to FcChar8*.
11 (find_xft_data): Return 0 if inst or xft_data is not set.
12 (wm_delete_window): Correct prototype. Initialize widget to 0
13 and return if widget is still 0 after loop.
14
12010-07-04 Dan Nicolaescu <dann@ics.uci.edu> 152010-07-04 Dan Nicolaescu <dann@ics.uci.edu>
2 16
3 * lwlib-Xaw.c: Convert function definitions to standard C. 17 * lwlib-Xaw.c: Convert function definitions to standard C.
diff --git a/lwlib/lwlib-Xaw.c b/lwlib/lwlib-Xaw.c
index 3ac72acdace..632ba7153ae 100644
--- a/lwlib/lwlib-Xaw.c
+++ b/lwlib/lwlib-Xaw.c
@@ -26,6 +26,7 @@ Boston, MA 02110-1301, USA. */
26 26
27#include <stdio.h> 27#include <stdio.h>
28#include <setjmp.h> 28#include <setjmp.h>
29#include <ctype.h>
29 30
30#include "../src/lisp.h" 31#include "../src/lisp.h"
31 32
@@ -151,7 +152,6 @@ fill_xft_data (struct widget_xft_data *data, Widget widget, XftFont *font)
151{ 152{
152 Pixel bg, fg; 153 Pixel bg, fg;
153 XColor colors[2]; 154 XColor colors[2];
154 int screen = XScreenNumberOfScreen (XtScreen (widget));
155 155
156 data->widget = widget; 156 data->widget = widget;
157 data->xft_font = font; 157 data->xft_font = font;
@@ -252,7 +252,9 @@ draw_text (struct widget_xft_data *data, char *lbl, int inverse)
252 char *cp = strchr (bp, '\n'); 252 char *cp = strchr (bp, '\n');
253 XftDrawStringUtf8 (data->xft_draw, 253 XftDrawStringUtf8 (data->xft_draw,
254 inverse ? &data->xft_bg : &data->xft_fg, 254 inverse ? &data->xft_bg : &data->xft_fg,
255 data->xft_font, x, y, bp, cp ? cp - bp : strlen (bp)); 255 data->xft_font, x, y,
256 (FcChar8 *) bp,
257 cp ? cp - bp : strlen (bp));
256 bp = cp ? cp + 1 : NULL; 258 bp = cp ? cp + 1 : NULL;
257 /* 1.2 gives reasonable line spacing. */ 259 /* 1.2 gives reasonable line spacing. */
258 y += data->xft_font->height * 1.2; 260 y += data->xft_font->height * 1.2;
@@ -264,7 +266,6 @@ draw_text (struct widget_xft_data *data, char *lbl, int inverse)
264static void 266static void
265set_text (struct widget_xft_data *data, Widget toplevel, char *lbl, int margin) 267set_text (struct widget_xft_data *data, Widget toplevel, char *lbl, int margin)
266{ 268{
267 int screen = XScreenNumberOfScreen (XtScreen (data->widget));
268 int width, height; 269 int width, height;
269 270
270 width = get_text_width_and_height (data->widget, lbl, data->xft_font, 271 width = get_text_width_and_height (data->widget, lbl, data->xft_font,
@@ -293,7 +294,7 @@ find_xft_data (Widget widget)
293 inst = lw_get_widget_instance (parent); 294 inst = lw_get_widget_instance (parent);
294 parent = XtParent (parent); 295 parent = XtParent (parent);
295 } 296 }
296 if (!inst || !inst->xft_data || !inst->xft_data[0].xft_font) return; 297 if (!inst || !inst->xft_data || !inst->xft_data[0].xft_font) return 0;
297 298
298 for (nr = 0; data == NULL && nr < inst->nr_xft_data; ++nr) 299 for (nr = 0; data == NULL && nr < inst->nr_xft_data; ++nr)
299 { 300 {
@@ -550,7 +551,10 @@ static char overrideTrans[] =
550/* Dialogs pop down on any key press */ 551/* Dialogs pop down on any key press */
551static char dialogOverride[] = 552static char dialogOverride[] =
552 "<KeyPress>Escape: lwlib_delete_dialog()"; 553 "<KeyPress>Escape: lwlib_delete_dialog()";
553static void wm_delete_window(Widget w, XtPointer closure, XtPointer call_data); 554static void wm_delete_window (Widget w,
555 XEvent *event,
556 String *params,
557 Cardinal *num_params);
554static XtActionsRec xaw_actions [] = { 558static XtActionsRec xaw_actions [] = {
555 {"lwlib_delete_dialog", wm_delete_window} 559 {"lwlib_delete_dialog", wm_delete_window}
556}; 560};
@@ -851,13 +855,16 @@ xaw_generic_callback (Widget widget, XtPointer closure, XtPointer call_data)
851} 855}
852 856
853static void 857static void
854wm_delete_window (Widget w, XtPointer closure, XtPointer call_data) 858wm_delete_window (Widget w,
859 XEvent *event,
860 String *params,
861 Cardinal *num_params)
855{ 862{
856 LWLIB_ID id; 863 LWLIB_ID id;
857 Cardinal nkids; 864 Cardinal nkids;
858 int i; 865 int i;
859 Widget *kids = 0; 866 Widget *kids = 0;
860 Widget widget, shell; 867 Widget widget = 0, shell;
861 868
862 if (XtIsSubclass (w, dialogWidgetClass)) 869 if (XtIsSubclass (w, dialogWidgetClass))
863 shell = XtParent (w); 870 shell = XtParent (w);
@@ -876,6 +883,8 @@ wm_delete_window (Widget w, XtPointer closure, XtPointer call_data)
876 if (XtIsSubclass (widget, dialogWidgetClass)) 883 if (XtIsSubclass (widget, dialogWidgetClass))
877 break; 884 break;
878 } 885 }
886 if (! widget) return;
887
879 id = lw_get_widget_id (widget); 888 id = lw_get_widget_id (widget);
880 if (! id) abort (); 889 if (! id) abort ();
881 890
diff --git a/lwlib/xlwmenu.c b/lwlib/xlwmenu.c
index 79d0eb1f9c1..242719a4a13 100644
--- a/lwlib/xlwmenu.c
+++ b/lwlib/xlwmenu.c
@@ -185,10 +185,11 @@ xlwMenuResources[] =
185}; 185};
186#undef offset 186#undef offset
187 187
188static Boolean XlwMenuSetValues(Widget current, Widget request, Widget new); 188static Boolean XlwMenuSetValues(Widget current, Widget request, Widget new,
189 ArgList args, Cardinal *num_args);
189static void XlwMenuRealize(Widget w, Mask *valueMask, XSetWindowAttributes *attributes); 190static void XlwMenuRealize(Widget w, Mask *valueMask, XSetWindowAttributes *attributes);
190static void XlwMenuResize(Widget w); 191static void XlwMenuResize(Widget w);
191static void XlwMenuInitialize(Widget request, XlwMenuWidget mw, ArgList args, Cardinal *num_args); 192static void XlwMenuInitialize(Widget request, Widget mw, ArgList args, Cardinal *num_args);
192static void XlwMenuRedisplay(Widget w, XEvent *ev, Region region); 193static void XlwMenuRedisplay(Widget w, XEvent *ev, Region region);
193static void XlwMenuDestroy(Widget w); 194static void XlwMenuDestroy(Widget w);
194static void XlwMenuClassInitialize(void); 195static void XlwMenuClassInitialize(void);
@@ -1086,7 +1087,6 @@ display_menu_item (mw, val, ws, where, highlighted_p, horizontal_p,
1086#ifdef HAVE_XFT 1087#ifdef HAVE_XFT
1087 if (ws->xft_draw) 1088 if (ws->xft_draw)
1088 { 1089 {
1089 XGlyphInfo gi;
1090 int draw_x = ws->width - ws->max_rest_width 1090 int draw_x = ws->width - ws->max_rest_width
1091 + mw->menu.arrow_spacing; 1091 + mw->menu.arrow_spacing;
1092 int draw_y = y + v_spacing + shadow + font_ascent; 1092 int draw_y = y + v_spacing + shadow + font_ascent;
@@ -1277,9 +1277,6 @@ make_windows_if_needed (XlwMenuWidget mw, int n)
1277 int i; 1277 int i;
1278 int start_at; 1278 int start_at;
1279 window_state* windows; 1279 window_state* windows;
1280#ifdef HAVE_XFT
1281 int screen = XScreenNumberOfScreen (mw->core.screen);
1282#endif
1283 1280
1284 if (mw->menu.windows_length >= n) 1281 if (mw->menu.windows_length >= n)
1285 return; 1282 return;
@@ -1852,10 +1849,10 @@ openXftFont (XlwMenuWidget mw)
1852#endif 1849#endif
1853 1850
1854static void 1851static void
1855XlwMenuInitialize (Widget request, XlwMenuWidget mw, ArgList args, Cardinal *num_args) 1852XlwMenuInitialize (Widget request, Widget w, ArgList args, Cardinal *num_args)
1856{ 1853{
1857 /* Get the GCs and the widget size */ 1854 /* Get the GCs and the widget size */
1858 1855 XlwMenuWidget mw = (XlwMenuWidget) w;
1859 Window window = RootWindowOfScreen (DefaultScreenOfDisplay (XtDisplay (mw))); 1856 Window window = RootWindowOfScreen (DefaultScreenOfDisplay (XtDisplay (mw)));
1860 Display* display = XtDisplay (mw); 1857 Display* display = XtDisplay (mw);
1861 1858
@@ -2003,7 +2000,6 @@ static void
2003XlwMenuRedisplay (Widget w, XEvent *ev, Region region) 2000XlwMenuRedisplay (Widget w, XEvent *ev, Region region)
2004{ 2001{
2005 XlwMenuWidget mw = (XlwMenuWidget)w; 2002 XlwMenuWidget mw = (XlwMenuWidget)w;
2006 int i;
2007 2003
2008 /* If we have a depth beyond 1, it's because a submenu was displayed. 2004 /* If we have a depth beyond 1, it's because a submenu was displayed.
2009 If the submenu has been destroyed, set the depth back to 1. */ 2005 If the submenu has been destroyed, set the depth back to 1. */
@@ -2106,7 +2102,8 @@ facename_changed (XlwMenuWidget newmw,
2106#endif 2102#endif
2107 2103
2108static Boolean 2104static Boolean
2109XlwMenuSetValues (Widget current, Widget request, Widget new) 2105XlwMenuSetValues (Widget current, Widget request, Widget new,
2106 ArgList args, Cardinal *num_args)
2110{ 2107{
2111 XlwMenuWidget oldmw = (XlwMenuWidget)current; 2108 XlwMenuWidget oldmw = (XlwMenuWidget)current;
2112 XlwMenuWidget newmw = (XlwMenuWidget)new; 2109 XlwMenuWidget newmw = (XlwMenuWidget)new;
diff --git a/src/ChangeLog b/src/ChangeLog
index 3bccc7179d5..0b23f0c4426 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,32 @@
12010-07-05 Jan Djärv <jan.h.d@swipnet.se>
2
3 * xsmfns.c (SSDATA): New macro.
4 (smc_save_yourself_CB, x_session_initialize): Use SSDATA for strings
5 passed to strlen/strcpy/strcat.
6 (create_client_leader_window): Surround with #ifndef USE_GTK. Cast
7 7:th arg to XChangeProperty to (unsigned char *)
8
9 * xsettings.c (something_changedCB, parse_settings)
10 (apply_xft_settings): Reformat prototype.
11 (something_changedCB, init_gconf): Remove unused variable i.
12 (read_settings): Remove unused variable long_len.
13
14 * gtkutil.c (xg_get_pixbuf_from_pix_and_mask)
15 (xg_get_image_for_pixmap, create_dialog)
16 (xg_get_file_with_selection, xg_get_file_name, update_cl_data)
17 (menuitem_highlight_callback, make_menu_item)
18 (xg_create_one_menuitem, create_menus, xg_update_menu_item)
19 (xg_create_scroll_bar, xg_update_scrollbar_pos)
20 (xg_set_toolkit_scroll_bar_thumb, xg_tool_bar_button_cb)
21 (xg_tool_bar_proxy_help_callback, xg_tool_bar_detach_callback)
22 (xg_tool_bar_attach_callback, xg_tool_bar_help_callback)
23 (xg_tool_bar_item_expose_callback): Reformat prototype.
24 (xg_update_menubar): GList *group => GSList *group.
25 (xg_modify_menubar_widgets): Initialize witem to 0, check witem != 0
26 before use.
27 (update_frame_tool_bar): 4:th param to xg_get_image_for_pixmap changed
28 to GTK_IMAGE (wimage).
29
12010-07-05 Dan Nicolaescu <dann@ics.uci.edu> 302010-07-05 Dan Nicolaescu <dann@ics.uci.edu>
2 31
3 * atimer.c: Use "" instead of <> for local includes for 32 * atimer.c: Use "" instead of <> for local includes for
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 86bf03eed41..447d5642b79 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -231,7 +231,9 @@ xg_create_default_cursor (Display *dpy)
231/* Apply GMASK to GPIX and return a GdkPixbuf with an alpha channel. */ 231/* Apply GMASK to GPIX and return a GdkPixbuf with an alpha channel. */
232 232
233static GdkPixbuf * 233static GdkPixbuf *
234xg_get_pixbuf_from_pix_and_mask (GdkPixmap *gpix, GdkPixmap *gmask, GdkColormap *cmap) 234xg_get_pixbuf_from_pix_and_mask (GdkPixmap *gpix,
235 GdkPixmap *gmask,
236 GdkColormap *cmap)
235{ 237{
236 int width, height; 238 int width, height;
237 GdkPixbuf *icon_buf, *tmp_buf; 239 GdkPixbuf *icon_buf, *tmp_buf;
@@ -309,7 +311,10 @@ file_for_image (Lisp_Object image)
309 If OLD_WIDGET is not NULL, that widget is modified. */ 311 If OLD_WIDGET is not NULL, that widget is modified. */
310 312
311static GtkWidget * 313static GtkWidget *
312xg_get_image_for_pixmap (FRAME_PTR f, struct image *img, GtkWidget *widget, GtkImage *old_widget) 314xg_get_image_for_pixmap (FRAME_PTR f,
315 struct image *img,
316 GtkWidget *widget,
317 GtkImage *old_widget)
313{ 318{
314 GdkPixmap *gpix; 319 GdkPixmap *gpix;
315 GdkPixmap *gmask; 320 GdkPixmap *gmask;
@@ -1039,7 +1044,9 @@ dialog_delete_callback (GtkWidget *w, GdkEvent *event, gpointer user_data)
1039 Returns the GTK dialog widget. */ 1044 Returns the GTK dialog widget. */
1040 1045
1041static GtkWidget * 1046static GtkWidget *
1042create_dialog (widget_value *wv, GCallback select_cb, GCallback deactivate_cb) 1047create_dialog (widget_value *wv,
1048 GCallback select_cb,
1049 GCallback deactivate_cb)
1043{ 1050{
1044 char *title = get_dialog_title (wv->name[0]); 1051 char *title = get_dialog_title (wv->name[0]);
1045 int total_buttons = wv->name[1] - '0'; 1052 int total_buttons = wv->name[1] - '0';
@@ -1459,12 +1466,11 @@ xg_get_file_name_from_selector (GtkWidget *w)
1459 Returns the created widget. */ 1466 Returns the created widget. */
1460 1467
1461static GtkWidget * 1468static GtkWidget *
1462xg_get_file_with_selection ( 1469xg_get_file_with_selection (FRAME_PTR f,
1463 FRAME_PTR f, 1470 char *prompt,
1464 char *prompt, 1471 char *default_filename,
1465 char *default_filename, 1472 int mustmatch_p, int only_dir_p,
1466 int mustmatch_p, int only_dir_p, 1473 xg_get_file_func *func)
1467 xg_get_file_func *func)
1468{ 1474{
1469 GtkWidget *filewin; 1475 GtkWidget *filewin;
1470 GtkFileSelection *filesel; 1476 GtkFileSelection *filesel;
@@ -1502,7 +1508,11 @@ xg_get_file_with_selection (
1502 The returned string must be freed by the caller. */ 1508 The returned string must be freed by the caller. */
1503 1509
1504char * 1510char *
1505xg_get_file_name (FRAME_PTR f, char *prompt, char *default_filename, int mustmatch_p, int only_dir_p) 1511xg_get_file_name (FRAME_PTR f,
1512 char *prompt,
1513 char *default_filename,
1514 int mustmatch_p,
1515 int only_dir_p)
1506{ 1516{
1507 GtkWidget *w = 0; 1517 GtkWidget *w = 0;
1508 char *fn = 0; 1518 char *fn = 0;
@@ -1652,7 +1662,9 @@ make_cl_data (xg_menu_cb_data *cl_data, FRAME_PTR f, GCallback highlight_cb)
1652 creating the menu bar. */ 1662 creating the menu bar. */
1653 1663
1654static void 1664static void
1655update_cl_data (xg_menu_cb_data *cl_data, FRAME_PTR f, GCallback highlight_cb) 1665update_cl_data (xg_menu_cb_data *cl_data,
1666 FRAME_PTR f,
1667 GCallback highlight_cb)
1656{ 1668{
1657 if (cl_data) 1669 if (cl_data)
1658 { 1670 {
@@ -1723,7 +1735,9 @@ menuitem_destroy_callback (GtkWidget *w, gpointer client_data)
1723 Returns FALSE to tell GTK to keep processing this event. */ 1735 Returns FALSE to tell GTK to keep processing this event. */
1724 1736
1725static gboolean 1737static gboolean
1726menuitem_highlight_callback (GtkWidget *w, GdkEventCrossing *event, gpointer client_data) 1738menuitem_highlight_callback (GtkWidget *w,
1739 GdkEventCrossing *event,
1740 gpointer client_data)
1727{ 1741{
1728 GdkEvent ev; 1742 GdkEvent ev;
1729 GtkWidget *subwidget; 1743 GtkWidget *subwidget;
@@ -1800,7 +1814,10 @@ make_widget_for_menu_item (char *utf8_label, char *utf8_key)
1800 but the MacOS X version doesn't either, so I guess that is OK. */ 1814 but the MacOS X version doesn't either, so I guess that is OK. */
1801 1815
1802static GtkWidget * 1816static GtkWidget *
1803make_menu_item (char *utf8_label, char *utf8_key, widget_value *item, GSList **group) 1817make_menu_item (char *utf8_label,
1818 char *utf8_key,
1819 widget_value *item,
1820 GSList **group)
1804{ 1821{
1805 GtkWidget *w; 1822 GtkWidget *w;
1806 GtkWidget *wtoadd = 0; 1823 GtkWidget *wtoadd = 0;
@@ -1945,7 +1962,12 @@ tearoff_activate (GtkWidget *widget, gpointer client_data)
1945 Returns the created GtkWidget. */ 1962 Returns the created GtkWidget. */
1946 1963
1947static GtkWidget * 1964static GtkWidget *
1948xg_create_one_menuitem (widget_value *item, FRAME_PTR f, GCallback select_cb, GCallback highlight_cb, xg_menu_cb_data *cl_data, GSList **group) 1965xg_create_one_menuitem (widget_value *item,
1966 FRAME_PTR f,
1967 GCallback select_cb,
1968 GCallback highlight_cb,
1969 xg_menu_cb_data *cl_data,
1970 GSList **group)
1949{ 1971{
1950 char *utf8_label; 1972 char *utf8_label;
1951 char *utf8_key; 1973 char *utf8_key;
@@ -1988,10 +2010,6 @@ xg_create_one_menuitem (widget_value *item, FRAME_PTR f, GCallback select_cb, GC
1988 return w; 2010 return w;
1989} 2011}
1990 2012
1991static GtkWidget *create_menus (widget_value *, FRAME_PTR, GCallback,
1992 GCallback, GCallback, int, int, int,
1993 GtkWidget *, xg_menu_cb_data *, char *);
1994
1995/* Create a full menu tree specified by DATA. 2013/* Create a full menu tree specified by DATA.
1996 F is the frame the created menu belongs to. 2014 F is the frame the created menu belongs to.
1997 SELECT_CB is the callback to use when a menu item is selected. 2015 SELECT_CB is the callback to use when a menu item is selected.
@@ -2015,19 +2033,17 @@ static GtkWidget *create_menus (widget_value *, FRAME_PTR, GCallback,
2015 This function calls itself to create submenus. */ 2033 This function calls itself to create submenus. */
2016 2034
2017static GtkWidget * 2035static GtkWidget *
2018create_menus (data, f, select_cb, deactivate_cb, highlight_cb, 2036create_menus (widget_value *data,
2019 pop_up_p, menu_bar_p, add_tearoff_p, topmenu, cl_data, name) 2037 FRAME_PTR f,
2020 widget_value *data; 2038 GCallback select_cb,
2021 FRAME_PTR f; 2039 GCallback deactivate_cb,
2022 GCallback select_cb; 2040 GCallback highlight_cb,
2023 GCallback deactivate_cb; 2041 int pop_up_p,
2024 GCallback highlight_cb; 2042 int menu_bar_p,
2025 int pop_up_p; 2043 int add_tearoff_p,
2026 int menu_bar_p; 2044 GtkWidget *topmenu,
2027 int add_tearoff_p; 2045 xg_menu_cb_data *cl_data,
2028 GtkWidget *topmenu; 2046 char *name)
2029 xg_menu_cb_data *cl_data;
2030 char *name;
2031{ 2047{
2032 widget_value *item; 2048 widget_value *item;
2033 GtkWidget *wmenu = topmenu; 2049 GtkWidget *wmenu = topmenu;
@@ -2397,7 +2413,7 @@ xg_update_menubar (GtkWidget *menubar,
2397 Insert X. */ 2413 Insert X. */
2398 2414
2399 int nr = pos; 2415 int nr = pos;
2400 GList *group = 0; 2416 GSList *group = 0;
2401 GtkWidget *w = xg_create_one_menuitem (val, 2417 GtkWidget *w = xg_create_one_menuitem (val,
2402 f, 2418 f,
2403 select_cb, 2419 select_cb,
@@ -2456,7 +2472,11 @@ xg_update_menubar (GtkWidget *menubar,
2456 CL_DATA is the data to set in the widget for menu invocation. */ 2472 CL_DATA is the data to set in the widget for menu invocation. */
2457 2473
2458static void 2474static void
2459xg_update_menu_item (widget_value *val, GtkWidget *w, GCallback select_cb, GCallback highlight_cb, xg_menu_cb_data *cl_data) 2475xg_update_menu_item (widget_value *val,
2476 GtkWidget *w,
2477 GCallback select_cb,
2478 GCallback highlight_cb,
2479 xg_menu_cb_data *cl_data)
2460{ 2480{
2461 GtkWidget *wchild; 2481 GtkWidget *wchild;
2462 GtkLabel *wlbl = 0; 2482 GtkLabel *wlbl = 0;
@@ -2760,7 +2780,7 @@ xg_modify_menubar_widgets (menubar, f, val, deep_p,
2760 GList *iter; 2780 GList *iter;
2761 GtkWidget *sub = 0; 2781 GtkWidget *sub = 0;
2762 GtkWidget *newsub; 2782 GtkWidget *newsub;
2763 GtkMenuItem *witem; 2783 GtkMenuItem *witem = 0;
2764 2784
2765 /* Find sub menu that corresponds to val and update it. */ 2785 /* Find sub menu that corresponds to val and update it. */
2766 for (iter = list ; iter; iter = g_list_next (iter)) 2786 for (iter = list ; iter; iter = g_list_next (iter))
@@ -2783,7 +2803,7 @@ xg_modify_menubar_widgets (menubar, f, val, deep_p,
2783 /* sub may still be NULL. If we just updated non deep and added 2803 /* sub may still be NULL. If we just updated non deep and added
2784 a new menu bar item, it has no sub menu yet. So we set the 2804 a new menu bar item, it has no sub menu yet. So we set the
2785 newly created sub menu under witem. */ 2805 newly created sub menu under witem. */
2786 if (newsub != sub) 2806 if (newsub != sub && witem != 0)
2787 { 2807 {
2788 xg_set_screen (newsub, f); 2808 xg_set_screen (newsub, f);
2789 gtk_menu_item_set_submenu (witem, newsub); 2809 gtk_menu_item_set_submenu (witem, newsub);
@@ -2976,7 +2996,11 @@ xg_gtk_scroll_destroy (GtkWidget *widget, gpointer data)
2976 to set resources for the widget. */ 2996 to set resources for the widget. */
2977 2997
2978void 2998void
2979xg_create_scroll_bar (FRAME_PTR f, struct scroll_bar *bar, GCallback scroll_callback, GCallback end_callback, char *scroll_bar_name) 2999xg_create_scroll_bar (FRAME_PTR f,
3000 struct scroll_bar *bar,
3001 GCallback scroll_callback,
3002 GCallback end_callback,
3003 char *scroll_bar_name)
2980{ 3004{
2981 GtkWidget *wscroll; 3005 GtkWidget *wscroll;
2982 GtkWidget *webox; 3006 GtkWidget *webox;
@@ -3047,7 +3071,12 @@ xg_remove_scroll_bar (FRAME_PTR f, int scrollbar_id)
3047 WIDTH, HEIGHT is the size in pixels the bar shall have. */ 3071 WIDTH, HEIGHT is the size in pixels the bar shall have. */
3048 3072
3049void 3073void
3050xg_update_scrollbar_pos (FRAME_PTR f, int scrollbar_id, int top, int left, int width, int height) 3074xg_update_scrollbar_pos (FRAME_PTR f,
3075 int scrollbar_id,
3076 int top,
3077 int left,
3078 int width,
3079 int height)
3051{ 3080{
3052 3081
3053 GtkWidget *wscroll = xg_get_widget_from_map (scrollbar_id); 3082 GtkWidget *wscroll = xg_get_widget_from_map (scrollbar_id);
@@ -3108,7 +3137,10 @@ xg_update_scrollbar_pos (FRAME_PTR f, int scrollbar_id, int top, int left, int w
3108 displaying PORTION out of a whole WHOLE, and our position POSITION. */ 3137 displaying PORTION out of a whole WHOLE, and our position POSITION. */
3109 3138
3110void 3139void
3111xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, int portion, int position, int whole) 3140xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar,
3141 int portion,
3142 int position,
3143 int whole)
3112{ 3144{
3113 GtkWidget *wscroll = xg_get_widget_from_map (bar->x_window); 3145 GtkWidget *wscroll = xg_get_widget_from_map (bar->x_window);
3114 3146
@@ -3245,7 +3277,9 @@ xg_event_is_for_scrollbar (FRAME_PTR f, XEvent *event)
3245 tool bar. 0 is the first button. */ 3277 tool bar. 0 is the first button. */
3246 3278
3247static gboolean 3279static gboolean
3248xg_tool_bar_button_cb (GtkWidget *widget, GdkEventButton *event, gpointer user_data) 3280xg_tool_bar_button_cb (GtkWidget *widget,
3281 GdkEventButton *event,
3282 gpointer user_data)
3249{ 3283{
3250 /* Casts to avoid warnings when gpointer is 64 bits and int is 32 bits */ 3284 /* Casts to avoid warnings when gpointer is 64 bits and int is 32 bits */
3251 gpointer ptr = (gpointer) (EMACS_INT) event->state; 3285 gpointer ptr = (gpointer) (EMACS_INT) event->state;
@@ -3326,7 +3360,9 @@ xg_tool_bar_help_callback (GtkWidget *w,
3326 the detached tool bar when the detached tool bar it is not expanded. */ 3360 the detached tool bar when the detached tool bar it is not expanded. */
3327 3361
3328static gboolean 3362static gboolean
3329xg_tool_bar_proxy_help_callback (GtkWidget *w, GdkEventCrossing *event, gpointer client_data) 3363xg_tool_bar_proxy_help_callback (GtkWidget *w,
3364 GdkEventCrossing *event,
3365 gpointer client_data)
3330{ 3366{
3331 GtkWidget *wbutton = GTK_WIDGET (g_object_get_data (G_OBJECT (w), 3367 GtkWidget *wbutton = GTK_WIDGET (g_object_get_data (G_OBJECT (w),
3332 XG_TOOL_BAR_PROXY_BUTTON)); 3368 XG_TOOL_BAR_PROXY_BUTTON));
@@ -3462,7 +3498,9 @@ xg_tool_bar_menu_proxy (GtkToolItem *toolitem, gpointer user_data)
3462 CLIENT_DATA is a pointer to the frame the tool bar belongs to. */ 3498 CLIENT_DATA is a pointer to the frame the tool bar belongs to. */
3463 3499
3464static void 3500static void
3465xg_tool_bar_detach_callback (GtkHandleBox *wbox, GtkWidget *w, gpointer client_data) 3501xg_tool_bar_detach_callback (GtkHandleBox *wbox,
3502 GtkWidget *w,
3503 gpointer client_data)
3466{ 3504{
3467 FRAME_PTR f = (FRAME_PTR) client_data; 3505 FRAME_PTR f = (FRAME_PTR) client_data;
3468 extern int x_gtk_whole_detached_tool_bar; 3506 extern int x_gtk_whole_detached_tool_bar;
@@ -3490,7 +3528,9 @@ xg_tool_bar_detach_callback (GtkHandleBox *wbox, GtkWidget *w, gpointer client_d
3490 CLIENT_DATA is a pointer to the frame the tool bar belongs to. */ 3528 CLIENT_DATA is a pointer to the frame the tool bar belongs to. */
3491 3529
3492static void 3530static void
3493xg_tool_bar_attach_callback (GtkHandleBox *wbox, GtkWidget *w, gpointer client_data) 3531xg_tool_bar_attach_callback (GtkHandleBox *wbox,
3532 GtkWidget *w,
3533 gpointer client_data)
3494{ 3534{
3495 FRAME_PTR f = (FRAME_PTR) client_data; 3535 FRAME_PTR f = (FRAME_PTR) client_data;
3496 g_object_set (G_OBJECT (w), "show-arrow", TRUE, NULL); 3536 g_object_set (G_OBJECT (w), "show-arrow", TRUE, NULL);
@@ -3517,7 +3557,9 @@ xg_tool_bar_attach_callback (GtkHandleBox *wbox, GtkWidget *w, gpointer client_d
3517 Returns FALSE to tell GTK to keep processing this event. */ 3557 Returns FALSE to tell GTK to keep processing this event. */
3518 3558
3519static gboolean 3559static gboolean
3520xg_tool_bar_help_callback (GtkWidget *w, GdkEventCrossing *event, gpointer client_data) 3560xg_tool_bar_help_callback (GtkWidget *w,
3561 GdkEventCrossing *event,
3562 gpointer client_data)
3521{ 3563{
3522 /* The EMACS_INT cast avoids a warning. */ 3564 /* The EMACS_INT cast avoids a warning. */
3523 int idx = (int) (EMACS_INT) client_data; 3565 int idx = (int) (EMACS_INT) client_data;
@@ -3556,7 +3598,9 @@ xg_tool_bar_help_callback (GtkWidget *w, GdkEventCrossing *event, gpointer clien
3556 Returns FALSE to tell GTK to keep processing this event. */ 3598 Returns FALSE to tell GTK to keep processing this event. */
3557 3599
3558static gboolean 3600static gboolean
3559xg_tool_bar_item_expose_callback (GtkWidget *w, GdkEventExpose *event, gpointer client_data) 3601xg_tool_bar_item_expose_callback (GtkWidget *w,
3602 GdkEventExpose *event,
3603 gpointer client_data)
3560{ 3604{
3561 gint width, height; 3605 gint width, height;
3562 3606
@@ -3849,7 +3893,6 @@ update_frame_tool_bar (FRAME_PTR f)
3849 GtkWidget *wbutton = NULL; 3893 GtkWidget *wbutton = NULL;
3850 GtkWidget *weventbox; 3894 GtkWidget *weventbox;
3851 Lisp_Object specified_file; 3895 Lisp_Object specified_file;
3852 Lisp_Object lbl = PROP (TOOL_BAR_ITEM_LABEL);
3853 char *label = SSDATA (PROP (TOOL_BAR_ITEM_LABEL)); 3896 char *label = SSDATA (PROP (TOOL_BAR_ITEM_LABEL));
3854 3897
3855 ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (wtoolbar), i); 3898 ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (wtoolbar), i);
@@ -4020,7 +4063,8 @@ update_frame_tool_bar (FRAME_PTR f)
4020 } 4063 }
4021 else if (img && old_img != img->pixmap) 4064 else if (img && old_img != img->pixmap)
4022 { 4065 {
4023 (void) xg_get_image_for_pixmap (f, img, x->widget, wimage); 4066 (void) xg_get_image_for_pixmap (f, img, x->widget,
4067 GTK_IMAGE (wimage));
4024 g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_IMAGE_DATA, 4068 g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_IMAGE_DATA,
4025 (gpointer)img->pixmap); 4069 (gpointer)img->pixmap);
4026 4070
diff --git a/src/xsettings.c b/src/xsettings.c
index e8aba9ef2d8..a8c89f5fb3d 100644
--- a/src/xsettings.c
+++ b/src/xsettings.c
@@ -100,7 +100,10 @@ struct xsettings
100 that is SYSTEM_MONO_FONT. */ 100 that is SYSTEM_MONO_FONT. */
101 101
102static void 102static void
103something_changedCB (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data) 103something_changedCB (GConfClient *client,
104 guint cnxn_id,
105 GConfEntry *entry,
106 gpointer user_data)
104{ 107{
105 GConfValue *v = gconf_entry_get_value (entry); 108 GConfValue *v = gconf_entry_get_value (entry);
106 109
@@ -108,7 +111,6 @@ something_changedCB (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpoi
108 if (v->type == GCONF_VALUE_STRING) 111 if (v->type == GCONF_VALUE_STRING)
109 { 112 {
110 const char *value = gconf_value_get_string (v); 113 const char *value = gconf_value_get_string (v);
111 int i;
112 if (current_mono_font != NULL && strcmp (value, current_mono_font) == 0) 114 if (current_mono_font != NULL && strcmp (value, current_mono_font) == 0)
113 return; /* No change. */ 115 return; /* No change. */
114 116
@@ -222,7 +224,9 @@ get_prop_window (struct x_display_info *dpyinfo)
222*/ 224*/
223 225
224static int 226static int
225parse_settings (unsigned char *prop, long unsigned int bytes, struct xsettings *settings) 227parse_settings (unsigned char *prop,
228 long unsigned int bytes,
229 struct xsettings *settings)
226{ 230{
227 Lisp_Object byteorder = Fbyteorder (); 231 Lisp_Object byteorder = Fbyteorder ();
228 int my_bo = XFASTINT (byteorder) == 'B' ? MSBFirst : LSBFirst; 232 int my_bo = XFASTINT (byteorder) == 'B' ? MSBFirst : LSBFirst;
@@ -394,7 +398,6 @@ parse_settings (unsigned char *prop, long unsigned int bytes, struct xsettings *
394static int 398static int
395read_settings (struct x_display_info *dpyinfo, struct xsettings *settings) 399read_settings (struct x_display_info *dpyinfo, struct xsettings *settings)
396{ 400{
397 long long_len;
398 Atom act_type; 401 Atom act_type;
399 int act_form; 402 int act_form;
400 unsigned long nitems, bytes_after; 403 unsigned long nitems, bytes_after;
@@ -423,7 +426,9 @@ read_settings (struct x_display_info *dpyinfo, struct xsettings *settings)
423 426
424 427
425static void 428static void
426apply_xft_settings (struct x_display_info *dpyinfo, int send_event_p, struct xsettings *settings) 429apply_xft_settings (struct x_display_info *dpyinfo,
430 int send_event_p,
431 struct xsettings *settings)
427{ 432{
428#ifdef HAVE_XFT 433#ifdef HAVE_XFT
429 FcPattern *pat; 434 FcPattern *pat;
@@ -620,7 +625,6 @@ static void
620init_gconf (void) 625init_gconf (void)
621{ 626{
622#if defined (HAVE_GCONF) && defined (HAVE_XFT) 627#if defined (HAVE_GCONF) && defined (HAVE_XFT)
623 int i;
624 char *s; 628 char *s;
625 629
626 g_type_init (); 630 g_type_init ();
diff --git a/src/xsmfns.c b/src/xsmfns.c
index dbf52af92d5..2ebd4a45c41 100644
--- a/src/xsmfns.c
+++ b/src/xsmfns.c
@@ -42,6 +42,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
42#include "termopts.h" 42#include "termopts.h"
43#include "xterm.h" 43#include "xterm.h"
44 44
45/* Avoid "differ in sign" warnings */
46#define SSDATA(x) ((char *) SDATA (x))
47
45/* The user login name. */ 48/* The user login name. */
46 49
47extern Lisp_Object Vuser_login_name; 50extern Lisp_Object Vuser_login_name;
@@ -219,7 +222,7 @@ smc_save_yourself_CB (SmcConn smcConn,
219 props[props_idx]->type = SmARRAY8; 222 props[props_idx]->type = SmARRAY8;
220 props[props_idx]->num_vals = 1; 223 props[props_idx]->num_vals = 1;
221 props[props_idx]->vals = &values[val_idx++]; 224 props[props_idx]->vals = &values[val_idx++];
222 props[props_idx]->vals[0].length = strlen (SDATA (Vinvocation_name)); 225 props[props_idx]->vals[0].length = strlen (SSDATA (Vinvocation_name));
223 props[props_idx]->vals[0].value = SDATA (Vinvocation_name); 226 props[props_idx]->vals[0].value = SDATA (Vinvocation_name);
224 ++props_idx; 227 ++props_idx;
225 228
@@ -263,7 +266,7 @@ smc_save_yourself_CB (SmcConn smcConn,
263 props[props_idx]->type = SmARRAY8; 266 props[props_idx]->type = SmARRAY8;
264 props[props_idx]->num_vals = 1; 267 props[props_idx]->num_vals = 1;
265 props[props_idx]->vals = &values[val_idx++]; 268 props[props_idx]->vals = &values[val_idx++];
266 props[props_idx]->vals[0].length = strlen (SDATA (Vuser_login_name)); 269 props[props_idx]->vals[0].length = strlen (SSDATA (Vuser_login_name));
267 props[props_idx]->vals[0].value = SDATA (Vuser_login_name); 270 props[props_idx]->vals[0].value = SDATA (Vuser_login_name);
268 ++props_idx; 271 ++props_idx;
269 272
@@ -388,6 +391,7 @@ ice_conn_watch_CB (IceConn iceConn, IcePointer clientData, int opening, IcePoint
388 391
389/* Create the client leader window. */ 392/* Create the client leader window. */
390 393
394#ifndef USE_GTK
391static void 395static void
392create_client_leader_window (struct x_display_info *dpyinfo, char *client_id) 396create_client_leader_window (struct x_display_info *dpyinfo, char *client_id)
393{ 397{
@@ -407,10 +411,12 @@ create_client_leader_window (struct x_display_info *dpyinfo, char *client_id)
407 411
408 sm_id = XInternAtom (dpyinfo->display, "SM_CLIENT_ID", False); 412 sm_id = XInternAtom (dpyinfo->display, "SM_CLIENT_ID", False);
409 XChangeProperty (dpyinfo->display, w, sm_id, XA_STRING, 8, PropModeReplace, 413 XChangeProperty (dpyinfo->display, w, sm_id, XA_STRING, 8, PropModeReplace,
410 client_id, strlen (client_id)); 414 (unsigned char *)client_id, strlen (client_id));
411 415
412 dpyinfo->client_leader_window = w; 416 dpyinfo->client_leader_window = w;
413} 417}
418#endif /* ! USE_GTK */
419
414 420
415/* Try to open a connection to the session manager. */ 421/* Try to open a connection to the session manager. */
416 422
@@ -429,12 +435,12 @@ x_session_initialize (struct x_display_info *dpyinfo)
429 /* Check if we where started by the session manager. If so, we will 435 /* Check if we where started by the session manager. If so, we will
430 have a previous id. */ 436 have a previous id. */
431 if (! EQ (Vx_session_previous_id, Qnil) && STRINGP (Vx_session_previous_id)) 437 if (! EQ (Vx_session_previous_id, Qnil) && STRINGP (Vx_session_previous_id))
432 previous_id = SDATA (Vx_session_previous_id); 438 previous_id = SSDATA (Vx_session_previous_id);
433 439
434 /* Construct the path to the Emacs program. */ 440 /* Construct the path to the Emacs program. */
435 if (! EQ (Vinvocation_directory, Qnil)) 441 if (! EQ (Vinvocation_directory, Qnil))
436 name_len += strlen (SDATA (Vinvocation_directory)); 442 name_len += strlen (SSDATA (Vinvocation_directory));
437 name_len += strlen (SDATA (Vinvocation_name)); 443 name_len += strlen (SSDATA (Vinvocation_name));
438 444
439 /* This malloc will not be freed, but it is only done once, and hopefully 445 /* This malloc will not be freed, but it is only done once, and hopefully
440 not very large */ 446 not very large */
@@ -442,8 +448,8 @@ x_session_initialize (struct x_display_info *dpyinfo)
442 emacs_program[0] = '\0'; 448 emacs_program[0] = '\0';
443 449
444 if (! EQ (Vinvocation_directory, Qnil)) 450 if (! EQ (Vinvocation_directory, Qnil))
445 strcpy (emacs_program, SDATA (Vinvocation_directory)); 451 strcpy (emacs_program, SSDATA (Vinvocation_directory));
446 strcat (emacs_program, SDATA (Vinvocation_name)); 452 strcat (emacs_program, SSDATA (Vinvocation_name));
447 453
448 /* The SM protocol says all callbacks are mandatory, so set up all 454 /* The SM protocol says all callbacks are mandatory, so set up all
449 here and in the mask passed to SmcOpenConnection. */ 455 here and in the mask passed to SmcOpenConnection. */