summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJérémie Courrèges-Anglas <jca@wxcvbn.org>2013-02-06 19:03:07 +0100
committerJérémie Courrèges-Anglas <jca@wxcvbn.org>2013-02-06 21:17:54 +0100
commit2685676e118cd63380e6a12ce81ce5d4f0badc0a (patch)
treee32bbf16aa5d84a68edfa061f68506a876f966fe /src
parent20c5d11a3be2843c808ba84f971ed3fed011e144 (diff)
downloadratpoison-2685676e118cd63380e6a12ce81ce5d4f0badc0a.zip
rp_text_width: remove "font" argument
* (globals.[ch]): remove rp_text_width "font" arg, since its value is always the global variable defaults.font (non-Xft case). remove one #ifdef while here * update rp_text_width() calls to match new signature
Diffstat (limited to 'src')
-rw-r--r--src/actions.c14
-rw-r--r--src/bar.c10
-rw-r--r--src/globals.c9
-rw-r--r--src/globals.h2
-rw-r--r--src/input.c9
-rw-r--r--src/split.c4
6 files changed, 22 insertions, 26 deletions
diff --git a/src/actions.c b/src/actions.c
index 912f0a8..9227feb 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -1772,7 +1772,7 @@ read_frame (struct sbuf *s, struct cmdarg **arg)
determine the height and width of the window. */
/* num = xsprintf (" %d ", cur->number); */
num = frame_selector (cur->number);
- width = defaults.bar_x_padding * 2 + rp_text_width (screen, defaults.font, num, -1);
+ width = defaults.bar_x_padding * 2 + rp_text_width (screen, num, -1);
height = (FONT_HEIGHT (screen) + defaults.bar_y_padding * 2);
/* Create and map the window. */
@@ -3310,7 +3310,7 @@ cmd_license (int interactive UNUSED, struct cmdarg **args UNUSED)
{
int tmp;
- tmp = rp_text_width (s, defaults.font, license_text[i], -1);
+ tmp = rp_text_width (s, license_text[i], -1);
if (tmp > max_width)
max_width = tmp;
}
@@ -3389,7 +3389,7 @@ cmd_help (int interactive, struct cmdarg **args)
keysym_name = keysym_to_string (prefix_key.sym, prefix_key.state);
rp_draw_string (s, s->help_window, STYLE_NORMAL,
- 10 + rp_text_width (s, defaults.font, "Command key: ", -1),
+ 10 + rp_text_width (s, "Command key: ", -1),
y + FONT_ASCENT(s),
keysym_name, -1);
free (keysym_name);
@@ -3408,8 +3408,8 @@ cmd_help (int interactive, struct cmdarg **args)
x, y + FONT_ASCENT(s),
keysym_name, -1);
- if (rp_text_width (s, defaults.font, keysym_name, -1) > max_width)
- max_width = rp_text_width (s, defaults.font, keysym_name, -1);
+ if (rp_text_width (s, keysym_name, -1) > max_width)
+ max_width = rp_text_width (s, keysym_name, -1);
free (keysym_name);
}
@@ -3419,9 +3419,9 @@ cmd_help (int interactive, struct cmdarg **args)
x, y + FONT_ASCENT(s),
map->actions[i].data, -1);
- if (rp_text_width (s, defaults.font, map->actions[i].data, -1) > max_width)
+ if (rp_text_width (s, map->actions[i].data, -1) > max_width)
{
- max_width = rp_text_width (s, defaults.font, map->actions[i].data, -1);
+ max_width = rp_text_width (s, map->actions[i].data, -1);
}
}
diff --git a/src/bar.c b/src/bar.c
index 47ada2d..22dcc92 100644
--- a/src/bar.c
+++ b/src/bar.c
@@ -262,7 +262,7 @@ max_line_length (char* msg)
int current_width;
/* Check if this line is the longest so far. */
- current_width = rp_text_width (s, defaults.font, msg + start, i - start);
+ current_width = rp_text_width (s, msg + start, i - start);
if(current_width > ret)
{
ret = current_width;
@@ -480,12 +480,10 @@ get_mark_box (char *msg, size_t mark_start, size_t mark_end,
if (mark_start == 0 || start_pos_in_line == 0)
start = 0;
else
- start = rp_text_width (s, defaults.font,
- &msg[start_line_beginning],
+ start = rp_text_width (s, &msg[start_line_beginning],
start_pos_in_line) + defaults.bar_x_padding;
-
- end = rp_text_width (s, defaults.font,
- &msg[end_line_beginning],
+
+ end = rp_text_width (s, &msg[end_line_beginning],
end_pos_in_line) + defaults.bar_x_padding * 2;
if (mark_end != strlen (msg))
diff --git a/src/globals.c b/src/globals.c
index fda69bf..05ebe28 100644
--- a/src/globals.c
+++ b/src/globals.c
@@ -321,12 +321,9 @@ rp_draw_string (rp_screen *s, Drawable d, int style, int x, int y,
}
int
-#ifdef USE_XFT_FONT
-rp_text_width (rp_screen *s, XFontSet font UNUSED, char *string, int count)
-#else
-rp_text_width (rp_screen *s UNUSED, XFontSet font, char *string, int count)
-#endif
+rp_text_width (rp_screen *s, char *string, int count)
{
+ (void) s; /* avoid "unused" warning */
if (count < 0)
count = strlen (string);
@@ -343,7 +340,7 @@ rp_text_width (rp_screen *s UNUSED, XFontSet font, char *string, int count)
PRINT_ERROR (("No Xft font available.\n"));
return 0;
#else
- return XmbTextEscapement (font, string, count);
+ return XmbTextEscapement (defaults.font, string, count);
#endif
}
diff --git a/src/globals.h b/src/globals.h
index 61081f4..12ccffd 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -212,6 +212,6 @@ void init_globals (void);
/* Wrapper font functions to support Xft */
void rp_draw_string (rp_screen *s, Drawable d, int style, int x, int y, char *string, int length);
-int rp_text_width (rp_screen *s, XFontSet font, char *string, int count);
+int rp_text_width (rp_screen *s, char *string, int count);
#endif
diff --git a/src/input.c b/src/input.c
index 8c8ab80..c8c031e 100644
--- a/src/input.c
+++ b/src/input.c
@@ -428,8 +428,8 @@ read_key (KeySym *keysym, unsigned int *modifiers, char *keysym_name, int len)
static void
update_input_window (rp_screen *s, rp_input_line *line)
{
- int prompt_width = rp_text_width (s, defaults.font, line->prompt, -1);
- int input_width = rp_text_width (s, defaults.font, line->buffer, line->length);
+ int prompt_width = rp_text_width (s, line->prompt, -1);
+ int input_width = rp_text_width (s, line->buffer, line->length);
int total_width;
GC lgc;
XGCValues gcv;
@@ -468,9 +468,10 @@ update_input_window (rp_screen *s, rp_input_line *line)
/* Draw a cheap-o cursor - MkII */
XFillRectangle (dpy, s->input_window, lgc,
- defaults.bar_x_padding + prompt_width + rp_text_width (s, defaults.font, line->buffer, line->position),
+ defaults.bar_x_padding + prompt_width +
+ rp_text_width (s, line->buffer, line->position),
defaults.bar_y_padding,
- rp_text_width (s, defaults.font, &line->buffer[line->position], 1),
+ rp_text_width (s, &line->buffer[line->position], 1),
FONT_HEIGHT (s));
XFlush (dpy);
diff --git a/src/split.c b/src/split.c
index 480fca1..1a8bf8e 100644
--- a/src/split.c
+++ b/src/split.c
@@ -972,8 +972,8 @@ show_frame_message (char *msg)
sbuf_concat (msgbuf, EMPTY_FRAME_MESSAGE);
}
- width = defaults.bar_x_padding * 2 + rp_text_width (s, defaults.font, msgbuf->data,
- msgbuf->len);
+ width = defaults.bar_x_padding * 2
+ + rp_text_width (s, msgbuf->data, msgbuf->len);
height = (FONT_HEIGHT (s) + defaults.bar_y_padding * 2);
/* We don't want another frame indicator to be displayed on another