Platform/Unix: Rename X11SharedDisplay to Xlib, and remove Display member variable from all classes.
We now initialize/destroy the display in Xlib::init/shutdown that is called in UnixApplication::init/shutdown and therefore is valid through the whole lifetime. So no need for classes to keep references.
This commit is contained in:
parent
60dd9bacb0
commit
090646b61a
17 changed files with 137 additions and 201 deletions
|
|
@ -1,8 +1,7 @@
|
|||
|
||||
#include <Spectre/System/Log.h>
|
||||
#include <Platform/PlatformMisc.h>
|
||||
#include "X11SharedDisplay.h"
|
||||
#include <X11/Xlib.h>
|
||||
#include "Xlib.h"
|
||||
#include <X11/extensions/Xrandr.h>
|
||||
#include <algorithm>
|
||||
|
||||
|
|
@ -13,7 +12,7 @@ namespace sp {
|
|||
|
||||
void PlatformMisc::GetDisplayModes(std::vector<DisplayMode>& modes)
|
||||
{
|
||||
::Display *disp = XGetDisplay();
|
||||
::Display *disp = Xlib::getDisplay();
|
||||
|
||||
if (disp) {
|
||||
int scr = DefaultScreen(disp);
|
||||
|
|
@ -28,7 +27,7 @@ void PlatformMisc::GetDisplayModes(std::vector<DisplayMode>& modes)
|
|||
XRRScreenSize* sizes = ::XRRConfigSizes(config, &nbSizes);
|
||||
if (sizes && nbSizes > 0) {
|
||||
int nbDepths = 0;
|
||||
int* depths = XListDepths(disp, scr, &nbDepths);
|
||||
int* depths = ::XListDepths(disp, scr, &nbDepths);
|
||||
if (depths && nbDepths > 0) {
|
||||
|
||||
for(int i = 0; i < nbDepths; i++) {
|
||||
|
|
@ -59,8 +58,6 @@ void PlatformMisc::GetDisplayModes(std::vector<DisplayMode>& modes)
|
|||
} else {
|
||||
Log::error("Failed to use XRandR extension while trying to get display modes.");
|
||||
}
|
||||
|
||||
XReleaseDisplay(disp);
|
||||
} else {
|
||||
Log::error("Failed to connect to the X server while trying to get display modes.");
|
||||
}
|
||||
|
|
@ -70,7 +67,7 @@ DisplayMode PlatformMisc::GetDesktopMode()
|
|||
{
|
||||
DisplayMode mode;
|
||||
|
||||
::Display *disp = XGetDisplay();
|
||||
::Display *disp = Xlib::getDisplay();
|
||||
|
||||
if (disp) {
|
||||
int scr = DefaultScreen(disp);
|
||||
|
|
@ -103,8 +100,6 @@ DisplayMode PlatformMisc::GetDesktopMode()
|
|||
} else {
|
||||
Log::error("Failed to use XRandR extension while trying to get desktop display mode.");
|
||||
}
|
||||
|
||||
XReleaseDisplay(disp);
|
||||
} else {
|
||||
Log::error("Failed to connect to the X server while trying to get desktop display mode.");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue