1
0
Fork 0

source/Platform/Unix: Rename XRandR to Xrandr

This commit is contained in:
Henrik Hautakoski 2024-06-22 19:53:16 +02:00
parent ca46bd0ef7
commit f71fdea463
5 changed files with 11 additions and 11 deletions

View file

@ -0,0 +1,34 @@
#include "Xrandr.h"
#include <Spectre/System/Log.h>
#include <algorithm>
namespace sp {
bool Xrandr::FindMode(::Display* disp, unsigned int width, unsigned int height, unsigned int bpp, SizeID *id, short *rate)
{
::XRRScreenSize *xrrs;
int num_sizes;
xrrs = XRRSizes(disp, 0, &num_sizes);
for(int i = 0; i < num_sizes; i++) {
Log::debug("Mode %dx%d", xrrs[i].width, xrrs[i].height);
if (xrrs[i].width != width && xrrs[i].height != height) {
continue;
}
short *rates;
int num_rates;
rates = XRRRates(disp, 0, i, &num_rates);
if (num_rates > 0) {
*id = i;
*rate = rates[num_rates - 1];
return true;
}
}
return false;
}
} // namespace sp