X Tutup
Skip to content

Commit bea0974

Browse files
committed
CEF 1 compilation fix.
CEF 1 dummy api script updated. Off-screen rendering error fixed when rendering a popup.
1 parent e121f7d commit bea0974

File tree

5 files changed

+20
-8
lines changed

5 files changed

+20
-8
lines changed

cefpython/browser.pyx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ cdef class PyBrowser:
432432
self.gwlStyle = GetWindowLong(hwnd, GWL_STYLE)
433433
self.gwlExStyle = GetWindowLong(hwnd, GWL_EXSTYLE)
434434
GetWindowRect(hwnd, &rect)
435-
self.windowRect = (rect.left, rect.top,
435+
self.windowRect = (rect.left, rect.top,
436436
rect.right, rect.bottom)
437437

438438
cdef int removeStyle, removeExStyle
@@ -456,7 +456,7 @@ cdef class PyBrowser:
456456
top = monitorInfo.rcMonitor.top
457457
right = monitorInfo.rcMonitor.right
458458
bottom = monitorInfo.rcMonitor.bottom
459-
SetWindowPos(hwnd, NULL,
459+
SetWindowPos(hwnd, NULL,
460460
left, top, right-left, bottom-top,
461461
SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED)
462462
else:
@@ -490,7 +490,7 @@ cdef class PyBrowser:
490490
if ret:
491491
return (width, height)
492492
else:
493-
return ()
493+
return (0, 0)
494494

495495
cpdef py_void SetSize(self, PaintElementType paintElementType,
496496
int width, int height):

cefpython/cef1/windows/binaries/cefpython_py27.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ def QuitMessageLoop():
4141
def Shutdown():
4242
return None
4343

44+
def GetModuleDirectory():
45+
return ""
46+
4447
#
4548
# Settings
4649
#
@@ -805,7 +808,7 @@ def RenderHandler_OnPopupShow(browser, show):
805808
def RenderHandler_OnPopupSize(browser, rect):
806809
return None
807810

808-
def RenderHandler_OnPaint(browser, paintElementType, out_dirtyRects,
811+
def RenderHandler_OnPaint(browser, paintElementType, out_dirtyRects,
809812
paintBuffer):
810813
return None
811814

cefpython/cef1/windows/binaries/panda3d_.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# CEF off-screen rendering using the Panda3D game engine:
22
# http://www.panda3d.org/
33

4-
# You need panda3D runtime that is compatible with python 2.7,
4+
# You need panda3D SDK that is compatible with python 2.7,
55
# version 1.8.0 comes by default with python 2.7.
66

77
# To use custom python (not the one provided with the SDK)
@@ -327,7 +327,12 @@ def __init__(self, browser, texture):
327327
def OnPaint(self, browser, paintElementType, dirtyRects, buffer):
328328
(width, height) = self.browser.GetSize(paintElementType)
329329
img = self.texture.modifyRamImage()
330-
img.setData(buffer.GetString(mode="bgra", origin="bottom-left"))
330+
if paintElementType == cefpython.PET_POPUP:
331+
print("width=%s, height=%s" % (width, height))
332+
elif paintElementType == cefpython.PET_VIEW:
333+
img.setData(buffer.GetString(mode="bgra", origin="bottom-left"))
334+
else:
335+
raise Exception("Unknown paintElementType: %s" % paintElementType)
331336

332337
def GetViewRect(self, browser, rect):
333338
return False

cefpython/cef1_api.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ def QuitMessageLoop():
4141
def Shutdown():
4242
return None
4343

44+
def GetModuleDirectory():
45+
return ""
46+
4447
#
4548
# Settings
4649
#
@@ -805,7 +808,7 @@ def RenderHandler_OnPopupShow(browser, show):
805808
def RenderHandler_OnPopupSize(browser, rect):
806809
return None
807810

808-
def RenderHandler_OnPaint(browser, paintElementType, out_dirtyRects,
811+
def RenderHandler_OnPaint(browser, paintElementType, out_dirtyRects,
809812
paintBuffer):
810813
return None
811814

cefpython/cython_includes/cef_types_wrappers.pxd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ include "compile_time_constants.pxi"
66

77
from libcpp cimport bool as cpp_bool
88
from cef_string cimport cef_string_t
9-
from cef_types cimport cef_state_t
9+
IF CEF_VERSION == 3:
10+
from cef_types cimport cef_state_t
1011

1112
cdef extern from "include/internal/cef_types_wrappers.h":
1213

0 commit comments

Comments
 (0)
X Tutup