Beispiel #1
0
int menu_button_handler(unsigned char MsgOptions)
{
        char refresh = 0;
	if(menu_current() == app_menu)
	{
		tHostMsg* pOutgoingMsg;
		app_menu = NULL;
		BPL_AllocMessageBuffer(&pOutgoingMsg);
		pOutgoingMsg->Type = IdleUpdate;
		RouteMsg(&pOutgoingMsg);
	}
	else
	{
	
	if(MsgOptions < MENU_ITEMS)
	{
            refresh = menu_handle_button(&(menu_current()->items[MsgOptions]));
	}
	else if(MsgOptions == MENU_BUTTON_EXIT)
	{
		if(istop())
		{
			tHostMsg* pOutgoingMsg;
			/* Only save stuff if it's been changed */
			/* save all of the non-volatile items */
			// FIXME SAVE STUFF!!

			//BPL_AllocMessageBuffer(&pOutgoingMsg);
			//pOutgoingMsg->Type = PariringControlMsg;
			//pOutgoingMsg->Options = PAIRING_CONTROL_OPTION_SAVE_SPP;
			//RouteMsg(&pOutgoingMsg);
			//SaveLinkAlarmEnable();
			//SaveRstNmiConfiguration();
			//SaveIdleBufferInvert();
			//SaveDisplaySeconds();
			//SaveTimeFormat();

			/* go back to the normal idle screen */
			BPL_AllocMessageBuffer(&pOutgoingMsg);
			pOutgoingMsg->Type = IdleUpdate;
			RouteMsg(&pOutgoingMsg);
		}
		else
		{
			menu_pop();
			refresh = 1;
		}
	}
	}
	return refresh;
}
Beispiel #2
0
int
main(int argc, char* argv[])
{
	atexit(close);
	Window root = 0;
	loadsettings();

	if(!(dpy = XOpenDisplay(NULL))) {
			fprintf(stderr, "Could not connect to the X server.\n");
			return EXIT_FAILURE;
	}
	screen = DefaultScreen(dpy);
	root = DefaultRootWindow(dpy);
	gc = XCreateGC(dpy, root, 0, 0);

	memset(&stext, 0, sizeof(stext));
	strcpy(stext, "stdbar version "VERSION);

	XSetWindowAttributes attributes;
	attributes.override_redirect = 0;
	attributes.background_pixel = alloccolor(settings[BGCOLOR].value);
	attributes.event_mask = ExposureMask;

	initdrawing();
	
	if(!istop())
		bary = DisplayHeight(dpy, screen)-barh;

	if(!(win = XCreateWindow(dpy, root, 0, bary, DisplayWidth(dpy, screen), barh, 0, DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen), CWOverrideRedirect | CWBackPixel | CWEventMask, &attributes))){
			fprintf(stderr, "Could not create the window.\n");
			XCloseDisplay(dpy);
			return EXIT_FAILURE;
	}
	initatoms();
	setatoms(barh);

	draw();

	XMapRaised(dpy, win);
	XSync(dpy, False);

	eventloop();

	close();
	return EXIT_SUCCESS;
}
Beispiel #3
0
static int32_t gnmc_krcomp_handler (gnmc_t *mon, kr_crate_t *crate) {

	screen_t *screen;
	kr_subunit_t subunit;
	screen_t **main_scrs;
  cr_cache_t *cache;

	kr_compositor_t *comp;

	main_scrs = mon->main_scrs;

	subunit = crate->addr->path.subunit;

	screen = main_scrs[COMP_SCR];

	switch (subunit.compositor_subunit) {
		case KR_VIDEOPORT:
			break;
		case KR_SPRITE:

      if (kr_crate_has_int (crate) || kr_crate_has_float (crate)) {
        if (istop (mon->top_screen,"Sprites")) {
          gnmc_comp_cache_update (mon->top_screen,crate,KR_SPRITE);
        }
      }


      if (kr_crate_loaded (crate)) {
        if (istop (mon->top_screen,"Sprites")) {
          gnmc_sprites_screen_populate (mon->top_screen,crate->inside.sprite,
            crate->addr->id.number);
          cache = mon->top_screen->cache;
          cache->write (cache,crate,crate->addr->id.number);
        }
      }

			break;
		case KR_TEXT:

      if (kr_crate_has_int (crate) || kr_crate_has_float (crate)) {
        if (istop (mon->top_screen,"Texts")) {
          gnmc_comp_cache_update (mon->top_screen,crate,KR_TEXT);
          gnmc_texts_screen_update (mon->top_screen,crate->addr->id.number);
        }
      }

      if (kr_crate_loaded (crate)) {
			 if (istop (mon->top_screen,"Texts")) {
          if (strlen (crate->inside.text->text) > 0) {
				    gnmc_texts_screen_populate (mon->top_screen,crate->inside.text,
              crate->addr->id.number);
            cache = mon->top_screen->cache;
            cache->write (cache,crate,crate->addr->id.number);
          }
			 }
      }

			break;
		case KR_VECTOR:
      if (kr_crate_loaded (crate)) {

      }
			break;
		default:
      if (kr_crate_loaded (crate)) {
			 comp = crate->inside.compositor;
			 if (gnmc_krvideoport_show (comp,screen) < 0) {
				 return -1;
			 }
      }
			break;
	}

	return 0;
}