当前位置: 首页>>代码示例>>C++>>正文


C++ DisplayHeightMM函数代码示例

本文整理汇总了C++中DisplayHeightMM函数的典型用法代码示例。如果您正苦于以下问题:C++ DisplayHeightMM函数的具体用法?C++ DisplayHeightMM怎么用?C++ DisplayHeightMM使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了DisplayHeightMM函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: dpy

XRRConfiguration::XRRConfiguration(Display *_dpy, Window _win)
	: dpy(_dpy)
	, win(_win)
	, screenResources(nullptr), outputInfo(nullptr), crtcInfo(nullptr)
	, fullMode(0)
	, fs_fb_width(0), fs_fb_height(0), fs_fb_width_mm(0), fs_fb_height_mm(0)
	, bValid(true), bIsFullscreen(false)
{
	int XRRMajorVersion, XRRMinorVersion;

	if (!XRRQueryVersion(dpy, &XRRMajorVersion, &XRRMinorVersion) ||
	    (XRRMajorVersion < 1 || (XRRMajorVersion == 1 && XRRMinorVersion < 3)))
	{
		WARN_LOG(VIDEO, "XRRExtension not supported.");
		bValid = false;
		return;
	}

	screenResources = XRRGetScreenResourcesCurrent(dpy, win);

	screen = DefaultScreen(dpy);
	fb_width = DisplayWidth(dpy, screen);
	fb_height = DisplayHeight(dpy, screen);
	fb_width_mm = DisplayWidthMM(dpy, screen);
	fb_height_mm = DisplayHeightMM(dpy, screen);

	INFO_LOG(VIDEO, "XRRExtension-Version %d.%d", XRRMajorVersion, XRRMinorVersion);
	Update();
}
开发者ID:adit-chandra,项目名称:dolphin,代码行数:29,代码来源:X11Utils.cpp

示例2: open_display

/*
 * Pøipojit k serveru, zjistit o nìm informace
 */
static void open_display(void)
{
    display_name = XDisplayName(NULL);
    if(!(display = XOpenDisplay(display_name))) {
	fprintf(stderr, "Cannot connect to X server \"%s\"\n", display_name);
	exit(1);
    }
    debug("Connected to X server \"%s\"\n", display_name);
    
    screen_num = DefaultScreen(display);
    screen = DefaultScreenOfDisplay(display);
    debug("Default screen number is %d\n", screen_num);
    
    screen_width = DisplayWidth(display, screen_num);
    screen_height = DisplayHeight(display, screen_num);
    screen_width_mm = DisplayWidthMM(display, screen_num);
    screen_height_mm = DisplayHeightMM(display, screen_num);
    debug("Screen size is %ux%u pixels, %ux%u mm\n", screen_width,
	  screen_height, screen_width_mm, screen_height_mm);
    
    root = RootWindow(display, screen_num);
    black = BlackPixel(display, screen_num);
    white = WhitePixel(display, screen_num);
    debug("Root window ID is %#lx, black is %#lx, white is %#lx\n", root,
	  black, white);

    def_gc = DefaultGC(display, screen_num);
    /* Toto volání XQueryFont() do def_font->fid neulo¾í ID fontu, ale
     * grafického kontextu! Nevím, jak získat ID nebo jméno standardního
     * fontu. */
    if(!(def_font = XQueryFont(display, XGContextFromGC(def_gc)))) {
	fprintf(stderr, "XQueryFont() failed\n");
	exit(1);
    }
}
开发者ID:tomby42,项目名称:prg-xws,代码行数:38,代码来源:clipping.c

示例3: x11_get_metrics

bool x11_get_metrics(void *data,
      enum display_metric_types type, float *value)
{
   unsigned     screen_no  = 0;
   Display           *dpy  = (Display*)XOpenDisplay(NULL);
   int pixels_x            = DisplayWidth(dpy, screen_no);
   int pixels_y            = DisplayHeight(dpy, screen_no);
   int physical_width      = DisplayWidthMM(dpy, screen_no);
   int physical_height     = DisplayHeightMM(dpy, screen_no);

   (void)pixels_y;

   XCloseDisplay(dpy);

   switch (type)
   {
      case DISPLAY_METRIC_MM_WIDTH:
         *value = (float)physical_width;
         break;
      case DISPLAY_METRIC_MM_HEIGHT:
         *value = (float)physical_height;
         break;
      case DISPLAY_METRIC_DPI:
         *value = ((((float)pixels_x) * 25.4) / ((float)physical_width));
         break;
      case DISPLAY_METRIC_NONE:
      default:
         *value = 0;
         return false;
   }

