linux-capture: Add helper to get xcb screen
Add a helper function to get a xcb screen from a screen id.master
parent
e7cdb837aa
commit
069ee92ff4
|
@ -188,3 +188,15 @@ void xshm_xcb_detach(xcb_shm_t *shm)
|
|||
bfree(shm);
|
||||
}
|
||||
|
||||
xcb_screen_t *xcb_get_screen(xcb_connection_t *xcb, int screen)
|
||||
{
|
||||
xcb_screen_iterator_t iter;
|
||||
|
||||
iter = xcb_setup_roots_iterator(xcb_get_setup(xcb));
|
||||
for (; iter.rem; --screen, xcb_screen_next(&iter)) {
|
||||
if (screen == 0)
|
||||
return iter.data;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ extern "C" {
|
|||
#include <X11/Xlib.h>
|
||||
#include <X11/extensions/XShm.h>
|
||||
#include <xcb/shm.h>
|
||||
#include <xcb/xproto.h>
|
||||
#include <obs.h>
|
||||
|
||||
typedef struct {
|
||||
|
@ -120,6 +121,15 @@ xcb_shm_t *xshm_xcb_attach(xcb_connection_t *xcb, const int w, const int h);
|
|||
*/
|
||||
void xshm_xcb_detach(xcb_shm_t *shm);
|
||||
|
||||
/**
|
||||
* Get screen by id for a xcb connection
|
||||
*
|
||||
* @param xcb xcb connection
|
||||
* @param screen id of the screen
|
||||
* @return screen info structure
|
||||
*/
|
||||
xcb_screen_t *xcb_get_screen(xcb_connection_t *xcb, int screen);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue