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


C++ HeightOfScreen函数代码示例

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


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

示例1: xfce_xsettings_helper_screen_dpi

static gint
xfce_xsettings_helper_screen_dpi (XfceXSettingsScreen *screen)
{
    Screen *xscreen;
    gint    width_mm, width_dpi;
    gint    height_mm, height_dpi;
    gint    dpi = DPI_FALLBACK;

    xscreen = ScreenOfDisplay (screen->xdisplay, screen->screen_num);
    if (G_LIKELY (xscreen != NULL))
    {
        width_mm = WidthMMOfScreen (xscreen);
        height_mm = HeightMMOfScreen (xscreen);

        if (G_LIKELY (width_mm > 0 && height_mm > 0))
        {
            width_dpi = 25.4 * WidthOfScreen (xscreen) / width_mm;
            height_dpi = 25.4 * HeightOfScreen (xscreen) / height_mm;

            /* both values need to be reasonable */
            if (width_dpi > DPI_LOW_REASONABLE && width_dpi < DPI_HIGH_REASONABLE
                && height_dpi > DPI_LOW_REASONABLE && height_dpi < DPI_HIGH_REASONABLE)
            {
                /* gnome takes the average between the two, however the
                 * minimin seems to result in sharper font in more cases */
                dpi = MIN (width_dpi, height_dpi);
            }
        }
    }

    xfsettings_dbg_filtered (XFSD_DEBUG_XSETTINGS, "calculated dpi of %d for screen %d",
                             dpi, screen->screen_num);

    return dpi;
}
开发者ID:Distrotech,项目名称:xfce4-settings,代码行数:35,代码来源:xsettings.c

示例2: x11_shadow_subsystem_base_init

int x11_shadow_subsystem_base_init(x11ShadowSubsystem* subsystem)
{
	if (subsystem->display)
		return 1; /* initialize once */

	if (!getenv("DISPLAY"))
		setenv("DISPLAY", ":0", 1);

	if (!XInitThreads())
		return -1;

	subsystem->display = XOpenDisplay(NULL);

	if (!subsystem->display)
	{
		WLog_ERR(TAG, "failed to open display: %s", XDisplayName(NULL));
		return -1;
	}

	subsystem->xfds = ConnectionNumber(subsystem->display);
	subsystem->number = DefaultScreen(subsystem->display);
	subsystem->screen = ScreenOfDisplay(subsystem->display, subsystem->number);
	subsystem->depth = DefaultDepthOfScreen(subsystem->screen);
	subsystem->width = WidthOfScreen(subsystem->screen);
	subsystem->height = HeightOfScreen(subsystem->screen);
	subsystem->root_window = RootWindow(subsystem->display, subsystem->number);

	return 1;
}
开发者ID:DavBfr,项目名称:FreeRDP,代码行数:29,代码来源:x11_shadow.c

示例3: switch_to_best_mode

static void switch_to_best_mode (void)
{
    Screen *scr = ScreenOfDisplay (display, screen);
    int w = WidthOfScreen (scr);
    int h = HeightOfScreen (scr);
    int d = DefaultDepthOfScreen (scr);
#ifdef USE_VIDMODE_EXTENSION
    int i, best;
    if (vidmodeavail) {
	best = 0;
	for (i = 1; i < vidmodecount; i++) {
	    if (allmodes[i]->hdisplay >= current_width
		&& allmodes[i]->vdisplay >= current_height
		&& allmodes[i]->hdisplay <= allmodes[best]->hdisplay
		&& allmodes[i]->vdisplay <= allmodes[best]->vdisplay)
		best = i;
	}
	write_log ("entering DGA mode: %dx%d (%d, %d)\n",
		allmodes[best]->hdisplay, allmodes[best]->vdisplay,
		current_width, current_height);
	XF86VidModeSwitchToMode (display, screen, allmodes[best]);
	XF86VidModeSetViewPort (display, screen, 0, 0);
    }
#endif
    XMoveWindow (display, mywin, 0, 0);
    XWarpPointer (display, None, rootwin, 0, 0, 0, 0, 0, 0);
    XF86DGADirectVideo (display, screen, XF86DGADirectGraphics | XF86DGADirectMouse | XF86DGADirectKeyb);
    XF86DGASetViewPort (display, screen, 0, 0);
    memset (fb_addr, 0, (w * h) * (d / 8));
}
开发者ID:CrashSerious,项目名称:PiUAE,代码行数:30,代码来源:xwin.c

示例4: ChooseSession

