Get rid of the GLFW ctypes bindings

This commit is contained in:
Kovid Goyal
2016-11-29 20:09:18 +05:30
parent a52c4670dc
commit f713117908
9 changed files with 270 additions and 478 deletions
+3 -7
View File
@@ -12,6 +12,7 @@ from contextlib import contextmanager
from functools import lru_cache
from time import monotonic
from .fast_data_types import glfw_get_physical_dpi
libc = ctypes.CDLL(None)
wcwidth_native = libc.wcwidth
@@ -50,14 +51,9 @@ def get_logical_dpi():
def get_dpi():
import glfw
if not hasattr(get_dpi, 'ans'):
m = glfw.glfwGetPrimaryMonitor()
width, height = glfw.glfwGetMonitorPhysicalSize(m)
vmode = glfw.glfwGetVideoMode(m)
dpix = vmode.width / (width / 25.4)
dpiy = vmode.height / (height / 25.4)
get_dpi.ans = {'physical': (dpix, dpiy), 'logical': get_logical_dpi()}
pdpi = glfw_get_physical_dpi()
get_dpi.ans = {'physical': pdpi, 'logical': get_logical_dpi()}
return get_dpi.ans
# Color names {{{