emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r110172: gnutls.c, gtkutil.c: Use boo


From: Paul Eggert
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r110172: gnutls.c, gtkutil.c: Use bool for boolean.
Date: Sun, 23 Sep 2012 12:36:31 -0700
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 110172
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Sun 2012-09-23 12:36:31 -0700
message:
  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.
modified:
  src/ChangeLog
  src/frame.h
  src/gnutls.c
  src/gtkutil.c
  src/gtkutil.h
  src/nsmenu.m
  src/w32menu.c
  src/w32term.c
  src/xfns.c
  src/xmenu.c
  src/xterm.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-09-23 18:03:48 +0000
+++ b/src/ChangeLog     2012-09-23 19:36:31 +0000
@@ -1,3 +1,30 @@
+2012-09-23  Paul Eggert  <address@hidden>
+
+       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  <address@hidden>
 
        * makefile.w32-in (BLOCKINPUT_H): Remove.

=== modified file 'src/frame.h'
--- a/src/frame.h       2012-09-05 17:05:32 +0000
+++ b/src/frame.h       2012-09-23 19:36:31 +0000
@@ -1203,7 +1203,7 @@
 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 @@
                                           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 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

=== modified file 'src/gnutls.c'
--- a/src/gnutls.c      2012-09-23 09:16:57 +0000
+++ b/src/gnutls.c      2012-09-23 19:36:31 +0000
@@ -30,15 +30,14 @@
 #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 @@
                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 @@
   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 @@
   }
 }
 
-/* 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 @@
 
   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.  */
     }

=== modified file 'src/gtkutil.c'
--- a/src/gtkutil.c     2012-09-23 08:44:20 +0000
+++ b/src/gtkutil.c     2012-09-23 19:36:31 +0000
@@ -576,16 +576,16 @@
 
 /* Check for special colors used in face spec for region face.
    The colors are fetched from the Gtk+ theme.
-   Return 1 if color was found, 0 if not.  */
+   Return true if color was found, false if not.  */
 
-int
+bool
 xg_check_special_colors (struct frame *f,
                          const char *color_name,
                          XColor *color)
 {
-  int success_p = 0;
-  int get_bg = strcmp ("gtk_selection_bg_color", color_name) == 0;
-  int get_fg = !get_bg && strcmp ("gtk_selection_fg_color", color_name) == 0;
+  bool success_p = 0;
+  bool get_bg = strcmp ("gtk_selection_bg_color", color_name) == 0;
+  bool get_fg = !get_bg && strcmp ("gtk_selection_fg_color", color_name) == 0;
 
   if (! FRAME_GTK_WIDGET (f) || ! (get_bg || get_fg))
     return success_p;
@@ -604,8 +604,9 @@
       gtk_style_context_get_background_color (gsty, state, &col);
 
     sprintf (buf, "rgbi:%lf/%lf/%lf", col.red, col.green, col.blue);
-    success_p = XParseColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f),
-                             buf, color);
+    success_p = (XParseColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f),
+                             buf, color)
+                != 0);
 #else
     GtkStyle *gsty = gtk_widget_get_style (FRAME_GTK_WIDGET (f));
     GdkColor *grgb = get_bg
@@ -703,9 +704,9 @@
 #endif /* USE_GTK_TOOLTIP */
 
 /* Prepare a tooltip to be shown, i.e. calculate WIDTH and HEIGHT.
-   Return zero if no system tooltip available, non-zero otherwise.  */
+   Return true if a system tooltip is available.  */
 
-int
+bool
 xg_prepare_tooltip (FRAME_PTR f,
                     Lisp_Object string,
                     int *width,
@@ -778,13 +779,13 @@
 }
 
 /* Hide tooltip if shown.  Do nothing if not shown.
-   Return non-zero if tip was hidden, non-zero if not (i.e. not using
+   Return true if tip was hidden, false if not (i.e. not using
    system tooltips).  */
 