void
ChooseSession(void)
{
    Dimension   width, height;
    Position	x, y;


    /*
     * Add the session names to the list
     */

    AddSessionNames (sessionNameCount, sessionNamesLong);


    /*
     * Center popup containing choice of sessions
     */
    
    XtRealizeWidget (chooseSessionPopup);

    XtVaGetValues (chooseSessionPopup,
	XtNwidth, &width,
	XtNheight, &height,
	NULL);

    x = (Position)(WidthOfScreen (XtScreen (topLevel)) - width) / 2;
    y = (Position)(HeightOfScreen (XtScreen (topLevel)) - height) / 3;

    XtVaSetValues (chooseSessionPopup,
	XtNx, x,
	XtNy, y,
	NULL);

    XtVaSetValues (chooseSessionListWidget,
	XtNlongest, width,
	NULL);

    XtVaSetValues (chooseSessionLabel,
	XtNwidth, width,
	NULL);

    XtVaGetValues (chooseSessionMessageLabel,
	XtNforeground, &save_message_foreground,
	XtNbackground, &save_message_background,
	NULL);

    XtVaSetValues (chooseSessionMessageLabel,
	XtNwidth, width,
	XtNforeground, save_message_background,
	NULL);

    /*
     * Wait for a map notify on the popup, then set input focus.
     */

    XtAddEventHandler (chooseSessionPopup, StructureNotifyMask, False,
	ChooseWindowStructureNotifyXtHandler, NULL);

    XtPopup (chooseSessionPopup, XtGrabNone);
}
开发者ID:alepharchives,项目名称:bitrig-xenocara,代码行数:60,代码来源:choose.c

示例5: parseArgs

int
parseArgs( int argc, char *argv[])
{
    char xsign, ysign;
    if ( argc != 3 || strcmp( "-geometry", argv[1] ) )
	return 1;

    if ( sscanf( argv[2], "%dx%d%c%d%c%d\n", &window_width, 
		 &window_height, 
		 &xsign, &window_x, &ysign, &window_y ) != 6 ) 
    	return 1;
    
    if ( xsign == '-' )
    {
	int screen_width = WidthOfScreen( 
	    ScreenOfDisplay( myDisplay, myScreen ) );
	window_x = screen_width - window_width - window_x;
    }

    if ( ysign == '-' )
    {
	int screen_height = HeightOfScreen( 
	    ScreenOfDisplay( myDisplay, myScreen ) );
	window_y = screen_height - window_height - window_y;
    }
    return 0;
}
开发者ID:peffis,项目名称:xmerlin,代码行数:27,代码来源:graphics.c

示例6: module_init

static int module_init(Display *dpy) {

    int i;

    data.display = dpy;
    data.windows = (Window *)malloc(sizeof(Window) * ScreenCount(dpy));

    for (i = 0; i < ScreenCount(dpy); i++) {

        Screen *screen = ScreenOfDisplay(dpy, i);
        Colormap colormap = DefaultColormapOfScreen(screen);
        XSetWindowAttributes xswa;
        XColor color;

        alock_alloc_color(dpy, colormap, data.colorname, "black", &color);

        xswa.override_redirect = True;
        xswa.colormap = colormap;
        xswa.background_pixel = color.pixel;

        data.windows[i] = XCreateWindow(dpy, RootWindowOfScreen(screen),
                0, 0, WidthOfScreen(screen), HeightOfScreen(screen), 0,
                CopyFromParent, InputOutput, CopyFromParent,
                CWOverrideRedirect | CWColormap | CWBackPixel,
                &xswa);

    }

    return 0;
}
开发者ID:Arkq,项目名称:alock,代码行数:30,代码来源:bg_blank.c

示例7: CenterWidgetAtPoint

static void
CenterWidgetAtPoint(Widget w, int x, int y)
{
    Arg	args[2];
    Dimension	width, height;

    XtSetArg(args[0], XtNwidth, &width);
    XtSetArg(args[1], XtNheight, &height);
    XtGetValues (w, args, 2);
    x = x - (int) width / 2;
    y = y - (int) height / 2;
    if (x < 0)
	x = 0;
    else {
	int scr_width = WidthOfScreen (XtScreen(w));
	if (x + (int)width > scr_width)
	    x = scr_width - width;
    }
    if (y < 0)
	y = 0;
    else {
	int scr_height = HeightOfScreen (XtScreen(w));
	if (y + (int)height > scr_height)
	    y = scr_height - height;
    }
    XtSetArg(args[0], XtNx, x);
    XtSetArg(args[1], XtNy, y);
    XtSetValues (w, args, 2);
}
开发者ID:alepharchives,项目名称:bitrig-xenocara,代码行数:29,代码来源:xclipboard.c

示例8: main

