Skip to content
This repository was archived by the owner on Aug 2, 2025. It is now read-only.

Commit 576f6ed

Browse files
committed
fix
1 parent c39e8d6 commit 576f6ed

File tree

539 files changed

+87948
-15438
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

539 files changed

+87948
-15438
lines changed

.vscode/c_cpp_properties.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"configurations": [
3+
{
4+
"name": "Win32",
5+
"includePath": [
6+
"C:/Program Files/Python311/include/**",
7+
"${workspaceFolder}/**"
8+
],
9+
"defines": [
10+
"_DEBUG",
11+
"UNICODE",
12+
"_UNICODE"
13+
],
14+
"windowsSdkVersion": "10.0.22621.0",
15+
"cStandard": "c17",
16+
"cppStandard": "c++17"
17+
}
18+
],
19+
"version": 4
20+
}

.vscode/settings.json

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
{
2+
"files.associations": {
3+
"memory": "cpp",
4+
"__config": "cpp",
5+
"cstddef": "cpp",
6+
"algorithm": "cpp",
7+
"any": "cpp",
8+
"array": "cpp",
9+
"atomic": "cpp",
10+
"bit": "cpp",
11+
"bitset": "cpp",
12+
"cctype": "cpp",
13+
"charconv": "cpp",
14+
"chrono": "cpp",
15+
"cinttypes": "cpp",
16+
"clocale": "cpp",
17+
"cmath": "cpp",
18+
"codecvt": "cpp",
19+
"compare": "cpp",
20+
"complex": "cpp",
21+
"concepts": "cpp",
22+
"condition_variable": "cpp",
23+
"coroutine": "cpp",
24+
"csignal": "cpp",
25+
"cstdarg": "cpp",
26+
"cstdint": "cpp",
27+
"cstdio": "cpp",
28+
"cstdlib": "cpp",
29+
"cstring": "cpp",
30+
"ctime": "cpp",
31+
"cwchar": "cpp",
32+
"cwctype": "cpp",
33+
"deque": "cpp",
34+
"exception": "cpp",
35+
"filesystem": "cpp",
36+
"format": "cpp",
37+
"forward_list": "cpp",
38+
"fstream": "cpp",
39+
"functional": "cpp",
40+
"future": "cpp",
41+
"initializer_list": "cpp",
42+
"iomanip": "cpp",
43+
"ios": "cpp",
44+
"iosfwd": "cpp",
45+
"iostream": "cpp",
46+
"istream": "cpp",
47+
"iterator": "cpp",
48+
"limits": "cpp",
49+
"list": "cpp",
50+
"locale": "cpp",
51+
"map": "cpp",
52+
"memory_resource": "cpp",
53+
"mutex": "cpp",
54+
"new": "cpp",
55+
"numeric": "cpp",
56+
"optional": "cpp",
57+
"ostream": "cpp",
58+
"queue": "cpp",
59+
"random": "cpp",
60+
"ranges": "cpp",
61+
"ratio": "cpp",
62+
"regex": "cpp",
63+
"scoped_allocator": "cpp",
64+
"set": "cpp",
65+
"span": "cpp",
66+
"sstream": "cpp",
67+
"stack": "cpp",
68+
"stdexcept": "cpp",
69+
"stop_token": "cpp",
70+
"streambuf": "cpp",
71+
"string": "cpp",
72+
"strstream": "cpp",
73+
"system_error": "cpp",
74+
"thread": "cpp",
75+
"tuple": "cpp",
76+
"type_traits": "cpp",
77+
"typeinfo": "cpp",
78+
"unordered_map": "cpp",
79+
"unordered_set": "cpp",
80+
"utility": "cpp",
81+
"valarray": "cpp",
82+
"variant": "cpp",
83+
"vector": "cpp",
84+
"xfacet": "cpp",
85+
"xhash": "cpp",
86+
"xiosbase": "cpp",
87+
"xlocale": "cpp",
88+
"xlocbuf": "cpp",
89+
"xlocinfo": "cpp",
90+
"xlocmes": "cpp",
91+
"xlocmon": "cpp",
92+
"xlocnum": "cpp",
93+
"xloctime": "cpp",
94+
"xmemory": "cpp",
95+
"xstddef": "cpp",
96+
"xstring": "cpp",
97+
"xtr1common": "cpp",
98+
"xtree": "cpp",
99+
"xutility": "cpp",
100+
"__bit_reference": "cpp",
101+
"__bits": "cpp",
102+
"__debug": "cpp",
103+
"__errc": "cpp",
104+
"__hash_table": "cpp",
105+
"__locale": "cpp",
106+
"__mutex_base": "cpp",
107+
"__node_handle": "cpp",
108+
"__split_buffer": "cpp",
109+
"__threading_support": "cpp",
110+
"__tree": "cpp",
111+
"__verbose_abort": "cpp",
112+
"propagate_const": "cpp",
113+
"string_view": "cpp",
114+
"*.tcc": "cpp",
115+
"cfenv": "cpp"
116+
}
117+
}

