Convert function definitions to standard C.

* src/xterm.c (x_frame_of_widget, x_alloc_nearest_color_for_widget)
(x_alloc_lighter_color_for_widget, cvt_string_to_pixel)
(cvt_pixel_dtor, x_window_to_menu_bar, xt_action_hook)
(xaw_jump_callback, xaw_scroll_callback)
(x_create_toolkit_scroll_bar, x_set_toolkit_scroll_bar_thumb)
(x_wm_set_size_hint, x_activate_timeout_atimer): Convert
definitions to standard C.
* src/xmenu.c (menubar_id_to_frame, popup_get_selection)
(popup_activate_callback, popup_deactivate_callback)
(menu_highlight_callback, menubar_selection_callback)
(apply_systemfont_to_dialog, apply_systemfont_to_menu)
(free_frame_menubar, popup_selection_callback, as)
(create_and_show_popup_menu, dialog_selection_callback)
(create_and_show_dialog):
* src/xfns.c (hack_wm_protocols, x_window):
* src/xfaces.c (x_update_menu_appearance):
* src/widget.c (get_default_char_pixel_size, pixel_to_char_size)
(char_to_pixel_size, round_size_to_char, get_wm_shell)
(set_frame_size, update_wm_hints, setup_frame_gcs)
(update_various_frame_slots, update_from_various_frame_slots)
(EmacsFrameInitialize, EmacsFrameRealize, EmacsFrameResize)
(EmacsFrameSetValues, EmacsFrameQueryGeometry)
(EmacsFrameSetCharSize, widget_store_internal_border): Likewise.
This commit is contained in:
Dan Nicolaescu 2010-07-12 12:29:49 -07:00
parent de06a2dd4d
commit ebd156110c
6 changed files with 87 additions and 182 deletions

View file

@ -1,3 +1,29 @@
2010-07-12 Dan Nicolaescu <dann@ics.uci.edu>
* xterm.c (x_frame_of_widget, x_alloc_nearest_color_for_widget)
(x_alloc_lighter_color_for_widget, cvt_string_to_pixel)
(cvt_pixel_dtor, x_window_to_menu_bar, xt_action_hook)
(xaw_jump_callback, xaw_scroll_callback)
(x_create_toolkit_scroll_bar, x_set_toolkit_scroll_bar_thumb)
(x_wm_set_size_hint, x_activate_timeout_atimer): Convert
definitions to standard C.
* xmenu.c (menubar_id_to_frame, popup_get_selection)
(popup_activate_callback, popup_deactivate_callback)
(menu_highlight_callback, menubar_selection_callback)
(apply_systemfont_to_dialog, apply_systemfont_to_menu)
(free_frame_menubar, popup_selection_callback, as)
(create_and_show_popup_menu, dialog_selection_callback)
(create_and_show_dialog):
* xfns.c (hack_wm_protocols, x_window):
* xfaces.c (x_update_menu_appearance):
* widget.c (get_default_char_pixel_size, pixel_to_char_size)
(char_to_pixel_size, round_size_to_char, get_wm_shell)
(set_frame_size, update_wm_hints, setup_frame_gcs)
(update_various_frame_slots, update_from_various_frame_slots)
(EmacsFrameInitialize, EmacsFrameRealize, EmacsFrameResize)
(EmacsFrameSetValues, EmacsFrameQueryGeometry)
(EmacsFrameSetCharSize, widget_store_internal_border): Likewise.
2010-07-12 Andreas Schwab <schwab@linux-m68k.org>
* dbusbind.c (xd_initialize): Don't compare boolean with a

View file

