[Commits] SDL: Fix SDL_GetWindowPosition to be properly monitor-aware and ...

libsdl.org revision control commits-owner at libsdl.org
Thu Jul 30 10:02:51 PDT 2015


details:   https://hg.libsdl.org/SDL/rev/cfeb59daba69
changeset: 9818:cfeb59daba69
user:      Alfred Reynolds <alfred at valvesoftware.com>
date:      Wed Jul 29 17:19:11 2015 -0700
description:
Fix SDL_GetWindowPosition to be properly monitor-aware and return the monitor x,y when fullscreened.

diffstat:

 src/video/SDL_video.c |  19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diffs (35 lines):

diff -r d71f8723dbe8 -r cfeb59daba69 src/video/SDL_video.c
--- a/src/video/SDL_video.c	Wed Jul 29 17:19:09 2015 -0700
+++ b/src/video/SDL_video.c	Wed Jul 29 17:19:11 2015 -0700
@@ -1679,12 +1679,31 @@
 
     /* Fullscreen windows are always at their display's origin */
     if (window->flags & SDL_WINDOW_FULLSCREEN) {
+        int displayIndex;
+        
         if (x) {
             *x = 0;
         }
         if (y) {
             *y = 0;
         }
+
+        /* Find the window's monitor and update to the
+           monitor offset. */
+        displayIndex = SDL_GetWindowDisplayIndex(window);
+        if (displayIndex >= 0) {
+            SDL_Rect bounds;
+
+            SDL_zero(bounds);
+
+            SDL_GetDisplayBounds(displayIndex, &bounds);
+            if (x) {
+                *x = bounds.x;
+            }
+            if (y) {
+                *y = bounds.y;
+            }
+        }
     } else {
         if (x) {
             *x = window->x;


More information about the commits mailing list