mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-03-08 10:10:00 +00:00
Merge pull request #85 from csantosbh/develop
Centering the cursor at (width/2, height/2) when the mouse is hidden
This commit is contained in:
commit
5882e5e27a
|
@ -898,8 +898,14 @@ namespace OpenTK.Platform.X11
|
|||
// is very very uncommon. Todo: Can this be remedied?
|
||||
int x = e.MotionEvent.x;
|
||||
int y =e.MotionEvent.y;
|
||||
int middle_x = (Bounds.Left + Bounds.Right) / 2;
|
||||
int middle_y = (Bounds.Top + Bounds.Bottom) / 2;
|
||||
// TODO: Have offset as a stored field, only update it when the window moves
|
||||
// The middle point cannot be the average of the Bounds.left/right/top/bottom,
|
||||
// because these fields take into account window decoration (borders, etc),
|
||||
// which we do not want to account for.
|
||||
Point offset = this.PointToClient(Point.Empty);
|
||||
int middle_x = Width/2-offset.X;
|
||||
int middle_y = Height/2-offset.Y;
|
||||
|
||||
Point screen_xy = PointToScreen(new Point(x, y));
|
||||
if (!CursorVisible && MouseWarpActive &&
|
||||
screen_xy.X == middle_x && screen_xy.Y == middle_y)
|
||||
|
|
Loading…
Reference in a new issue