Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
290afc14
Commit
290afc14
authored
3 years ago
by
Deucе
Browse files
Options
Downloads
Patches
Plain Diff
Set High DPI Awareness before calling SDL_Init()
parent
a539edfb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/conio/sdl_con.c
+0
-38
0 additions, 38 deletions
src/conio/sdl_con.c
src/conio/sdlfuncs.c
+38
-0
38 additions, 0 deletions
src/conio/sdlfuncs.c
with
38 additions
and
38 deletions
src/conio/sdl_con.c
+
0
−
38
View file @
290afc14
...
...
@@ -467,44 +467,6 @@ int sdl_init(int mode)
cio_api
.
mode
=
fullscreen
?
CIOLIB_MODE_SDL_FULLSCREEN
:
CIOLIB_MODE_SDL
;
#ifdef _WIN32
FreeConsole
();
// code that tells windows we're High DPI aware so it doesn't scale our windows
// taken from Yamagi Quake II
typedef
enum
D3_PROCESS_DPI_AWARENESS
{
D3_PROCESS_DPI_UNAWARE
=
0
,
D3_PROCESS_SYSTEM_DPI_AWARE
=
1
,
D3_PROCESS_PER_MONITOR_DPI_AWARE
=
2
}
YQ2_PROCESS_DPI_AWARENESS
;
/* For Vista, Win7 and Win8 */
BOOL
(
WINAPI
*
SetProcessDPIAware
)(
void
)
=
NULL
;
/* Win8.1 and later */
HRESULT
(
WINAPI
*
SetProcessDpiAwareness
)(
enum
D3_PROCESS_DPI_AWARENESS
dpiAwareness
)
=
NULL
;
const
char
*
user32dll
[]
=
{
"User32"
,
NULL
};
dll_handle
userDLL
=
xp_dlopen
(
user32dll
,
RTLD_LAZY
,
0
);
if
(
userDLL
)
{
SetProcessDPIAware
=
xp_dlsym
(
userDLL
,
"SetProcessDPIAware"
);
}
const
char
*
shcoredll
[]
=
{
"SHCore"
,
NULL
};
dll_handle
shcoreDLL
=
xp_dlopen
(
shcoredll
,
RTLD_LAZY
,
0
);
if
(
shcoreDLL
)
{
SetProcessDpiAwareness
=
xp_dlsym
(
shcoreDLL
,
"SetProcessDpiAwareness"
);
}
if
(
SetProcessDpiAwareness
)
{
SetProcessDpiAwareness
(
D3_PROCESS_PER_MONITOR_DPI_AWARE
);
}
else
if
(
SetProcessDPIAware
)
{
SetProcessDPIAware
();
}
#endif
cio_api
.
options
|=
CONIO_OPT_PALETTE_SETTING
|
CONIO_OPT_SET_TITLE
|
CONIO_OPT_SET_NAME
|
CONIO_OPT_SET_ICON
;
return
(
0
);
...
...
This diff is collapsed.
Click to expand it.
src/conio/sdlfuncs.c
+
38
−
0
View file @
290afc14
...
...
@@ -231,6 +231,44 @@ int init_sdl_video(void)
sdl
.
SetHint
(
SDL_HINT_RENDER_SCALE_QUALITY
,
"2"
);
sdl
.
SetHint
(
SDL_HINT_VIDEO_ALLOW_SCREENSAVER
,
"1"
);
#ifdef _WIN32
// code that tells windows we're High DPI aware so it doesn't scale our windows
// taken from Yamagi Quake II
typedef
enum
D3_PROCESS_DPI_AWARENESS
{
D3_PROCESS_DPI_UNAWARE
=
0
,
D3_PROCESS_SYSTEM_DPI_AWARE
=
1
,
D3_PROCESS_PER_MONITOR_DPI_AWARE
=
2
}
YQ2_PROCESS_DPI_AWARENESS
;
/* For Vista, Win7 and Win8 */
BOOL
(
WINAPI
*
SetProcessDPIAware
)(
void
)
=
NULL
;
/* Win8.1 and later */
HRESULT
(
WINAPI
*
SetProcessDpiAwareness
)(
enum
D3_PROCESS_DPI_AWARENESS
dpiAwareness
)
=
NULL
;
const
char
*
user32dll
[]
=
{
"User32"
,
NULL
};
dll_handle
userDLL
=
xp_dlopen
(
user32dll
,
RTLD_LAZY
,
0
);
if
(
userDLL
)
{
SetProcessDPIAware
=
xp_dlsym
(
userDLL
,
"SetProcessDPIAware"
);
}
const
char
*
shcoredll
[]
=
{
"SHCore"
,
NULL
};
dll_handle
shcoreDLL
=
xp_dlopen
(
shcoredll
,
RTLD_LAZY
,
0
);
if
(
shcoreDLL
)
{
SetProcessDpiAwareness
=
xp_dlsym
(
shcoreDLL
,
"SetProcessDpiAwareness"
);
}
if
(
SetProcessDpiAwareness
)
{
SetProcessDpiAwareness
(
D3_PROCESS_PER_MONITOR_DPI_AWARE
);
}
else
if
(
SetProcessDPIAware
)
{
SetProcessDPIAware
();
}
/* Fail to windib (ie: No mouse attached) */
if
(
sdl
.
Init
(
SDL_INIT_VIDEO
)
==
0
)
{
sdl_video_initialized
=
TRUE
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment