linux-xshm: Use macro for logging.

This adds a macro to automatically prepend the plugin name to debug
statements like it is done in other plugins.
master
fryshorts 2014-11-18 20:18:14 +01:00
parent 1a51d5fab7
commit 08c9f39220
1 changed files with 8 additions and 6 deletions

View File

@ -27,6 +27,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define XSHM_DATA(voidptr) struct xshm_data *data = voidptr; #define XSHM_DATA(voidptr) struct xshm_data *data = voidptr;
#define blog(level, msg, ...) blog(level, "xshm-input: " msg, ##__VA_ARGS__)
struct xshm_data { struct xshm_data {
/** Xlib display object */ /** Xlib display object */
Display *dpy; Display *dpy;
@ -96,11 +98,11 @@ static int_fast32_t xshm_update_geometry(struct xshm_data *data,
} }
if (!data->width || !data->height) { if (!data->width || !data->height) {
blog(LOG_ERROR, "xshm-input: Failed to get geometry"); blog(LOG_ERROR, "Failed to get geometry");
return -1; return -1;
} }
blog(LOG_INFO, "xshm-input: Geometry %"PRIdFAST32"x%"PRIdFAST32 blog(LOG_INFO, "Geometry %"PRIdFAST32"x%"PRIdFAST32
" @ %"PRIdFAST32",%"PRIdFAST32, " @ %"PRIdFAST32",%"PRIdFAST32,
data->width, data->height, data->x_org, data->y_org); data->width, data->height, data->x_org, data->y_org);
@ -131,7 +133,7 @@ static void xshm_update(void *vptr, obs_data_t *settings)
xshm_detach(data->xshm); xshm_detach(data->xshm);
if (xshm_update_geometry(data, settings) < 0) { if (xshm_update_geometry(data, settings) < 0) {
blog(LOG_ERROR, "xshm-input: failed to update geometry !"); blog(LOG_ERROR, "failed to update geometry !");
return; return;
} }
@ -141,7 +143,7 @@ static void xshm_update(void *vptr, obs_data_t *settings)
data->xshm = xshm_attach(data->dpy, data->screen, data->xshm = xshm_attach(data->dpy, data->screen,
data->width, data->height); data->width, data->height);
if (!data->xshm) { if (!data->xshm) {
blog(LOG_ERROR, "xshm-input: failed to attach shm !"); blog(LOG_ERROR, "failed to attach shm !");
return; return;
} }
} }
@ -218,12 +220,12 @@ static void *xshm_create(obs_data_t *settings, obs_source_t *source)
data->dpy = XOpenDisplay(NULL); data->dpy = XOpenDisplay(NULL);
if (!data->dpy) { if (!data->dpy) {
blog(LOG_ERROR, "xshm-input: Unable to open X display !"); blog(LOG_ERROR, "Unable to open X display !");
goto fail; goto fail;
} }
if (!XShmQueryExtension(data->dpy)) { if (!XShmQueryExtension(data->dpy)) {
blog(LOG_ERROR, "xshm-input: XShm extension not found !"); blog(LOG_ERROR, "XShm extension not found !");
goto fail; goto fail;
} }