@@ -66,15 +66,13 @@ def start(self):
66
66
self .old_windProc = SetWindowLong_wrapper (
67
67
self .hwnd , GWL_WNDPROC , self .new_windProc )
68
68
69
- if Window .borderless or Window .fullscreen :
70
- self .caption_size = 0
71
- else :
72
- self .caption_size = windll .user32 .GetSystemMetrics (SM_CYCAPTION )
73
-
74
69
def update (self , dispatch_fn ):
75
- win_rect = RECT ()
76
- windll .user32 .GetWindowRect (self .hwnd , byref (win_rect ))
77
- caption = self .caption_size
70
+ c_rect = RECT ()
71
+ windll .user32 .GetClientRect (self .hwnd , byref (c_rect ))
72
+ pt = POINT (x = 0 , y = 0 )
73
+ windll .user32 .ClientToScreen (self .hwnd , byref (pt ))
74
+ x_offset , y_offset = pt .x , pt .y
75
+ usable_w , usable_h = float (c_rect .w ), float (c_rect .h )
78
76
79
77
while True :
80
78
try :
@@ -83,9 +81,8 @@ def update(self, dispatch_fn):
83
81
break
84
82
85
83
# adjust x,y to window coordinates (0.0 to 1.0)
86
- x = (t .screen_x () - win_rect .x ) / float (win_rect .w )
87
- y = 1.0 - (t .screen_y () - win_rect .y - caption
88
- ) / float (win_rect .h )
84
+ x = (t .screen_x () - x_offset ) / usable_w
85
+ y = 1.0 - (t .screen_y () - y_offset ) / usable_h
89
86
90
87
# actually dispatch input
91
88
if t .event_type == 'begin' :
0 commit comments