May 24, 2019, 11:17:36 PM

Author Topic: Questions about application "windows" (multi-platform)  (Read 70 times)

Offline Yellownakji

  • Full Member
  • ***
  • Posts: 216
  • Whoop-de-doo-ba-dooo!
Questions about application "windows" (multi-platform)
« on: April 30, 2019, 06:18:12 AM »
I have a few questions regarding Blitzmax-NG in MAX2D mode with "windows".

- Is borderless in BMXNG possible with Max2D?  Is borderless possible, periord? (Win,Linux,MacOS)
- Can i prevent a window from being drag-able?
- Can i manually tell the app to start at specific coordinates on the desktop, instead of centered?

I'm re-creating a project that i've lost the source too.  Borderless, not draggable and 'spawned' the the bottom right corner.  Specific traits i need.

Offline Derron

  • Hero Member
  • *****
  • Posts: 2087
Re: Questions about application "windows" (multi-platform)
« Reply #1 on: April 30, 2019, 06:54:02 AM »
In Linux it's not up to the application but the window manager to limit stuff, apps can just hmm "signal their wishes".

Borderless is a matter of the window creation - so it should "just" need the right flags when doing so.
with "sdl.mod" (or here sdl.sdlvideo) you gain access to:
Code: BlitzMax
  1. Type TSDLVideo
  2. [...]
  3.         Rem
  4.         bbdoc: Sets the border state of the window.
  5.         about: This will add or remove the window's SDL_WINDOW_BORDERLESS flag and add or remove the border from the actual window.
  6.         This is a no-op if the window's border already matches the requested state.
  7.         You can't change the border state of a fullscreen window.
  8.         End Rem
  9.         Method SetBordered(bordered:Int)
  10.                 SDL_SetWindowBordered(windowPtr, bordered)
  11.         End Method

The same code file has this:
Code: BlitzMax
  1.         Rem
  2.         bbdoc: Creates a window with the specified position, dimensions, and flags.
  3.         returns: The window that was created or Null on failure.
  4.         End Rem
  5.         Function Create:TSDLWindow(title:String, x:Int, y:Int, w:Int, h:Int, flags:UInt)
  6.                 Return _create(bmx_sdl_video_CreateWindow(title, x, y, w, h, flags))
  7.         End Function

The SDLGraphicsDriver calls this function with X and Y defined as SDL_WINDOWPOS_CENTERED.

If you created it with "SDL_CreateShapedWindow" then you would have borderless by default.

For now I think you would be needed to modify sdl.mod/* stuff. I will ask  Brucey if it was ok to alter the code to allow for some "configuration" before opening up a window (position, borderless, ...).

Edit: currently sdl.SDLGraphics pass the given "flags" on graphics creation to the window creation. So doing a
should already pass it.
This "SDL_GRAPHICS_NATIVE" is required to pass the SDL_...config

Means you need to manually pass these if desired:
(compared to the GRAPHICS_BACKBUFFER ... etc commands)