Skip to content

Commit

Permalink
enable write access for buffers we own
Browse files Browse the repository at this point in the history
(just not for XShm memory)
  • Loading branch information
totaam committed Feb 6, 2024
1 parent 11e36be commit f574309
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions xpra/x11/bindings/ximage.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ cdef extern from "Python.h":
void PyBuffer_Release(Py_buffer *view)
int PyBUF_ANY_CONTIGUOUS
int PyBUF_READ
int PyBUF_WRITE

cdef extern from "stdlib.h":
int posix_memalign(void **memptr, size_t alignment, size_t size)
Expand Down Expand Up @@ -315,6 +316,9 @@ cdef class XImageWrapper:
cdef void *pix_ptr = self.get_pixels_ptr()
if pix_ptr==NULL:
return None
cdef int flags = PyBUF_READ
if self.pixels!=NULL:
flags = PyBUF_WRITE
return PyMemoryView_FromMemory(<char *> pix_ptr, self.get_size(), PyBUF_READ)

def get_sub_image(self, unsigned int x, unsigned int y, unsigned int w, unsigned int h):
Expand Down

0 comments on commit f574309

Please sign in to comment.