X11Utils: Don't depend on wx
We want to have two build targets: Main and MainNoGUI, and this code will be linked against in both cases, so the ifdef isn't enough for this case. Just append to a vector of strings, and then convert it after the fact.
This commit is contained in:
parent
601a406e95
commit
2b8a476a05
|
@ -175,7 +175,10 @@ static wxArrayString GetListOfResolutions()
|
||||||
ZeroMemory(&dmi, sizeof(dmi));
|
ZeroMemory(&dmi, sizeof(dmi));
|
||||||
}
|
}
|
||||||
#elif defined(HAVE_XRANDR) && HAVE_XRANDR
|
#elif defined(HAVE_XRANDR) && HAVE_XRANDR
|
||||||
main_frame->m_XRRConfig->AddResolutions(retlist);
|
std::vector<std::string> resos;
|
||||||
|
main_frame->m_XRRConfig->AddResolutions(resos);
|
||||||
|
for (auto res : resos)
|
||||||
|
retlist.Add(StrToWxStr(res));
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
CFArrayRef modes = CGDisplayCopyAllDisplayModes(CGMainDisplayID(), nullptr);
|
CFArrayRef modes = CGDisplayCopyAllDisplayModes(CGMainDisplayID(), nullptr);
|
||||||
for (CFIndex i = 0; i < CFArrayGetCount(modes); i++)
|
for (CFIndex i = 0; i < CFArrayGetCount(modes); i++)
|
||||||
|
|
|
@ -254,8 +254,7 @@ void XRRConfiguration::ToggleDisplayMode(bool bFullscreen)
|
||||||
XSync(dpy, false);
|
XSync(dpy, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_WX) && HAVE_WX
|
void XRRConfiguration::AddResolutions(std::vector<std::string>& resos)
|
||||||
void XRRConfiguration::AddResolutions(wxArrayString& arrayStringFor_FullscreenResolution)
|
|
||||||
{
|
{
|
||||||
if (!bValid || !screenResources)
|
if (!bValid || !screenResources)
|
||||||
return;
|
return;
|
||||||
|
@ -268,7 +267,6 @@ void XRRConfiguration::AddResolutions(wxArrayString& arrayStringFor_FullscreenRe
|
||||||
|
|
||||||
if (output_info && output_info->crtc && output_info->connection == RR_Connected)
|
if (output_info && output_info->crtc && output_info->connection == RR_Connected)
|
||||||
{
|
{
|
||||||
std::vector<std::string> resos;
|
|
||||||
for (int j = 0; j < output_info->nmode; j++)
|
for (int j = 0; j < output_info->nmode; j++)
|
||||||
for (int k = 0; k < screenResources->nmode; k++)
|
for (int k = 0; k < screenResources->nmode; k++)
|
||||||
if (output_info->modes[j] == screenResources->modes[k].id)
|
if (output_info->modes[j] == screenResources->modes[k].id)
|
||||||
|
@ -280,7 +278,6 @@ void XRRConfiguration::AddResolutions(wxArrayString& arrayStringFor_FullscreenRe
|
||||||
if (std::find(resos.begin(), resos.end(), strRes) == resos.end())
|
if (std::find(resos.begin(), resos.end(), strRes) == resos.end())
|
||||||
{
|
{
|
||||||
resos.push_back(strRes);
|
resos.push_back(strRes);
|
||||||
arrayStringFor_FullscreenResolution.Add(StrToWxStr(strRes));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -288,7 +285,6 @@ void XRRConfiguration::AddResolutions(wxArrayString& arrayStringFor_FullscreenRe
|
||||||
XRRFreeOutputInfo(output_info);
|
XRRFreeOutputInfo(output_info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -51,9 +51,7 @@ class XRRConfiguration
|
||||||
|
|
||||||
void Update();
|
void Update();
|
||||||
void ToggleDisplayMode(bool bFullscreen);
|
void ToggleDisplayMode(bool bFullscreen);
|
||||||
#if defined(HAVE_WX) && HAVE_WX
|
void AddResolutions(std::vector<std::string>& resos);
|
||||||
void AddResolutions(wxArrayString& arrayStringFor_FullscreenResolution);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
|
|
Loading…
Reference in New Issue