summaryrefslogtreecommitdiff
path: root/plugingui/nativewindow_x11.h
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2017-02-05 10:56:29 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2017-02-05 10:57:26 +0100
commitd321eec79f3af2c359a1577e172ea1f7329e2dc2 (patch)
tree2087bbf11de821f0e7b2c5eb8ba82f817283eaa3 /plugingui/nativewindow_x11.h
parenta3935f0c0506e1d5ea5b7961f861dd0d3f4a8391 (diff)
Added XShmImage support in X11 rendering backend.
Diffstat (limited to 'plugingui/nativewindow_x11.h')
-rw-r--r--plugingui/nativewindow_x11.h26
1 files changed, 22 insertions, 4 deletions
diff --git a/plugingui/nativewindow_x11.h b/plugingui/nativewindow_x11.h
index db6ec76..f36be51 100644
--- a/plugingui/nativewindow_x11.h
+++ b/plugingui/nativewindow_x11.h
@@ -27,13 +27,18 @@
#pragma once
#include <X11/Xlib.h>
+#include <X11/extensions/XShm.h>
#include "nativewindow.h"
-namespace GUI {
+namespace GUI
+{
class Window;
-class NativeWindowX11 : public NativeWindow {
+
+class NativeWindowX11
+ : public NativeWindow
+{
public:
NativeWindowX11(void* native_window, Window& window);
~NativeWindowX11();
@@ -54,11 +59,22 @@ public:
private:
std::shared_ptr<Event> translateXMessage(XEvent& xevent, bool peek = false);
- XImage* createImageFromBuffer(unsigned char* buf, int width, int height);
+
+ //! Allocate new shared memory buffer for the pixel buffer.
+ //! Frees the existing buffer if there is one.
+ void allocateShmImage(std::size_t width, std::size_t height);
+
+ //! Deallocate image and shm resources.
+ void deallocateShmImage();
+
+ //! Copy data from the pixel buffer into the shared memory
+ void updateImageFromBuffer();
+
+ XShmSegmentInfo shm_info;
+ XImage* image{nullptr};
::Window xwindow{0};
GC gc{0};
- XImage* buffer{nullptr};
Window& window;
@@ -66,6 +82,8 @@ private:
Display* display{nullptr};
int screen{0};
+ int depth{0};
+ Visual* visual{nullptr};
Atom wmDeleteMessage{0};
};