mirror of
https://github.com/QB64Official/qb64.git
synced 2024-07-05 15:50:25 +00:00
Fix bug with DPI, Width, and Height (Win)
Fixes a bug that would make QB64 return the incorrect size monitor/desktop size when the resolution is scaled. Also, the last fix I added that set `_Source` to `_Console` automatically caused an issue with `_Width` and `_Height`, causing them to return only the console's image dimensions rather than the image that is passed.
This commit is contained in:
parent
7365689515
commit
189cdb8e39
|
@ -18464,6 +18464,20 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
|
||||||
//Creating/destroying an image surface:
|
//Creating/destroying an image surface:
|
||||||
|
|
||||||
int32 func__newimage(int32 x,int32 y,int32 bpp,int32 passed){
|
int32 func__newimage(int32 x,int32 y,int32 bpp,int32 passed){
|
||||||
|
#ifdef QB64_WINDOWS
|
||||||
|
static bool j;
|
||||||
|
if(j != 1){
|
||||||
|
FARPROC dpiaware;
|
||||||
|
HMODULE user32 = LoadLibrary(TEXT("user32.dll"));
|
||||||
|
if(user32 != NULL){
|
||||||
|
dpiaware = GetProcAddress(user32, "SetProcessDPIAware");
|
||||||
|
if(NULL != dpiaware){
|
||||||
|
(dpiaware) ();
|
||||||
|
j = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
static int32 i;
|
static int32 i;
|
||||||
if (new_error) return 0;
|
if (new_error) return 0;
|
||||||
if (x<=0||y<=0){error(5); return 0;}
|
if (x<=0||y<=0){error(5); return 0;}
|
||||||
|
@ -18824,7 +18838,7 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
|
||||||
if (new_error) return 0;
|
if (new_error) return 0;
|
||||||
|
|
||||||
#ifdef QB64_WINDOWS
|
#ifdef QB64_WINDOWS
|
||||||
if (read_page->console||i==console_image){
|
if (i==console_image){
|
||||||
SECURITY_ATTRIBUTES SecAttribs = {sizeof(SECURITY_ATTRIBUTES), 0, 1};
|
SECURITY_ATTRIBUTES SecAttribs = {sizeof(SECURITY_ATTRIBUTES), 0, 1};
|
||||||
HANDLE cl_conout = CreateFileA("CONOUT$", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, & SecAttribs, OPEN_EXISTING, 0, 0);
|
HANDLE cl_conout = CreateFileA("CONOUT$", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, & SecAttribs, OPEN_EXISTING, 0, 0);
|
||||||
CONSOLE_SCREEN_BUFFER_INFO cl_bufinfo;
|
CONSOLE_SCREEN_BUFFER_INFO cl_bufinfo;
|
||||||
|
@ -18853,7 +18867,7 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
|
||||||
if (new_error) return 0;
|
if (new_error) return 0;
|
||||||
|
|
||||||
#ifdef QB64_WINDOWS
|
#ifdef QB64_WINDOWS
|
||||||
if (read_page->console||i==console_image){
|
if (i==console_image){
|
||||||
SECURITY_ATTRIBUTES SecAttribs = {sizeof(SECURITY_ATTRIBUTES), 0, 1};
|
SECURITY_ATTRIBUTES SecAttribs = {sizeof(SECURITY_ATTRIBUTES), 0, 1};
|
||||||
HANDLE cl_conout = CreateFileA("CONOUT$", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, & SecAttribs, OPEN_EXISTING, 0, 0);
|
HANDLE cl_conout = CreateFileA("CONOUT$", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, & SecAttribs, OPEN_EXISTING, 0, 0);
|
||||||
CONSOLE_SCREEN_BUFFER_INFO cl_bufinfo;
|
CONSOLE_SCREEN_BUFFER_INFO cl_bufinfo;
|
||||||
|
|
Loading…
Reference in a new issue