Exemple #1
0
std::vector<display::mode> display::modes() const
{
	std::vector<display::mode> result;
	if (randr.is_available)
	{
		XRRScreenResources* sr = XRRGetScreenResources(g_display, g_root);
		XRRCrtcInfo* ci = XRRGetCrtcInfo(g_display, sr, crtc);
		XRROutputInfo* oi = XRRGetOutputInfo(g_display, sr, output);

		for (int i = 0; i < oi->nmode; ++i)
		{
			XRRModeInfo const* mi = mode_info(sr, oi->modes[i]);
			if (mi && !(mi->modeFlags & RR_Interlace))
			{
				result.emplace_back(make_mode(mi, ci));
			}
		}

		XRRFreeOutputInfo(oi);
		XRRFreeCrtcInfo(ci);
		XRRFreeScreenResources(sr);

		std::sort(result.begin(), result.end());
		result.erase(std::unique(result.begin(), result.end()), result.end());
	}
	else
	{
		result.emplace_back(current_mode());
	}
	return result;
}
Exemple #2
0
void mylib_put_choices(int x,int y,char *s,int color){
  int index,newx,newy;
  char spaces = 0;
  index = 0;
  if (current_mode_pos == 0){
    while (s[index]){
      if (s[index] == ' '){
	index++;
	spaces++;
	continue;
      }
      newx = x+8*(index-spaces);
      newy = y;
      mylib_calc_pos(&newx,&newy);
      if ('0' <= s[index] && '9' >= s[index]){ 
	mylib_putnum(newx,newy,s[index]-'0',color,((index/2) == current_mode()->choice_pos));
      } else {
	mylib_putc(newx,newy,s[index],color,((index/2) == current_mode()->choice_pos));
      }
      index++;
    }
  } else {
    while (s[index]){
      if (s[index] == ' '){
	index++;
	spaces++;
	continue;
      }
      newx = x+8*index;
      newy = y;
      mylib_calc_pos(&newx,&newy);
      if ('0' <= s[index] && '9' >= s[index]){ 
	mylib_putnum(newx,newy,s[index]-'0',color,((spaces-1) == current_mode()->choice_pos));
      } else {
	mylib_putc(newx,newy,s[index],color,((spaces-1) == current_mode()->choice_pos));
      }
      index++;
    }
  }
}
Exemple #3
0
void show_choices(void){
  mylib_put_choices(0,100,current_mode()->choice_label,_black_);
}
Exemple #4
0
void show_current_mode(void){
  mylib_puts(100,113,current_mode()->label,_blue_);
}