   return true;
}
开发者ID:aliaspider,项目名称:RetroArch,代码行数:33,代码来源:x11_common.c

示例4: calcDisplayDensity

static float calcDisplayDensity()
{
	const char* current_display = getenv("DISPLAY");

	if (current_display != NULL) {
			Display * x11display = XOpenDisplay(current_display);

			if (x11display != NULL) {
				/* try x direct */
				float dpi_height =
						floor(DisplayHeight(x11display, 0) /
								(DisplayHeightMM(x11display, 0) * 0.039370) + 0.5);
				float dpi_width =
						floor(DisplayWidth(x11display, 0) /
								(DisplayWidthMM(x11display, 0) * 0.039370) +0.5);

				XCloseDisplay(x11display);

				return std::max(dpi_height,dpi_width) / 96.0;
			}
		}

	/* return manually specified dpi */
	return g_settings->getFloat("screen_dpi")/96.0;
}
开发者ID:racam,项目名称:minetest,代码行数:25,代码来源:porting.cpp

示例5: locker

QSize MythXDisplay::GetDisplayDimensions(void)
{
    MythXLocker locker(this);
    int displayWidthMM  = DisplayWidthMM( m_disp, m_screen_num);
    int displayHeightMM = DisplayHeightMM(m_disp, m_screen_num);
    return QSize(displayWidthMM, displayHeightMM);
}
开发者ID:footoflove,项目名称:libmythtv-ui,代码行数:7,代码来源:mythxdisplay.cpp

示例6: open_display

/*
 * Pøipojit k serveru, zjistit o nìm informace
 */
static void open_display(void)
{
    display_name = XDisplayName(NULL);
    if(!(display = XOpenDisplay(display_name))) {
        fprintf(stderr, "Cannot connect to X server \"%s\"\n", display_name);
        exit(1);
    }
    debug("Connected to X server \"%s\"\n", display_name);

    screen_num = DefaultScreen(display);
    screen = DefaultScreenOfDisplay(display);
    debug("Default screen number is %d\n", screen_num);

    screen_width = DisplayWidth(display, screen_num);
    screen_height = DisplayHeight(display, screen_num);
    screen_width_mm = DisplayWidthMM(display, screen_num);
    screen_height_mm = DisplayHeightMM(display, screen_num);
    debug("Screen size is %ux%u pixels, %ux%u mm\n", screen_width,
          screen_height, screen_width_mm, screen_height_mm);

    root = RootWindow(display, screen_num);
    black = BlackPixel(display, screen_num);
    white = WhitePixel(display, screen_num);
    debug("Root window ID is %#lx, black is %#lx, white is %#lx\n", root,
          black, white);

    def_gc = DefaultGC(display, screen_num);
    if(!(def_font = XQueryFont(display, XGContextFromGC(def_gc)))) {
        fprintf(stderr, "XQueryFont() failed\n");
        exit(1);
    }
}
开发者ID:tomby42,项目名称:prg-xws,代码行数:35,代码来源:gravity.c

示例7: cdGetScreenSize

void cdGetScreenSize(int *width, int *height, double *width_mm, double *height_mm)
{
  static int first = 1;
  static int dpy_width, dpy_height, dpy_width_mm, dpy_height_mm;

  if (first)
  {
    Display* drv_display = XOpenDisplay(NULL);
    int drv_screen  = DefaultScreen (drv_display);

    dpy_width = DisplayWidth(drv_display,drv_screen);
    dpy_height = DisplayHeight(drv_display,drv_screen);
    dpy_width_mm = DisplayWidthMM(drv_display,drv_screen);
    dpy_height_mm = DisplayHeightMM(drv_display,drv_screen);

    XCloseDisplay(drv_display);

    first = 0;
  }

  if (width) *width = dpy_width;
  if (height) *height = dpy_height;
  if (width_mm) *width_mm = dpy_width_mm;
  if (height_mm) *height_mm = dpy_height_mm;
}
开发者ID:LuaDist,项目名称:cd,代码行数:25,代码来源:cdxnative.c

示例8: getSystemContentScale