int main(void)
{
	Display *dpy;
	int width, height, fd;
	unsigned int attachments[] = {
		DRI2BufferBackLeft,
		DRI2BufferFrontLeft,
	};

	dpy = XOpenDisplay (NULL);
	if (dpy == NULL)
		return 77;

	fd = dri2_open(dpy);
	if (fd < 0)
		return 1;

	width = WidthOfScreen(DefaultScreenOfDisplay(dpy));
	height = HeightOfScreen(DefaultScreenOfDisplay(dpy));
	run(dpy, width, height, attachments, 1, "fullscreen");
	run(dpy, width, height, attachments, 2, "fullscreen (with front)");

	width /= 2;
	height /= 2;
	run(dpy, width, height, attachments, 1, "windowed");
	run(dpy, width, height, attachments, 2, "windowed (with front)");

	return 0;
}
开发者ID:krlmlr-archive,项目名称:xserver-xorg-video-intel,代码行数:29,代码来源:dri2-race.c

示例9: gdk_x11_screen_get_height

static gint
gdk_x11_screen_get_height (GdkScreen *screen)
{
  g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);

  return HeightOfScreen (GDK_X11_SCREEN (screen)->xscreen);
}
开发者ID:nacho,项目名称:gtk-,代码行数:7,代码来源:gdkscreen-x11.c

示例10: SDL_VERSION

bool SpringApp::GetDisplayGeometry()
{
	SDL_SysWMinfo info;
	SDL_VERSION(&info.version);
	if (!SDL_GetWMInfo(&info)) {
		return false;
	}

	info.info.x11.lock_func();
	{
		Display* display = info.info.x11.display;
		Window   window  = info.info.x11.window;

		XWindowAttributes attrs;
		XGetWindowAttributes(display, window, &attrs);
		const Screen* screen = attrs.screen;
		gu->screenSizeX = WidthOfScreen(screen);
		gu->screenSizeY = HeightOfScreen(screen);
		gu->winSizeX = attrs.width;
		gu->winSizeY = attrs.height;

		Window tmp;
		int xp, yp;
		XTranslateCoordinates(display, window, attrs.root, 0, 0, &xp, &yp, &tmp);
		gu->winPosX = xp;
		gu->winPosY = gu->screenSizeY - gu->winSizeY - yp;
	}
	info.info.x11.unlock_func();

	return true;
}		
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:31,代码来源:Main.cpp

示例11: xf_list_monitors

int xf_list_monitors(xfInfo* xfi)
{
#ifdef WITH_XINERAMAZ
	int i, nmonitors = 0;
	int ignored, ignored2;
	XineramaScreenInfo* screen = NULL;

	if (XineramaQueryExtension(xfi->display, &ignored, &ignored2))
	{
		if (XineramaIsActive(xfi->display))
		{
			screen = XineramaQueryScreens(xfi->display, &nmonitors);

			for (i = 0; i < nmonitors; i++)
			{
				DEBUG_MSG("      %s [%d] %dx%d\t+%d+%d\n",
				       (i == 0) ? "*" : " ", i,
				       screen[i].width, screen[i].height,
				       screen[i].x_org, screen[i].y_org);
			}

			XFree(screen);
		}
	}
#else
	Screen* screen;

	screen = ScreenOfDisplay(xfi->display, DefaultScreen(xfi->display));
	DEBUG_MSG("      * [0] %dx%d\t+%d+%d\n", WidthOfScreen(screen), HeightOfScreen(screen), 0, 0);
#endif

	return 0;
}
开发者ID:JozLes77,项目名称:FreeRDP,代码行数:33,代码来源:xf_monitors.c

示例12: monitor_dimensions

// find the dimensions of the monitor displaying point x,y
void monitor_dimensions ( Display *display, Screen *screen, int x, int y, workarea *mon )
{
    memset ( mon, 0, sizeof ( workarea ) );
    mon->w = WidthOfScreen ( screen );
    mon->h = HeightOfScreen ( screen );

    // locate the current monitor
    if ( XineramaIsActive ( display ) ) {
        int                monitors;
        XineramaScreenInfo *info = XineramaQueryScreens ( display, &monitors );

        if ( info ) {
            for ( int i = 0; i < monitors; i++ ) {
                if ( INTERSECT ( x, y, 1, 1, info[i].x_org, info[i].y_org, info[i].width, info[i].height ) ) {
                    mon->x = info[i].x_org;
                    mon->y = info[i].y_org;
                    mon->w = info[i].width;
                    mon->h = info[i].height;
                    break;
                }
            }
        }

        XFree ( info );
    }
}
开发者ID:jubalh,项目名称:rofi,代码行数:27,代码来源:x11-helper.c

示例13: create_full_screen_window

