Re: Initial window placement



> I like concrete :-). The problem is this: a document is open. User wants
> a search/replace dialogue to open. Ideally this dialogue should not hide
> any portion of the document when mapped (if the sizes allow for that,
> that is). So to have it at a nice starting position i'd like to put it

Very easy to do without any additional hints.

Lets say you know rectangle within your client window that you don't
want to overlap. You then use XTranslateCoordinates to translate it into
root coordinates. Then you decide where you have more space and want your
dialog to be. Then you map it in this location and use GRAVITY HINT to
keep it out of the way. For example :

Lets say you want to avoid covering area of 300x200+500+10 and you fdecide
that on your left youy have plenty of space to put search dialog in there
Lets say search dialog is 400x100. What you do then is you map your dialog
at +100+55 and request EastGravity for it. What happen then is that window
manager calculates reference point to be at +500+105 and it places Center
of the Right edge of the frame window into this location !!!
As the result you get dialog's frame edging at +500 and not overlapping
your text. Bingo!!! That is only if window manager would go and implement
gravity handling the way it should.

Even better - you could dynamically resize your search dialog, and its
right edge will stay put and will not overlap your text! Simply becouse
you requested EastGravity.

If window manager has policy of denying your PPosition and places dialog
where it pleased to - then you are out of luck any way you go, it will
just as well reject any otherhint you provide it with.

There is no way you could get a-la MS Windows window placement in X.
Get used to it. Its just not possible, plain wrong and will absolutely
never work. If you want that - you'll have to write your own window
manager that in fact will be incompatible with anything else.


> Regards, Philipp

Cheers
Sasha.






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]