xcursor_t *xcursor_init(Display *dpy) { xcursor_t *data = bzalloc(sizeof(xcursor_t)); data->dpy = dpy; xcursor_tick(data); return data; }
/** * Prepare the capture data */ static void xshm_video_tick(void *vptr, float seconds) { UNUSED_PARAMETER(seconds); XSHM_DATA(vptr); if (!data->xshm) return; obs_enter_graphics(); XShmGetImage(data->dpy, XRootWindowOfScreen(data->screen), data->xshm->image, data->x_org, data->y_org, AllPlanes); gs_texture_set_image(data->texture, (void *) data->xshm->image->data, data->width * 4, false); xcursor_tick(data->cursor); obs_leave_graphics(); }
void XCompcapMain::tick(float seconds) { UNUSED_PARAMETER(seconds); PLock lock(&p->lock, true); if (!lock.isLocked()) return; XCompcap::processEvents(); if (XCompcap::windowWasReconfigured(p->win)) updateSettings(0); if (!p->tex || !p->gltex) return; obs_enter_graphics(); if (p->lockX) { XLockDisplay(xdisp); XSync(xdisp, 0); } gs_copy_texture_region(p->tex, 0, 0, p->gltex, p->cur_cut_left, p->cur_cut_top, width(), height()); if (p->cursor && p->show_cursor) { xcursor_tick(p->cursor); p->cursor_outside = p->cursor->x < p->cur_cut_left || p->cursor->y < p->cur_cut_top || p->cursor->x > int(p->width - p->cur_cut_right) || p->cursor->y > int(p->height - p->cur_cut_bot); } if (p->lockX) XUnlockDisplay(xdisp); obs_leave_graphics(); }
void XCompcapMain::tick(float seconds) { if (!obs_source_showing(p->source)) return; PLock lock(&p->lock, true); if (!lock.isLocked()) return; XCompcap::processEvents(); if (p->win && XCompcap::windowWasReconfigured(p->win)) { p->window_check_time = FIND_WINDOW_INTERVAL; p->win = 0; } XDisplayLock xlock; XWindowAttributes attr; if (!p->win || !XGetWindowAttributes(xdisp, p->win, &attr)) { p->window_check_time += (double)seconds; if (p->window_check_time < FIND_WINDOW_INTERVAL) return; Window newWin = getWindowFromString(p->windowName); p->window_check_time = 0.0; if (newWin && XGetWindowAttributes(xdisp, newWin, &attr)) { p->win = newWin; updateSettings(0); } else { return; } } if (!p->tex || !p->gltex) return; obs_enter_graphics(); if (p->lockX) { XLockDisplay(xdisp); XSync(xdisp, 0); } if (p->include_border) { gs_copy_texture_region( p->tex, 0, 0, p->gltex, p->cur_cut_left, p->cur_cut_top, width(), height()); } else { gs_copy_texture_region( p->tex, 0, 0, p->gltex, p->cur_cut_left + p->border, p->cur_cut_top + p->border, width(), height()); } if (p->cursor && p->show_cursor) { xcursor_tick(p->cursor); p->cursor_outside = p->cursor->x < p->cur_cut_left || p->cursor->y < p->cur_cut_top || p->cursor->x > int(p->width - p->cur_cut_right) || p->cursor->y > int(p->height - p->cur_cut_bot); } if (p->lockX) XUnlockDisplay(xdisp); obs_leave_graphics(); }
void XCompcapMain::tick(float seconds) { UNUSED_PARAMETER(seconds); if (!obs_source_showing(p->source)) return; PLock lock(&p->lock, true); if (!lock.isLocked()) return; XCompcap::processEvents(); if (XCompcap::windowWasReconfigured(p->win)) updateSettings(0); XErrorLock xlock; xlock.resetError(); XWindowAttributes attr; if (!XGetWindowAttributes(xdisp, p->win, &attr)) { Window newWin = getWindowFromString(p->windowName); if (XGetWindowAttributes(xdisp, newWin, &attr)) { p->win = newWin; updateSettings(0); } return; } if (!p->tex || !p->gltex) return; obs_enter_graphics(); if (p->lockX) { XLockDisplay(xdisp); XSync(xdisp, 0); } if (p->include_border) { gs_copy_texture_region( p->tex, 0, 0, p->gltex, p->cur_cut_left, p->cur_cut_top, width(), height()); } else { gs_copy_texture_region( p->tex, 0, 0, p->gltex, p->cur_cut_left + p->border, p->cur_cut_top + p->border, width(), height()); } if (p->cursor && p->show_cursor) { xcursor_tick(p->cursor); p->cursor_outside = p->cursor->x < p->cur_cut_left || p->cursor->y < p->cur_cut_top || p->cursor->x > int(p->width - p->cur_cut_right) || p->cursor->y > int(p->height - p->cur_cut_bot); } if (p->lockX) XUnlockDisplay(xdisp); obs_leave_graphics(); }