-int
+bool
 xg_hide_tooltip (FRAME_PTR f)
 {
-  int ret = 0;
+  bool ret = 0;
 #ifdef USE_GTK_TOOLTIP
   if (f->output_data.x->ttip_window)
     {
@@ -1110,9 +1111,9 @@
 }
 
 /* Create and set up the GTK widgets for frame F.
-   Return 0 if creation failed, non-zero otherwise.  */
+   Return true if creation succeeded.  */
 
-int
+bool
 xg_create_frame_widgets (FRAME_PTR f)
 {
   GtkWidget *wtop;
@@ -1309,11 +1310,11 @@
 /* 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 User Position
+   If USER_POSITION, set the User Position
    flag (this is useful when FLAGS is 0).  */
 
 void
-x_wm_set_size_hint (FRAME_PTR f, long int flags, int user_position)
+x_wm_set_size_hint (FRAME_PTR f, long int flags, bool user_position)
 {
   /* Must use GTK routines here, otherwise GTK resets the size hints
      to its own defaults.  */
@@ -1519,7 +1520,7 @@
 
   /* If the number of buttons is greater than 4, make two rows of buttons
      instead.  This looks better.  */
-  int make_two_rows = total_buttons > 4;
+  bool make_two_rows = total_buttons > 4;
 
   if (right_buttons == 0) right_buttons = total_buttons/2;
   left_buttons = total_buttons - right_buttons;
@@ -1716,10 +1717,9 @@
 /***********************************************************************
                       File dialog functions
  ***********************************************************************/
-/* Return non-zero if the old file selection dialog is being used.
-   Return zero if not.  */
+/* Return true if the old file selection dialog is being used.  */
 
-int
+bool
 xg_uses_old_file_dialog (void)
 {
 #ifdef HAVE_GTK_FILE_SELECTION_NEW
@@ -1790,7 +1790,7 @@
    F is the current frame.
    PROMPT is a prompt to show to the user.  May not be NULL.
    DEFAULT_FILENAME is a default selection to be displayed.  May be NULL.
-   If MUSTMATCH_P is non-zero, the returned file name must be an existing
+   If MUSTMATCH_P, the returned file name must be an existing
    file.  (Actually, this only has cosmetic effects, the user can
    still enter a non-existing file.)  *FUNC is set to a function that
    can be used to retrieve the selected file name from the returned widget.
@@ -1801,7 +1801,7 @@
 xg_get_file_with_chooser (FRAME_PTR f,
                          char *prompt,
                          char *default_filename,
-                         int mustmatch_p, int only_dir_p,
+                         bool mustmatch_p, bool only_dir_p,
                          xg_get_file_func *func)
 {
   char msgbuf[1024];
@@ -1913,7 +1913,7 @@
    F is the current frame.
    PROMPT is a prompt to show to the user.  May not be NULL.
    DEFAULT_FILENAME is a default selection to be displayed.  May be NULL.
-   If MUSTMATCH_P is non-zero, the returned file name must be an existing
+   If MUSTMATCH_P, the returned file name must be an existing
    file.  *FUNC is set to a function that can be used to retrieve the
    selected file name from the returned widget.
 
@@ -1923,7 +1923,7 @@
 xg_get_file_with_selection (FRAME_PTR f,
                             char *prompt,
                             char *default_filename,
-                            int mustmatch_p, int only_dir_p,
+                            bool mustmatch_p, bool only_dir_p,
                             xg_get_file_func *func)
 {
   GtkWidget *filewin;
@@ -1955,7 +1955,7 @@
    F is the current frame.
    PROMPT is a prompt to show to the user.  May not be NULL.
    DEFAULT_FILENAME is a default selection to be displayed.  May be NULL.
-   If MUSTMATCH_P is non-zero, the returned file name must be an existing
+   If MUSTMATCH_P, the returned file name must be an existing
    file.
 
    Returns a file name or NULL if no file was selected.
@@ -1965,8 +1965,8 @@
 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)
 {
   GtkWidget *w = 0;
   char *fn = 0;
@@ -2403,9 +2403,9 @@
 
 static int xg_detached_menus;
 
-/* Returns non-zero if there are detached menus.  */
+/* Return true if there are detached menus.  */
 
-int
+bool
 xg_have_tear_offs (void)
 {
   return xg_detached_menus > 0;
@@ -2509,10 +2509,9 @@
    SELECT_CB is the callback to use when a menu item is selected.
    DEACTIVATE_CB is the callback to use when a sub menu is not shown anymore.
    HIGHLIGHT_CB is the callback to call when entering/leaving menu items.
-   POP_UP_P is non-zero if we shall create a popup menu.
-   MENU_BAR_P is non-zero if we shall create a menu bar.
-   ADD_TEAROFF_P is non-zero if we shall add a tearoff menu item.  Ignored
-   if MENU_BAR_P is non-zero.
+   If POP_UP_P, create a popup menu.
+   If MENU_BAR_P, create a menu bar.
+   If ADD_TEAROFF_P, add a tearoff menu item.  Ignored if MENU_BAR_P.
    TOPMENU is the topmost GtkWidget that others shall be placed under.
    It may be NULL, in that case we create the appropriate widget
    (menu bar or menu item depending on POP_UP_P and MENU_BAR_P)
@@ -2532,9 +2531,9 @@
               GCallback select_cb,
               GCallback deactivate_cb,
               GCallback highlight_cb,
-              int pop_up_p,
-              int menu_bar_p,
-              int add_tearoff_p,
+              bool pop_up_p,
+              bool menu_bar_p,
+              bool add_tearoff_p,
               GtkWidget *topmenu,
               xg_menu_cb_data *cl_data,
               const char *name)
@@ -2674,8 +2673,8 @@
                  GCallback highlight_cb)
 {
   GtkWidget *w = 0;
-  int menu_bar_p = strcmp (type, "menubar") == 0;
-  int pop_up_p = strcmp (type, "popup") == 0;
+  bool menu_bar_p = strcmp (type, "menubar") == 0;
+  bool pop_up_p = strcmp (type, "popup") == 0;
 
   if (strcmp (type, "dialog") == 0)
     {
@@ -2728,12 +2727,12 @@
   return gtk_label_get_label (wlabel);
 }
 
-/* Return non-zero if the menu item WITEM has the text LABEL.  */
+/* Return true if the menu item WITEM has the text LABEL.  */
 
-static int
+static bool
 xg_item_label_same_p (GtkMenuItem *witem, const char *label)
 {
-  int is_same = 0;
+  bool is_same = 0;
   char *utf8_label = get_utf8_string (label);
   const char *old_label = witem ? xg_get_menu_item_label (witem) : 0;
 
@@ -2824,8 +2823,8 @@
     {
       GtkMenuItem *witem = GTK_MENU_ITEM (iter->data);
       GtkMenuItem *witem2 = 0;
-      int val_in_menubar = 0;
-      int iter_in_new_menubar = 0;
+      bool val_in_menubar = 0;
+      bool iter_in_new_menubar = 0;
       GList *iter2;
       widget_value *cur;
 
@@ -3103,7 +3102,7 @@
   GList *list = 0;
   GList *iter;
   widget_value *cur;
-  int has_tearoff_p = 0;
+  bool has_tearoff_p = 0;
   GList *first_radio = 0;
 
   if (submenu)
@@ -3225,7 +3224,7 @@
 /* Update the MENUBAR.
    F is the frame the menu bar belongs to.
    VAL describes the contents of the menu bar.
-   If DEEP_P is non-zero, rebuild all but the top level menu names in
+   If DEEP_P, rebuild all but the top level menu names in
    the MENUBAR.  If DEEP_P is zero, just rebuild the names in the menubar.
    SELECT_CB is the callback to use when a menu item is selected.
    DEACTIVATE_CB is the callback to use when a sub menu is not shown anymore.
@@ -3233,7 +3232,7 @@
 
 void
 xg_modify_menubar_widgets (GtkWidget *menubar, FRAME_PTR f, widget_value *val,
-                          int deep_p,
+                          bool deep_p,
                            GCallback select_cb, GCallback deactivate_cb,
                           GCallback highlight_cb)
 {
@@ -3317,19 +3316,19 @@
 }
 
 /* Recompute all the widgets of frame F, when the menu bar has been
-   changed.  Value is non-zero if widgets were updated.  */
+   changed.  */
 
-int
+void
 xg_update_frame_menubar (FRAME_PTR f)
 {
   struct x_output *x = f->output_data.x;
   GtkRequisition req;
 
   if (!x->menubar_widget || gtk_widget_get_mapped (x->menubar_widget))
-    return 0;
+    return;
 
   if (x->menubar_widget && gtk_widget_get_parent (x->menubar_widget))
-    return 0; /* Already done this, happens for frames created invisible.  */
+    return; /* Already done this, happens for frames created invisible.  */
 
   block_input ();
 
@@ -3352,8 +3351,6 @@
       xg_height_or_width_changed (f);
     }
   unblock_input ();
-
-  return 1;
 }
 
 /* Get rid of the menu bar of frame F, and free its storage.
@@ -3378,7 +3375,7 @@
     }
 }
 
-int
+bool
 xg_event_is_for_menubar (FRAME_PTR f, XEvent *event)
 {
   struct x_output *x = f->output_data.x;
@@ -3425,7 +3422,7 @@
         break;
     }
   g_list_free (list);
-  return iter == 0 ? 0 : 1;
+  return iter != 0;
 }
 
 
@@ -3438,7 +3435,7 @@
 /* Setting scroll bar values invokes the callback.  Use this variable
    to indicate that callback should do nothing.  */
 
-int xg_ignore_gtk_scrollbar;
+bool xg_ignore_gtk_scrollbar;
 
 /* The width of the scroll bar for the current theme.  */
 
@@ -3764,7 +3761,7 @@
       int size, value;
       int old_size;
       int new_step;
-      int changed = 0;
+      bool changed = 0;
 
       adj = gtk_range_get_adjustment (GTK_RANGE (wscroll));
 
@@ -3829,17 +3826,15 @@
     }
 }
 
-/* Return non-zero if EVENT is for a scroll bar in frame F.
+/* Return true if EVENT is for a scroll bar in frame F.
    When the same X window is used for several Gtk+ widgets, we cannot
    say for sure based on the X window alone if an event is for the
-   frame.  This function does additional checks.
-
-   Return non-zero if the event is for a scroll bar, zero otherwise.  */
-
-int
+   frame.  This function does additional checks.  */
+
+bool
 xg_event_is_for_scrollbar (FRAME_PTR f, XEvent *event)
 {
-  int retval = 0;
+  bool retval = 0;
 
   if (f && event->type == ButtonPress && event->xbutton.button < 4)
     {
@@ -4270,7 +4265,7 @@
 xg_pack_tool_bar (FRAME_PTR f, Lisp_Object pos)
 {
   struct x_output *x = f->output_data.x;
-  int into_hbox = EQ (pos, Qleft) || EQ (pos, Qright);
+  bool into_hbox = EQ (pos, Qleft) || EQ (pos, Qright);
 
   toolbar_set_orientation (x->toolbar_widget,
                            into_hbox
@@ -4302,7 +4297,7 @@
     }
   else
     {
-      int vbox_pos = x->menubar_widget ? 1 : 0;
+      bool vbox_pos = x->menubar_widget != 0;
       gtk_handle_box_set_handle_position (GTK_HANDLE_BOX (x->handlebox_widget),
                                           GTK_POS_LEFT);
       gtk_box_pack_start (GTK_BOX (x->vbox_widget), x->handlebox_widget,
@@ -4393,7 +4388,7 @@
                    GtkWidget *wimage,
                    GtkWidget **wbutton,
                    const char *label,
-                   int i, int horiz, int text_image)
+                   int i, bool horiz, bool text_image)
 {
   GtkToolItem *ti = gtk_tool_item_new ();
   GtkWidget *vb = gtk_box_new (horiz
@@ -4488,11 +4483,11 @@
   return ti;
 }
 
-static int
-is_box_type (GtkWidget *vb, int is_horizontal)
+static bool
+is_box_type (GtkWidget *vb, bool is_horizontal)
 {
 #ifdef HAVE_GTK3
-  int ret = 0;
+  bool ret = 0;
   if (GTK_IS_BOX (vb))
     {
       GtkOrientation ori = gtk_orientable_get_orientation (GTK_ORIENTABLE 
(vb));
@@ -4506,10 +4501,10 @@
 }
 
 
-static int
+static bool
 xg_tool_item_stale_p (GtkWidget *wbutton, const char *stock_name,
                      const char *icon_name, const struct image *img,
-                     const char *label, int horiz)
+                     const char *label, bool horiz)
 {
   gpointer old;
   GtkWidget *wimage;
@@ -4551,7 +4546,7 @@
   return 0;
 }
 
-static int
+static bool
 xg_update_tool_bar_sizes (FRAME_PTR f)
 {
   struct x_output *x = f->output_data.x;
@@ -4607,9 +4602,9 @@
   GtkToolbar *wtoolbar;
   GtkToolItem *ti;
   GtkTextDirection dir;
-  int pack_tool_bar = x->handlebox_widget == NULL;
+  bool pack_tool_bar = x->handlebox_widget == NULL;
   Lisp_Object style;
-  int text_image, horiz;
+  bool text_image, horiz;
   struct xg_frame_tb_info *tbinfo;
 
   if (! FRAME_GTK_WIDGET (f))
@@ -4673,8 +4668,8 @@
 
   for (i = j = 0; i < f->n_tool_bar_items; ++i)
     {
-      int enabled_p = !NILP (PROP (TOOL_BAR_ITEM_ENABLED_P));
-      int selected_p = !NILP (PROP (TOOL_BAR_ITEM_SELECTED_P));
+      bool enabled_p = !NILP (PROP (TOOL_BAR_ITEM_ENABLED_P));
+      bool selected_p = !NILP (PROP (TOOL_BAR_ITEM_SELECTED_P));
       int idx;
       ptrdiff_t img_id;
       int icon_size = 0;
@@ -4687,7 +4682,7 @@
       Lisp_Object rtl;
       GtkWidget *wbutton = NULL;
       Lisp_Object specified_file;
-      int vert_only = ! NILP (PROP (TOOL_BAR_ITEM_VERT_ONLY));
+      bool vert_only = ! NILP (PROP (TOOL_BAR_ITEM_VERT_ONLY));
       const char *label
        = (EQ (style, Qimage) || (vert_only && horiz)) ? NULL
        : STRINGP (PROP (TOOL_BAR_ITEM_LABEL))
@@ -4882,7 +4877,7 @@
   if (x->toolbar_widget)
     {
       struct xg_frame_tb_info *tbinfo;
-      int is_packed = x->handlebox_widget != 0;
+      bool is_packed = x->handlebox_widget != 0;
       block_input ();
       /* We may have created the toolbar_widget in xg_create_tool_bar, but
          not the x->handlebox_widget which is created in xg_pack_tool_bar.  */
@@ -4919,13 +4914,13 @@
     }
 }
 
-int
+void
 xg_change_toolbar_position (FRAME_PTR f, Lisp_Object pos)
 {
   struct x_output *x = f->output_data.x;
 
   if (! x->toolbar_widget || ! x->handlebox_widget)
-    return 1;
+    return;
 
   block_input ();
   g_object_ref (x->handlebox_widget);
@@ -4941,7 +4936,6 @@
     xg_height_or_width_changed (f);
 
   unblock_input ();
-  return 1;
 }
 
 

=== modified file 'src/gtkutil.h'
--- a/src/gtkutil.h     2012-09-02 10:53:46 +0000
+++ b/src/gtkutil.h     2012-09-23 19:36:31 +0000
@@ -79,13 +79,13 @@
 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 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 int xg_event_is_for_menubar (FRAME_PTR f, XEvent *event);
-
-extern int xg_have_tear_offs (void);
+extern void xg_update_frame_menubar (FRAME_PTR f);
+
+extern bool xg_event_is_for_menubar (FRAME_PTR f, XEvent *event);
+
+extern bool xg_have_tear_offs (void);
 
 extern ptrdiff_t xg_get_scroll_id_for_window (Display *dpy, Window wid);
 
@@ -131,12 +131,12 @@
                                              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_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 @@
 
 /* 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 */

=== modified file 'src/nsmenu.m'
--- a/src/nsmenu.m      2012-09-23 08:44:20 +0000
+++ b/src/nsmenu.m      2012-09-23 19:36:31 +0000
@@ -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)timeout_handler: (NSTimer *)timedEntry
 {
   NSEvent *nxev = [NSEvent otherEventWithType: NSApplicationDefined

=== modified file 'src/w32menu.c'
--- a/src/w32menu.c     2012-09-23 08:44:20 +0000
+++ b/src/w32menu.c     2012-09-23 19:36:31 +0000
@@ -85,7 +85,7 @@
 
 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 @@
    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;

=== modified file 'src/w32term.c'
--- a/src/w32term.c     2012-09-23 17:33:16 +0000
+++ b/src/w32term.c     2012-09-23 19:36:31 +0000
@@ -197,7 +197,7 @@
 
 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 @@
 /* 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);
 

=== modified file 'src/xfns.c'
--- a/src/xfns.c        2012-09-23 08:44:20 +0000
+++ b/src/xfns.c        2012-09-23 19:36:31 +0000
@@ -656,8 +656,8 @@
   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 @@
 #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);

=== modified file 'src/xmenu.c'
--- a/src/xmenu.c       2012-09-23 08:44:20 +0000
+++ b/src/xmenu.c       2012-09-23 19:36:31 +0000
@@ -834,13 +834,13 @@
 #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 @@
   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 @@
   EmacsFrameSetCharSize (x->edit_widget, columns, rows);
   unblock_input ();
 #endif
-  return 1;
 }
 
 #ifdef USE_LUCID
@@ -921,7 +920,7 @@
    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

=== modified file 'src/xterm.c'
--- a/src/xterm.c       2012-09-23 10:03:35 +0000
+++ b/src/xterm.c       2012-09-23 19:36:31 +0000
@@ -9541,13 +9541,13 @@
 /* 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);


reply via email to

[Prev in Thread] Current Thread [Next in Thread]