examples/tutorial.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@
6060
def main():
6161
check_versions()
6262
sys.excepthook = cef.ExceptHook # To shutdown all CEF processes on error
63-
# To change user agent use either "product_version"
63+
# To change user agent use either "user_agent_product"
6464
# or "user_agent" options. Explained in Tutorial in
6565
# "Change user agent string" section.
6666
settings = {
67-
# "product_version": "MyProduct/10.00",
67+
# "user_agent_product": "MyProduct/10.00",
6868
# "user_agent": "MyAgent/20.00 MyProduct/10.00",
6969
}
7070
cef.Initialize(settings=settings)

src/browser.pyx

Lines changed: 42 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ cdef PyBrowser GetPyBrowser(CefRefPtr[CefBrowser] cefBrowser,
5858
provided."""
5959

6060
global g_pyBrowsers
61-
62-
if <void*>cefBrowser == NULL or not cefBrowser.get():
61+
#lc void*
62+
if not cefBrowser.get():
6363
raise Exception("{caller}: CefBrowser reference is NULL"
6464
.format(caller=callerIdStr))
6565

@@ -148,7 +148,7 @@ cdef void RemovePyBrowser(int browserId) except *:
148148
# noinspection PyUnresolvedReferences
149149
Debug("del g_pyBrowsers[%s]" % browserId)
150150
pyBrowser = g_pyBrowsers[browserId]
151-
pyBrowser.cefBrowser.Assign(NULL)
151+
pyBrowser.cefBrowser.Assign(nullptr)
152152
del pyBrowser
153153
del g_pyBrowsers[browserId]
154154
g_unreferenced_browsers.append(browserId)
@@ -207,15 +207,17 @@ cdef class PyBrowser:
207207
cdef void* imageBuffer
208208

209209
cdef CefRefPtr[CefBrowser] GetCefBrowser(self) except *:
210-
if <void*>self.cefBrowser != NULL and self.cefBrowser.get():
210+
#lc void*
211+
if self.cefBrowser.get():
211212
return self.cefBrowser
212213
raise Exception("PyBrowser.GetCefBrowser() failed: CefBrowser "
213214
"was destroyed")
214215

215216
cdef CefRefPtr[CefBrowserHost] GetCefBrowserHost(self) except *:
216217
cdef CefRefPtr[CefBrowserHost] cefBrowserHost = (
217218
self.GetCefBrowser().get().GetHost())
218-
if <void*>cefBrowserHost != NULL and cefBrowserHost.get():
219+
#lc void*
220+
if cefBrowserHost.get():
219221
return cefBrowserHost
220222
raise Exception("PyBrowser.GetCefBrowserHost() failed: this "
221223
"method can only be called in the browser "
@@ -394,9 +396,9 @@ cdef class PyBrowser:
394396
# If using GetCookieManager to implement custom cookie managers
395397
# then flushing of cookies would need to be handled manually.
396398
self.GetCefBrowserHost().get().GetRequestContext().get() \
397-
.GetDefaultCookieManager(
398-
<CefRefPtr[CefCompletionCallback]?>NULL) \
399-
.get().FlushStore(<CefRefPtr[CefCompletionCallback]?>NULL)
399+
.GetCookieManager(
400+
<CefRefPtr[CefCompletionCallback]?>nullptr) \
401+
.get().FlushStore(<CefRefPtr[CefCompletionCallback]?>nullptr)
400402

401403
cdef int browserId = self.GetCefBrowser().get().GetIdentifier()
402404
self.GetCefBrowserHost().get().CloseBrowser(bool(forceClose))
@@ -413,12 +415,12 @@ cdef class PyBrowser:
413415
py_string scriptUrl="", int startLine=1):
414416
self.GetMainFrame().ExecuteJavascript(jsCode, scriptUrl, startLine)
415417

416-
cpdef py_void Find(self, int searchId, py_string searchText,
418+
cpdef py_void Find(self, py_string searchText,
417419
py_bool forward, py_bool matchCase,
418420
py_bool findNext):
419421
cdef CefString cefSearchText
420422
PyToCefString(searchText, cefSearchText)
421-
self.GetCefBrowserHost().get().Find(searchId, cefSearchText,
423+
self.GetCefBrowserHost().get().Find(cefSearchText,
422424
bool(forward), bool(matchCase), bool(findNext))
423425

424426
cpdef PyFrame GetFocusedFrame(self):
@@ -581,7 +583,7 @@ cdef class PyBrowser:
581583
cdef CefBrowserSettings settings
582584
cdef CefPoint inspect_element_at
583585
self.GetCefBrowserHost().get().ShowDevTools(
584-
window_info, <CefRefPtr[CefClient]?>NULL, settings,
586+
window_info, <CefRefPtr[CefClient]?>nullptr, settings,
585587
inspect_element_at)
586588

587589
cpdef py_void StopLoad(self):
@@ -728,8 +730,8 @@ cdef class PyBrowser:
728730
self.GetCefBrowserHost().get().SendMouseWheelEvent(mouseEvent,
729731
deltaX, deltaY)
730732

731-
cpdef py_void SendFocusEvent(self, py_bool setFocus):
732-
self.GetCefBrowserHost().get().SendFocusEvent(bool(setFocus))
733+
# cpdef py_void SendFocusEvent(self, py_bool setFocus):
734+
# self.GetCefBrowserHost().get().SendFocusEvent(bool(setFocus))
733735

734736
cpdef py_void SendCaptureLostEvent(self):
735737
self.GetCefBrowserHost().get().SendCaptureLostEvent()
@@ -738,12 +740,12 @@ cdef class PyBrowser:
738740
self.GetCefBrowserHost().get().StartDownload(PyToCefStringValue(
739741
url))
740742

741-
cpdef py_void SetMouseCursorChangeDisabled(self, py_bool disabled):
742-
self.GetCefBrowserHost().get().SetMouseCursorChangeDisabled(
743-
bool(disabled))
743+
# cpdef py_void SetMouseCursorChangeDisabled(self, py_bool disabled):
744+
# self.GetCefBrowserHost().get().SetMouseCursorChangeDisabled(
745+
# bool(disabled))
744746

745-
cpdef py_bool IsMouseCursorChangeDisabled(self):
746-
return self.GetCefBrowserHost().get().IsMouseCursorChangeDisabled()
747+
# cpdef py_bool IsMouseCursorChangeDisabled(self):
748+
# return self.GetCefBrowserHost().get().IsMouseCursorChangeDisabled()
747749

748750
cpdef py_bool TryCloseBrowser(self):
749751
return self.GetCefBrowserHost().get().TryCloseBrowser()
@@ -757,28 +759,28 @@ cdef class PyBrowser:
757759
cpdef py_void NotifyScreenInfoChanged(self):
758760
self.GetCefBrowserHost().get().NotifyScreenInfoChanged()
759761

760-
cdef void SendProcessMessage(self, cef_process_id_t targetProcess,
761-
object frameId, py_string messageName, list pyArguments
762-
) except *:
763-
cdef CefRefPtr[CefProcessMessage] message = \
764-
CefProcessMessage_Create(PyToCefStringValue(messageName))
765-
# This does not work, no idea why, the CEF implementation
766-
# seems not to allow it, both Assign() and swap() do not work:
767-
# | message.get().GetArgumentList().Assign(arguments.get())
768-
# | message.get().GetArgumentList().swap(arguments)
769-
cdef CefRefPtr[CefListValue] messageArguments = \
770-
message.get().GetArgumentList()
771-
PyListToExistingCefListValue(self.GetIdentifier(), frameId,
772-
pyArguments, messageArguments)
773-
Debug("SendProcessMessage(): message=%s, arguments size=%d" % (
774-
messageName,
775-
message.get().GetArgumentList().get().GetSize()))
776-
cdef cpp_bool success = \
777-
self.GetCefBrowser().get().SendProcessMessage(
778-
targetProcess, message)
779-
if not success:
780-
raise Exception("Browser.SendProcessMessage() failed: "\
781-
"messageName=%s" % messageName)
762+
# cdef void SendProcessMessage(self, cef_process_id_t targetProcess,
763+
# object frameId, py_string messageName, list pyArguments
764+
# ) except *:
765+
# cdef CefRefPtr[CefProcessMessage] message = \
766+
# CefProcessMessage_Create(PyToCefStringValue(messageName))
767+
# # This does not work, no idea why, the CEF implementation
768+
# # seems not to allow it, both Assign() and swap() do not work:
769+
# # | message.get().GetArgumentList().Assign(arguments.get())
770+
# # | message.get().GetArgumentList().swap(arguments)
771+
# cdef CefRefPtr[CefListValue] messageArguments = \
772+
# message.get().GetArgumentList()
773+
# PyListToExistingCefListValue(self.GetIdentifier(), frameId,
774+
# pyArguments, messageArguments)
775+
# Debug("SendProcessMessage(): message=%s, arguments size=%d" % (
776+
# messageName,
777+
# message.get().GetArgumentList().get().GetSize()))
778+
# cdef cpp_bool success = \
779+
# self.GetCefBrowser().get().SendProcessMessage(
780+
# targetProcess, message)
781+
# if not success:
782+
# raise Exception("Browser.SendProcessMessage() failed: "\
783+
# "messageName=%s" % messageName)
782784

783785
# -------------------------------------------------------------------------
784786
# OSR drag & drop

0 commit comments

Comments
 (0)