// Retrieve system content scale via folklore heuristics
//
static void getSystemContentScale(float* xscale, float* yscale)
{
    // NOTE: Fall back to the display-wide DPI instead of RandR monitor DPI if
    //       Xft.dpi retrieval below fails as we don't currently have an exact
    //       policy for which monitor a window is considered to "be on"
    float xdpi = DisplayWidth(_glfw.x11.display, _glfw.x11.screen) *
        25.4f / DisplayWidthMM(_glfw.x11.display, _glfw.x11.screen);
    float ydpi = DisplayHeight(_glfw.x11.display, _glfw.x11.screen) *
        25.4f / DisplayHeightMM(_glfw.x11.display, _glfw.x11.screen);

    // NOTE: Basing the scale on Xft.dpi where available should provide the most
    //       consistent user experience (matches Qt, Gtk, etc), although not
    //       always the most accurate one
    char* rms = XResourceManagerString(_glfw.x11.display);
    if (rms)
    {
        XrmDatabase db = XrmGetStringDatabase(rms);
        if (db)
        {
            XrmValue value;
            char* type = NULL;

            if (XrmGetResource(db, "Xft.dpi", "Xft.Dpi", &type, &value))
            {
                if (type && strcmp(type, "String") == 0)
                    xdpi = ydpi = atof(value.addr);
            }

            XrmDestroyDatabase(db);
        }
    }

    *xscale = xdpi / 96.f;
    *yscale = ydpi / 96.f;
}
开发者ID:hgl888,项目名称:glfw,代码行数:37,代码来源:x11_init.c

示例9: iupdrvGetScreenDpi

float iupdrvGetScreenDpi(void)
{
  float dpi;
  Display* drv_display = (Display*)iupdrvGetDisplay();
  int screen = XDefaultScreen(drv_display);
  dpi = ((float)DisplayHeight(drv_display, screen) / (float)DisplayHeightMM(drv_display, screen));
  return dpi * 25.4f;  /* mm to inch */
}
开发者ID:LuaDist,项目名称:iup,代码行数:8,代码来源:iupunix_info.c

示例10: wxDisplaySizeMM

void wxDisplaySizeMM(int *width, int *height)
{
    Display *dpy = (Display*) wxGetDisplay();

    if ( width )
        *width = DisplayWidthMM(dpy, DefaultScreen (dpy));
    if ( height )
        *height = DisplayHeightMM(dpy, DefaultScreen (dpy));
}
开发者ID:LuaDist,项目名称:wxwidgets,代码行数:9,代码来源:utils.cpp

示例11: gst_vaapi_display_x11_get_size_mm

static void
gst_vaapi_display_x11_get_size_mm(
    GstVaapiDisplay *display,
    guint           *pwidth,
    guint           *pheight
)
{
    GstVaapiDisplayX11Private * const priv =
        GST_VAAPI_DISPLAY_X11(display)->priv;
    guint width_mm, height_mm;

    if (!priv->x11_display)
        return;

    width_mm  = DisplayWidthMM(priv->x11_display, priv->x11_screen);
    height_mm = DisplayHeightMM(priv->x11_display, priv->x11_screen);

#ifdef HAVE_XRANDR
    /* XXX: fix up physical size if the display is rotated */
    if (priv->use_xrandr) {
        XRRScreenConfiguration *xrr_config = NULL;
        XRRScreenSize *xrr_sizes;
        Window win;
        int num_xrr_sizes, size_id, screen;
        Rotation rotation;

        do {
            win    = DefaultRootWindow(priv->x11_display);
            screen = XRRRootToScreen(priv->x11_display, win);

            xrr_config = XRRGetScreenInfo(priv->x11_display, win);
            if (!xrr_config)
                break;

            size_id = XRRConfigCurrentConfiguration(xrr_config, &rotation);
            if (rotation == RR_Rotate_0 || rotation == RR_Rotate_180)
                break;

            xrr_sizes = XRRSizes(priv->x11_display, screen, &num_xrr_sizes);
            if (!xrr_sizes || size_id >= num_xrr_sizes)
                break;

            width_mm  = xrr_sizes[size_id].mheight;
            height_mm = xrr_sizes[size_id].mwidth;
        } while (0);
        if (xrr_config)
            XRRFreeScreenConfigInfo(xrr_config);
    }
#endif

    if (pwidth)
        *pwidth = width_mm;

    if (pheight)
        *pheight = height_mm;
}
开发者ID:cbetz421,项目名称:gst-vaapi,代码行数:56,代码来源:gstvaapidisplay_x11.c

示例12: get_screen_sizemm

