Skip to content

Commit

Permalink
Merge branch 'fix-for-high-dpi' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
pit-ray committed Feb 21, 2021
2 parents a71929b + 1f12d30 commit dea7e13
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 21 deletions.
19 changes: 0 additions & 19 deletions core/include/screen_metrics.hpp
Original file line number Diff line number Diff line change
@@ -1,21 +1,6 @@
#ifndef _SCREEN_METRICS_HPP
#define _SCREEN_METRICS_HPP

#define _WIN32_WINNT_WIN10 0x0A00 //Windows 10

//for DPI support
#if !defined(WINVER)

#define WINVER _WIN32_WINNT_WIN10
#define _WIN32_WINNT _WIN32_WINNT_WIN10

#elif WINVER < _WIN32_WINNT_WIN10

#define WINVER _WIN32_WINNT_WIN10
#define _WIN32_WINNT _WIN32_WINNT_WIN10

#endif

#include <windows.h>
#include <sstream>
#include <string>
Expand Down Expand Up @@ -100,10 +85,6 @@ namespace ScreenMetrics {
}

inline void get_conbined_metrics(RECT* const rect) {
if(!SetProcessDPIAware()) {
throw RUNTIME_EXCEPT("Your system is not supported DPI.") ;
}

WINDOWINFO winfo ;
winfo.cbSize = sizeof(WINDOWINFO) ;
if(!GetWindowInfo(GetDesktopWindow(), &winfo)) {
Expand Down
21 changes: 21 additions & 0 deletions core/src/win_vind.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
#include "win_vind.hpp"

#define _WIN32_WINNT_WIN10 0x0A00 //Windows 10

//for DPI support
#if !defined(WINVER)

#define WINVER _WIN32_WINNT_WIN10
#define _WIN32_WINNT _WIN32_WINNT_WIN10

#elif WINVER < _WIN32_WINNT_WIN10

#define WINVER _WIN32_WINNT_WIN10
#define _WIN32_WINNT _WIN32_WINNT_WIN10

#endif

#include <windows.h>

#if defined(__GNUC__)
Expand Down Expand Up @@ -106,6 +121,12 @@ namespace win_vind
return false ;
}

//enable high DPI support
if(!SetProcessDPIAware()) {
ERROR_PRINT("Your system is not supported DPI.") ;
return false ;
}

//load keyboard mapping of ascii code
//For example, we type LShift + 1 or RShift + 1 in order to input '!' at JP-Keyboard.
VKCConverter::load_input_combination() ;
Expand Down
4 changes: 2 additions & 2 deletions wxgui/src/wx_prop_dlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
#define KEY_COLOR "#1e96ff"
#define TXT_COLOR "gray"
#define TXT_SIZE "small"
#define CREATE_ITEM(KEY, VAL) "<tt><span size='"TXT_SIZE"' foreground='" KEY_COLOR \
#define CREATE_ITEM(KEY, VAL) "<tt><span size='" TXT_SIZE "' foreground='" KEY_COLOR \
"'>" KEY \
"</span> <span size='"TXT_SIZE"' foreground='" TXT_COLOR \
"</span> <span size='" TXT_SIZE "' foreground='" TXT_COLOR \
"'>" VAL "</span></tt>"

namespace wxGUI
Expand Down

0 comments on commit dea7e13

Please sign in to comment.