Skip to content

Commit 9af918b

Browse files
committed
DisplayServer (Linux): swaps width/height in vertical mode and native X11
1 parent 37b8bb4 commit 9af918b

2 files changed

Lines changed: 22 additions & 5 deletions

File tree

src/detection/displayserver/linux/xcb.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,13 @@ static bool xcbRandrHandleOutput(XcbRandrData* data, xcb_randr_output_t output,
153153
ffEdidGetName(edidData, name);
154154
}
155155

156-
uint8_t randrEmulation = 0;
156+
bool randrEmulation = false;
157157
FF_AUTO_FREE xcb_randr_get_output_property_reply_t* randrEmulationReply = xcbRandrGetProperty(data, output, "RANDR Emulation");
158158
if(randrEmulationReply)
159159
{
160160
int len = data->ffxcb_randr_get_output_property_data_length(randrEmulationReply);
161161
if(len >= 1)
162-
randrEmulation = data->ffxcb_randr_get_output_property_data(randrEmulationReply)[0];
162+
randrEmulation = !!data->ffxcb_randr_get_output_property_data(randrEmulationReply)[0];
163163
}
164164

165165
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,
227227
: (currentMode ? "xcb-randr-mode" : "xcb-randr-crtc")
228228

229229
);
230-
if (item && edidData && edidLength >= 128)
230+
if (item)
231231
{
232-
item->hdrStatus = ffEdidGetHdrCompatible(edidData, (uint32_t) edidLength) ? FF_DISPLAY_HDR_STATUS_SUPPORTED : FF_DISPLAY_HDR_STATUS_UNSUPPORTED;
233-
ffEdidGetSerialAndManufactureDate(edidData, &item->serial, &item->manufactureYear, &item->manufactureWeek);
232+
if (edidData && edidLength >= 128)
233+
{
234+
item->hdrStatus = ffEdidGetHdrCompatible(edidData, (uint32_t) edidLength) ? FF_DISPLAY_HDR_STATUS_SUPPORTED : FF_DISPLAY_HDR_STATUS_UNSUPPORTED;
235+
ffEdidGetSerialAndManufactureDate(edidData, &item->serial, &item->manufactureYear, &item->manufactureWeek);
236+
}
234237
item->bitDepth = bitDepth;
238+
if ((rotation == 90 || rotation == 180) && !randrEmulation)
239+
{
240+
// In XWayland mode, width / height has been swapped out of box
241+
uint32_t tmp = item->width;
242+
item->width = item->height;
243+
item->height = tmp;
244+
}
235245
}
236246

237247
return !!item;

src/detection/displayserver/linux/xlib.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,13 @@ static bool xrandrHandleCrtc(XrandrData* data, XRROutputInfo* output, FFstrbuf*
169169
ffEdidGetSerialAndManufactureDate(edidData, &item->serial, &item->manufactureYear, &item->manufactureWeek);
170170
}
171171
item->bitDepth = bitDepth;
172+
if ((rotation == 90 || rotation == 180) && !randrEmulation)
173+
{
174+
// In XWayland mode, width / height has been swapped out of box
175+
uint32_t tmp = item->width;
176+
item->width = item->height;
177+
item->height = tmp;
178+
}
172179
}
173180

174181
data->ffXRRFreeCrtcInfo(crtcInfo);

0 commit comments

Comments
 (0)