Mac and Linux SDL2 binary snapshots
Edward Rudd
2020-05-02 03f8528315fa46c95991a34f3325d7b33ae5538c
source/src/main/haiku/SDL_BApp.h
@@ -1,6 +1,6 @@
/*
  Simple DirectMedia Layer
  Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
  Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
  This software is provided 'as-is', without any express or implied
  warranty.  In no event will the authors be held liable for any damages
@@ -228,7 +228,23 @@
            return;
        }
        win = GetSDLWindow(winID);
        SDL_SendMouseMotion(win, 0, 0, x, y);
      // Simple relative mode support for mouse.
      if (SDL_GetMouse()->relative_mode) {
         int winWidth, winHeight, winPosX, winPosY;
         SDL_GetWindowSize(win, &winWidth, &winHeight);
         SDL_GetWindowPosition(win, &winPosX, &winPosY);
         int dx = x - (winWidth / 2);
         int dy = y - (winHeight / 2);
         SDL_SendMouseMotion(win, 0, SDL_GetMouse()->relative_mode, dx, dy);
         set_mouse_position((winPosX + winWidth / 2), (winPosY + winHeight / 2));
         if (!be_app->IsCursorHidden())
            be_app->HideCursor();
      } else {
         SDL_SendMouseMotion(win, 0, 0, x, y);
         if (SDL_ShowCursor(-1) && be_app->IsCursorHidden())
            be_app->ShowCursor();
      }
        /* Tell the application that the mouse passed over, redraw needed */
        HAIKU_UpdateWindowFramebuffer(NULL,win,NULL,-1);
@@ -261,7 +277,7 @@
            return;
        }
        win = GetSDLWindow(winID);
        SDL_SendMouseWheel(win, 0, xTicks, yTicks, SDL_MOUSEWHEEL_NORMAL);
        SDL_SendMouseWheel(win, 0, xTicks, -yTicks, SDL_MOUSEWHEEL_NORMAL);
    }
    void _HandleKey(BMessage *msg) {
@@ -285,7 +301,7 @@
            ssize_t count;
            if (msg->FindData("key-utf8", B_INT8_TYPE, (const void**)&keyUtf8, &count) == B_OK) {
                char text[SDL_TEXTINPUTEVENT_TEXT_SIZE];
                SDL_zero(text);
                SDL_zeroa(text);
                SDL_memcpy(text, keyUtf8, count);
                SDL_SendKeyboardText(text);
            }