|
|
@ -99,11 +99,9 @@ static void x11grab_draw_region_win(struct x11grab *s) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Display *dpy = s->dpy; |
|
|
|
Display *dpy = s->dpy; |
|
|
|
Window win = s->region_win; |
|
|
|
Window win = s->region_win; |
|
|
|
int screen; |
|
|
|
int screen = DefaultScreen(dpy); |
|
|
|
GC gc; |
|
|
|
GC gc = XCreateGC(dpy, win, 0, 0); |
|
|
|
|
|
|
|
|
|
|
|
screen = DefaultScreen(dpy); |
|
|
|
|
|
|
|
gc = XCreateGC(dpy, win, 0, 0); |
|
|
|
|
|
|
|
XSetForeground(dpy, gc, WhitePixel(dpy, screen)); |
|
|
|
XSetForeground(dpy, gc, WhitePixel(dpy, screen)); |
|
|
|
XSetBackground(dpy, gc, BlackPixel(dpy, screen)); |
|
|
|
XSetBackground(dpy, gc, BlackPixel(dpy, screen)); |
|
|
|
XSetLineAttributes(dpy, gc, REGION_WIN_BORDER, LineDoubleDash, 0, 0); |
|
|
|
XSetLineAttributes(dpy, gc, REGION_WIN_BORDER, LineDoubleDash, 0, 0); |
|
|
@ -121,12 +119,10 @@ static void x11grab_draw_region_win(struct x11grab *s) |
|
|
|
static void x11grab_region_win_init(struct x11grab *s) |
|
|
|
static void x11grab_region_win_init(struct x11grab *s) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Display *dpy = s->dpy; |
|
|
|
Display *dpy = s->dpy; |
|
|
|
int screen; |
|
|
|
|
|
|
|
XSetWindowAttributes attribs; |
|
|
|
|
|
|
|
XRectangle rect; |
|
|
|
XRectangle rect; |
|
|
|
|
|
|
|
XSetWindowAttributes attribs = { .override_redirect = True }; |
|
|
|
|
|
|
|
int screen = DefaultScreen(dpy); |
|
|
|
|
|
|
|
|
|
|
|
screen = DefaultScreen(dpy); |
|
|
|
|
|
|
|
attribs.override_redirect = True; |
|
|
|
|
|
|
|
s->region_win = XCreateWindow(dpy, RootWindow(dpy, screen), |
|
|
|
s->region_win = XCreateWindow(dpy, RootWindow(dpy, screen), |
|
|
|
s->x_off - REGION_WIN_BORDER, |
|
|
|
s->x_off - REGION_WIN_BORDER, |
|
|
|
s->y_off - REGION_WIN_BORDER, |
|
|
|
s->y_off - REGION_WIN_BORDER, |
|
|
@ -164,12 +160,8 @@ static int x11grab_read_header(AVFormatContext *s1) |
|
|
|
AVStream *st = NULL; |
|
|
|
AVStream *st = NULL; |
|
|
|
enum AVPixelFormat input_pixfmt; |
|
|
|
enum AVPixelFormat input_pixfmt; |
|
|
|
XImage *image; |
|
|
|
XImage *image; |
|
|
|
int x_off = 0; |
|
|
|
int x_off = 0, y_off = 0, ret = 0, screen, use_shm = 0; |
|
|
|
int y_off = 0; |
|
|
|
|
|
|
|
int screen; |
|
|
|
|
|
|
|
int use_shm = 0; |
|
|
|
|
|
|
|
char *dpyname, *offset; |
|
|
|
char *dpyname, *offset; |
|
|
|
int ret = 0; |
|
|
|
|
|
|
|
Colormap color_map; |
|
|
|
Colormap color_map; |
|
|
|
XColor color[256]; |
|
|
|
XColor color[256]; |
|
|
|
int i; |
|
|
|
int i; |
|
|
@ -578,10 +570,10 @@ static int x11grab_read_packet(AVFormatContext *s1, AVPacket *pkt) |
|
|
|
|
|
|
|
|
|
|
|
if (s->show_region) { |
|
|
|
if (s->show_region) { |
|
|
|
if (s->region_win) { |
|
|
|
if (s->region_win) { |
|
|
|
XEvent evt; |
|
|
|
XEvent evt = { .type = NoEventMask }; |
|
|
|
// clean up the events, and do the initinal draw or redraw.
|
|
|
|
// Clean up the events, and do the initial draw or redraw.
|
|
|
|
for (evt.type = NoEventMask; |
|
|
|
while (XCheckMaskEvent(dpy, ExposureMask | StructureNotifyMask, |
|
|
|
XCheckMaskEvent(dpy, ExposureMask | StructureNotifyMask, &evt);) |
|
|
|
&evt)) |
|
|
|
; |
|
|
|
; |
|
|
|
if (evt.type) |
|
|
|
if (evt.type) |
|
|
|
x11grab_draw_region_win(s); |
|
|
|
x11grab_draw_region_win(s); |
|
|
|