@ -50,6 +50,8 @@
# define GLFW_HAS_PER_MONITOR_DPI (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3300) // 3.3+ glfwGetMonitorContentScale
# define GLFW_HAS_PER_MONITOR_DPI (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3300) // 3.3+ glfwGetMonitorContentScale
# define GLFW_HAS_VULKAN (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3200) // 3.2+ glfwCreateWindowSurface
# define GLFW_HAS_VULKAN (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3200) // 3.2+ glfwCreateWindowSurface
# define GLFW_HAS_FOCUS_WINDOW (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3200) // 3.2+ glfwFocusWindow
# define GLFW_HAS_FOCUS_WINDOW (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3200) // 3.2+ glfwFocusWindow
# define GLFW_HAS_FOCUS_ON_SHOW (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3300) // 3.3+ GLFW_FOCUS_ON_SHOW
# define GLFW_HAS_MONITOR_WORK_AREA (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3300) // 3.3+ glfwGetMonitorWorkarea
// Data
// Data
enum GlfwClientApi
enum GlfwClientApi
@ -428,8 +430,12 @@ static void ImGui_ImplGlfw_CreateWindow(ImGuiViewport* viewport)
viewport - > PlatformUserData = data ;
viewport - > PlatformUserData = data ;
// GLFW 3.2 unfortunately always set focus on glfwCreateWindow() if GLFW_VISIBLE is set, regardless of GLFW_FOCUSED
// GLFW 3.2 unfortunately always set focus on glfwCreateWindow() if GLFW_VISIBLE is set, regardless of GLFW_FOCUSED
// With GLFW 3.3, the hint GLFW_FOCUS_ON_SHOW fixes this problem
glfwWindowHint ( GLFW_VISIBLE , false ) ;
glfwWindowHint ( GLFW_VISIBLE , false ) ;
glfwWindowHint ( GLFW_FOCUSED , false ) ;
glfwWindowHint ( GLFW_FOCUSED , false ) ;
# if GLFW_HAS_FOCUS_ON_SHOW
glfwWindowHint ( GLFW_FOCUS_ON_SHOW , false ) ;
# endif
glfwWindowHint ( GLFW_DECORATED , ( viewport - > Flags & ImGuiViewportFlags_NoDecoration ) ? false : true ) ;
glfwWindowHint ( GLFW_DECORATED , ( viewport - > Flags & ImGuiViewportFlags_NoDecoration ) ? false : true ) ;
# if GLFW_HAS_WINDOW_TOPMOST
# if GLFW_HAS_WINDOW_TOPMOST
glfwWindowHint ( GLFW_FLOATING , ( viewport - > Flags & ImGuiViewportFlags_TopMost ) ? true : false ) ;
glfwWindowHint ( GLFW_FLOATING , ( viewport - > Flags & ImGuiViewportFlags_TopMost ) ? true : false ) ;
@ -515,6 +521,7 @@ static void ImGui_ImplGlfw_ShowWindow(ImGuiViewport* viewport)
: : SetWindowLongPtr ( hwnd , GWLP_WNDPROC , ( LONG_PTR ) WndProcNoInputs ) ;
: : SetWindowLongPtr ( hwnd , GWLP_WNDPROC , ( LONG_PTR ) WndProcNoInputs ) ;
# endif
# endif
# if !GLFW_HAS_FOCUS_ON_SHOW
// GLFW hack: GLFW 3.2 has a bug where glfwShowWindow() also activates/focus the window.
// GLFW hack: GLFW 3.2 has a bug where glfwShowWindow() also activates/focus the window.
// The fix was pushed to GLFW repository on 2018/01/09 and should be included in GLFW 3.3 via a GLFW_FOCUS_ON_SHOW window attribute.
// The fix was pushed to GLFW repository on 2018/01/09 and should be included in GLFW 3.3 via a GLFW_FOCUS_ON_SHOW window attribute.
// See https://github.com/glfw/glfw/issues/1189
// See https://github.com/glfw/glfw/issues/1189
@ -524,6 +531,7 @@ static void ImGui_ImplGlfw_ShowWindow(ImGuiViewport* viewport)
: : ShowWindow ( hwnd , SW_SHOWNA ) ;
: : ShowWindow ( hwnd , SW_SHOWNA ) ;
return ;
return ;
}
}
# endif
# endif
# endif
glfwShowWindow ( data - > Window ) ;
glfwShowWindow ( data - > Window ) ;
@ -678,8 +686,17 @@ static void ImGui_ImplGlfw_UpdateMonitors()
int x , y ;
int x , y ;
glfwGetMonitorPos ( glfw_monitors [ n ] , & x , & y ) ;
glfwGetMonitorPos ( glfw_monitors [ n ] , & x , & y ) ;
const GLFWvidmode * vid_mode = glfwGetVideoMode ( glfw_monitors [ n ] ) ;
const GLFWvidmode * vid_mode = glfwGetVideoMode ( glfw_monitors [ n ] ) ;
# if GLFW_HAS_MONITOR_WORK_AREA
monitor . MainPos = ImVec2 ( ( float ) x , ( float ) y ) ;
monitor . MainSize = ImVec2 ( ( float ) vid_mode - > width , ( float ) vid_mode - > height ) ;
int w , h ;
glfwGetMonitorWorkarea ( glfw_monitors [ n ] , & x , & y , & w , & h ) ;
monitor . WorkPos = ImVec2 ( ( float ) x , ( float ) y ) ; ;
monitor . WorkSize = ImVec2 ( ( float ) w , ( float ) h ) ;
# else
monitor . MainPos = monitor . WorkPos = ImVec2 ( ( float ) x , ( float ) y ) ;
monitor . MainPos = monitor . WorkPos = ImVec2 ( ( float ) x , ( float ) y ) ;
monitor . MainSize = monitor . WorkSize = ImVec2 ( ( float ) vid_mode - > width , ( float ) vid_mode - > height ) ;
monitor . MainSize = monitor . WorkSize = ImVec2 ( ( float ) vid_mode - > width , ( float ) vid_mode - > height ) ;
# endif
# if GLFW_HAS_PER_MONITOR_DPI
# if GLFW_HAS_PER_MONITOR_DPI
// Warning: the validity of monitor DPI information on Windows depends on the application DPI awareness settings, which generally needs to be set in the manifest or at runtime.
// Warning: the validity of monitor DPI information on Windows depends on the application DPI awareness settings, which generally needs to be set in the manifest or at runtime.
float x_scale , y_scale ;
float x_scale , y_scale ;