August 25, 2019, 09:15:52 AM

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

Offline Yellownakji

  • Full Member
  • ***
  • Posts: 247
  • No.
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: 2337
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
  12.  


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
  8.  

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
Graphics 800,600,0,SDL_WINDOW_BORDERLESS | SDL_GRAPHICS_NATIVE
should already pass it.
This "SDL_GRAPHICS_NATIVE" is required to pass the SDL_...config

Means you need to manually pass these if desired:
SDL_GRAPHICS_BACKBUFFER | SDL_GRAPHICS_ALPHABUFFER | SDL_GRAPHICS_DEPTHBUFFER | SDL_GRAPHICS_STENCILBUFFER | SDL_GRAPHICS_ACCUMBUFFER
(compared to the GRAPHICS_BACKBUFFER ... etc commands)



bye
Ron