build-scripts/nacl-buildbot.sh
author Sam Lantinga <slouken@libsdl.org>
Sun, 17 Aug 2014 14:57:52 -0700
changeset 9086 c5e33f9a0d03
parent 8882 4fc9e98413c3
child 10592 a5667285680d
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 the script buildbot.libsdl.org uses to cross-compile SDL2 from
     4 #  amd64 Linux to NaCl.
     5 
     6 export NACL_SDK_ROOT="/nacl_sdk/pepper_35"
     7 
     8 TARBALL="$1"
     9 if [ -z $1 ]; then
    10     TARBALL=sdl-nacl.tar.xz
    11 fi
    12 
    13 OSTYPE=`uname -s`
    14 if [ "$OSTYPE" != "Linux" ]; then
    15     # !!! FIXME
    16     echo "This only works on x86 or x64-64 Linux at the moment." 1>&2
    17     exit 1
    18 fi
    19 
    20 if [ "x$MAKE" == "x" ]; then
    21     NCPU=`cat /proc/cpuinfo |grep vendor_id |wc -l`
    22     let NCPU=$NCPU+1
    23     MAKE="make -j$NCPU"
    24 fi
    25 
    26 BUILDBOTDIR="nacl-buildbot"
    27 PARENTDIR="$PWD"
    28 
    29 set -e
    30 set -x
    31 rm -f $TARBALL
    32 rm -rf $BUILDBOTDIR
    33 mkdir -p $BUILDBOTDIR
    34 pushd $BUILDBOTDIR
    35 
    36 # !!! FIXME: ccache?
    37 export CC="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-clang"
    38 export CFLAGS="$CFLAGS -I$NACL_SDK_ROOT/include -I$NACL_SDK_ROOT/include/pnacl"
    39 export AR="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-ar"
    40 export LD="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-ar"
    41 export RANLIB="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-ranlib"
    42 
    43 ../configure --host=pnacl --prefix=$PWD/nacl-sdl2-installed
    44 $MAKE
    45 $MAKE install
    46 # Fix up a few things to a real install path
    47 perl -w -pi -e "s#$PWD/nacl-sdl2-installed#/usr/local#g;" ./nacl-sdl2-installed/lib/libSDL2.la ./nacl-sdl2-installed/lib/pkgconfig/sdl2.pc ./nacl-sdl2-installed/bin/sdl2-config
    48 mkdir -p ./usr
    49 mv ./nacl-sdl2-installed ./usr/local
    50 
    51 popd
    52 tar -cJvvf $TARBALL -C $BUILDBOTDIR usr
    53 rm -rf $BUILDBOTDIR
    54 
    55 set +x
    56 echo "All done. Final installable is in $TARBALL ...";
    57