static Bool get_screen_sizemm(Display *dpy, int screen_idx,
                              int fb_width, int fb_height,
                              int *fb_width_mm, int *fb_height_mm,
                              int *pre_fb_width, int *pre_fb_height) {
    *pre_fb_width = DisplayWidth (dpy, screen_idx);
    *pre_fb_height = DisplayHeight (dpy, screen_idx);
    Bool fb_change;
    if (fb_width != *pre_fb_width || fb_height != *pre_fb_height ) {
        float dpi = (25.4 * *pre_fb_height) / DisplayHeightMM(dpy, screen_idx);
        *fb_width_mm = (25.4 * fb_width) / dpi;
        *fb_height_mm = (25.4 * fb_height) / dpi;
        fb_change = True;
    } else {
        *fb_width_mm = DisplayWidthMM (dpy, screen_idx);
        *fb_height_mm = DisplayHeightMM (dpy, screen_idx);
        fb_change = False;
    }
    return fb_change;
}
开发者ID:465060874,项目名称:jogl,代码行数:19,代码来源:xrandr_utils.c

示例13: StripMisc_init

/*
 * StripMisc_init
 *
 *      Initializes global constants.
 */
void    StripMisc_init  (Display *display, int screen)
{
  horizontal_pixels_per_mm = 
    ((float)DisplayWidth(display, screen) /
     (float)DisplayWidthMM(display, screen));

  vertical_pixels_per_mm = 
    ((float)DisplayHeight(display, screen) /
     (float)DisplayHeightMM(display, screen));
}
开发者ID:epicsdeb,项目名称:striptool,代码行数:15,代码来源:StripMisc.c

示例14: DisplayWidth

/* Xlib font utils define */
static XFontStruct *LoadQueryScalableFont (Display * dpy, int screen, char *name, int size)
{
    int i, j, field;
    char newname[500];          /* big enough for a long font name */
    int res_x, res_y;           /* resolution values for this screen */
    /* catch obvious errors */
    if ((name == NULL) || (name[0] != '-'))
        return NULL;
    /* calculate our screen resolution in dots per inch. 25.4mm = 1 inch */
    res_x = DisplayWidth (dpy, screen) / (DisplayWidthMM (dpy, screen) / 25.4);
    res_y = DisplayHeight (dpy, screen) / (DisplayHeightMM (dpy, screen) / 25.4);
    /* copy the font name, changing the scalable fields as we do so */
    for (i = j = field = 0; name[i] != '\0' && field <= 14; i++)
    {
        newname[j++] = name[i];
        if (name[i] == '-')
        {
            field++;
            switch (field)
            {
            case 7:            /* pixel size */
            case 12:           /* average width */
                /* change from "-0-" to "-*-" */
                newname[j] = '*';
                j++;
                if (name[i + 1] != '\0')
                    i++;
                break;
            case 8:            /* point size */
                /* change from "-0-" to "-<size>-" */
                sprintf (&newname[j], "%d", size);
                while (newname[j] != '\0')
                    j++;
                if (name[i + 1] != '\0')
                    i++;
                break;
            case 9:            /* x-resolution */
            case 10:           /* y-resolution */
                /* change from an unspecified resolution to res_x or res_y */
                sprintf (&newname[j], "%d", (field == 9) ? res_x : res_y);
                while (newname[j] != '\0')
                    j++;
                while ((name[i + 1] != '-') && (name[i + 1] != '\0'))
                    i++;
                break;
            }
        }
    }
    newname[j] = '\0';
    /* if there aren't 14 hyphens, it isn't a well formed name */
    if (field != 14)
        return NULL;
    return XLoadQueryFont (dpy, newname);
}
开发者ID:jih488,项目名称:dtplayer_c,代码行数:55,代码来源:vo_x11.c

示例15: NvCtrlGetScreenHeightMM

int NvCtrlGetScreenHeightMM(NvCtrlAttributeHandle *handle)
{
    NvCtrlAttributePrivateHandle *h;

    if (!handle) return -1;

    h = (NvCtrlAttributePrivateHandle *) handle;

    if (h->target_type != NV_CTRL_TARGET_TYPE_X_SCREEN) return -1;

    return DisplayHeightMM(h->dpy, h->target_id);
    
} /* NvCtrlGetScreenHeightMM() */
开发者ID:tash1,项目名称:nvidia-settings,代码行数:13,代码来源:NvCtrlAttributes.c


注:本文中的DisplayHeightMM函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。