Commit 18e27ea8 authored by Paul Eggert's avatar Paul Eggert

gnutls.c, gtkutil.c: Use bool for boolean.

* gnutls.c (gnutls_global_initialized, init_gnutls_functions)
(emacs_gnutls_handle_error):
* gtkutil.c (xg_check_special_colors, xg_prepare_tooltip)
(xg_hide_tooltip, xg_create_frame_widgets)
(create_dialog, xg_uses_old_file_dialog)
(xg_get_file_with_chooser, xg_get_file_with_selection)
(xg_get_file_name, xg_have_tear_offs, create_menus, xg_create_widget)
(xg_item_label_same_p, xg_update_menubar)
(xg_modify_menubar_widgets, xg_event_is_for_menubar)
(xg_ignore_gtk_scrollbar, xg_set_toolkit_scroll_bar_thumb)
(xg_event_is_for_scrollbar, xg_pack_tool_bar, xg_make_tool_item)
(is_box_type, xg_tool_item_stale_p, xg_update_tool_bar_sizes)
(update_frame_tool_bar, free_frame_tool_bar):
* gtkutil.c, w32term.c, xterm.c (x_wm_set_size_hint):
* nsmenu.m (ns_update_menubar):
* nsmenu.m, w32menu.c, xmenu.c (set_frame_menubar):
* xfns.c (Fx_show_tip) [USE_GTK]:
Use bool for boolean.
* gtkutil.c (xg_update_frame_menubar):
* xmenu.c (update_frame_menubar):
Return void, not int, since caller ignores return value.
* gtkutil.c (xg_change_toolbar_position):
Return void, not 1.
parent 67d63151
2012-09-23 Paul Eggert <eggert@cs.ucla.edu>
gnutls.c, gtkutil.c: Use bool for boolean.
* gnutls.c (gnutls_global_initialized, init_gnutls_functions)
(emacs_gnutls_handle_error):
* gtkutil.c (xg_check_special_colors, xg_prepare_tooltip)
(xg_hide_tooltip, xg_create_frame_widgets)
(create_dialog, xg_uses_old_file_dialog)
(xg_get_file_with_chooser, xg_get_file_with_selection)
(xg_get_file_name, xg_have_tear_offs, create_menus, xg_create_widget)
(xg_item_label_same_p, xg_update_menubar)
(xg_modify_menubar_widgets, xg_event_is_for_menubar)
(xg_ignore_gtk_scrollbar, xg_set_toolkit_scroll_bar_thumb)
(xg_event_is_for_scrollbar, xg_pack_tool_bar, xg_make_tool_item)
(is_box_type, xg_tool_item_stale_p, xg_update_tool_bar_sizes)
(update_frame_tool_bar, free_frame_tool_bar):
* gtkutil.c, w32term.c, xterm.c (x_wm_set_size_hint):
* nsmenu.m (ns_update_menubar):
* nsmenu.m, w32menu.c, xmenu.c (set_frame_menubar):
* xfns.c (Fx_show_tip) [USE_GTK]:
Use bool for boolean.
* gtkutil.c (xg_update_frame_menubar):
* xmenu.c (update_frame_menubar):
Return void, not int, since caller ignores return value.
* gtkutil.c (xg_change_toolbar_position):
Return void, not 1.
2012-09-23 Juanma Barranquero <lekktu@gmail.com>
* makefile.w32-in (BLOCKINPUT_H): Remove.
......
......@@ -1203,7 +1203,7 @@ extern Lisp_Object Qrun_hook_with_args;
extern void x_set_scroll_bar_default_width (struct frame *);
extern void x_set_offset (struct frame *, int, int, int);
extern void x_wm_set_icon_position (struct frame *, int, int);
extern void x_wm_set_size_hint (FRAME_PTR f, long flags, int user_position);
extern void x_wm_set_size_hint (FRAME_PTR f, long flags, bool user_position);
extern Lisp_Object x_new_font (struct frame *, Lisp_Object, int);
......@@ -1249,7 +1249,7 @@ extern Lisp_Object display_x_get_resource (Display_Info *,
Lisp_Object component,
Lisp_Object subclass);
extern void set_frame_menubar (struct frame *f, int first_time, int deep_p);
extern void set_frame_menubar (struct frame *f, bool first_time, bool deep_p);
extern void x_set_window_size (struct frame *f, int change_grav,
int cols, int rows);
extern void x_sync (struct frame *);
......@@ -1283,9 +1283,6 @@ extern char *x_get_resource_string (const char *, const char *);
extern void x_query_colors (struct frame *f, XColor *, int);
/* In xmenu.c */
extern void set_frame_menubar (FRAME_PTR, int, int);
#endif /* HAVE_WINDOW_SYSTEM */
INLINE_HEADER_END
......
......@@ -30,15 +30,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "w32.h"
#endif
static int
emacs_gnutls_handle_error (gnutls_session_t, int err);
static bool emacs_gnutls_handle_error (gnutls_session_t, int);
static Lisp_Object Qgnutls_dll;
static Lisp_Object Qgnutls_code;
static Lisp_Object Qgnutls_anon, Qgnutls_x509pki;
static Lisp_Object Qgnutls_e_interrupted, Qgnutls_e_again,
Qgnutls_e_invalid_session, Qgnutls_e_not_ready_for_handshake;
static int gnutls_global_initialized;
static bool gnutls_global_initialized;
/* The following are for the property list of `gnutls-boot'. */
static Lisp_Object QCgnutls_bootprop_priority;
......@@ -141,7 +140,7 @@ DEF_GNUTLS_FN (int, gnutls_x509_crt_import,
gnutls_x509_crt_fmt_t));
DEF_GNUTLS_FN (int, gnutls_x509_crt_init, (gnutls_x509_crt_t *));
static int
static bool
init_gnutls_functions (void)
{
HMODULE library;
......@@ -438,7 +437,7 @@ emacs_gnutls_read (struct Lisp_Process *proc, char *buf, ptrdiff_t nbyte)
else if (rtnval == GNUTLS_E_UNEXPECTED_PACKET_LENGTH)
/* The peer closed the connection. */
return 0;
else if (emacs_gnutls_handle_error (state, rtnval) == 0)
else if (emacs_gnutls_handle_error (state, rtnval))
/* non-fatal error */
return -1;
else {
......@@ -447,19 +446,19 @@ emacs_gnutls_read (struct Lisp_Process *proc, char *buf, ptrdiff_t nbyte)
}
}
/* report a GnuTLS error to the user.
Returns zero if the error code was successfully handled. */
static int
/* Report a GnuTLS error to the user.
Return true if the error code was successfully handled. */
static bool
emacs_gnutls_handle_error (gnutls_session_t session, int err)
{
int max_log_level = 0;
int ret;
bool ret;
const char *str;
/* TODO: use a Lisp_Object generated by gnutls_make_error? */
if (err >= 0)
return 0;
return 1;
max_log_level = global_gnutls_log_level;
......@@ -471,12 +470,12 @@ emacs_gnutls_handle_error (gnutls_session_t session, int err)
if (fn_gnutls_error_is_fatal (err))
{
ret = err;
ret = 0;
GNUTLS_LOG2 (0, max_log_level, "fatal error:", str);
}
else
{
ret = 0;
ret = 1;
GNUTLS_LOG2 (1, max_log_level, "non-fatal error:", str);
/* TODO: EAGAIN AKA Qgnutls_e_again should be level 2. */
}
......
This diff is collapsed.
......@@ -79,13 +79,13 @@ struct _widget_value;
extern struct _widget_value *malloc_widget_value (void);
extern void free_widget_value (struct _widget_value *);
extern int xg_uses_old_file_dialog (void) ATTRIBUTE_CONST;
extern bool xg_uses_old_file_dialog (void) ATTRIBUTE_CONST;
extern char *xg_get_file_name (FRAME_PTR f,
char *prompt,
char *default_filename,
int mustmatch_p,
int only_dir_p);
bool mustmatch_p,
bool only_dir_p);
extern Lisp_Object xg_get_font (FRAME_PTR f, const char *);
......@@ -100,16 +100,16 @@ extern GtkWidget *xg_create_widget (const char *type,
extern void xg_modify_menubar_widgets (GtkWidget *menubar,
FRAME_PTR f,
struct _widget_value *val,
int deep_p,
bool deep_p,
GCallback select_cb,
GCallback deactivate_cb,
GCallback highlight_cb);
extern int xg_update_frame_menubar (FRAME_PTR f);
extern void xg_update_frame_menubar (FRAME_PTR f);
extern int xg_event_is_for_menubar (FRAME_PTR f, XEvent *event);
extern bool xg_event_is_for_menubar (FRAME_PTR f, XEvent *event);
extern int xg_have_tear_offs (void);
extern bool xg_have_tear_offs (void);
extern ptrdiff_t xg_get_scroll_id_for_window (Display *dpy, Window wid);
......@@ -131,12 +131,12 @@ extern void xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar,
int portion,
int position,
int whole);
extern int xg_event_is_for_scrollbar (FRAME_PTR f, XEvent *event);
extern bool xg_event_is_for_scrollbar (FRAME_PTR f, XEvent *event);
extern int xg_get_default_scrollbar_width (void);
extern void update_frame_tool_bar (FRAME_PTR f);
extern void free_frame_tool_bar (FRAME_PTR f);
extern int xg_change_toolbar_position (FRAME_PTR f, Lisp_Object pos);
extern void xg_change_toolbar_position (FRAME_PTR f, Lisp_Object pos);
extern void xg_frame_resized (FRAME_PTR f,
int pixelwidth,
......@@ -148,23 +148,23 @@ extern void xg_display_open (char *display_name, Display **dpy);
extern void xg_display_close (Display *dpy);
extern GdkCursor * xg_create_default_cursor (Display *dpy);
extern int xg_create_frame_widgets (FRAME_PTR f);
extern bool xg_create_frame_widgets (FRAME_PTR f);
extern void xg_free_frame_widgets (FRAME_PTR f);
extern void xg_set_background_color (FRAME_PTR f, unsigned long bg);
extern int xg_check_special_colors (struct frame *f,
const char *color_name,
XColor *color);
extern bool xg_check_special_colors (struct frame *f,
const char *color_name,
XColor *color);
extern void xg_set_frame_icon (FRAME_PTR f,
Pixmap icon_pixmap,
Pixmap icon_mask);
extern int xg_prepare_tooltip (FRAME_PTR f,
Lisp_Object string,
int *width,
int *height);
extern bool xg_prepare_tooltip (FRAME_PTR f,
Lisp_Object string,
int *width,
int *height);
extern void xg_show_tooltip (FRAME_PTR f, int root_x, int root_y);
extern int xg_hide_tooltip (FRAME_PTR f);
extern bool xg_hide_tooltip (FRAME_PTR f);
/* Mark all callback data that are Lisp_object:s during GC. */
......@@ -175,7 +175,7 @@ extern void xg_initialize (void);
/* Setting scrollbar values invokes the callback. Use this variable
to indicate that the callback should do nothing. */
extern int xg_ignore_gtk_scrollbar;
extern bool xg_ignore_gtk_scrollbar;
#endif /* USE_GTK */
#endif /* GTKUTIL_H */
......@@ -115,13 +115,13 @@
/* --------------------------------------------------------------------------
Update menubar. Three cases:
1) deep_p = 0, submenu = nil: Fresh switch onto a frame -- either set up
1) ! deep_p, submenu = nil: Fresh switch onto a frame -- either set up
just top-level menu strings (OS X), or goto case (2) (GNUstep).
2) deep_p = 1, submenu = nil: Recompute all submenus.
3) deep_p = 1, submenu = non-nil: Update contents of a single submenu.
2) deep_p, submenu = nil: Recompute all submenus.
3) deep_p, submenu = non-nil: Update contents of a single submenu.
-------------------------------------------------------------------------- */
void
ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu)
ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu)
{
NSAutoreleasePool *pool;
id menu = [NSApp mainMenu];
......@@ -507,7 +507,7 @@
frame's menus have changed, and the *step representation should be updated
from Lisp. */
void
set_frame_menubar (struct frame *f, int first_time, int deep_p)
set_frame_menubar (struct frame *f, bool first_time, bool deep_p)
{
ns_update_menubar (f, deep_p, nil);
}
......@@ -1766,7 +1766,7 @@ - (void)clicked: sender
}
- (void)timeout_handler: (NSTimer *)timedEntry
{
NSEvent *nxev = [NSEvent otherEventWithType: NSApplicationDefined
......
......@@ -85,7 +85,7 @@ MessageBoxW_Proc unicode_message_box = NULL;
Lisp_Object Qdebug_on_next_call;
void set_frame_menubar (FRAME_PTR, int, int);
void set_frame_menubar (FRAME_PTR, bool, bool);
#ifdef HAVE_DIALOGS
static Lisp_Object w32_dialog_show (FRAME_PTR, int, Lisp_Object, char**);
......@@ -356,7 +356,7 @@ menubar_selection_callback (FRAME_PTR f, void * client_data)
it is set the first time this is called, from initialize_frame_menubar. */
void
set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
set_frame_menubar (FRAME_PTR f, bool first_time, bool deep_p)
{
HMENU menubar_widget = f->output_data.w32->menubar_widget;
Lisp_Object items;
......
......@@ -197,7 +197,7 @@ static void w32_define_cursor (Window, Cursor);
void x_lower_frame (struct frame *);
void x_scroll_bar_clear (struct frame *);
void x_wm_set_size_hint (struct frame *, long, int);
void x_wm_set_size_hint (struct frame *, long, bool);
void x_raise_frame (struct frame *);
void x_set_window_size (struct frame *, int, int, int);
void x_wm_set_window_state (struct frame *, int);
......@@ -5982,10 +5982,10 @@ x_destroy_window (struct frame *f)
/* Set the normal size hints for the window manager, for frame F.
FLAGS is the flags word to use--or 0 meaning preserve the flags
that the window now has.
If USER_POSITION is nonzero, we set the USPosition
If USER_POSITION, set the USPosition
flag (this is useful when FLAGS is 0). */
void
x_wm_set_size_hint (struct frame *f, long flags, int user_position)
x_wm_set_size_hint (struct frame *f, long flags, bool user_position)
{
Window window = FRAME_W32_WINDOW (f);
......
......@@ -656,8 +656,8 @@ x_set_tool_bar_position (struct frame *f,
if (EQ (new_value, old_value)) return;
#ifdef USE_GTK
if (xg_change_toolbar_position (f, new_value))
fset_tool_bar_position (f, new_value);
xg_change_toolbar_position (f, new_value);
fset_tool_bar_position (f, new_value);
#endif
}
......@@ -4985,13 +4985,14 @@ Text larger than the specified size is clipped. */)
#ifdef USE_GTK
if (x_gtk_use_system_tooltips)
{
int ok;
bool ok;
/* Hide a previous tip, if any. */
Fx_hide_tip ();
block_input ();
if ((ok = xg_prepare_tooltip (f, string, &width, &height)) != 0)
ok = xg_prepare_tooltip (f, string, &width, &height);
if (ok)
{
compute_tip_xy (f, parms, dx, dy, width, height, &root_x, &root_y);
xg_show_tooltip (f, root_x, root_y);
......
......@@ -834,13 +834,13 @@ menubar_selection_callback (Widget widget, LWLIB_ID id, XtPointer client_data)
#endif /* not USE_GTK */
/* Recompute all the widgets of frame F, when the menu bar has been
changed. Value is non-zero if widgets were updated. */
changed. */
static int
static void
update_frame_menubar (FRAME_PTR f)
{
#ifdef USE_GTK
return xg_update_frame_menubar (f);
xg_update_frame_menubar (f);
#else
struct x_output *x;
int columns, rows;
......@@ -851,7 +851,7 @@ update_frame_menubar (FRAME_PTR f)
x = f->output_data.x;
if (!x->menubar_widget || XtIsManaged (x->menubar_widget))
return 0;
return;
block_input ();
/* Save the size of the frame because the pane widget doesn't accept
......@@ -882,7 +882,6 @@ update_frame_menubar (FRAME_PTR f)
EmacsFrameSetCharSize (x->edit_widget, columns, rows);
unblock_input ();
#endif
return 1;
}
#ifdef USE_LUCID
......@@ -921,7 +920,7 @@ apply_systemfont_to_menu (struct frame *f, Widget w)
it is set the first time this is called, from initialize_frame_menubar. */
void
set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
set_frame_menubar (FRAME_PTR f, bool first_time, bool deep_p)
{
xt_or_gtk_widget menubar_widget;
#ifdef USE_X_TOOLKIT
......
......@@ -9541,13 +9541,13 @@ x_destroy_window (struct frame *f)
/* Set the normal size hints for the window manager, for frame F.
FLAGS is the flags word to use--or 0 meaning preserve the flags
that the window now has.
If USER_POSITION is nonzero, we set the USPosition
If USER_POSITION, set the USPosition
flag (this is useful when FLAGS is 0).
The GTK version is in gtkutils.c */
The GTK version is in gtkutils.c. */
#ifndef USE_GTK
void
x_wm_set_size_hint (struct frame *f, long flags, int user_position)
x_wm_set_size_hint (struct frame *f, long flags, bool user_position)
{
XSizeHints size_hints;
Window window = FRAME_OUTER_WINDOW (f);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment