Skip to content

Commit

Permalink
Fix "center" position placement.
Browse files Browse the repository at this point in the history
This completely ignored the window's monitor and fell back to the default
value.
  • Loading branch information
domivogt committed Dec 17, 2021
1 parent 9e609ae commit 44e21c5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion fvwm/placement.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,11 +387,13 @@ static pl_penalty_t __pl_position_get_pos_simple(
position *ret_p, struct pl_ret_t *ret, const struct pl_arg_t *arg)
{
char *spos;
char *string_to_free;
Bool fPointer;
int n;
int i;
Bool is_under_mouse;

string_to_free = NULL;
is_under_mouse = False;
spos = SGET_PLACEMENT_POSITION_STRING(*arg->style);
if (spos == NULL || *spos == 0)
Expand All @@ -401,7 +403,10 @@ static pl_penalty_t __pl_position_get_pos_simple(
}
else if (StrEquals(spos, "Center"))
{
spos = DEFAULT_PLACEMENT_POS_CENTER_STRING;
xasprintf(
&spos, DEFAULT_PLACEMENT_POS_CENTER_STRING,
arg->place_fw->m->si->name);
string_to_free = spos;
i = 1;
}
else if (StrEquals(spos, "UnderMouse"))
Expand Down Expand Up @@ -430,6 +435,10 @@ static pl_penalty_t __pl_position_get_pos_simple(
arg->reason->pos.is_pl_position_string_invalid = 1;
}
}
if (string_to_free != NULL)
{
free(string_to_free);
}
if (n < 2)
{
/* bug */
Expand Down
2 changes: 1 addition & 1 deletion libs/defaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@
/** Other placement related values **/
/* default string for position placement */
#define DEFAULT_PLACEMENT_POSITION_STRING "0 0"
#define DEFAULT_PLACEMENT_POS_CENTER_STRING "screen $[w.screen] 50-50w 50-50w"
#define DEFAULT_PLACEMENT_POS_CENTER_STRING "screen %s 50-50w 50-50w"
#define DEFAULT_PLACEMENT_POS_MOUSE_STRING "m-50w m-50w"

/*** icon layout ***/
Expand Down

0 comments on commit 44e21c5

Please sign in to comment.