소스 검색

Maintain static screen DPI on resize

Trying to dynamically track the DPI did not really work as we'd
start accumulating errors and eventually the DPI would start to
drift. Instead maintain a fixed, sensible DPI at all times.
tags/v1.11.90
Pierre Ossman 5 년 전
부모
커밋
0946e29807
2개의 변경된 파일16개의 추가작업 그리고 13개의 파일을 삭제
  1. 9
    9
      unix/x0vncserver/RandrGlue.c
  2. 7
    4
      unix/xserver/hw/vnc/RandrGlue.c

+ 9
- 9
unix/x0vncserver/RandrGlue.c 파일 보기

@@ -117,15 +117,15 @@ int vncRandRResizeScreen(int width, int height)
{
vncGlueContext *ctx = &randrGlueContext;

int xwidth = DisplayWidth(ctx->dpy, DefaultScreen(ctx->dpy));
int xheight = DisplayHeight(ctx->dpy, DefaultScreen(ctx->dpy));
int xwidthmm = DisplayWidthMM(ctx->dpy, DefaultScreen(ctx->dpy));
int xheightmm = DisplayHeightMM(ctx->dpy, DefaultScreen(ctx->dpy));
/* Try to retain DPI when we resize */
XRRSetScreenSize(ctx->dpy, DefaultRootWindow(ctx->dpy), width, height,
xwidthmm * width / xwidth,
xheightmm * height / xheight);
int mwidth, mheight;
// Always calculate a DPI of 96.
// It's what mutter does, so good enough for us.
mwidth = width * 254 / 96 / 10;
mheight = height * 254 / 96 / 10;
XRRSetScreenSize(ctx->dpy, DefaultRootWindow(ctx->dpy),
width, height, mwidth, mheight);

return 1;
}

+ 7
- 4
unix/xserver/hw/vnc/RandrGlue.c 파일 보기

@@ -64,11 +64,14 @@ int vncRandRIsValidScreenSize(int width, int height)
int vncRandRResizeScreen(int width, int height)
{
ScreenPtr pScreen = screenInfo.screens[scrIdx];
int dpi, mwidth, mheight;

/* Try to retain DPI when we resize */
return RRScreenSizeSet(pScreen, width, height,
pScreen->mmWidth * width / pScreen->width,
pScreen->mmHeight * height / pScreen->height);
/* Keep the DPI specified at start */
dpi = monitorResolution ? monitorResolution : 96;
mwidth = width * 254 / dpi / 10;
mheight = height * 254 / dpi / 10;

return RRScreenSizeSet(pScreen, width, height, mwidth, mheight);
}

void vncRandRUpdateSetTime(void)

Loading…
취소
저장