xrdp icon indicating copy to clipboard operation
xrdp copied to clipboard

Support for HiDPI

Open okhowang opened this issue 4 years ago • 11 comments

I use an Thinkpad X1 with 200% DPI. when I connect to xrdp, remote X server's dpi is 96. but when I connect to windows rdp, system will process dpi to 200% auto.

okhowang avatar Jun 19 '20 09:06 okhowang

I think it depends on the WM.

metalefty avatar Jun 22 '20 12:06 metalefty

but when I use Thinkpad X1 to connect xrdp

$ xdpyinfo | grep resolution
  resolution: 96x96 dots per inchs

It seem like incorrect dpi was reported by virtual screen

okhowang avatar Jun 23 '20 03:06 okhowang

What's your backend? The issue can be addressed with xorgxrdp but can't with VNC.

metalefty avatar Jun 23 '20 08:06 metalefty

xorgxrdp

okhowang avatar Jun 23 '20 08:06 okhowang

okay cool

metalefty avatar Jun 23 '20 08:06 metalefty

@metalefty I have a branch dpi for support monitor info in xrdp and xorgxrdp. but there is some trouble when processing scaling for xorg server. do you have any idea in this?

static RRTransformPtr
rdpGetTransform(uint32_t scale, int width, int height) {
    double d_scale;
    XFixed f_scale;
    if (scale == 0 || scale == 100) return NULL;
    d_scale = (double)scale / 100;
    f_scale = XDoubleToFixed(d_scale);
    RRTransformPtr transform = malloc(sizeof(RRTransformRec));
    RRTransformInit(transform);
    pixman_transform_init_scale(&transform->transform, f_scale, f_scale);
//    PictFilterPtr filter = malloc(sizeof(PictFilterRec));
//    filter->name = PictureGetFilterName(PictFilterBest);
//    filter->ValidateParams = NULL;
//    filter->id = PictFilterBest;
//    filter->height = height;
//    filter->width = width;
//    RRTransformSetFilter(transform, filter, &f_scale, 0, width, height);
    return transform;
}

is filter necessary? and how make transform work properly?

okhowang avatar Sep 22 '20 06:09 okhowang

by the way, KDE/plasma have also a bit problem with HiDPI with TV's(WebOS) with/without kscreen2, have make a bugreport under bugs.kde.org https://bugs.kde.org/show_bug.cgi?id=425111 just as info and hint ...

blackcrack avatar Sep 22 '20 07:09 blackcrack

I think we need to call x86SetDpi here https://github.com/neutrinolabs/xorgxrdp/blob/a4ce59b46867e61ffc7bb630824d764916c78832/module/rdpClientCon.c#L749

We need to compute the scale based on what the client sends us through the monitor description. I'm not sure how to go from, say, 200% scale to a given DPI. Right now this is set to 0 here: https://github.com/neutrinolabs/xorgxrdp/blob/a4ce59b46867e61ffc7bb630824d764916c78832/xrdpdev/xrdpdev.c#L244

Relevant PDU is here: https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpedisp/ea2de591-9203-42cd-9908-be7a55237d1c

We're interested specifically in piping through DesktopScaleFactor

Nexarian avatar Jul 03 '22 16:07 Nexarian

i use mostly 125 or 130 DPI in KDE over sddm.conf

uhddpi=130
sddmconf_update(){ 
 echo -en "\n[Wayland]\n EnableHiDPI=true \n ServerArguments=-nolisten tcp -dpi $uhddpi \n \n[X11]\n EnableHiDPI=true\n ServerArguments=-nolisten tcp -dpi $uhddpi \n " >>/etc/sddm.conf 
 }

best

blackcrack avatar Jul 03 '22 17:07 blackcrack