On Fri, Dec 17, 2021 at 12:42:25AM +0000, Hegel3DReloaded wrote: > On Friday, December 17th, 2021 at 1:18 AM, Dominik Vogt <dominik.v...@gmx.de> > wrote: > > > When __pl_position_get_pos_simple() enconters a "center" argument > > it replaces it with DEFAULT_PLACEMENT_POS_CENTER_STRING which is > > defined to "screen $[w.screen] 50-50w 50-50w" as of commit id > > 71c57858ffebdede86c2097464339b65b5742864: > > > > > PositionPlacement: include screen for Center > > > When using "PositionPlacement Center", take into account the screen the > > > window is on, so it's centered appropriately. > > > Fixes #211 > > > This string is passed to GetMoveArguments() for interpretation. > > However, $[w.screen] never gets expanded because that line is not > > passed through the parser. FScreenGetScrRect() later looks for a > > screen with the name "$[w.screen]", finds non and falls back to > > the global monitor for placement (since a recent patch) but seems > > to have used the "current" monitor before. > > > One way to fix this woud be to replace "$[w.screen]" with "c" for > > the current screen, but that ignores the window's screen if > > specified. Also, some places of the code expect screens specified > > as "@g", " @c", "@p" while others use "g", "c" and "p". > > Are this latest examples for the "Move arguments"? G is global, c > current, and p primary. I cannot find in docs what is the difference > with or without '@'.
It depends on context and is mostly undocumented. :-( If the screen is part of a single string like +0+0@g it needs the "@". Otherwise it doesn't, but maybe not everywhere. Now that screens have names screen c is harmful because you cannot name your screen "c", "g" or "p". > Passing $[w.screen] to the parser is not an > option in that part of the code? No, it's not. The patched code takes the monitor from the window structure, prints the name into a generated string, passes that to GetMoveArguments() which then looks up the original monitor structure by name. That's stupid enough without piping it through the parser. > I'm too tired now. I will try to confirm tomorrow that it used 'c' before > breaking explicit monitor placement in the current release. FindScreen() used some monitor by "accident" when it didn't find one by that name. I fixed that a while ago because of undefined behaviour and crashes. Ciao Dominik ^_^ ^_^ -- Dominik Vogt