Window create_full_screen_window (Display *dpy, int screen, Colormap cmap)
{
  XSetWindowAttributes attrs;
  Window win;
  Visual *visual;
  Screen *screen_obj;
  unsigned long attrmask;
  int depth;

  screen_obj = ScreenOfDisplay (dpy, screen);
  visual = DefaultVisualOfScreen (screen_obj);
  depth = visual_depth (screen_obj, visual);

  attrmask = (CWOverrideRedirect | CWEventMask | CWBackingStore | CWColormap
              | CWCursor);
  attrs.override_redirect = True;
  attrs.event_mask = (ExposureMask | KeyPressMask | ButtonPressMask
                      | Button1MotionMask | ButtonReleaseMask);
  attrs.backing_store = NotUseful;
  attrs.colormap = cmap;
  attrs.cursor = XCreateFontCursor (dpy, XC_cross);

  win = XCreateWindow (dpy, RootWindowOfScreen (screen_obj),
                       0, 0, WidthOfScreen (screen_obj),
                       HeightOfScreen (screen_obj), 0,
                       depth, InputOutput, visual,
                       attrmask, &attrs);
  return win;
}
开发者ID:kodecharlie,项目名称:xdelimitarea,代码行数:29,代码来源:windows.c

示例14: checkMask

// We use this to detect if we should enable masking or not.
// This is really important because if a user tries to screenshot a window that's
// slightly off-screen he probably wants the whole window, but if a user
// takes a full screenshot, then he would most certainly want it masked, but
// only if they have pixels that are offscreen.
bool checkMask( std::string type, int x, int y, int w, int h, Window id ) {
    if ( type == "auto" ) {
        // If we specified an actual window we certainly don't want to mask anything.
        if ( id != None && id != xengine->m_root ) {
            return false;
        }
        const int sw = WidthOfScreen( xengine->m_screen );
        const int sh = HeightOfScreen( xengine->m_screen );
        // First we check if there's even any offscreen pixels
        int monitorArea = 0;
        std::vector<XRRCrtcInfo*> monitors = xengine->getCRTCS();
        for ( unsigned int i = 0;i<monitors.size();i++ ) {
            XRRCrtcInfo* cmonitor = monitors[ i ];
            monitorArea += cmonitor->height * cmonitor->width;
        }
        xengine->freeCRTCS( monitors );
        // If our monitors cover the entire screen, masking won't do anything anyway.
        if ( monitorArea >= sw * sh ) {
            return false;
        }
        // If our screenshot has > 80% of the screen covered, we probably want it masked by off-screen pixels.
        if ( abs( (int)( (float)sw - (float)w ) ) / (float)sw < 0.2 &&
             abs( (int)( (float)sh - (float)h ) ) / (float)sh < 0.2 &&
             (float)x / (float)sw < 0.2 &&
             (float)y / (float)sh < 0.2 ) {
            return true;
        }
        // Otherwise we're probably taking a picture of a specific thing on the screen.
        return false;
    } else if ( type == "on" ) {
        return true;
    }
    return false;
}
开发者ID:belstgut,项目名称:maim,代码行数:39,代码来源:main.cpp

示例15: cairo_create_x11_surface

/*! Open an X11 window and create a cairo surface base on that window. If x and
 * y are set to 0 the function opens a full screen window and stores to window
 * dimensions to x and y.
 * @param x Pointer to width of window.
 * @param y Pointer to height of window.
 * @return Returns a pointer to a valid Xlib cairo surface. The function does
 * not return on error (exit(3)).
 */
cairo_surface_t* 
cairo_create_x11_surface(int *x, int *y) {

   Display *dsp;
   Drawable da;
   Screen *scr;
   int screen;
   cairo_surface_t *sfc;

   if ((dsp = XOpenDisplay(NULL)) == NULL)
      exit(1);
   screen = DefaultScreen(dsp);
   scr = DefaultScreenOfDisplay(dsp);
   if (!*x || !*y)
   {
      *x = WidthOfScreen(scr), *y = HeightOfScreen(scr);
      da = XCreateSimpleWindow(dsp, DefaultRootWindow(dsp), 0, 0, *x, *y, 0, 0, 0);
      fullscreen (dsp, da);
   }
   else
      da = XCreateSimpleWindow(dsp, DefaultRootWindow(dsp), 0, 0, *x, *y, 0, 0, 0);
   XSelectInput(dsp, da, ButtonPressMask | KeyPressMask);
   XMapWindow(dsp, da);

   sfc = cairo_xlib_surface_create(dsp, da, DefaultVisual(dsp, screen), *x, *y);
   cairo_xlib_surface_set_size(sfc, *x, *y);

   return sfc;
}
开发者ID:peko,项目名称:tttm2,代码行数:37,代码来源:test_cairo.c


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