Mercurial > emacs
diff src/gtkutil.c @ 109141:fa173b9bd9ce
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 *)
author | Jan D <jan.h.d@swipnet.se> |
---|---|
date | Mon, 05 Jul 2010 11:17:12 +0200 |
parents | c25c24812fb1 |
children | 89a16701cde1 |
line wrap: on
line diff
--- a/src/gtkutil.c Sun Jul 04 21:57:13 2010 -0700 +++ b/src/gtkutil.c Mon Jul 05 11:17:12 2010 +0200 @@ -231,7 +231,9 @@ /* Apply GMASK to GPIX and return a GdkPixbuf with an alpha channel. */ static GdkPixbuf * -xg_get_pixbuf_from_pix_and_mask (GdkPixmap *gpix, GdkPixmap *gmask, GdkColormap *cmap) +xg_get_pixbuf_from_pix_and_mask (GdkPixmap *gpix, + GdkPixmap *gmask, + GdkColormap *cmap) { int width, height; GdkPixbuf *icon_buf, *tmp_buf; @@ -309,7 +311,10 @@ If OLD_WIDGET is not NULL, that widget is modified. */ static GtkWidget * -xg_get_image_for_pixmap (FRAME_PTR f, struct image *img, GtkWidget *widget, GtkImage *old_widget) +xg_get_image_for_pixmap (FRAME_PTR f, + struct image *img, + GtkWidget *widget, + GtkImage *old_widget) { GdkPixmap *gpix; GdkPixmap *gmask; @@ -1039,7 +1044,9 @@ Returns the GTK dialog widget. */ static GtkWidget * -create_dialog (widget_value *wv, GCallback select_cb, GCallback deactivate_cb) +create_dialog (widget_value *wv, + GCallback select_cb, + GCallback deactivate_cb) { char *title = get_dialog_title (wv->name[0]); int total_buttons = wv->name[1] - '0'; @@ -1459,12 +1466,11 @@ Returns the created widget. */ static GtkWidget * -xg_get_file_with_selection ( - FRAME_PTR f, - char *prompt, - char *default_filename, - int mustmatch_p, int only_dir_p, - xg_get_file_func *func) +xg_get_file_with_selection (FRAME_PTR f, + char *prompt, + char *default_filename, + int mustmatch_p, int only_dir_p, + xg_get_file_func *func) { GtkWidget *filewin; GtkFileSelection *filesel; @@ -1502,7 +1508,11 @@ The returned string must be freed by the caller. */ char * -xg_get_file_name (FRAME_PTR f, char *prompt, char *default_filename, int mustmatch_p, int only_dir_p) +xg_get_file_name (FRAME_PTR f, + char *prompt, + char *default_filename, + int mustmatch_p, + int only_dir_p) { GtkWidget *w = 0; char *fn = 0; @@ -1652,7 +1662,9 @@ creating the menu bar. */ static void -update_cl_data (xg_menu_cb_data *cl_data, FRAME_PTR f, GCallback highlight_cb) +update_cl_data (xg_menu_cb_data *cl_data, + FRAME_PTR f, + GCallback highlight_cb) { if (cl_data) { @@ -1723,7 +1735,9 @@ Returns FALSE to tell GTK to keep processing this event. */ static gboolean -menuitem_highlight_callback (GtkWidget *w, GdkEventCrossing *event, gpointer client_data) +menuitem_highlight_callback (GtkWidget *w, + GdkEventCrossing *event, + gpointer client_data) { GdkEvent ev; GtkWidget *subwidget; @@ -1800,7 +1814,10 @@ but the MacOS X version doesn't either, so I guess that is OK. */ static GtkWidget * -make_menu_item (char *utf8_label, char *utf8_key, widget_value *item, GSList **group) +make_menu_item (char *utf8_label, + char *utf8_key, + widget_value *item, + GSList **group) { GtkWidget *w; GtkWidget *wtoadd = 0; @@ -1945,7 +1962,12 @@ Returns the created GtkWidget. */ static GtkWidget * -xg_create_one_menuitem (widget_value *item, FRAME_PTR f, GCallback select_cb, GCallback highlight_cb, xg_menu_cb_data *cl_data, GSList **group) +xg_create_one_menuitem (widget_value *item, + FRAME_PTR f, + GCallback select_cb, + GCallback highlight_cb, + xg_menu_cb_data *cl_data, + GSList **group) { char *utf8_label; char *utf8_key; @@ -1988,10 +2010,6 @@ return w; } -static GtkWidget *create_menus (widget_value *, FRAME_PTR, GCallback, - GCallback, GCallback, int, int, int, - GtkWidget *, xg_menu_cb_data *, char *); - /* Create a full menu tree specified by DATA. F is the frame the created menu belongs to. SELECT_CB is the callback to use when a menu item is selected. @@ -2015,19 +2033,17 @@ This function calls itself to create submenus. */ static GtkWidget * -create_menus (data, f, select_cb, deactivate_cb, highlight_cb, - pop_up_p, menu_bar_p, add_tearoff_p, topmenu, cl_data, name) - widget_value *data; - FRAME_PTR f; - GCallback select_cb; - GCallback deactivate_cb; - GCallback highlight_cb; - int pop_up_p; - int menu_bar_p; - int add_tearoff_p; - GtkWidget *topmenu; - xg_menu_cb_data *cl_data; - char *name; +create_menus (widget_value *data, + FRAME_PTR f, + GCallback select_cb, + GCallback deactivate_cb, + GCallback highlight_cb, + int pop_up_p, + int menu_bar_p, + int add_tearoff_p, + GtkWidget *topmenu, + xg_menu_cb_data *cl_data, + char *name) { widget_value *item; GtkWidget *wmenu = topmenu; @@ -2397,7 +2413,7 @@ Insert X. */ int nr = pos; - GList *group = 0; + GSList *group = 0; GtkWidget *w = xg_create_one_menuitem (val, f, select_cb, @@ -2456,7 +2472,11 @@ CL_DATA is the data to set in the widget for menu invocation. */ static void -xg_update_menu_item (widget_value *val, GtkWidget *w, GCallback select_cb, GCallback highlight_cb, xg_menu_cb_data *cl_data) +xg_update_menu_item (widget_value *val, + GtkWidget *w, + GCallback select_cb, + GCallback highlight_cb, + xg_menu_cb_data *cl_data) { GtkWidget *wchild; GtkLabel *wlbl = 0; @@ -2760,7 +2780,7 @@ GList *iter; GtkWidget *sub = 0; GtkWidget *newsub; - GtkMenuItem *witem; + GtkMenuItem *witem = 0; /* Find sub menu that corresponds to val and update it. */ for (iter = list ; iter; iter = g_list_next (iter)) @@ -2783,7 +2803,7 @@ /* sub may still be NULL. If we just updated non deep and added a new menu bar item, it has no sub menu yet. So we set the newly created sub menu under witem. */ - if (newsub != sub) + if (newsub != sub && witem != 0) { xg_set_screen (newsub, f); gtk_menu_item_set_submenu (witem, newsub); @@ -2976,7 +2996,11 @@ to set resources for the widget. */ void -xg_create_scroll_bar (FRAME_PTR f, struct scroll_bar *bar, GCallback scroll_callback, GCallback end_callback, char *scroll_bar_name) +xg_create_scroll_bar (FRAME_PTR f, + struct scroll_bar *bar, + GCallback scroll_callback, + GCallback end_callback, + char *scroll_bar_name) { GtkWidget *wscroll; GtkWidget *webox; @@ -3047,7 +3071,12 @@ WIDTH, HEIGHT is the size in pixels the bar shall have. */ void -xg_update_scrollbar_pos (FRAME_PTR f, int scrollbar_id, int top, int left, int width, int height) +xg_update_scrollbar_pos (FRAME_PTR f, + int scrollbar_id, + int top, + int left, + int width, + int height) { GtkWidget *wscroll = xg_get_widget_from_map (scrollbar_id); @@ -3108,7 +3137,10 @@ displaying PORTION out of a whole WHOLE, and our position POSITION. */ void -xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, int portion, int position, int whole) +xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, + int portion, + int position, + int whole) { GtkWidget *wscroll = xg_get_widget_from_map (bar->x_window); @@ -3245,7 +3277,9 @@ tool bar. 0 is the first button. */ static gboolean -xg_tool_bar_button_cb (GtkWidget *widget, GdkEventButton *event, gpointer user_data) +xg_tool_bar_button_cb (GtkWidget *widget, + GdkEventButton *event, + gpointer user_data) { /* Casts to avoid warnings when gpointer is 64 bits and int is 32 bits */ gpointer ptr = (gpointer) (EMACS_INT) event->state; @@ -3326,7 +3360,9 @@ the detached tool bar when the detached tool bar it is not expanded. */ static gboolean -xg_tool_bar_proxy_help_callback (GtkWidget *w, GdkEventCrossing *event, gpointer client_data) +xg_tool_bar_proxy_help_callback (GtkWidget *w, + GdkEventCrossing *event, + gpointer client_data) { GtkWidget *wbutton = GTK_WIDGET (g_object_get_data (G_OBJECT (w), XG_TOOL_BAR_PROXY_BUTTON)); @@ -3462,7 +3498,9 @@ CLIENT_DATA is a pointer to the frame the tool bar belongs to. */ static void -xg_tool_bar_detach_callback (GtkHandleBox *wbox, GtkWidget *w, gpointer client_data) +xg_tool_bar_detach_callback (GtkHandleBox *wbox, + GtkWidget *w, + gpointer client_data) { FRAME_PTR f = (FRAME_PTR) client_data; extern int x_gtk_whole_detached_tool_bar; @@ -3490,7 +3528,9 @@ CLIENT_DATA is a pointer to the frame the tool bar belongs to. */ static void -xg_tool_bar_attach_callback (GtkHandleBox *wbox, GtkWidget *w, gpointer client_data) +xg_tool_bar_attach_callback (GtkHandleBox *wbox, + GtkWidget *w, + gpointer client_data) { FRAME_PTR f = (FRAME_PTR) client_data; g_object_set (G_OBJECT (w), "show-arrow", TRUE, NULL); @@ -3517,7 +3557,9 @@ Returns FALSE to tell GTK to keep processing this event. */ static gboolean -xg_tool_bar_help_callback (GtkWidget *w, GdkEventCrossing *event, gpointer client_data) +xg_tool_bar_help_callback (GtkWidget *w, + GdkEventCrossing *event, + gpointer client_data) { /* The EMACS_INT cast avoids a warning. */ int idx = (int) (EMACS_INT) client_data; @@ -3556,7 +3598,9 @@ Returns FALSE to tell GTK to keep processing this event. */ static gboolean -xg_tool_bar_item_expose_callback (GtkWidget *w, GdkEventExpose *event, gpointer client_data) +xg_tool_bar_item_expose_callback (GtkWidget *w, + GdkEventExpose *event, + gpointer client_data) { gint width, height; @@ -3849,7 +3893,6 @@ GtkWidget *wbutton = NULL; GtkWidget *weventbox; Lisp_Object specified_file; - Lisp_Object lbl = PROP (TOOL_BAR_ITEM_LABEL); char *label = SSDATA (PROP (TOOL_BAR_ITEM_LABEL)); ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (wtoolbar), i); @@ -4020,7 +4063,8 @@ } else if (img && old_img != img->pixmap) { - (void) xg_get_image_for_pixmap (f, img, x->widget, wimage); + (void) xg_get_image_for_pixmap (f, img, x->widget, + GTK_IMAGE (wimage)); g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_IMAGE_DATA, (gpointer)img->pixmap);