Skip to content

Commit f097fab

Browse files
committed
Add init of scale_factor; modify version filter.
1 parent 0d37515 commit f097fab

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

webview/platforms/winforms.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ def edge_build(key_type, key, description=''):
7474
register_key = rf'Computer\{key_type}\{path}'
7575
windows_key = winreg.OpenKey(getattr(winreg, key_type), rf'SOFTWARE\{path}')
7676
build, _ = winreg.QueryValueEx(windows_key, 'pv')
77-
build = int(build.replace('.', '')[:6])
77+
# build = int(build.replace('.', '')[:6])
78+
build = int(build.split('.')[0])
7879

7980
return build
8081
except Exception as e:
@@ -113,8 +114,8 @@ def edge_build(key_type, key, description=''):
113114
for item in build_versions:
114115
for key_type in ('HKEY_CURRENT_USER', 'HKEY_LOCAL_MACHINE'):
115116
build = edge_build(key_type, item['key'], item['description'])
116-
117-
if build >= 860622: # Webview2 86.0.622.0
117+
# if build >= 860622: # Webview2 86.0.622.0
118+
if build >= 86: # Webview2 86.x
118119
return True
119120

120121
except Exception as e:
@@ -200,7 +201,8 @@ def __init__(self, window):
200201
self.url = window.real_url
201202
self.text_select = window.text_select
202203
self.on_top = window.on_top
203-
204+
self.scale_factor = 1
205+
204206
self.is_fullscreen = False
205207
if window.fullscreen:
206208
self.toggle_fullscreen()
@@ -396,7 +398,8 @@ def move(self, x, y):
396398
SWP_NOSIZE = 0x0001 # Retains the current size
397399
SWP_NOZORDER = 0x0004 # Retains the current Z order
398400
SWP_SHOWWINDOW = 0x0040 # Displays the window
399-
if(self.scale_factor):
401+
if(self.scale_factor != 1):
402+
# The coordinates needed to be scaled
400403
x_modified = x * self.scale_factor
401404
y_modified = y * self.scale_factor
402405
windll.user32.SetWindowPos(self.Handle.ToInt32(), None, int(x_modified), int(y_modified), None, None, SWP_NOSIZE|SWP_NOZORDER|SWP_SHOWWINDOW)

0 commit comments

Comments
 (0)