summaryrefslogtreecommitdiff
path: root/src/xsettings.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2014-12-26 13:43:00 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2014-12-26 13:44:31 -0800
commit7a305f8bb5d777caf68702212ef85e7b3cbf765b (patch)
treedd04c55cd5e42e2c9f2388dadc96e148210e23a7 /src/xsettings.c
parent7284a174abc03c9ccf45aa43c939585beea351b7 (diff)
downloademacs-7a305f8bb5d777caf68702212ef85e7b3cbf765b.tar.gz
Use bool for boolean in xselect.c, xsettings.c
* xselect.c (x_get_local_selection, struct selection_data) (x_selection_request_lisp_error, struct prop_location) (x_handle_selection_request, x_convert_selection) (waiting_for_other_props_on_window, expect_property_change) (wait_for_property_change, x_handle_property_notify) (x_get_foreign_selection, x_get_window_property) (receive_incremental_selection) (x_get_window_property_as_lisp_data) (lisp_data_to_selection_data, Fx_get_selection_internal) (x_send_client_event): * xselect.c, xterm.h (x_handle_dnd_message): * xsettings.c (dpyinfo_valid, parse_settings, read_settings) (apply_xft_settings, read_and_apply_settings) (xft_settings_event, init_gsettings, init_xsettings) (syms_of_xsettings): Use bool for boolean. * xselect.c (x_get_window_property): Omit last arg, which was an unused boolean. * xsettings.c (apply_xft_settings): Remove 2nd arg, which was always true. All callers changed.
Diffstat (limited to 'src/xsettings.c')
-rw-r--r--src/xsettings.c58
1 files changed, 28 insertions, 30 deletions
diff --git a/src/xsettings.c b/src/xsettings.c
index 5f4275df545..afdeab9f206 100644
--- a/src/xsettings.c
+++ b/src/xsettings.c
@@ -68,11 +68,11 @@ store_config_changed_event (Lisp_Object arg, Lisp_Object display_name)
kbd_buffer_store_event (&event);
}
-/* Return non-zero if DPYINFO is still valid. */
-static int
+/* Return true if DPYINFO is still valid. */
+static bool
dpyinfo_valid (struct x_display_info *dpyinfo)
{
- int found = 0;
+ bool found = false;
if (dpyinfo != NULL)
{
struct x_display_info *d;
@@ -419,7 +419,7 @@ parse_settings (unsigned char *prop,
CARD32 vlen, ival = 0;
char name[128]; /* The names we are looking for are not this long. */
char sval[128]; /* The values we are looking for are not this long. */
- int want_this;
+ bool want_this;
int to_cpy;
sval[0] = '\0';
@@ -565,9 +565,9 @@ parse_settings (unsigned char *prop,
/* Read settings from the XSettings property window on display for DPYINFO.
Store settings read in SETTINGS.
- Return non-zero if successful, zero if not. */
+ Return true iff successful. */
-static int
+static bool
read_settings (struct x_display_info *dpyinfo, struct xsettings *settings)
{
Atom act_type;
@@ -597,17 +597,16 @@ read_settings (struct x_display_info *dpyinfo, struct xsettings *settings)
}
/* Apply Xft settings in SETTINGS to the Xft library.
- If SEND_EVENT_P is non-zero store a Lisp event that Xft settings changed. */
+ Store a Lisp event that Xft settings changed. */
static void
apply_xft_settings (struct x_display_info *dpyinfo,
- int send_event_p,
struct xsettings *settings)
{
#ifdef HAVE_XFT
FcPattern *pat;
struct xsettings oldsettings;
- int changed = 0;
+ bool changed = false;
memset (&oldsettings, 0, sizeof (oldsettings));
pat = FcPatternCreate ();
@@ -627,7 +626,7 @@ apply_xft_settings (struct x_display_info *dpyinfo,
{
FcPatternDel (pat, FC_ANTIALIAS);
FcPatternAddBool (pat, FC_ANTIALIAS, settings->aa);
- ++changed;
+ changed = true;
oldsettings.aa = settings->aa;
}
@@ -636,7 +635,7 @@ apply_xft_settings (struct x_display_info *dpyinfo,
{
FcPatternDel (pat, FC_HINTING);
FcPatternAddBool (pat, FC_HINTING, settings->hinting);
- ++changed;
+ changed = true;
oldsettings.hinting = settings->hinting;
}
if ((settings->seen & SEEN_RGBA) != 0 && oldsettings.rgba != settings->rgba)
@@ -644,7 +643,7 @@ apply_xft_settings (struct x_display_info *dpyinfo,
FcPatternDel (pat, FC_RGBA);
FcPatternAddInteger (pat, FC_RGBA, settings->rgba);
oldsettings.rgba = settings->rgba;
- ++changed;
+ changed = true;
}
/* Older fontconfig versions don't have FC_LCD_FILTER. */
@@ -653,7 +652,7 @@ apply_xft_settings (struct x_display_info *dpyinfo,
{
FcPatternDel (pat, FC_LCD_FILTER);
FcPatternAddInteger (pat, FC_LCD_FILTER, settings->lcdfilter);
- ++changed;
+ changed = true;
oldsettings.lcdfilter = settings->lcdfilter;
}
@@ -663,7 +662,7 @@ apply_xft_settings (struct x_display_info *dpyinfo,
{
FcPatternDel (pat, FC_HINT_STYLE);
FcPatternAddInteger (pat, FC_HINT_STYLE, settings->hintstyle);
- ++changed;
+ changed = true;
oldsettings.hintstyle = settings->hintstyle;
}
#endif
@@ -673,7 +672,7 @@ apply_xft_settings (struct x_display_info *dpyinfo,
{
FcPatternDel (pat, FC_DPI);
FcPatternAddDouble (pat, FC_DPI, settings->dpi);
- ++changed;
+ changed = true;
oldsettings.dpi = settings->dpi;
/* Changing the DPI on this display affects all frames on it.
@@ -699,9 +698,8 @@ apply_xft_settings (struct x_display_info *dpyinfo,
char buf[sizeof format + d_formats * d_growth + lf_formats * lf_growth];
XftDefaultSet (dpyinfo->display, pat);
- if (send_event_p)
- store_config_changed_event (Qfont_render,
- XCAR (dpyinfo->name_list_element));
+ store_config_changed_event (Qfont_render,
+ XCAR (dpyinfo->name_list_element));
Vxft_settings
= make_formatted_string (buf, format,
oldsettings.aa, oldsettings.hinting,
@@ -715,17 +713,17 @@ apply_xft_settings (struct x_display_info *dpyinfo,
}
/* Read XSettings from the display for DPYINFO.
- If SEND_EVENT_P is non-zero store a Lisp event settings that changed. */
+ If SEND_EVENT_P store a Lisp event settings that changed. */
static void
-read_and_apply_settings (struct x_display_info *dpyinfo, int send_event_p)
+read_and_apply_settings (struct x_display_info *dpyinfo, bool send_event_p)
{
struct xsettings settings;
if (!read_settings (dpyinfo, &settings))
return;
- apply_xft_settings (dpyinfo, True, &settings);
+ apply_xft_settings (dpyinfo, &settings);
if (settings.seen & SEEN_TB_STYLE)
{
if (send_event_p)
@@ -751,27 +749,27 @@ read_and_apply_settings (struct x_display_info *dpyinfo, int send_event_p)
void
xft_settings_event (struct x_display_info *dpyinfo, const XEvent *event)
{
- bool check_window_p = 0, apply_settings_p = 0;
+ bool check_window_p = false, apply_settings_p = false;
switch (event->type)
{
case DestroyNotify:
if (dpyinfo->xsettings_window == event->xany.window)
- check_window_p = 1;
+ check_window_p = true;
break;
case ClientMessage:
if (event->xclient.message_type == dpyinfo->Xatom_xsettings_mgr
&& event->xclient.data.l[1] == dpyinfo->Xatom_xsettings_sel
&& event->xclient.window == dpyinfo->root_window)
- check_window_p = 1;
+ check_window_p = true;
break;
case PropertyNotify:
if (event->xproperty.window == dpyinfo->xsettings_window
&& event->xproperty.state == PropertyNewValue
&& event->xproperty.atom == dpyinfo->Xatom_xsettings_prop)
- apply_settings_p = 1;
+ apply_settings_p = true;
break;
}
@@ -781,11 +779,11 @@ xft_settings_event (struct x_display_info *dpyinfo, const XEvent *event)
dpyinfo->xsettings_window = None;
get_prop_window (dpyinfo);
if (dpyinfo->xsettings_window != None)
- apply_settings_p = 1;
+ apply_settings_p = true;
}
if (apply_settings_p)
- read_and_apply_settings (dpyinfo, True);
+ read_and_apply_settings (dpyinfo, true);
}
/* Initialize GSettings and read startup values. */
@@ -795,7 +793,7 @@ init_gsettings (void)
{
#ifdef HAVE_GSETTINGS
GVariant *val;
- int schema_found = 0;
+ bool schema_found = false;
#if ! GLIB_CHECK_VERSION (2, 36, 0)
g_type_init ();
@@ -937,7 +935,7 @@ init_xsettings (struct x_display_info *dpyinfo)
get_prop_window (dpyinfo);
if (dpyinfo->xsettings_window != None)
- read_and_apply_settings (dpyinfo, False);
+ read_and_apply_settings (dpyinfo, false);
unblock_input ();
}
@@ -1030,7 +1028,7 @@ syms_of_xsettings (void)
When this is non-nil and the system defined fixed width font changes, we
update frames dynamically.
If this variable is nil, Emacs ignores system font changes. */);
- use_system_font = 0;
+ use_system_font = false;
DEFVAR_LISP ("xft-settings", Vxft_settings,
doc: /* Font settings applied to Xft. */);