build-scripts/checker-buildbot.sh
author Sam Lantinga <slouken@libsdl.org>
Sun, 17 Aug 2014 14:57:52 -0700
changeset 9086 c5e33f9a0d03
parent 8644 f218b4e65498
child 9100 441e6cee6d14
permissions -rwxr-xr-x
Fixed bug 2655 - OSX: Window position and global mouse coord spaces are different

Tim McDaniel

On OSX, with revision 8729, the coordinate space for window position and the coordinate space for global mouse position don't match. For a non-fullscreen window, the window position is global relative to the bottom of the menubar. The global mouse position is relative to the top of the screen. This affects Cocoa_WarpMouse and potentially other things as well. Further, the coordinate system for window position is now affected by what screen it is on. For example, if I have two equal size screens oriented side by side such that the tops of the screens are equal in global space, with the menubar on one screen, and a window straddles the two screens, the window's y position makes no sense. The window's y position depends on what screen "most" of the window is on. So if I move the window horizontally just a bit, the y position of my window is now different by the size of the menubar, even though the window was not moved vertically.

I'd like to reiterate that this was a fairly fundamental change (and a breaking change for us). If SDL OSX is to really support multi-display configurations, this is especially problematic.

If the real concern is preventing windows from going under the menubar, then perhaps a solution involving something like overriding [NSWindow constrainFrameRect] would be less problematic than redefining the global window coord space for the main display.
     1 #!/bin/bash
     2 
     3 # This is a script used by some Buildbot buildslaves to push the project
     4 #  through Clang's static analyzer and prepare the output to be uploaded
     5 #  back to the buildmaster. You might find it useful too.
     6 
     7 # Install Clang (you already have it on Mac OS X, apt-get install clang
     8 #  on Ubuntu, etc),
     9 # or download checker at http://clang-analyzer.llvm.org/ and unpack it in
    10 #  /usr/local ... update CHECKERDIR as appropriate.
    11 
    12 FINALDIR="$1"
    13 
    14 CHECKERDIR="/usr/local/checker-276"
    15 if [ ! -d "$CHECKERDIR" ]; then
    16     echo "$CHECKERDIR not found. Trying /usr/share/clang ..." 1>&2
    17     CHECKERDIR="/usr/share/clang/scan-build"
    18 fi
    19 
    20 if [ ! -d "$CHECKERDIR" ]; then
    21     echo "$CHECKERDIR not found. Giving up." 1>&2
    22     exit 1
    23 fi
    24 
    25 if [ -z "$MAKE" ]; then
    26     OSTYPE=`uname -s`
    27     if [ "$OSTYPE" == "Linux" ]; then
    28         NCPU=`cat /proc/cpuinfo |grep vendor_id |wc -l`
    29         let NCPU=$NCPU+1
    30     elif [ "$OSTYPE" = "Darwin" ]; then
    31         NCPU=`sysctl -n hw.ncpu`
    32     elif [ "$OSTYPE" = "SunOS" ]; then
    33         NCPU=`/usr/sbin/psrinfo |wc -l |sed -e 's/^ *//g;s/ *$//g'`
    34     else
    35         NCPU=1
    36     fi
    37 
    38     if [ -z "$NCPU" ]; then
    39         NCPU=1
    40     elif [ "$NCPU" = "0" ]; then
    41         NCPU=1
    42     fi
    43 
    44     MAKE="make -j$NCPU"
    45 fi
    46 
    47 echo "\$MAKE is '$MAKE'"
    48 
    49 set -x
    50 set -e
    51 
    52 cd `dirname "$0"`
    53 cd ..
    54 
    55 rm -rf checker-buildbot analysis
    56 if [ ! -z "$FINALDIR" ]; then
    57     rm -rf "$FINALDIR"
    58 fi
    59 
    60 mkdir checker-buildbot
    61 cd checker-buildbot
    62 
    63 # You might want to do this for CMake-backed builds instead...
    64 #cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER="$CHECKERDIR/libexec/ccc-analyzer" ..
    65 
    66 # ...or run configure without the scan-build wrapper...
    67 #CC="$CHECKERDIR/libexec/ccc-analyzer" CFLAGS="-O0" ../configure
    68 
    69 # ...but this works for our buildbots just fine.
    70 CFLAGS="-O0" PATH="$CHECKERDIR:$PATH" scan-build -o analysis ../configure
    71 
    72 rm -rf analysis
    73 PATH="$CHECKERDIR:$PATH" scan-build -o analysis $MAKE
    74 mv analysis/* ../analysis
    75 rmdir analysis   # Make sure this is empty.
    76 cd ..
    77 chmod -R a+r analysis
    78 chmod -R go-w analysis
    79 find analysis -type d -exec chmod a+x {} \;
    80 if [ -x /usr/bin/xattr ]; then find analysis -exec /usr/bin/xattr -d com.apple.quarantine {} \; 2>/dev/null ; fi
    81 
    82 if [ ! -z "$FINALDIR" ]; then
    83     mv analysis "$FINALDIR"
    84 else
    85     FINALDIR=analysis
    86 fi
    87 
    88 rm -rf checker-buildbot
    89 
    90 echo "Done. Final output is in '$FINALDIR' ..."
    91 
    92 # end of checker-buildbot.sh ...
    93