picoe / Eto

Cross platform GUI framework for desktop and mobile applications in .NET
Other
3.62k stars 329 forks source link

Eto.Forms - Incorrect window's location #2340

Open ghost opened 1 year ago

ghost commented 1 year ago

Hello there, I'm not entirely sure if it's a duplicate of #2336 but basically I tried to center the window with the code below:

this.Location = new Point(((int)Screen.PrimaryScreen.WorkingArea.Width - this.Width) / 2,
                          (int)(Screen.PrimaryScreen.WorkingArea.Height - this.Height) / 2);

But it appears to not do what I actually expected so I tried to check the positions, and I found something a bit weird. image

So as you can see in the corner of the screen, it says "0; 31" but it's not right it should actually say "0; 0" since I'm in the top left corner of the screen.

Update: Also want to point out that setting location is also broken, basically trying to set the location to 0; 0 won't set the window to this location and exactly do the above.

Expected Behavior

Actual Behavior

Steps to Reproduce the Problem

  1. Create an Eto.Forms project
  2. Add a LocationChanged event with the code below
    private void OnPosChanged(object sender, EventArgs e)
    {
     this.Title = $"{this.Location.X}; {this.Location.Y}";
    }
  3. Notice the problem

Specifications

Miepee commented 1 year ago

Checking this locally, this seems like the Y position is the position for the Client, and not the whole window (i.e it excludes decorations and title bars). On KDE, if I disable the borders of the window, and then maximize it, the 0,0 position is correct. With borders: grafik without borders: grafik

ghost commented 1 year ago

Yes, and that's quite of an issue in my opinion, It would great if this could be changed.