Skip to content

Commit 46f2aa9

Browse files
authored
Revert pygame.mouse.get_pos() changes
Revert pygame.mouse.get_pos() changes
2 parents 247b184 + d7c071f commit 46f2aa9

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src_c/mouse.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,27 +76,24 @@ mouse_get_pos(PyObject *self, PyObject *_null)
7676
if (sdlRenderer != NULL) {
7777
SDL_Rect vprect;
7878
float scalex, scaley;
79-
int w, h;
8079

8180
SDL_RenderGetScale(sdlRenderer, &scalex, &scaley);
8281
SDL_RenderGetViewport(sdlRenderer, &vprect);
8382

8483
x = (int)(x / scalex);
8584
y = (int)(y / scaley);
8685

87-
SDL_RenderGetLogicalSize(sdlRenderer, &w, &h);
88-
8986
x -= vprect.x;
9087
y -= vprect.y;
9188

9289
if (x < 0)
9390
x = 0;
94-
if (x >= w)
95-
x = w - 1;
91+
if (x >= vprect.w)
92+
x = vprect.w - 1;
9693
if (y < 0)
9794
y = 0;
98-
if (y >= h)
99-
y = h - 1;
95+
if (y >= vprect.h)
96+
y = vprect.h - 1;
10097
}
10198
}
10299

0 commit comments

Comments
 (0)