Mac and Linux SDL2 binary snapshots
Edward Rudd
2019-04-09 9cd2e9ec8fc0127393dfce9c0359d500c8c238be
source/src/video/haiku/SDL_bwindow.cc
@@ -32,36 +32,36 @@
#endif
static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) {
   return ((SDL_BWin*)(window->driverdata));
    return ((SDL_BWin*)(window->driverdata));
}
static SDL_INLINE SDL_BApp *_GetBeApp() {
   return ((SDL_BApp*)be_app);
    return ((SDL_BApp*)be_app);
}
static int _InitWindow(_THIS, SDL_Window *window) {
   uint32 flags = 0;
   window_look look = B_TITLED_WINDOW_LOOK;
    uint32 flags = 0;
    window_look look = B_TITLED_WINDOW_LOOK;
   BRect bounds(
    BRect bounds(
        window->x,
        window->y,
        window->x + window->w - 1,   //BeWindows have an off-by-one px w/h thing
        window->x + window->w - 1,    //BeWindows have an off-by-one px w/h thing
        window->y + window->h - 1
    );
    
    if(window->flags & SDL_WINDOW_FULLSCREEN) {
       /* TODO: Add support for this flag */
       printf(__FILE__": %d!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n",__LINE__);
        /* TODO: Add support for this flag */
        printf(__FILE__": %d!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n",__LINE__);
    }
    if(window->flags & SDL_WINDOW_OPENGL) {
       /* TODO: Add support for this flag */
        /* TODO: Add support for this flag */
    }
    if(!(window->flags & SDL_WINDOW_RESIZABLE)) {
       flags |= B_NOT_RESIZABLE | B_NOT_ZOOMABLE;
        flags |= B_NOT_RESIZABLE | B_NOT_ZOOMABLE;
    }
    if(window->flags & SDL_WINDOW_BORDERLESS) {
       look = B_NO_BORDER_WINDOW_LOOK;
        look = B_NO_BORDER_WINDOW_LOOK;
    }
    SDL_BWin *bwin = new(std::nothrow) SDL_BWin(bounds, look, flags);
@@ -75,39 +75,39 @@
    return 0;
}
int BE_CreateWindow(_THIS, SDL_Window *window) {
int HAIKU_CreateWindow(_THIS, SDL_Window *window) {
    if (_InitWindow(_this, window) < 0) {
        return -1;
    }
   /* Start window loop */
    /* Start window loop */
    _ToBeWin(window)->Show();
    return 0;
}
int BE_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) {
int HAIKU_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) {
   SDL_BWin *otherBWin = (SDL_BWin*)data;
   if(!otherBWin->LockLooper())
      return -1;
   /* Create the new window and initialize its members */
   window->x = (int)otherBWin->Frame().left;
   window->y = (int)otherBWin->Frame().top;
   window->w = (int)otherBWin->Frame().Width();
   window->h = (int)otherBWin->Frame().Height();
   /* Set SDL flags */
   if(!(otherBWin->Flags() & B_NOT_RESIZABLE)) {
      window->flags |= SDL_WINDOW_RESIZABLE;
   }
   /* If we are out of memory, return the error code */
    SDL_BWin *otherBWin = (SDL_BWin*)data;
    if(!otherBWin->LockLooper())
        return -1;
    /* Create the new window and initialize its members */
    window->x = (int)otherBWin->Frame().left;
    window->y = (int)otherBWin->Frame().top;
    window->w = (int)otherBWin->Frame().Width();
    window->h = (int)otherBWin->Frame().Height();
    /* Set SDL flags */
    if(!(otherBWin->Flags() & B_NOT_RESIZABLE)) {
        window->flags |= SDL_WINDOW_RESIZABLE;
    }
    /* If we are out of memory, return the error code */
    if (_InitWindow(_this, window) < 0) {
        return -1;
    }
   /* TODO: Add any other SDL-supported window attributes here */
    /* TODO: Add any other SDL-supported window attributes here */
    _ToBeWin(window)->SetTitle(otherBWin->Title());
    
    /* Start window loop and unlock the other window */
@@ -117,107 +117,107 @@
    return 0;
}
void BE_SetWindowTitle(_THIS, SDL_Window * window) {
   BMessage msg(BWIN_SET_TITLE);
   msg.AddString("window-title", window->title);
   _ToBeWin(window)->PostMessage(&msg);
void HAIKU_SetWindowTitle(_THIS, SDL_Window * window) {
    BMessage msg(BWIN_SET_TITLE);
    msg.AddString("window-title", window->title);
    _ToBeWin(window)->PostMessage(&msg);
}
void BE_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) {
   /* FIXME: Icons not supported by Haiku */
void HAIKU_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) {
    /* FIXME: Icons not supported by Haiku */
}
void BE_SetWindowPosition(_THIS, SDL_Window * window) {
   BMessage msg(BWIN_MOVE_WINDOW);
   msg.AddInt32("window-x", window->x);
   msg.AddInt32("window-y", window->y);
   _ToBeWin(window)->PostMessage(&msg);
void HAIKU_SetWindowPosition(_THIS, SDL_Window * window) {
    BMessage msg(BWIN_MOVE_WINDOW);
    msg.AddInt32("window-x", window->x);
    msg.AddInt32("window-y", window->y);
    _ToBeWin(window)->PostMessage(&msg);
}
void BE_SetWindowSize(_THIS, SDL_Window * window) {
   BMessage msg(BWIN_RESIZE_WINDOW);
   msg.AddInt32("window-w", window->w - 1);
   msg.AddInt32("window-h", window->h - 1);
   _ToBeWin(window)->PostMessage(&msg);
void HAIKU_SetWindowSize(_THIS, SDL_Window * window) {
    BMessage msg(BWIN_RESIZE_WINDOW);
    msg.AddInt32("window-w", window->w - 1);
    msg.AddInt32("window-h", window->h - 1);
    _ToBeWin(window)->PostMessage(&msg);
}
void BE_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered) {
   BMessage msg(BWIN_SET_BORDERED);
   msg.AddBool("window-border", bordered != SDL_FALSE);
   _ToBeWin(window)->PostMessage(&msg);
void HAIKU_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered) {
    BMessage msg(BWIN_SET_BORDERED);
    msg.AddBool("window-border", bordered != SDL_FALSE);
    _ToBeWin(window)->PostMessage(&msg);
}
void BE_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable) {
   BMessage msg(BWIN_SET_RESIZABLE);
   msg.AddBool("window-resizable", resizable != SDL_FALSE);
   _ToBeWin(window)->PostMessage(&msg);
void HAIKU_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable) {
    BMessage msg(BWIN_SET_RESIZABLE);
    msg.AddBool("window-resizable", resizable != SDL_FALSE);
    _ToBeWin(window)->PostMessage(&msg);
}
void BE_ShowWindow(_THIS, SDL_Window * window) {
   BMessage msg(BWIN_SHOW_WINDOW);
   _ToBeWin(window)->PostMessage(&msg);
void HAIKU_ShowWindow(_THIS, SDL_Window * window) {
    BMessage msg(BWIN_SHOW_WINDOW);
    _ToBeWin(window)->PostMessage(&msg);
}
void BE_HideWindow(_THIS, SDL_Window * window) {
   BMessage msg(BWIN_HIDE_WINDOW);
   _ToBeWin(window)->PostMessage(&msg);
void HAIKU_HideWindow(_THIS, SDL_Window * window) {
    BMessage msg(BWIN_HIDE_WINDOW);
    _ToBeWin(window)->PostMessage(&msg);
}
void BE_RaiseWindow(_THIS, SDL_Window * window) {
   BMessage msg(BWIN_SHOW_WINDOW);   /* Activate this window and move to front */
   _ToBeWin(window)->PostMessage(&msg);
void HAIKU_RaiseWindow(_THIS, SDL_Window * window) {
    BMessage msg(BWIN_SHOW_WINDOW);    /* Activate this window and move to front */
    _ToBeWin(window)->PostMessage(&msg);
}
void BE_MaximizeWindow(_THIS, SDL_Window * window) {
   BMessage msg(BWIN_MAXIMIZE_WINDOW);
   _ToBeWin(window)->PostMessage(&msg);
void HAIKU_MaximizeWindow(_THIS, SDL_Window * window) {
    BMessage msg(BWIN_MAXIMIZE_WINDOW);
    _ToBeWin(window)->PostMessage(&msg);
}
void BE_MinimizeWindow(_THIS, SDL_Window * window) {
   BMessage msg(BWIN_MINIMIZE_WINDOW);
   _ToBeWin(window)->PostMessage(&msg);
void HAIKU_MinimizeWindow(_THIS, SDL_Window * window) {
    BMessage msg(BWIN_MINIMIZE_WINDOW);
    _ToBeWin(window)->PostMessage(&msg);
}
void BE_RestoreWindow(_THIS, SDL_Window * window) {
   BMessage msg(BWIN_RESTORE_WINDOW);
   _ToBeWin(window)->PostMessage(&msg);
void HAIKU_RestoreWindow(_THIS, SDL_Window * window) {
    BMessage msg(BWIN_RESTORE_WINDOW);
    _ToBeWin(window)->PostMessage(&msg);
}
void BE_SetWindowFullscreen(_THIS, SDL_Window * window,
      SDL_VideoDisplay * display, SDL_bool fullscreen) {
   /* Haiku tracks all video display information */
   BMessage msg(BWIN_FULLSCREEN);
   msg.AddBool("fullscreen", fullscreen);
   _ToBeWin(window)->PostMessage(&msg);
void HAIKU_SetWindowFullscreen(_THIS, SDL_Window * window,
        SDL_VideoDisplay * display, SDL_bool fullscreen) {
    /* Haiku tracks all video display information */
    BMessage msg(BWIN_FULLSCREEN);
    msg.AddBool("fullscreen", fullscreen);
    _ToBeWin(window)->PostMessage(&msg);
}
int BE_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp) {
   /* FIXME: Not Haiku supported */
   return -1;
int HAIKU_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp) {
    /* FIXME: Not Haiku supported */
    return -1;
}
int BE_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp) {
   /* FIXME: Not Haiku supported */
   return -1;
int HAIKU_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp) {
    /* FIXME: Not Haiku supported */
    return -1;
}
void BE_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed) {
   /* TODO: Implement this! */
void HAIKU_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed) {
    /* TODO: Implement this! */
}
void BE_DestroyWindow(_THIS, SDL_Window * window) {
   _ToBeWin(window)->LockLooper();   /* This MUST be locked */
   _GetBeApp()->ClearID(_ToBeWin(window));
   _ToBeWin(window)->Quit();
   window->driverdata = NULL;
void HAIKU_DestroyWindow(_THIS, SDL_Window * window) {
    _ToBeWin(window)->LockLooper();    /* This MUST be locked */
    _GetBeApp()->ClearID(_ToBeWin(window));
    _ToBeWin(window)->Quit();
    window->driverdata = NULL;
}
SDL_bool BE_GetWindowWMInfo(_THIS, SDL_Window * window,
SDL_bool HAIKU_GetWindowWMInfo(_THIS, SDL_Window * window,
                                    struct SDL_SysWMinfo *info) {
   /* FIXME: What is the point of this? What information should be included? */
   return SDL_FALSE;
    /* FIXME: What is the point of this? What information should be included? */
    return SDL_FALSE;
}