Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FvwmIconMan: Don't chop window display string #752

Merged
merged 1 commit into from
Nov 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 5 additions & 18 deletions modules/FvwmIconMan/xmanager.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,13 +455,13 @@ static void resize_window(WinManager *man)
fix_manager_size(man, man->geometry.width, man->geometry.height);
}

static char *make_display_string(WinData *win, char *format, int len)
static char *make_display_string(WinData *win, char *format)
{
#define MAX_DISPLAY_SIZE 1024
#define COPY(field) \
temp_p = win->field; \
if (temp_p) \
while (*temp_p && out_p - buf < len - 1) \
while (*temp_p && out_p - buf < MAX_DISPLAY_SIZE - 1) \
*out_p++ = *temp_p++; \
in_p++;

Expand All @@ -471,10 +471,7 @@ static char *make_display_string(WinData *win, char *format, int len)
in_p = format;
out_p = buf;

if (len > MAX_DISPLAY_SIZE || len <= 0)
len = MAX_DISPLAY_SIZE;

while (*in_p && out_p - buf < len - 1) {
while (*in_p && out_p - buf < MAX_DISPLAY_SIZE - 1) {
if (*in_p == '%') {
switch (*(++in_p)) {
case 'i':
Expand Down Expand Up @@ -1006,7 +1003,6 @@ void del_win_state(WinData *win, int flag)
void set_win_displaystring(WinData *win)
{
WinManager *man = win->manager;
int maxlen;
char *tmp;

if (man && win->button && win->button == man->tipped_button)
Expand All @@ -1021,15 +1017,7 @@ void set_win_displaystring(WinData *win)
return;
}

if (man->window_up) {
assert(man->geometry.width && man->fontwidth);
maxlen = man->geometry.width / man->fontwidth + 2 /* fudge factor */;
}
else {
maxlen = 0;
}

tmp = make_display_string(win, man->formatstring, maxlen);
tmp = make_display_string(win, man->formatstring);
if ((tmp == NULL && win->display_string == NULL) ||
(tmp != NULL && win->display_string != NULL &&
strcmp(tmp, win->display_string) == 0))
Expand Down Expand Up @@ -2583,8 +2571,7 @@ static char *get_tips(WinManager *man, Button *b)
{
CopyString(
&s, make_display_string(
b->drawn_state.win, man->tips_formatstring,
0));
b->drawn_state.win, man->tips_formatstring));
free_str = s;
}
else
Expand Down