Skip to content
This repository has been archived by the owner on Aug 18, 2023. It is now read-only.

Commit

Permalink
Fix screen tearing in fullscreen on Windows 10
Browse files Browse the repository at this point in the history
  • Loading branch information
bladeSk committed Apr 4, 2019
1 parent 9837c78 commit c45894d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
6 changes: 3 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ When `aspect=true`, the aspect ratio is approximated using rectangular pixels. F

### Borderless fullscreen window / VSYNC

A feature used by modern games that relies on the OS to provide VSYNC. This eliminates screen tearing. Currently works only on Windows 8 or later.
A feature used by modern games that relies on the OS to provide VSYNC. This eliminates screen tearing.

## High-DPI support

Expand Down Expand Up @@ -59,7 +59,7 @@ You can just use the provided config, but if you have your own special `dosbox.c

All the dependencies are included in the source code (under `lib`). You need to build them before you can build DOSBox. I used Visual Studio 2017, but older versions should be fine also. The projects you need to build are:

* `lib\libpng-1.6.29\projects\vstudio\vstudio.sln`
* `lib\libpng-1.6.29\projects\vstudio\vstudio.sln` (use the "Release Library" configuration)
* `lib\SDL-1.2.15\VisualC\SDL.sln`
* `lib\SDL_net-1.2.7\VisualC\SDL_net.sln`
* `lib\SDL_net-1.2.7\VisualC\SDL_net.sln` (requires MFC to be installed)
* `visualc_net\dosbox.sln`
10 changes: 10 additions & 0 deletions src/gui/sdlmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,16 @@ SDL_Surface* SDL_SetVideoMode_Wrap(int width,int height,int bpp,Bit32u flags){
i_flags = flags;
#endif

#ifdef WIN32
if (flags&SDL_NOFRAME) {
SDL_SysWMinfo wminfo = { 0 };
SDL_GetWMInfo(&wminfo);
HWND hwnd = wminfo.window;
SetWindowLong(hwnd, GWL_STYLE, WS_VISIBLE);
SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE);
}
#endif

return s;
}

Expand Down
2 changes: 1 addition & 1 deletion src/platform/visualc/config.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#define VERSION "pixel-perfect fork, version SVN 4019.2"
#define VERSION "pixel-perfect fork, version SVN 4019.3"

/* Define to 1 to enable internal debugger, requires libcurses */
#define C_DEBUG 0
Expand Down

0 comments on commit c45894d

Please sign in to comment.