소스 검색

Backed out changeset 2e42ec46061e.

This change isn't correct. See comments in Bugzilla #4183.
Ryan C. Gordon 7 년 전
부모
커밋
8f0cc4a4b7
1개의 변경된 파일10개의 추가작업 그리고 2개의 파일을 삭제
  1. 10 2
      src/video/x11/SDL_x11xinput2.c

+ 10 - 2
src/video/x11/SDL_x11xinput2.c

@@ -83,8 +83,16 @@ xinput2_normalize_touch_coordinates(SDL_VideoData *videodata, Window window,
     for (i = 0; i < videodata->numwindows; i++) {
         SDL_WindowData *d = videodata->windowlist[i];
         if (d->xwindow == window) {
-            *out_x = in_x / d->window->w;
-            *out_y = in_y / d->window->h;
+            if (d->window->w == 1) {
+                *out_x = 0.5f;
+            } else {
+                *out_x = in_x / (d->window->w - 1);
+            }
+            if (d->window->h == 1) {
+                *out_y = 0.5f;
+            } else {
+                *out_y = in_y / (d->window->h - 1);
+            }
             return;
         }
     }