# include <unistd.h>
#endif
-#ifndef HAVE_COCOA
+#ifndef HAVE_JWXYZ
# include <X11/Intrinsic.h> /* for XtDatabase in hack_resources() */
#endif
analogtv_reception recs[MAX_MULTICHAN];
double noise_level;
Bool image_loaded_p;
- char *filename; /* mostly unused */
+/* char *filename; was only used for diagnostics */
int dur;
} chansetting;
chansetting *cs;
int change_now;
-
+ int colorbars_only_p;
};
ypos=ANALOGTV_V/5;
xpos=ANALOGTV_VIS_START + ANALOGTV_VIS_LEN/2;
+ if (! st->colorbars_only_p)
{
char localname[256];
if (gethostname (localname, sizeof (localname))==0) {
}
ypos += st->ugly_font.char_h*5/2;
- analogtv_draw_xpm(st->tv, input,
- logo_50_xpm, xpos - 100, ypos);
+ if (! st->colorbars_only_p)
+ analogtv_draw_xpm(st->tv, input,
+ logo_50_xpm, xpos - 100, ypos);
ypos += 58;
ypos += st->ugly_font.char_h*4;
#endif
+ if (! st->colorbars_only_p)
{
char timestamp[256];
time_t t = time ((time_t *) 0);
".background: black",
".foreground: white",
"*delay: 5",
- "*grabDesktopImages: False", /* HAVE_COCOA */
- "*chooseRandomImages: True", /* HAVE_COCOA */
+ "*grabDesktopImages: False", /* HAVE_JWXYZ */
+ "*chooseRandomImages: True", /* HAVE_JWXYZ */
ANALOGTV_DEFAULTS
0,
};
static XrmOptionDescRec xanalogtv_options [] = {
{ "-delay", ".delay", XrmoptionSepArg, 0 },
+ { "-colorbars-only", ".colorbarsOnly", XrmoptionNoArg, "True" },
ANALOGTV_OPTIONS
{ 0, 0, 0, 0 }
};
static void
hack_resources (Display *dpy)
{
-#ifndef HAVE_COCOA
+#ifndef HAVE_JWXYZ
static int count = -1;
count++;
value.size = strlen(buf2);
XrmPutResource (&db, buf1, "String", &value);
}
-#endif /* HAVE_COCOA */
+#endif /* HAVE_JWXYZ */
}
analogtv_input *input = st->stations[i];
st->chansettings[i].image_loaded_p = True;
- if (i == 0) { /* station 0 is always colorbars */
+ if (i == 0 || /* station 0 is always colorbars */
+ st->colorbars_only_p) {
input->updater = update_smpte_colorbars;
input->do_teletext=1;
}
st->window = window;
st->tv=analogtv_allocate(dpy, window);
+ st->colorbars_only_p =
+ get_boolean_resource(dpy, "colorbarsOnly", "ColorbarsOnly");
+
add_stations(st);
analogtv_set_defaults(st->tv, "");
int curticks=getticks(st);
double curtime=curticks*0.001;
- if (st->change_now ||
- (curticks >= st->change_ticks && st->tv->powerup > 10.0)) {
+ const analogtv_reception *recs[MAX_MULTICHAN];
+ unsigned rec_count = 0;
+
+ int auto_change = curticks >= st->change_ticks && st->tv->powerup > 10.0 ? 1 : 0;
+
+ if (st->change_now || auto_change) {
+ st->curinputi=(st->curinputi+st->change_now+auto_change+N_CHANNELS)%N_CHANNELS;
st->change_now = 0;
- st->curinputi=(st->curinputi+1)%N_CHANNELS;
st->cs = &st->chansettings[st->curinputi];
#if 0
fprintf (stderr, "%s: channel %d, %s\n", progname, st->curinputi,
st->tv->powerup=curtime;
- analogtv_init_signal(st->tv, st->cs->noise_level);
for (i=0; i<MAX_MULTICHAN; i++) {
analogtv_reception *rec = &st->cs->recs[i];
- analogtv_input *inp=rec->input;
- if (!inp) continue;
-
- analogtv_reception_update(rec);
- analogtv_add_signal(st->tv, rec);
+ if (rec->input) {
+ analogtv_reception_update(rec);
+ recs[rec_count] = rec;
+ ++rec_count;
+ }
}
- analogtv_draw(st->tv);
- return 10000;
+ analogtv_draw(st->tv, st->cs->noise_level, recs, rec_count);
+
+#ifdef HAVE_MOBILE
+ return 0;
+#else
+ return 5000;
+#endif
}
static void
if (event->type == ButtonPress)
{
- st->change_now = 1;
+ unsigned button = event->xbutton.button;
+ st->change_now = button == 2 || button == 3 || button == 5 ? -1 : 1;
return True;
}
else if (event->type == KeyPress)
KeySym keysym;
char c = 0;
XLookupString (&event->xkey, &c, 1, &keysym, 0);
- if (c == ' ' || c == '\t' || c == '\r' || c == '\n')
+ if (c == ' ' || c == '\t' || c == '\r' || c == '\n' ||
+ keysym == XK_Up || keysym == XK_Right || keysym == XK_Prior)
{
st->change_now = 1;
return True;
}
+ else if (c == '\b' ||
+ keysym == XK_Down || keysym == XK_Left || keysym == XK_Next)
+ {
+ st->change_now = -1;
+ return True;
+ }
+ else if (screenhack_event_helper (dpy, window, event))
+ goto DEF;
+ }
+ else if (screenhack_event_helper (dpy, window, event))
+ {
+ DEF:
+ st->change_now = ((random() & 1) ? 1 : -1);
+ return True;
}
return False;