Open tinchodias opened 1 month ago
Possible implementation:
BlSpace>>numberOfVideoDisplays
method and videoDisplayIndex
instvar and accessors in BlSpace
and, IF POSSIBLE, the host takes into account the display index to do what is neededLet's think on scenarios.
Simple case: open a space in 50@100 of the last of the monitors (I guess 1 is the default, and that's the OS main monitor)
s := BlSpace new.
s position: 50@100.
s videoDisplayIndex: s numberOfVideoDisplays.
s show
Move that space to 50@100 position but in first (main) display: s videoDisplayIndex: 1
In the case the default Bloc host is Morphic, not SDL, then 2. has no effect.
Hi! Cool! This is important to determine on what screen to display, for example on starting an application I can display a first window on screen 1 and a second window on screen 2. Each windows can be in fullscreen or not. But before that it is necessary to known the hardware configuration, what is the way to known:
This question also concern window placement and moving after starting the application.
Okay, for extra info, I see:
https://wiki.libsdl.org/SDL2/SDL_GetDisplayName, to get a String
https://wiki.libsdl.org/SDL2/SDL_GetDisplayDPI, to get: int | displayIndex | the index of the display from which DPI information should be queried. |
---|---|---|
float * | ddpi | a pointer filled in with the diagonal DPI of the display; may be NULL. |
float * | hdpi | a pointer filled in with the horizontal DPI of the display; may be NULL. |
float * | vdpi | a pointer filled in with the vertical DPI of the display; may be NULL. |
https://wiki.libsdl.org/SDL2/SDL_GetNumDisplayModes and https://wiki.libsdl.org/SDL2/SDL_GetDisplayMode, to get a list of:
Uint32 format; /**< pixel format */
int w; /**< width, in screen coordinates */
int h; /**< height, in screen coordinates */
int refresh_rate; /**< refresh rate (or zero for unspecified) */
void *driverdata; /**< driver-specific data, initialize to 0 */
https://wiki.libsdl.org/SDL2/SDL_DisplayOrientation, to get one of:
SDL_ORIENTATION_UNKNOWN, /**< The display orientation can't be determined */
SDL_ORIENTATION_LANDSCAPE, /**< The display is in landscape mode, with the right side up, relative to portrait mode */
SDL_ORIENTATION_LANDSCAPE_FLIPPED, /**< The display is in landscape mode, with the left side up, relative to portrait mode */
SDL_ORIENTATION_PORTRAIT, /**< The display is in portrait mode */
SDL_ORIENTATION_PORTRAIT_FLIPPED /**< The display is in portrait mode, upside down */
Wow awesome!
I looked at how it would be to support multiple monitors with SDL2 host. I did this "research" from a question of @labordep in #507
This is a tutorial about this: https://lazyfoo.net/tutorials/SDL/37_multiple_displays/index.php
Apparently it's as simple as knowing the number of monitors with: https://wiki.libsdl.org/SDL2/SDL_GetNumVideoDisplays , and then you ask for each monitors bound (a rectangle): https://wiki.libsdl.org/SDL2/SDL_GetDisplayBounds and finally, you set the window position at e.g.
(monitorBounds at: 2) origin + aSpace positionInMonitor