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

Re: Getting real size and position for arranged controls.


On Sun, 26 Jan 2025 at 14:17, T Lee Davidson <t.lee.davidson@xxxxxxxxx>
wrote:

> On 1/26/25 7:24 AM, Gianluigi wrote:
> > Il 26/01/25 00:27, Carlos Prieto López ha scritto:
> >> I was making a mistake: before the form is opened, the coordinates are
> >> zero, but after the arrangement, they can be read without problem.
> Thanks!
> >
> > Hi Carlos,
> >
> > What I meant is that on the Wayland platform, a code that is based on
> > the position of the window, it cannot work whether it is with QT or GTK.
> > Maybe if you answer to Lee, you can receive more targeted help.
> >
> > Regards
> > Gianluigi
>
> I think Carlos has realized what what causing the issue he experienced. As
> for Wayland, I don't know how control or window
> coordinates are handled as I don't use it.
>
>
> --
> Lee
>

Glad you figured it out Carlos :)

I'll try to explain the wayland issue for anyone who's interested as it's a
rainy Sunday and I'm bored.....
The way to get your head around wayland is to think your application window
now opens in it's very own personal screen.
The compositor gives your program a space the size of your window.

Unlike in X11 where your window is a smaller rectangle inside a larger
screen rectangle and the windows X and Y position can be moved to any point
inside the larger screen. Also Form.Move() works as expected.

With Wayland your window is kind of fullscreen in it's own screen space.
From the gambas programs view the screen is the size of your window and the
windows X and Y position is always 0, 0 (ish)
So GianLuigi is correct that there are wayland issues but i think they are
not really relevant to this suggested type of usage.
it's not quite as bad as "any code based on window position cannot work in
wayland"
In reality it ONLY negates code that wants to *move* the main window inside
the screen. that is not possible with wayland as explained.

But for most code working "inside" the application area, for example...
' find an objects position in the form using Form.ScreenX and
Control.ScreenX values...
Dim iXPos As Integer = hControl.ScreenX - hControl.Window.ScreenX

There is no real difference in the outcome.
"for the most part" usage of ScreenX/ScreenY values work just as well with
wayland as X11, the difference/offset is handled internally.

Only when it comes to top-level window movement or reading top-level window
positions () will you find Form.ScreenX/.ScreenY properties not making
sense in wayland as the "screen" as we know it is not the same.

Otherwise it's probably code that will still work as expected :)

I hope that made sense :)

Respects
BruceS

Follow-Ups:
Re: Getting real size and position for arranged controls.Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
References:
Getting real size and position for arranged controls.Carlos Prieto <caprilo@xxxxxxxx>
Re: Getting real size and position for arranged controls.T Lee Davidson <t.lee.davidson@xxxxxxxxx>
Re: Getting real size and position for arranged controls.Gianluigi <gradobag@xxxxxxxxxxx>
Re: Getting real size and position for arranged controls.Carlos Prieto López <caprilo@xxxxxxxx>
Re: Getting real size and position for arranged controls.Gianluigi <gradobag@xxxxxxxxxxx>
Re: Getting real size and position for arranged controls.T Lee Davidson <t.lee.davidson@xxxxxxxxx>