Provide pixmap format in XShm helper

This commit is contained in:
Martin Gräßlin 2013-06-17 13:41:35 +02:00
parent f4ee319c6a
commit 2cf7a4bad3
2 changed files with 10 additions and 0 deletions

View file

@ -265,6 +265,7 @@ Shm::Shm()
, m_buffer(NULL)
, m_segment(XCB_NONE)
, m_valid(false)
, m_pixmapFormat(XCB_IMAGE_FORMAT_XY_BITMAP)
{
m_valid = init();
}
@ -290,6 +291,7 @@ bool Shm::init()
qDebug() << "Failed to get SHM extension version information";
return false;
}
m_pixmapFormat = version->pixmap_format;
const int MAXSIZE = 4096 * 2048 * 4; // TODO check there are not larger windows
m_shmId = shmget(IPC_PRIVATE, MAXSIZE, IPC_CREAT | 0600);
if (m_shmId < 0) {

View file

@ -923,12 +923,14 @@ public:
void *buffer() const;
xcb_shm_seg_t segment() const;
bool isValid() const;
uint8_t pixmapFormat() const;
private:
bool init();
int m_shmId;
void *m_buffer;
xcb_shm_seg_t m_segment;
bool m_valid;
uint8_t m_pixmapFormat;
};
inline
@ -955,6 +957,12 @@ int Shm::shmId() const
return m_shmId;
}
inline
uint8_t Shm::pixmapFormat() const
{
return m_pixmapFormat;
}
} // namespace X11
} // namespace KWin