DisplayServer (Linux): swaps width/height in vertical mode and native X11

This commit is contained in:
Carter Li
2026-03-13 23:43:42 +08:00
committed by 李通洲
parent 37b8bb4fc0
commit 9af918b1ef
2 changed files with 22 additions and 5 deletions
+15 -5
View File
@@ -153,13 +153,13 @@ static bool xcbRandrHandleOutput(XcbRandrData* data, xcb_randr_output_t output,
ffEdidGetName(edidData, name);
}
uint8_t randrEmulation = 0;
bool randrEmulation = false;
FF_AUTO_FREE xcb_randr_get_output_property_reply_t* randrEmulationReply = xcbRandrGetProperty(data, output, "RANDR Emulation");
if(randrEmulationReply)
{
int len = data->ffxcb_randr_get_output_property_data_length(randrEmulationReply);
if(len >= 1)
randrEmulation = data->ffxcb_randr_get_output_property_data(randrEmulationReply)[0];
randrEmulation = !!data->ffxcb_randr_get_output_property_data(randrEmulationReply)[0];
}
xcb_randr_get_crtc_info_cookie_t crtcInfoCookie = data->ffxcb_randr_get_crtc_info(data->connection, outputInfoReply->crtc, XCB_CURRENT_TIME);
@@ -227,11 +227,21 @@ static bool xcbRandrHandleOutput(XcbRandrData* data, xcb_randr_output_t output,
: (currentMode ? "xcb-randr-mode" : "xcb-randr-crtc")
);
if (item && edidData && edidLength >= 128)
if (item)
{
item->hdrStatus = ffEdidGetHdrCompatible(edidData, (uint32_t) edidLength) ? FF_DISPLAY_HDR_STATUS_SUPPORTED : FF_DISPLAY_HDR_STATUS_UNSUPPORTED;
ffEdidGetSerialAndManufactureDate(edidData, &item->serial, &item->manufactureYear, &item->manufactureWeek);
if (edidData && edidLength >= 128)
{
item->hdrStatus = ffEdidGetHdrCompatible(edidData, (uint32_t) edidLength) ? FF_DISPLAY_HDR_STATUS_SUPPORTED : FF_DISPLAY_HDR_STATUS_UNSUPPORTED;
ffEdidGetSerialAndManufactureDate(edidData, &item->serial, &item->manufactureYear, &item->manufactureWeek);
}
item->bitDepth = bitDepth;
if ((rotation == 90 || rotation == 180) && !randrEmulation)
{
// In XWayland mode, width / height has been swapped out of box
uint32_t tmp = item->width;
item->width = item->height;
item->height = tmp;
}
}
return !!item;
+7
View File
@@ -169,6 +169,13 @@ static bool xrandrHandleCrtc(XrandrData* data, XRROutputInfo* output, FFstrbuf*
ffEdidGetSerialAndManufactureDate(edidData, &item->serial, &item->manufactureYear, &item->manufactureWeek);
}
item->bitDepth = bitDepth;
if ((rotation == 90 || rotation == 180) && !randrEmulation)
{
// In XWayland mode, width / height has been swapped out of box
uint32_t tmp = item->width;
item->width = item->height;
item->height = tmp;
}
}
data->ffXRRFreeCrtcInfo(crtcInfo);