14 #ifndef SUBPROCESSWINDOWBUFFER_H 15 #define SUBPROCESSWINDOWBUFFER_H 37 void *
operator new(size_t,
void *addr);
44 std::string &filename,
45 int x_size,
int y_size);
47 const std::string &filename,
51 const std::string &filename);
53 const std::string &filename,
85 EF_has_mouse = 0x0001,
86 EF_mouse_position = 0x0002,
87 EF_shift_held = 0x0004,
88 EF_control_held = 0x0008,
90 EF_meta_held = 0x0020,
91 EF_caps_lock = 0x0040,
111 enum { magic_number_length = 8 };
112 static const char _magic_number[magic_number_length];
113 char _this_magic[magic_number_length];
120 int _x_size, _y_size;
122 size_t _framebuffer_size;
125 enum { max_events = 64 };
128 Event _events[max_events];
void close_write_framebuffer()
Releases the framebuffer after a previous call to open_write_framebuffer().
bool ready_for_read() const
Returns true if the framebuffer data has been updated since open_read_framebuffer() was last called.
void close_read_framebuffer()
Releases the framebuffer after a previous call to open_read_framebuffer().
size_t get_framebuffer_size() const
Returns the total number of bytes in the framebuffer.
bool verify_magic_number() const
Returns true if the buffer's magic number matches, false otherwise.
bool add_event(const Event &event)
Adds a new Event to the queue.
int get_y_size() const
Returns the height of the framebuffer in pixels.
bool get_event(Event &event)
If the queue is nonempty, fills event with the first Event on the queue and returns true.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static void close_buffer(int fd, size_t mmap_size, const std::string &filename, SubprocessWindowBuffer *buffer)
Closes a buffer object created via a previous call to open_buffer().
bool has_event() const
Returns true if the queue has at least one Event to extract, false if it is empty.
void * open_write_framebuffer()
Returns a writable pointer to the framebuffer.
static SubprocessWindowBuffer * new_buffer(int &fd, size_t &mmap_size, std::string &filename, int x_size, int y_size)
Call this method to create a new buffer in shared memory space.
This is a special class that is designed to faciliate SubprocessWindow.
bool ready_for_write() const
Returns true if the framebuffer data has been read since open_write_framebuffer() was last called.
size_t get_row_size() const
Returns the length of a row of the framebuffer, in bytes.
A named event, possibly with parameters.
const void * open_read_framebuffer()
Returns a read-only pointer to the framebuffer.
static void destroy_buffer(int fd, size_t mmap_size, const std::string &filename, SubprocessWindowBuffer *buffer)
Destroys a buffer object created via a previous call to new_buffer().
int get_x_size() const
Returns the width of the framebuffer in pixels.
static SubprocessWindowBuffer * open_buffer(int &fd, size_t &mmap_size, const std::string &filename)
Call this method to open a reference to an existing buffer in shared memory space.