88 return pInstance == NULL ? 0 : pInstance->m_mainThreadId; 89 } 90 91 static jobject EnterNestedEventLoop(JNIEnv * env); 92 static void LeaveNestedEventLoop(JNIEnv * env, jobject retValue); 93 static void SetGlassClassLoader(JNIEnv *env, jobject classLoader); 94 static jclass ClassForName(JNIEnv *env, char *className); 95 96 static void SetHInstance(HINSTANCE hInstace) { GlassApplication::hInstace = hInstace; } 97 static HINSTANCE GetHInstance() { return GlassApplication::hInstace; } 98 99 /* Maintains a counter. Must be balanced with UninstallMouseLLHook. */ 100 static void InstallMouseLLHook(); 101 static void UninstallMouseLLHook(); 102 103 static ULONG IncrementAccessibility(); 104 static ULONG DecrementAccessibility(); 105 static ULONG GetAccessibilityCount(); 106 107 static jfloat overrideUIScale; 108 static jfloat overrideRenderScale; 109 static jfloat minDPIScale; 110 static jboolean forceIntegerRenderScale; 111 112 inline static jfloat GetUIScale(UINT dpi) 113 { 114 if (overrideUIScale > 0.0f) return overrideUIScale; 115 jfloat uiScale = dpi / 96.0f; 116 if (uiScale < minDPIScale) return 1.0f; 117 return uiScale; 118 } 119 120 inline static jfloat getRenderScale(jfloat uiScale) { 121 if (overrideRenderScale > 0.0f) return overrideRenderScale; 122 if (forceIntegerRenderScale) return ceil(uiScale); 123 return uiScale; 124 } 125 126 protected: 127 virtual LRESULT WindowProc(UINT msg, WPARAM wParam, LPARAM lParam); 128 virtual LPCTSTR GetWindowClassNameSuffix(); 129 130 private: 131 jobject m_grefThis; 132 jobject m_clipboard; 133 static GlassApplication *pInstance; 134 HWND m_hNextClipboardView; 135 DWORD m_mainThreadId; 136 static jobject sm_glassClassLoader; 137 138 // These are static because the GlassApplication instance may be 139 // destroyed while the nested loop is spinning 140 static bool sm_shouldLeaveNestedLoop; 141 static JGlobalRef<jobject> sm_nestedLoopReturnValue; 142 143 static HINSTANCE hInstace; | 88 return pInstance == NULL ? 0 : pInstance->m_mainThreadId; 89 } 90 91 static jobject EnterNestedEventLoop(JNIEnv * env); 92 static void LeaveNestedEventLoop(JNIEnv * env, jobject retValue); 93 static void SetGlassClassLoader(JNIEnv *env, jobject classLoader); 94 static jclass ClassForName(JNIEnv *env, char *className); 95 96 static void SetHInstance(HINSTANCE hInstace) { GlassApplication::hInstace = hInstace; } 97 static HINSTANCE GetHInstance() { return GlassApplication::hInstace; } 98 99 /* Maintains a counter. Must be balanced with UninstallMouseLLHook. */ 100 static void InstallMouseLLHook(); 101 static void UninstallMouseLLHook(); 102 103 static ULONG IncrementAccessibility(); 104 static ULONG DecrementAccessibility(); 105 static ULONG GetAccessibilityCount(); 106 107 static jfloat overrideUIScale; 108 109 inline static jboolean IsUIScaleOverridden() 110 { 111 return (overrideUIScale > 0.0f); 112 } 113 114 inline static jfloat GetUIScale(UINT dpi) 115 { 116 return IsUIScaleOverridden() 117 ? overrideUIScale 118 : dpi / ((float) USER_DEFAULT_SCREEN_DPI); 119 } 120 121 protected: 122 virtual LRESULT WindowProc(UINT msg, WPARAM wParam, LPARAM lParam); 123 virtual LPCTSTR GetWindowClassNameSuffix(); 124 125 private: 126 jobject m_grefThis; 127 jobject m_clipboard; 128 static GlassApplication *pInstance; 129 HWND m_hNextClipboardView; 130 DWORD m_mainThreadId; 131 static jobject sm_glassClassLoader; 132 133 // These are static because the GlassApplication instance may be 134 // destroyed while the nested loop is spinning 135 static bool sm_shouldLeaveNestedLoop; 136 static JGlobalRef<jobject> sm_nestedLoopReturnValue; 137 138 static HINSTANCE hInstace; |