@ -76,14 +76,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#define DEFAULT_FACE_FONT "-*-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-*"
static void EmacsFrameInitialize (/*Widget, Widget, ArgList, Cardinal * */);
static void EmacsFrameDestroy (/* Widget */);
static void EmacsFrameRealize (/* Widget, XtValueMask*, XSetWindowAttributes* */);
void EmacsFrameResize (/* Widget widget */);
static Boolean EmacsFrameSetValues (/* Widget, Widget, Widget,
ArgList, Cardinal * */);
static XtGeometryResult EmacsFrameQueryGeometry (/* Widget, XtWidgetGeometry*,
XtWidgetGeometry* */);
static void EmacsFrameInitialize (Widget request, Widget new, ArgList dum1, Cardinal *dum2);
static void EmacsFrameDestroy (Widget widget);
static void EmacsFrameRealize (Widget widget, XtValueMask *mask, XSetWindowAttributes *attrs);
void EmacsFrameResize (Widget widget);
static Boolean EmacsFrameSetValues (Widget cur_widget, Widget req_widget, Widget new_widget, ArgList dum1, Cardinal *dum2);
static XtGeometryResult EmacsFrameQueryGeometry (Widget widget, XtWidgetGeometry *request, XtWidgetGeometry *result);
#undef XtOffset
@ -180,10 +178,7 @@ EmacsFrameClassRec emacsFrameClassRec = {
WidgetClass emacsFrameClass = (WidgetClass) &emacsFrameClassRec;
static void
get_default_char_pixel_size (ew, pixel_width, pixel_height)
EmacsFrame ew;
int* pixel_width;
int* pixel_height;
get_default_char_pixel_size (EmacsFrame ew, int *pixel_width, int *pixel_height)
{
struct frame* f = ew->emacs_frame.frame;
*pixel_width = FRAME_COLUMN_WIDTH (f);
@ -191,12 +186,7 @@ get_default_char_pixel_size (ew, pixel_width, pixel_height)
}
static void
pixel_to_char_size (ew, pixel_width, pixel_height, char_width, char_height)
EmacsFrame ew;
Dimension pixel_width;
Dimension pixel_height;
int* char_width;
int* char_height;
pixel_to_char_size (EmacsFrame ew, Dimension pixel_width, Dimension pixel_height, int *char_width, int *char_height)
{
struct frame* f = ew->emacs_frame.frame;
*char_width = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, (int) pixel_width);
@ -204,12 +194,7 @@ pixel_to_char_size (ew, pixel_width, pixel_height, char_width, char_height)
}
static void
char_to_pixel_size (ew, char_width, char_height, pixel_width, pixel_height)
EmacsFrame ew;
int char_width;
int char_height;
Dimension* pixel_width;
Dimension* pixel_height;
char_to_pixel_size (EmacsFrame ew, int char_width, int char_height, Dimension *pixel_width, Dimension *pixel_height)
{
struct frame* f = ew->emacs_frame.frame;
*pixel_width = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, char_width);
@ -217,12 +202,7 @@ char_to_pixel_size (ew, char_width, char_height, pixel_width, pixel_height)
}
static void
round_size_to_char (ew, in_width, in_height, out_width, out_height)
EmacsFrame ew;
Dimension in_width;
Dimension in_height;
Dimension* out_width;
Dimension* out_height;
round_size_to_char (EmacsFrame ew, Dimension in_width, Dimension in_height, Dimension *out_width, Dimension *out_height)
{
int char_width;
int char_height;
@ -231,8 +211,7 @@ round_size_to_char (ew, in_width, in_height, out_width, out_height)
}
static Widget
get_wm_shell (w)
Widget w;
get_wm_shell (Widget w)
{
Widget wmshell;
@ -269,8 +248,7 @@ static Boolean first_frame_p = True;
#endif
static void
set_frame_size (ew)
EmacsFrame ew;
set_frame_size (EmacsFrame ew)
{
/* The widget hierarchy is
@ -491,8 +469,7 @@ set_frame_size (ew)
int update_hints_inhibit;
static void
update_wm_hints (ew)
EmacsFrame ew;
update_wm_hints (EmacsFrame ew)
{
Widget wmshell = get_wm_shell ((Widget)ew);
int cw;
@ -570,8 +547,7 @@ static char setup_frame_cursor_bits[] =
};
static void
setup_frame_gcs (ew)
EmacsFrame ew;
setup_frame_gcs (EmacsFrame ew)
{
XGCValues gc_values;
struct frame* s = ew->emacs_frame.frame;
@ -649,8 +625,7 @@ setup_frame_gcs (ew)
}
static void
update_various_frame_slots (ew)
EmacsFrame ew;
update_various_frame_slots (EmacsFrame ew)
{
struct frame *f = ew->emacs_frame.frame;
struct x_output *x = f->output_data.x;
@ -661,8 +636,7 @@ update_various_frame_slots (ew)
}
static void
update_from_various_frame_slots (ew)
EmacsFrame ew;
update_from_various_frame_slots (EmacsFrame ew)
{
struct frame *f = ew->emacs_frame.frame;
struct x_output *x = f->output_data.x;
@ -677,11 +651,7 @@ update_from_various_frame_slots (ew)
}
static void
EmacsFrameInitialize (request, new, dum1, dum2)
Widget request;
Widget new;
ArgList dum1;
Cardinal *dum2;
EmacsFrameInitialize (Widget request, Widget new, ArgList dum1, Cardinal *dum2)
{
EmacsFrame ew = (EmacsFrame)new;
@ -698,10 +668,7 @@ EmacsFrameInitialize (request, new, dum1, dum2)
static void
EmacsFrameRealize (widget, mask, attrs)
Widget widget;
XtValueMask *mask;
XSetWindowAttributes *attrs;
EmacsFrameRealize (Widget widget, XtValueMask *mask, XSetWindowAttributes *attrs)
{
EmacsFrame ew = (EmacsFrame)widget;
@ -717,11 +684,10 @@ EmacsFrameRealize (widget, mask, attrs)
update_wm_hints (ew);
}
extern void free_frame_faces (/* struct frame * */);
extern void free_frame_faces (struct frame *);
static void
EmacsFrameDestroy (widget)
Widget widget;
EmacsFrameDestroy (Widget widget)
{
EmacsFrame ew = (EmacsFrame) widget;
struct frame* s = ew->emacs_frame.frame;
@ -739,8 +705,7 @@ EmacsFrameDestroy (widget)
}
void
EmacsFrameResize (widget)
Widget widget;
EmacsFrameResize (Widget widget)
{
EmacsFrame ew = (EmacsFrame)widget;
struct frame *f = ew->emacs_frame.frame;
@ -756,12 +721,7 @@ EmacsFrameResize (widget)
}
static Boolean
EmacsFrameSetValues (cur_widget, req_widget, new_widget, dum1, dum2)
Widget cur_widget;
Widget req_widget;
Widget new_widget;
ArgList dum1;
Cardinal *dum2;
EmacsFrameSetValues (Widget cur_widget, Widget req_widget, Widget new_widget, ArgList dum1, Cardinal *dum2)
{
EmacsFrame cur = (EmacsFrame)cur_widget;
EmacsFrame new = (EmacsFrame)new_widget;
@ -834,10 +794,7 @@ EmacsFrameSetValues (cur_widget, req_widget, new_widget, dum1, dum2)
}
static XtGeometryResult
EmacsFrameQueryGeometry (widget, request, result)
Widget widget;
XtWidgetGeometry* request;
XtWidgetGeometry* result;
EmacsFrameQueryGeometry (Widget widget, XtWidgetGeometry *request, XtWidgetGeometry *result)
{
EmacsFrame ew = (EmacsFrame)widget;
@ -867,10 +824,7 @@ EmacsFrameQueryGeometry (widget, request, result)
/* Special entrypoints */
void
EmacsFrameSetCharSize (widget, columns, rows)
Widget widget;
int columns;
int rows;
EmacsFrameSetCharSize (Widget widget, int columns, int rows)
{
EmacsFrame ew = (EmacsFrame) widget;
struct frame *f = ew->emacs_frame.frame;
@ -880,8 +834,7 @@ EmacsFrameSetCharSize (widget, columns, rows)
void
widget_store_internal_border (widget)
Widget widget;
widget_store_internal_border (Widget widget)
{
EmacsFrame ew = (EmacsFrame) widget;
FRAME_PTR f = ew->emacs_frame.frame;

View file

@ -3599,8 +3599,7 @@ DEFUN ("internal-set-lisp-face-attribute-from-resource",
/* Make menus on frame F appear as specified by the `menu' face. */
static void
x_update_menu_appearance (f)
struct frame *f;
x_update_menu_appearance (struct frame *f)
{
struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
XrmDatabase rdb;

View file

@ -1816,9 +1816,7 @@ x_default_scroll_bar_color_parameter (struct frame *f,
for example, but Xt doesn't). */
static void
hack_wm_protocols (f, widget)
FRAME_PTR f;
Widget widget;
hack_wm_protocols (FRAME_PTR f, Widget widget)
{
Display *dpy = XtDisplay (widget);
Window w = XtWindow (widget);
@ -2392,10 +2390,7 @@ xic_set_xfontset (struct frame *f, char *base_fontname)
/* Create and set up the X widget for frame F. */
static void
x_window (f, window_prompting, minibuffer_only)
struct frame *f;
long window_prompting;
int minibuffer_only;
x_window (struct frame *f, long window_prompting, int minibuffer_only)
{
XClassHint class_hints;
XSetWindowAttributes attributes;

View file

@ -165,8 +165,7 @@ int pending_menu_activation;
/* Return the frame whose ->output_data.x->id equals ID, or 0 if none. */
static struct frame *
menubar_id_to_frame (id)
LWLIB_ID id;
menubar_id_to_frame (LWLIB_ID id)
{
Lisp_Object tail, frame;
FRAME_PTR f;
@ -456,11 +455,7 @@ x_menu_wait_for_event (void *data)
with BLOCK_INPUT, UNBLOCK_INPUT wrappers. */
static void
popup_get_selection (initial_event, dpyinfo, id, do_timers)
XEvent *initial_event;
struct x_display_info *dpyinfo;
LWLIB_ID id;
int do_timers;
popup_get_selection (XEvent *initial_event, struct x_display_info *dpyinfo, LWLIB_ID id, int do_timers)
{
XEvent event;
@ -705,10 +700,7 @@ x_activate_menubar (FRAME_PTR f)
#ifndef USE_GTK
static void
popup_activate_callback (widget, id, client_data)
Widget widget;
LWLIB_ID id;
XtPointer client_data;
popup_activate_callback (Widget widget, LWLIB_ID id, XtPointer client_data)
{
popup_activated_flag = 1;
#ifdef USE_X_TOOLKIT
@ -728,10 +720,7 @@ popup_deactivate_callback (GtkWidget *widget, gpointer client_data)
}
#else
static void
popup_deactivate_callback (widget, id, client_data)
Widget widget;
LWLIB_ID id;
XtPointer client_data;
popup_deactivate_callback (Widget widget, LWLIB_ID id, XtPointer client_data)
{
popup_activated_flag = 0;
}
@ -799,10 +788,7 @@ menu_highlight_callback (GtkWidget *widget, gpointer call_data)
}
#else
void
menu_highlight_callback (widget, id, call_data)
Widget widget;
LWLIB_ID id;
void *call_data;
menu_highlight_callback (Widget widget, LWLIB_ID id, void *call_data)
{
struct frame *f;
Lisp_Object help;
@ -873,10 +859,7 @@ menubar_selection_callback (GtkWidget *widget, gpointer client_data)
Figure out what the user chose
and put the appropriate events into the keyboard buffer. */
static void
menubar_selection_callback (widget, id, client_data)
Widget widget;
LWLIB_ID id;
XtPointer client_data;
menubar_selection_callback (Widget widget, LWLIB_ID id, XtPointer client_data)
{
FRAME_PTR f;
@ -942,8 +925,7 @@ update_frame_menubar (FRAME_PTR f)
#ifdef USE_LUCID
static void
apply_systemfont_to_dialog (w)
Widget w;
apply_systemfont_to_dialog (Widget w)
{
const char *fn = xsettings_get_system_normal_font ();
if (fn)
@ -955,8 +937,7 @@ apply_systemfont_to_dialog (w)
}
static void
apply_systemfont_to_menu (w)
Widget w;
apply_systemfont_to_menu (Widget w)
{
const char *fn = xsettings_get_system_normal_font ();
int defflt;
@ -1352,8 +1333,7 @@ initialize_frame_menubar (FRAME_PTR f)
#ifndef USE_GTK
void
free_frame_menubar (f)
FRAME_PTR f;
free_frame_menubar (FRAME_PTR f)
{
Widget menubar_widget;
@ -1569,10 +1549,7 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y, i
LWLIB_ID widget_id_tick;
static void
popup_selection_callback (widget, id, client_data)
Widget widget;
LWLIB_ID id;
XtPointer client_data;
popup_selection_callback (Widget widget, LWLIB_ID id, XtPointer client_data)
{
menu_item_selection = (Lisp_Object *) client_data;
}
@ -1581,8 +1558,7 @@ popup_selection_callback (widget, id, client_data)
as a Lisp object as (HIGHPART . LOWPART). */
static Lisp_Object
pop_down_menu (arg)
Lisp_Object arg;
pop_down_menu (Lisp_Object arg)
{
LWLIB_ID id = (XINT (XCAR (arg)) << 4 * sizeof (LWLIB_ID)
| XINT (XCDR (arg)));
@ -1599,13 +1575,7 @@ pop_down_menu (arg)
menu pops down.
menu_item_selection will be set to the selection. */
static void
create_and_show_popup_menu (f, first_wv, x, y, for_click, timestamp)
FRAME_PTR f;
widget_value *first_wv;
int x;
int y;
int for_click;
EMACS_UINT timestamp;
create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y, int for_click, unsigned int timestamp)
{
int i;
Arg av[2];
@ -1997,10 +1967,7 @@ create_and_show_dialog (FRAME_PTR f, widget_value *first_wv)
#else /* not USE_GTK */
static void
dialog_selection_callback (widget, id, client_data)
Widget widget;
LWLIB_ID id;
XtPointer client_data;
dialog_selection_callback (Widget widget, LWLIB_ID id, XtPointer client_data)
{
/* The EMACS_INT cast avoids a warning. There's no problem
as long as pointers have enough bits to hold small integers. */
@ -2018,9 +1985,7 @@ dialog_selection_callback (widget, id, client_data)
dialog pops down.
menu_item_selection will be set to the selection. */
static void
create_and_show_dialog (f, first_wv)
FRAME_PTR f;
widget_value *first_wv;
create_and_show_dialog (FRAME_PTR f, widget_value *first_wv)
{
LWLIB_ID dialog_id;

View file

@ -1367,8 +1367,7 @@ static void cvt_pixel_dtor (XtAppContext, XrmValue *, XtPointer,
cannot be determined. */
static struct frame *
x_frame_of_widget (widget)
Widget widget;
x_frame_of_widget (Widget widget)
{
struct x_display_info *dpyinfo;
Lisp_Object tail;
@ -1404,10 +1403,7 @@ x_frame_of_widget (widget)
if successful. This is called from lwlib. */
int
x_alloc_nearest_color_for_widget (widget, cmap, color)
Widget widget;
Colormap cmap;
XColor *color;
x_alloc_nearest_color_for_widget (Widget widget, Colormap cmap, XColor *color)
{
struct frame *f = x_frame_of_widget (widget);
return x_alloc_nearest_color (f, cmap, color);
@ -1422,13 +1418,8 @@ x_alloc_nearest_color_for_widget (widget, cmap, color)
Value is non-zero if successful. */
int
x_alloc_lighter_color_for_widget (widget, display, cmap, pixel, factor, delta)
Widget widget;
Display *display;
Colormap cmap;
unsigned long *pixel;
double factor;
int delta;
x_alloc_lighter_color_for_widget (Widget widget, Display *display, Colormap cmap,
unsigned long *pixel, double factor, int delta)
{
struct frame *f = x_frame_of_widget (widget);
return x_alloc_lighter_color (f, display, cmap, pixel, factor, delta);
@ -1471,12 +1462,9 @@ static Pixel cvt_string_to_pixel_value;
Value is True if successful, False otherwise. */
static Boolean
cvt_string_to_pixel (dpy, args, nargs, from, to, closure_ret)
Display *dpy;
XrmValue *args;
Cardinal *nargs;
XrmValue *from, *to;
XtPointer *closure_ret;
cvt_string_to_pixel (Display *dpy, XrmValue *args, Cardinal *nargs,
XrmValue *from, XrmValue *to,
XtPointer *closure_ret)
{
Screen *screen;
Colormap cmap;
@ -1560,12 +1548,8 @@ cvt_string_to_pixel (dpy, args, nargs, from, to, closure_ret)
ARGS and NARGS are like for cvt_string_to_pixel. */
static void
cvt_pixel_dtor (app, to, closure, args, nargs)
XtAppContext app;
XrmValuePtr to;
XtPointer closure;
XrmValuePtr args;
Cardinal *nargs;
cvt_pixel_dtor (XtAppContext app, XrmValuePtr to, XtPointer closure, XrmValuePtr args,
Cardinal *nargs)
{
if (*nargs != 2)
{
@ -3953,8 +3937,7 @@ x_window_to_scroll_bar (Display *display, Window window_id)
if WINDOW is not part of a menu bar. */
static Widget
x_window_to_menu_bar (window)
Window window;
x_window_to_menu_bar (Window window)
{
Lisp_Object tail;
@ -4021,14 +4004,8 @@ static Boolean xaw3d_pick_top;
a `end-scroll' SCROLL_BAR_CLICK_EVENT' event if so. */
static void
xt_action_hook (widget, client_data, action_name, event, params,
num_params)
Widget widget;
XtPointer client_data;
String action_name;
XEvent *event;
String *params;
Cardinal *num_params;
xt_action_hook (Widget widget, XtPointer client_data, String action_name,
XEvent *event, String *params, Cardinal *num_params)
{
int scroll_bar_p;
char *end_action;
@ -4341,9 +4318,7 @@ xg_end_scroll_callback (GtkWidget *widget,
the thumb is. */
static void
xaw_jump_callback (widget, client_data, call_data)
Widget widget;
XtPointer client_data, call_data;
xaw_jump_callback (Widget widget, XtPointer client_data, XtPointer call_data)
{
struct scroll_bar *bar = (struct scroll_bar *) client_data;
float top = *(float *) call_data;
@ -4385,9 +4360,7 @@ xaw_jump_callback (widget, client_data, call_data)
Values < height of scroll bar mean line-wise movement. */
static void
xaw_scroll_callback (widget, client_data, call_data)
Widget widget;
XtPointer client_data, call_data;
xaw_scroll_callback (Widget widget, XtPointer client_data, XtPointer call_data)
{
struct scroll_bar *bar = (struct scroll_bar *) client_data;
/* The position really is stored cast to a pointer. */
@ -4439,9 +4412,7 @@ x_create_toolkit_scroll_bar (struct frame *f, struct scroll_bar *bar)
#else /* not USE_GTK */
static void
x_create_toolkit_scroll_bar (f, bar)
struct frame *f;
struct scroll_bar *bar;
x_create_toolkit_scroll_bar (struct frame *f, struct scroll_bar *bar)
{
Window xwindow;
Widget widget;
@ -4648,9 +4619,8 @@ x_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, int portion, int positio
#else /* not USE_GTK */
static void
x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole)
struct scroll_bar *bar;
int portion, position, whole;
x_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, int portion, int position,
int whole)
{
struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
Widget widget = SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar);
@ -9436,10 +9406,7 @@ x_destroy_window (struct frame *f)
#ifndef USE_GTK
void
x_wm_set_size_hint (f, flags, user_position)
struct frame *f;
long flags;
int user_position;
x_wm_set_size_hint (struct frame *f, long flags, int user_position)
{
XSizeHints size_hints;
Window window = FRAME_OUTER_WINDOW (f);
@ -10402,7 +10369,7 @@ x_process_timeouts (timer)
processed, these widgets don't behave normally. */
void
x_activate_timeout_atimer ()
x_activate_timeout_atimer (void)
{
BLOCK_INPUT;
if (!x_timeout_atimer_activated_flag)