X Tutup
Skip to content

Commit c0a8011

Browse files
committed
Expose DragData image APIs on all platforms (cztomczak#251)
1 parent e6bcf2c commit c0a8011

File tree

3 files changed

+15
-23
lines changed

3 files changed

+15
-23
lines changed

api/Browser.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ Returns the names of all existing frames. This list does not include the main fr
427427
| --- | --- |
428428
| __Return__ | tuple(bytes buffer, int width, int height) |
429429

430-
Currently works only on Linux (Issue [#427](../../../issues/427)).
430+
Currently available only on Linux (Issue [#427](../../../issues/427)).
431431

432432
Get browser contents as image. Only screen visible contents are returned.
433433

src/cefpython.pyx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -368,11 +368,7 @@ include "command_line.pyx"
368368
include "app.pyx"
369369
include "drag_data.pyx"
370370
include "helpers.pyx"
371-
372-
# Currently used only on Linux via DragData. Do not include on other
373-
# platforms otherwise warning about unused function appears.
374-
IF UNAME_SYSNAME == "Linux":
375-
include "image.pyx"
371+
include "image.pyx"
376372

377373
# Handlers
378374
include "handlers/browser_process_handler.pyx"

src/drag_data.pyx

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,16 @@ cdef class DragData:
3636
cpdef py_string GetFragmentHtml(self):
3737
return CefToPyString(self.cef_drag_data.get().GetFragmentHtml())
3838

39-
IF UNAME_SYSNAME == "Linux":
40-
41-
cpdef PyImage GetImage(self):
42-
cdef CefRefPtr[CefImage] cef_image =\
43-
self.cef_drag_data.get().GetImage()
44-
if not cef_image.get():
45-
raise Exception("Image is not available")
46-
return PyImage_Init(cef_image)
47-
48-
cpdef tuple GetImageHotspot(self):
49-
cdef CefPoint point = self.cef_drag_data.get().GetImageHotspot()
50-
return (point.x, point.y)
51-
52-
cpdef py_bool HasImage(self):
53-
return self.cef_drag_data.get().HasImage()
54-
55-
# END IF UNAME_SYSNAME == "Linux":
39+
cpdef PyImage GetImage(self):
40+
cdef CefRefPtr[CefImage] cef_image =\
41+
self.cef_drag_data.get().GetImage()
42+
if not cef_image.get():
43+
raise Exception("Image is not available")
44+
return PyImage_Init(cef_image)
45+
46+
cpdef tuple GetImageHotspot(self):
47+
cdef CefPoint point = self.cef_drag_data.get().GetImageHotspot()
48+
return point.x, point.y
49+
50+
cpdef py_bool HasImage(self):
51+
return self.cef_drag_data.get().HasImage()

0 commit comments

Comments
 (0)
X Tutup