Lines 117-131
int vncRandRResizeScreen(int width, int height)
Link Here
|
117 |
{ |
117 |
{ |
118 |
vncGlueContext *ctx = &randrGlueContext; |
118 |
vncGlueContext *ctx = &randrGlueContext; |
119 |
|
119 |
|
120 |
int xwidth = DisplayWidth(ctx->dpy, DefaultScreen(ctx->dpy)); |
120 |
int mwidth, mheight; |
121 |
int xheight = DisplayHeight(ctx->dpy, DefaultScreen(ctx->dpy)); |
|
|
122 |
int xwidthmm = DisplayWidthMM(ctx->dpy, DefaultScreen(ctx->dpy)); |
123 |
int xheightmm = DisplayHeightMM(ctx->dpy, DefaultScreen(ctx->dpy)); |
124 |
|
121 |
|
125 |
/* Try to retain DPI when we resize */ |
122 |
// Always calculate a DPI of 96. |
126 |
XRRSetScreenSize(ctx->dpy, DefaultRootWindow(ctx->dpy), width, height, |
123 |
// It's what mutter does, so good enough for us. |
127 |
xwidthmm * width / xwidth, |
124 |
mwidth = width * 254 / 96 / 10; |
128 |
xheightmm * height / xheight); |
125 |
mheight = height * 254 / 96 / 10; |
|
|
126 |
|
127 |
XRRSetScreenSize(ctx->dpy, DefaultRootWindow(ctx->dpy), |
128 |
width, height, mwidth, mheight); |
129 |
|
129 |
|
130 |
return 1; |
130 |
return 1; |
131 |
} |
131 |
} |