lib/waiter: Add timeout waiters
[petitboot] / ui / twin / pbt-scr.c
index 8d6c498ec710cf1a38a0f7552d81930b8d8beef0..e093c3c66b13fcc28defaa3d8b882a3d8d746511 100644 (file)
@@ -180,7 +180,7 @@ twin_pixmap_t *pbt_background_load(twin_screen_t *tscreen,
 const char *pbt_icon_chooser(const char *hint)
 {
        if (strstr(hint, "net"))
-               return PB_ARTWORK_PATH "/network.png";
+               return PB_ARTWORK_PATH "/network-wired.png";
 
        return NULL;
 }
@@ -368,7 +368,9 @@ static void pbt_scr_destructor(struct pbt_scr *scr)
        memset(scr, 0, sizeof(*scr));
 }
 
-struct pbt_scr *pbt_scr_init(void *talloc_ctx, enum pbt_twin_backend backend,
+struct pbt_scr *pbt_scr_init(void *talloc_ctx,
+       struct waitset *waitset,
+       enum pbt_twin_backend backend,
        unsigned int width, unsigned int height,
        const char *filename_background,
        twin_bool_t (*scr_event_cb)(twin_screen_t *tscreen,
@@ -378,8 +380,6 @@ struct pbt_scr *pbt_scr_init(void *talloc_ctx, enum pbt_twin_backend backend,
        int waiter_fd = -1;
 
        assert(backend && backend < 3);
-       assert(width > 100);
-       assert(height > 100);
 
        if (!scr) {
                pb_log("%s: alloc pbt_scr failed.\n", __func__);
@@ -394,6 +394,9 @@ struct pbt_scr *pbt_scr_init(void *talloc_ctx, enum pbt_twin_backend backend,
 
        if (backend == pbt_twin_x11) {
                pb_log("%s: using twin x11 backend.\n", __func__);
+               assert(width > 100);
+               assert(height > 100);
+
 #if !defined(HAVE_LIBTWIN_TWIN_X11_H)
                assert(0);
 #else
@@ -440,8 +443,8 @@ struct pbt_scr *pbt_scr_init(void *talloc_ctx, enum pbt_twin_backend backend,
 
        assert(waiter_fd != -1);
 
-       waiter_register(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;