X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=ui%2Ftwin%2Fpbt-scr.c;h=c360047cb5879ca7bce16e4629f46da7031f0cad;hp=8532bc10bfb79cfb79338fae96dea0bbcc035670;hb=c4be9490a5d94b662370576157b6e0ed73f2fe77;hpb=37428306a270088bfcb1f94362a0fe5b7a5a888e diff --git a/ui/twin/pbt-scr.c b/ui/twin/pbt-scr.c index 8532bc1..c360047 100644 --- a/ui/twin/pbt-scr.c +++ b/ui/twin/pbt-scr.c @@ -15,8 +15,10 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#if defined(HAVE_CONFIG_H) #include "config.h" -#define _GNU_SOURCE +#endif + #include #include @@ -136,7 +138,7 @@ twin_pixmap_t *pbt_background_load(twin_screen_t *tscreen, raw_background = twin_jpeg_to_pixmap(filename, TWIN_ARGB32); if (!raw_background) { - pb_log("%s: loading image '%s' failed\n", __func__, filename); + pb_log_fn("loading image '%s' failed\n", filename); /* Fallback to a default pattern */ @@ -156,7 +158,7 @@ twin_pixmap_t *pbt_background_load(twin_screen_t *tscreen, tscreen->width, tscreen->height); if (!scaled_background) { - pb_log("%s: scale '%s' failed\n", __func__, filename); + pb_log_fn("scale '%s' failed\n", filename); twin_pixmap_destroy(raw_background); return twin_make_pattern(); } @@ -222,7 +224,7 @@ retry: new.icon = twin_png_to_pixmap(filename, TWIN_ARGB32); if (!new.icon) { - pb_log("%s: loading image '%s' failed\n", __func__, filename); + pb_log_fn("loading image '%s' failed\n", filename); if (filename == default_icon_file) return NULL; @@ -361,7 +363,7 @@ static int pbt_twin_waiter_cb(struct pbt_twin_ctx *twin_ctx) static void pbt_scr_destructor(struct pbt_scr *scr) { - pb_log("%s\n", __func__); + pb_debug("%s\n", __func__); twin_x11_destroy(scr->twin_ctx.x11); // FIXME: need cursor cleanup??? @@ -382,7 +384,7 @@ struct pbt_scr *pbt_scr_init(void *talloc_ctx, assert(backend && backend < 3); if (!scr) { - pb_log("%s: alloc pbt_scr failed.\n", __func__); + pb_log_fn("alloc pbt_scr failed.\n"); goto fail_alloc; } @@ -393,37 +395,37 @@ struct pbt_scr *pbt_scr_init(void *talloc_ctx, scr->twin_ctx.backend = backend; if (backend == pbt_twin_x11) { - pb_log("%s: using twin x11 backend.\n", __func__); + pb_log_fn("using twin x11 backend.\n"); assert(width > 100); assert(height > 100); #if !defined(HAVE_LIBTWIN_TWIN_X11_H) assert(0); #else - scr->twin_ctx.x11 = twin_x11_create_ext(XOpenDisplay(0), width, - height, 0); + scr->twin_ctx.x11 = twin_x11_create_ext(XOpenDisplay(NULL), + width, height, 0); if (!scr->twin_ctx.x11) { - pb_log("%s: twin_x11_create_ext failed.\n", __func__); + pb_log_fn("twin_x11_create_ext failed.\n"); perror("failed to create twin x11 context\n"); goto fail_ctx_create; } - pb_log("%s: x11: %p\n", __func__, scr->twin_ctx.x11); + pb_debug("%s: x11: %p\n", __func__, scr->twin_ctx.x11); assert(scr->twin_ctx.x11->screen); scr->tscreen = scr->twin_ctx.x11->screen; waiter_fd = ConnectionNumber(scr->twin_ctx.x11->dpy); #endif } else if (backend == pbt_twin_fbdev) { - pb_log("%s: using twin fbdev backend.\n", __func__); + pb_log_fn("using twin fbdev backend.\n"); #if !defined(HAVE_LIBTWIN_TWIN_FBDEV_H) assert(0); #else scr->twin_ctx.fbdev = twin_fbdev_create_ext(-1, SIGUSR1, 0); if (!scr->twin_ctx.fbdev) { - pb_log("%s: twin_fbdev_create_ext failed.\n", __func__); + pb_log_fn("twin_fbdev_create_ext failed.\n"); perror("failed to create twin fbdev context\n"); goto fail_ctx_create; } @@ -443,8 +445,8 @@ struct pbt_scr *pbt_scr_init(void *talloc_ctx, assert(waiter_fd != -1); - waiter_register(waitset, waiter_fd, WAIT_IN, (void *)pbt_twin_waiter_cb, - &scr->twin_ctx); + waiter_register_io(waitset, waiter_fd, WAIT_IN, + (void *)pbt_twin_waiter_cb, &scr->twin_ctx); return scr;