Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Windows OS ::getDesktopMode() fix  (Read 20809 times)

0 Members and 1 Guest are viewing this topic.

Hydra

  • Newbie
  • *
  • Posts: 37
    • View Profile
Re: Windows OS ::getDesktopMode() fix
« Reply #30 on: August 18, 2015, 05:18:49 pm »
...
While the window borders shrunk to 1 pixel thickness in Windows 10, Microsoft kept the old "thick borders"  behind the scenes for easier resizing.

Here you can see it in action:



As you can see, from the top, the cursor changes as the cursor touches the actual window.

But from the left, the cursor changes quite a bit earlier. This invisible part of the border is what causes that "gap" when displaying the windowed full screen with borders.
...

just thought that was very interesting 


...Also it clearly doesn't change with themes because I have a theme installed and it doesn't change.

but just because it doesn't change with the theme you're using does that guarantee that it won't be affected by ANY theme ?

and I think his point still stands

what if MS decides to change border width on the next windows 10 update ?
or what if it makes the border visible ?

Themes don't affect it. They simply change icons and colors. Also as I said in my original post there is a more dynamic solution which is using <window.h> to get the border width. Which would mean even if it changed you would be able to get the correct width.

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Windows OS ::getDesktopMode() fix
« Reply #31 on: August 18, 2015, 05:20:54 pm »
I wonder why nobody has suggested just maximizing the window...

Obviously, with the current SFML API, there is no way of saying "give me a window whose outer extents match x,y". So instead of saying give me a window that is the same size as the desktop resolution, just maximize the window right after you create it. That is what you really want in the end anyway. The desktop resolution video mode should only really have to be used for fullscreen or positioning the window somehow, but not for creating floating windows, else you will end up with the problem described in this thread.

Since SFML doesn't support programmatically maximizing the window, you will have to use the Windows API for this:
ShowWindow(window.getSystemHandle(), SW_MAXIMIZE);
Don't forget to include <windows.h>.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: Windows OS ::getDesktopMode() fix
« Reply #32 on: August 18, 2015, 05:34:46 pm »
Themes don't affect it. They simply change icons and colors. Also as I said in my original post there is a more dynamic solution which is using <window.h> to get the border width. Which would mean even if it changed you would be able to get the correct width.
Unfortunately it's not that easy either. There's a visible discrepancy between the actual border width (didn't try it, but I'm sure it's reported as either 0 or 1) and the visible border we've noticed.

I thought about adding a small patch to re-center the window horizontally in case it's bigger than the desktop, but I guess this would screw up multi-screen setups (which I can't test right now due to lack of desktop space).

Hydra

  • Newbie
  • *
  • Posts: 37
    • View Profile
Re: Windows OS ::getDesktopMode() fix
« Reply #33 on: August 18, 2015, 08:34:50 pm »
Themes don't affect it. They simply change icons and colors. Also as I said in my original post there is a more dynamic solution which is using <window.h> to get the border width. Which would mean even if it changed you would be able to get the correct width.
Unfortunately it's not that easy either. There's a visible discrepancy between the actual border width (didn't try it, but I'm sure it's reported as either 0 or 1) and the visible border we've noticed.

I thought about adding a small patch to re-center the window horizontally in case it's bigger than the desktop, but I guess this would screw up multi-screen setups (which I can't test right now due to lack of desktop space).

Yeah, but for me even if I change border width the code I supplied works with that solution?

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Windows OS ::getDesktopMode() fix
« Reply #34 on: August 18, 2015, 11:15:22 pm »
with the current SFML API, there is no way of saying "give me a window whose outer extents match x,y". So instead of saying give me a window that is the same size as the desktop resolution, just maximize the window right after you create it. That is what you really want in the end anyway
So maybe SFML should provide that (fullscreen option)? Sounds like a useful addition to me.
I want a window that covers the entire screen at the current resolution - that seems like a reasonable (and useful) thing to ask for.
« Last Edit: August 18, 2015, 11:35:10 pm by Jesper Juhl »

Satus

  • Guest
Re: Windows OS ::getDesktopMode() fix
« Reply #35 on: August 18, 2015, 11:44:01 pm »
Quote
... just maximize the window right after you create it ...
Correct me if I'm wrong, but if the size of the window is bigger or equals to the size of the screen, then when you maximize it, the objects inside will be slightly but noticeably resided.

Hydra

  • Newbie
  • *
  • Posts: 37
    • View Profile
Re: Windows OS ::getDesktopMode() fix
« Reply #36 on: August 20, 2015, 01:13:11 pm »
I don't mean to revive an old topic but does anyone actually know why Microsoft made it so the Windows window borders are bigger? It's a little weird how it's only on the sides.

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: Windows OS ::getDesktopMode() fix
« Reply #37 on: August 20, 2015, 02:06:10 pm »
Revive? The topic is still pretty "recent". :)

As mentioned above, I guess it's to easy resizing/grabbing the edge, considering 1 pixel is really narrow (a lot thinner compared to previous versions of Windows), especially considering Windows 10 wants to allow you to use touch as well.

You don't need that precision for the title bar, since that's a lot bigger anyway.