mirror of
https://github.com/gwm17/glfw.git
synced 2024-11-26 12:18:51 -05:00
Replaced display with monitor in monitor related api.
This commit is contained in:
parent
58d4323ece
commit
426df42d00
|
@ -539,36 +539,36 @@ GLFWAPI int glfwGetError(void);
|
|||
GLFWAPI const char* glfwErrorString(int error);
|
||||
GLFWAPI void glfwSetErrorCallback(GLFWerrorfun cbfun);
|
||||
|
||||
/* Display constants */
|
||||
#define GLFW_DISPLAY_INVALID_HANDLE (NULL)
|
||||
#define GLFW_DISPLAY_CONNECTED 0
|
||||
#define GLFW_DISPLAY_DISCONNECTED 1
|
||||
#define GLFW_DISPLAY_PARAM_S_NAME 0
|
||||
#define GLFW_DISPLAY_PARAM_I_PHYS_WIDTH 1
|
||||
#define GLFW_DISPLAY_PARAM_I_PHYS_HEIGHT 2
|
||||
#define GLFW_DISPLAY_PARAM_I_SCREEN_X_POS 3
|
||||
#define GLFW_DISPLAY_PARAM_I_SCREEN_Y_POS 4
|
||||
#define GLFW_DISPLAY_PARAM_S_NAME_LEN 30
|
||||
/* Monitor constants */
|
||||
#define GLFW_MONITOR_INVALID_HANDLE (NULL)
|
||||
#define GLFW_MONITOR_CONNECTED 0
|
||||
#define GLFW_MONITOR_DISCONNECTED 1
|
||||
#define GLFW_MONITOR_PARAM_S_NAME 0
|
||||
#define GLFW_MONITOR_PARAM_I_PHYS_WIDTH 1
|
||||
#define GLFW_MONITOR_PARAM_I_PHYS_HEIGHT 2
|
||||
#define GLFW_MONITOR_PARAM_I_SCREEN_X_POS 3
|
||||
#define GLFW_MONITOR_PARAM_I_SCREEN_Y_POS 4
|
||||
#define GLFW_MONITOR_PARAM_S_NAME_LEN 30
|
||||
|
||||
/* Display types */
|
||||
typedef struct _GLFWdisplay* GLFWdisplay;
|
||||
typedef void (* GLFWdisplaydevicefun)(GLFWdisplay,int); /* connect / disconnect */
|
||||
/* Monitor types */
|
||||
typedef struct _GLFWmonitor* GLFWmonitor;
|
||||
typedef void (* GLFWmonitordevicefun)(GLFWmonitor,int); /* connect / disconnect */
|
||||
|
||||
/* Display callback registration */
|
||||
GLFWAPI void glfwSetDisplayDeviceCallback(GLFWdisplaydevicefun cbfun);
|
||||
/* Monitor callback registration */
|
||||
GLFWAPI void glfwSetMonitorDeviceCallback(GLFWmonitordevicefun cbfun);
|
||||
|
||||
/* Display attributes */
|
||||
GLFWAPI void glfwSetDisplayUserPointer(GLFWdisplay display, void* pointer);
|
||||
GLFWAPI void* glfwGetDisplayUserPointer(GLFWdisplay display);
|
||||
GLFWAPI int glfwGetDisplayIntegerParam(GLFWdisplay display, int param);
|
||||
GLFWAPI const char* glfwGetDisplayStringParam(GLFWdisplay display, int param);
|
||||
/* Monitor attributes */
|
||||
GLFWAPI void glfwSetMonitorUserPointer(GLFWmonitor monitor, void* pointer);
|
||||
GLFWAPI void* glfwGetMonitorUserPointer(GLFWmonitor monitor);
|
||||
GLFWAPI int glfwGetMonitorIntegerParam(GLFWmonitor monitor, int param);
|
||||
GLFWAPI const char* glfwGetMonitorStringParam(GLFWmonitor monitor, int param);
|
||||
|
||||
/* Display discovery */
|
||||
GLFWAPI GLFWdisplay glfwGetNextDisplay(GLFWdisplay iterator);
|
||||
/* Monitor discovery */
|
||||
GLFWAPI GLFWmonitor glfwGetNextMonitor(GLFWmonitor iterator);
|
||||
|
||||
|
||||
/* Video mode functions */
|
||||
GLFWAPI int glfwGetVideoModes(GLFWdisplay display, GLFWvidmode* list, int maxcount);
|
||||
GLFWAPI int glfwGetVideoModes(GLFWmonitor monitor, GLFWvidmode* list, int maxcount);
|
||||
GLFWAPI void glfwGetDesktopMode(GLFWvidmode* mode);
|
||||
|
||||
/* Gamma ramp functions */
|
||||
|
|
|
@ -32,21 +32,21 @@
|
|||
|
||||
|
||||
//========================================================================
|
||||
// Get a list of connected displays
|
||||
// Get a list of connected monitors
|
||||
//========================================================================
|
||||
|
||||
GLFWAPI GLFWdisplay glfwGetNextDisplay(GLFWdisplay iterator)
|
||||
GLFWAPI GLFWmonitor glfwGetNextMonitor(GLFWmonitor iterator)
|
||||
{
|
||||
GLFWdisplay result = GLFW_DISPLAY_INVALID_HANDLE;
|
||||
GLFWmonitor result = GLFW_MONITOR_INVALID_HANDLE;
|
||||
if (!_glfwInitialized)
|
||||
{
|
||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
||||
return result;
|
||||
}
|
||||
|
||||
if (iterator == GLFW_DISPLAY_INVALID_HANDLE)
|
||||
if (iterator == GLFW_MONITOR_INVALID_HANDLE)
|
||||
{
|
||||
result = _glfwLibrary.displayListHead;
|
||||
result = _glfwLibrary.monitorListHead;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -55,7 +55,7 @@ GLFWAPI GLFWdisplay glfwGetNextDisplay(GLFWdisplay iterator)
|
|||
return result;
|
||||
}
|
||||
|
||||
GLFWAPI int glfwGetDisplayIntegerParam(GLFWdisplay display, int param)
|
||||
GLFWAPI int glfwGetMonitorIntegerParam(GLFWmonitor monitor, int param)
|
||||
{
|
||||
if (!_glfwInitialized)
|
||||
{
|
||||
|
@ -63,29 +63,29 @@ GLFWAPI int glfwGetDisplayIntegerParam(GLFWdisplay display, int param)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (display == GLFW_DISPLAY_INVALID_HANDLE)
|
||||
if (monitor == GLFW_MONITOR_INVALID_HANDLE)
|
||||
{
|
||||
_glfwSetError(GLFW_INVALID_VALUE, "Display handle is invalid.");
|
||||
_glfwSetError(GLFW_INVALID_VALUE, "Monitor handle is invalid.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch(param)
|
||||
{
|
||||
case GLFW_DISPLAY_PARAM_I_PHYS_WIDTH:
|
||||
return display->physicalWidth;
|
||||
case GLFW_DISPLAY_PARAM_I_PHYS_HEIGHT:
|
||||
return display->physicalHeight;
|
||||
case GLFW_DISPLAY_PARAM_I_SCREEN_X_POS:
|
||||
return display->screenXPosition;
|
||||
case GLFW_DISPLAY_PARAM_I_SCREEN_Y_POS:
|
||||
return display->screenYPosition;
|
||||
case GLFW_MONITOR_PARAM_I_PHYS_WIDTH:
|
||||
return monitor->physicalWidth;
|
||||
case GLFW_MONITOR_PARAM_I_PHYS_HEIGHT:
|
||||
return monitor->physicalHeight;
|
||||
case GLFW_MONITOR_PARAM_I_SCREEN_X_POS:
|
||||
return monitor->screenXPosition;
|
||||
case GLFW_MONITOR_PARAM_I_SCREEN_Y_POS:
|
||||
return monitor->screenYPosition;
|
||||
default:
|
||||
_glfwSetError(GLFW_INVALID_ENUM, "Param represents not a valid integer display attribute.");
|
||||
_glfwSetError(GLFW_INVALID_ENUM, "Param represents not a valid integer monitor attribute.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
GLFWAPI const char* glfwGetDisplayStringParam(GLFWdisplay display, int param)
|
||||
GLFWAPI const char* glfwGetMonitorStringParam(GLFWmonitor monitor, int param)
|
||||
{
|
||||
if (!_glfwInitialized)
|
||||
{
|
||||
|
@ -93,18 +93,18 @@ GLFWAPI const char* glfwGetDisplayStringParam(GLFWdisplay display, int param)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (display == GLFW_DISPLAY_INVALID_HANDLE)
|
||||
if (monitor == GLFW_MONITOR_INVALID_HANDLE)
|
||||
{
|
||||
_glfwSetError(GLFW_INVALID_VALUE, "display handle is invalid.");
|
||||
_glfwSetError(GLFW_INVALID_VALUE, "monitor handle is invalid.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch(param)
|
||||
{
|
||||
case GLFW_DISPLAY_PARAM_S_NAME:
|
||||
return display->deviceName;
|
||||
case GLFW_MONITOR_PARAM_S_NAME:
|
||||
return monitor->deviceName;
|
||||
default:
|
||||
_glfwSetError(GLFW_INVALID_ENUM, "Param represents not a valid string display attribute.");
|
||||
_glfwSetError(GLFW_INVALID_ENUM, "Param represents not a valid string monitor attribute.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ void _glfwSplitBPP(int bpp, int* red, int* green, int* blue)
|
|||
// Get a list of available video modes
|
||||
//========================================================================
|
||||
|
||||
GLFWAPI int glfwGetVideoModes(GLFWdisplay display, GLFWvidmode* list, int maxcount)
|
||||
GLFWAPI int glfwGetVideoModes(GLFWmonitor monitor, GLFWvidmode* list, int maxcount)
|
||||
{
|
||||
int count;
|
||||
|
||||
|
@ -110,9 +110,9 @@ GLFWAPI int glfwGetVideoModes(GLFWdisplay display, GLFWvidmode* list, int maxcou
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (display == GLFW_DISPLAY_INVALID_HANDLE)
|
||||
if (monitor == GLFW_MONITOR_INVALID_HANDLE)
|
||||
{
|
||||
_glfwSetError(GLFW_INVALID_VALUE, "Display handle is invalid.");
|
||||
_glfwSetError(GLFW_INVALID_VALUE, "Monitor handle is invalid.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ GLFWAPI int glfwGetVideoModes(GLFWdisplay display, GLFWvidmode* list, int maxcou
|
|||
return 0;
|
||||
}
|
||||
|
||||
count = _glfwPlatformGetVideoModes(display, list, maxcount);
|
||||
count = _glfwPlatformGetVideoModes(monitor, list, maxcount);
|
||||
if (count > 0)
|
||||
qsort(list, count, sizeof(GLFWvidmode), _glfwCompareVideoModes);
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ typedef struct _GLFWwndconfig _GLFWwndconfig;
|
|||
typedef struct _GLFWfbconfig _GLFWfbconfig;
|
||||
typedef struct _GLFWwindow _GLFWwindow;
|
||||
typedef struct _GLFWlibrary _GLFWlibrary;
|
||||
typedef struct _GLFWdisplay _GLFWdisplay;
|
||||
typedef struct _GLFWmonitor _GLFWmonitor;
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
@ -219,13 +219,13 @@ struct _GLFWwindow
|
|||
//------------------------------------------------------------------------
|
||||
// Display structure
|
||||
//------------------------------------------------------------------------
|
||||
struct _GLFWdisplay
|
||||
struct _GLFWmonitor
|
||||
{
|
||||
struct _GLFWdisplay* next;
|
||||
struct _GLFWmonitor* next;
|
||||
|
||||
void* userPointer;
|
||||
|
||||
char deviceName[GLFW_DISPLAY_PARAM_S_NAME_LEN+1];
|
||||
char deviceName[GLFW_MONITOR_PARAM_S_NAME_LEN+1];
|
||||
// physical dimensions in millimeters.
|
||||
int physicalWidth;
|
||||
int physicalHeight;
|
||||
|
@ -234,7 +234,7 @@ struct _GLFWdisplay
|
|||
int screenYPosition;
|
||||
|
||||
// These are defined in the current port's platform.h
|
||||
_GLFW_PLATFORM_DISPLAY_STATE;
|
||||
_GLFW_PLATFORM_MONITOR_STATE;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
@ -248,7 +248,7 @@ struct _GLFWlibrary
|
|||
_GLFWwindow* currentWindow;
|
||||
_GLFWwindow* activeWindow;
|
||||
_GLFWwindow* cursorLockWindow;
|
||||
_GLFWdisplay* displayListHead;
|
||||
_GLFWmonitor* monitorListHead;
|
||||
|
||||
GLFWwindowsizefun windowSizeCallback;
|
||||
GLFWwindowclosefun windowCloseCallback;
|
||||
|
@ -301,7 +301,7 @@ void _glfwPlatformEnableSystemKeys(_GLFWwindow* window);
|
|||
void _glfwPlatformDisableSystemKeys(_GLFWwindow* window);
|
||||
|
||||
// Fullscreen
|
||||
int _glfwPlatformGetVideoModes(GLFWdisplay display, GLFWvidmode* list, int maxcount);
|
||||
int _glfwPlatformGetVideoModes(GLFWmonitor monitor, GLFWvidmode* list, int maxcount);
|
||||
void _glfwPlatformGetDesktopMode(GLFWvidmode* mode);
|
||||
|
||||
// Gamma ramp
|
||||
|
|
|
@ -38,12 +38,12 @@
|
|||
////// GLFW platform API //////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
_GLFWdisplay** _glfwCreateDisplay(_GLFWdisplay** current, DISPLAY_DEVICE* adapter, DISPLAY_DEVICE* monitor, DEVMODE* setting)
|
||||
_GLFWmonitor** _glfwCreateMonitor(_GLFWmonitor** current, DISPLAY_DEVICE* adapter, DISPLAY_DEVICE* monitor, DEVMODE* setting)
|
||||
{
|
||||
HDC dc = NULL;
|
||||
|
||||
*current = _glfwMalloc(sizeof(_GLFWdisplay));
|
||||
memset(*current, 0, sizeof(_GLFWdisplay));
|
||||
*current = _glfwMalloc(sizeof(_GLFWmonitor));
|
||||
memset(*current, 0, sizeof(_GLFWmonitor));
|
||||
|
||||
dc = CreateDC("DISPLAY", monitor->DeviceString, NULL, NULL);
|
||||
|
||||
|
@ -52,8 +52,8 @@ _GLFWdisplay** _glfwCreateDisplay(_GLFWdisplay** current, DISPLAY_DEVICE* adapte
|
|||
|
||||
DeleteDC(dc);
|
||||
|
||||
memcpy((*current)->deviceName, monitor->DeviceName, GLFW_DISPLAY_PARAM_S_NAME_LEN+1);
|
||||
(*current)->deviceName[GLFW_DISPLAY_PARAM_S_NAME_LEN] = '\0';
|
||||
memcpy((*current)->deviceName, monitor->DeviceName, GLFW_MONITOR_PARAM_S_NAME_LEN+1);
|
||||
(*current)->deviceName[GLFW_MONITOR_PARAM_S_NAME_LEN] = '\0';
|
||||
|
||||
(*current)->screenXPosition = setting->dmPosition.x;
|
||||
(*current)->screenYPosition = setting->dmPosition.y;
|
||||
|
@ -62,20 +62,20 @@ _GLFWdisplay** _glfwCreateDisplay(_GLFWdisplay** current, DISPLAY_DEVICE* adapte
|
|||
return &((*current)->next);
|
||||
}
|
||||
|
||||
_GLFWdisplay* _glfwDestroyDisplay(_GLFWdisplay* display)
|
||||
_GLFWmonitor* _glfwDestroyMonitor(_GLFWmonitor* monitor)
|
||||
{
|
||||
_GLFWdisplay* result;
|
||||
_GLFWmonitor* result;
|
||||
|
||||
result = display->next;
|
||||
result = monitor->next;
|
||||
|
||||
_glfwFree(display);
|
||||
_glfwFree(monitor);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void _glfwInitDisplays(void)
|
||||
void _glfwInitMonitors(void)
|
||||
{
|
||||
_GLFWdisplay** curDisplay;
|
||||
_GLFWmonitor** curMonitor;
|
||||
|
||||
DISPLAY_DEVICE adapter;
|
||||
DWORD adapterNum;
|
||||
|
@ -85,7 +85,7 @@ void _glfwInitDisplays(void)
|
|||
DEVMODE setting;
|
||||
DWORD settingNum;
|
||||
|
||||
curDisplay = &_glfwLibrary.displayListHead;
|
||||
curMonitor = &_glfwLibrary.monitorListHead;
|
||||
|
||||
adapter.cb = sizeof(DISPLAY_DEVICE);
|
||||
adapterNum = 0;
|
||||
|
@ -105,13 +105,13 @@ void _glfwInitDisplays(void)
|
|||
|
||||
EnumDisplayDevices(adapter.DeviceName, 0, &monitor, 0);
|
||||
|
||||
curDisplay = _glfwCreateDisplay(curDisplay, &adapter, &monitor, &setting);
|
||||
curMonitor = _glfwCreateMonitor(curMonitor, &adapter, &monitor, &setting);
|
||||
}
|
||||
}
|
||||
|
||||
void _glfwTerminateDisplays(void)
|
||||
void _glfwTerminateMonitors(void)
|
||||
{
|
||||
while(_glfwLibrary.displayListHead)
|
||||
_glfwLibrary.displayListHead = _glfwDestroyDisplay(_glfwLibrary.displayListHead);
|
||||
while(_glfwLibrary.monitorListHead)
|
||||
_glfwLibrary.monitorListHead = _glfwDestroyMonitor(_glfwLibrary.monitorListHead);
|
||||
}
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@ void _glfwRestoreVideoMode(void)
|
|||
// Get a list of available video modes
|
||||
//========================================================================
|
||||
|
||||
int _glfwPlatformGetVideoModes(GLFWdisplay display, GLFWvidmode* list, int maxcount)
|
||||
int _glfwPlatformGetVideoModes(GLFWmonitor monitor, GLFWvidmode* list, int maxcount)
|
||||
{
|
||||
DEVMODE deviceMode;
|
||||
DWORD deviceModeNum;
|
||||
|
@ -197,7 +197,7 @@ int _glfwPlatformGetVideoModes(GLFWdisplay display, GLFWvidmode* list, int maxc
|
|||
vidModes = NULL;
|
||||
vidModesCount = 0;
|
||||
|
||||
while (EnumDisplaySettings(display->Win32.DeviceName, deviceModeNum, &deviceMode) && (!list || (vidModesCount < maxcount)))
|
||||
while (EnumDisplaySettings(monitor->Win32.DeviceName, deviceModeNum, &deviceMode) && (!list || (vidModesCount < maxcount)))
|
||||
{
|
||||
deviceModeNum++;
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@ int _glfwPlatformInit(void)
|
|||
_glfwLibrary.originalRampSize = 256;
|
||||
_glfwPlatformGetGammaRamp(&_glfwLibrary.originalRamp);
|
||||
|
||||
_glfwInitDisplays();
|
||||
_glfwInitMonitors();
|
||||
|
||||
_glfwInitTimer();
|
||||
|
||||
|
@ -181,7 +181,7 @@ int _glfwPlatformTerminate(void)
|
|||
// Restore the original gamma ramp
|
||||
_glfwPlatformSetGammaRamp(&_glfwLibrary.originalRamp);
|
||||
|
||||
_glfwTerminateDisplays();
|
||||
_glfwTerminateMonitors();
|
||||
|
||||
if (_glfwLibrary.Win32.classAtom)
|
||||
{
|
||||
|
|
|
@ -202,7 +202,7 @@ typedef DWORD (WINAPI * TIMEGETTIME_T) (void);
|
|||
#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowWin32 Win32
|
||||
#define _GLFW_PLATFORM_LIBRARY_STATE _GLFWlibraryWin32 Win32
|
||||
#define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextWGL WGL
|
||||
#define _GLFW_PLATFORM_DISPLAY_STATE _GLFWdisplayWin32 Win32
|
||||
#define _GLFW_PLATFORM_MONITOR_STATE _GLFWmonitorWin32 Win32
|
||||
|
||||
|
||||
//========================================================================
|
||||
|
@ -312,12 +312,12 @@ typedef struct _GLFWlibraryWin32
|
|||
} _GLFWlibraryWin32;
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Platform-specific display structure
|
||||
// Platform-specific monitor structure
|
||||
//------------------------------------------------------------------------
|
||||
typedef struct _GLFWdisplayWin32
|
||||
typedef struct _GLFWmonitorWin32
|
||||
{
|
||||
char DeviceName[32];
|
||||
} _GLFWdisplayWin32;
|
||||
} _GLFWmonitorWin32;
|
||||
|
||||
//========================================================================
|
||||
// Prototypes for platform specific internal functions
|
||||
|
@ -326,9 +326,9 @@ typedef struct _GLFWdisplayWin32
|
|||
// Time
|
||||
void _glfwInitTimer(void);
|
||||
|
||||
// Display support
|
||||
void _glfwInitDisplays(void);
|
||||
void _glfwTerminateDisplays(void);
|
||||
// Monitor support
|
||||
void _glfwInitMonitors(void);
|
||||
void _glfwTerminateMonitors(void);
|
||||
|
||||
// Fullscreen support
|
||||
void _glfwSetVideoMode(int* width, int* height,
|
||||
|
|
|
@ -38,16 +38,16 @@
|
|||
////// GLFW platform API //////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
_GLFWdisplay** _glfwCreateDisplay(_GLFWdisplay** current, XRROutputInfo* outputInfo, XRRCrtcInfo* crtcInfo)
|
||||
_GLFWmonitor** _glfwCreateMonitor(_GLFWmonitor** current, XRROutputInfo* outputInfo, XRRCrtcInfo* crtcInfo)
|
||||
{
|
||||
*current = _glfwMalloc(sizeof(_GLFWdisplay));
|
||||
memset(*current, 0, sizeof(_GLFWdisplay));
|
||||
*current = _glfwMalloc(sizeof(_GLFWmonitor));
|
||||
memset(*current, 0, sizeof(_GLFWmonitor));
|
||||
|
||||
(*current)->physicalWidth = outputInfo->mm_width;
|
||||
(*current)->physicalHeight = outputInfo->mm_height;
|
||||
|
||||
memcpy((*current)->deviceName, outputInfo->name, GLFW_DISPLAY_PARAM_S_NAME_LEN+1);
|
||||
(*current)->deviceName[GLFW_DISPLAY_PARAM_S_NAME_LEN] = '\0';
|
||||
memcpy((*current)->deviceName, outputInfo->name, GLFW_MONITOR_PARAM_S_NAME_LEN+1);
|
||||
(*current)->deviceName[GLFW_MONITOR_PARAM_S_NAME_LEN] = '\0';
|
||||
|
||||
(*current)->screenXPosition = crtcInfo->x;
|
||||
(*current)->screenYPosition = crtcInfo->y;
|
||||
|
@ -56,28 +56,28 @@ _GLFWdisplay** _glfwCreateDisplay(_GLFWdisplay** current, XRROutputInfo* outputI
|
|||
return &((*current)->next);
|
||||
}
|
||||
|
||||
_GLFWdisplay* _glfwDestroyDisplay(_GLFWdisplay* display)
|
||||
_GLFWmonitor* _glfwDestroyMonitor(_GLFWmonitor* monitor)
|
||||
{
|
||||
_GLFWdisplay* result;
|
||||
_GLFWmonitor* result;
|
||||
|
||||
result = display->next;
|
||||
result = monitor->next;
|
||||
|
||||
XRRFreeOutputInfo(display->X11.output);
|
||||
XRRFreeOutputInfo(monitor->X11.output);
|
||||
|
||||
_glfwFree(display);
|
||||
_glfwFree(monitor);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void _glfwInitDisplays(void)
|
||||
void _glfwInitMonitors(void)
|
||||
{
|
||||
if(_glfwLibrary.X11.RandR.available == GL_TRUE)
|
||||
{
|
||||
XRRScreenResources* resources;
|
||||
int outputIDX;
|
||||
_GLFWdisplay** curDisplay;
|
||||
_GLFWmonitor** curMonitor;
|
||||
|
||||
curDisplay = &_glfwLibrary.displayListHead;
|
||||
curMonitor = &_glfwLibrary.monitorListHead;
|
||||
|
||||
resources = XRRGetScreenResources(_glfwLibrary.X11.display,
|
||||
_glfwLibrary.X11.root);
|
||||
|
@ -107,18 +107,18 @@ void _glfwInitDisplays(void)
|
|||
}
|
||||
}
|
||||
|
||||
curDisplay = _glfwCreateDisplay(curDisplay, outputInfo, crtcInfo);
|
||||
curMonitor = _glfwCreateMonitor(curMonitor, outputInfo, crtcInfo);
|
||||
|
||||
// Freeing of the outputInfo is done in _glfwDestroyDisplay
|
||||
// Freeing of the outputInfo is done in _glfwDestroyMonitor
|
||||
XRRFreeCrtcInfo(crtcInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void _glfwTerminateDisplays(void)
|
||||
void _glfwTerminateMonitors(void)
|
||||
{
|
||||
while(_glfwLibrary.displayListHead)
|
||||
_glfwLibrary.displayListHead = _glfwDestroyDisplay(_glfwLibrary.displayListHead);
|
||||
while(_glfwLibrary.monitorListHead)
|
||||
_glfwLibrary.monitorListHead = _glfwDestroyMonitor(_glfwLibrary.monitorListHead);
|
||||
}
|
||||
|
||||
|
|
|
@ -344,7 +344,7 @@ int _glfwCompareResolution(const void* left, const void* right)
|
|||
// List available video modes
|
||||
//========================================================================
|
||||
|
||||
int _glfwPlatformGetVideoModes(GLFWdisplay display, GLFWvidmode* list, int maxcount)
|
||||
int _glfwPlatformGetVideoModes(GLFWmonitor monitor, GLFWvidmode* list, int maxcount)
|
||||
{
|
||||
int count, k, l, r, g, b, rgba, gl;
|
||||
int depth, screen;
|
||||
|
@ -416,13 +416,13 @@ int _glfwPlatformGetVideoModes(GLFWdisplay display, GLFWvidmode* list, int maxco
|
|||
unsigned int a;
|
||||
resource = XRRGetScreenResources(_glfwLibrary.X11.display, _glfwLibrary.X11.root);
|
||||
|
||||
resarray = (struct _glfwResolution*) _glfwMalloc(sizeof(struct _glfwResolution) * display->X11.output->nmode);
|
||||
resarray = (struct _glfwResolution*) _glfwMalloc(sizeof(struct _glfwResolution) * monitor->X11.output->nmode);
|
||||
|
||||
for (k = 0; k < display->X11.output->nmode; k++)
|
||||
for (k = 0; k < monitor->X11.output->nmode; k++)
|
||||
{
|
||||
for (a = 0; a < resource->nmode; a++)
|
||||
{
|
||||
if (resource->modes[a].id != display->X11.output->modes[k])
|
||||
if (resource->modes[a].id != monitor->X11.output->modes[k])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -577,7 +577,7 @@ int _glfwPlatformInit(void)
|
|||
|
||||
_glfwInitJoysticks();
|
||||
|
||||
_glfwInitDisplays();
|
||||
_glfwInitMonitors();
|
||||
|
||||
// Start the timer
|
||||
_glfwInitTimer();
|
||||
|
@ -600,7 +600,7 @@ int _glfwPlatformTerminate(void)
|
|||
|
||||
terminateDisplay();
|
||||
|
||||
_glfwTerminateDisplays();
|
||||
_glfwTerminateMonitors();
|
||||
|
||||
_glfwTerminateJoysticks();
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowX11 X11
|
||||
#define _GLFW_PLATFORM_LIBRARY_STATE _GLFWlibraryX11 X11
|
||||
#define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextGLX GLX
|
||||
#define _GLFW_PLATFORM_DISPLAY_STATE _GLFWdisplayX11 X11
|
||||
#define _GLFW_PLATFORM_MONITOR_STATE _GLFWmonitorX11 X11
|
||||
|
||||
|
||||
//========================================================================
|
||||
|
@ -248,10 +248,10 @@ GLFWGLOBAL struct {
|
|||
//------------------------------------------------------------------------
|
||||
// Platform-specific window structure
|
||||
//------------------------------------------------------------------------
|
||||
typedef struct _GLFWdisplayX11
|
||||
typedef struct _GLFWmonitorX11
|
||||
{
|
||||
XRROutputInfo* output;
|
||||
} _GLFWdisplayX11;
|
||||
} _GLFWmonitorX11;
|
||||
|
||||
|
||||
//========================================================================
|
||||
|
@ -271,9 +271,9 @@ void _glfwRestoreVideoMode(int screen);
|
|||
void _glfwInitJoysticks(void);
|
||||
void _glfwTerminateJoysticks(void);
|
||||
|
||||
// Displays
|
||||
void _glfwInitDisplays(void);
|
||||
void _glfwTerminateDisplays(void);
|
||||
// Monitors
|
||||
void _glfwInitMonitors(void);
|
||||
void _glfwTerminateMonitors(void);
|
||||
|
||||
// Unicode support
|
||||
long _glfwKeySym2Unicode(KeySym keysym);
|
||||
|
|
|
@ -18,7 +18,7 @@ static void print_mode(GLFWvidmode* mode)
|
|||
|
||||
int main(void)
|
||||
{
|
||||
GLFWdisplay displayHandle;
|
||||
GLFWmonitor monitorHandle;
|
||||
GLFWvidmode dtmode, modes[400];
|
||||
int modecount, i;
|
||||
|
||||
|
@ -33,21 +33,21 @@ int main(void)
|
|||
printf("Desktop mode: ");
|
||||
print_mode(&dtmode);
|
||||
|
||||
displayHandle = GLFW_DISPLAY_INVALID_HANDLE;
|
||||
monitorHandle = GLFW_MONITOR_INVALID_HANDLE;
|
||||
|
||||
while( GLFW_DISPLAY_INVALID_HANDLE != ( displayHandle = glfwGetNextDisplay( displayHandle )))
|
||||
while( GLFW_MONITOR_INVALID_HANDLE != ( monitorHandle = glfwGetNextMonitor( monitorHandle )))
|
||||
{
|
||||
printf( "Display name: %s\n"
|
||||
printf( "Monitor name: %s\n"
|
||||
"Physical dimensions: %dmm x %dmm\n"
|
||||
"Logical position: (%d,%d)\n",
|
||||
glfwGetDisplayStringParam( displayHandle, GLFW_DISPLAY_PARAM_S_NAME ),
|
||||
glfwGetDisplayIntegerParam( displayHandle, GLFW_DISPLAY_PARAM_I_PHYS_WIDTH ),
|
||||
glfwGetDisplayIntegerParam( displayHandle, GLFW_DISPLAY_PARAM_I_PHYS_HEIGHT ),
|
||||
glfwGetDisplayIntegerParam( displayHandle, GLFW_DISPLAY_PARAM_I_SCREEN_X_POS ),
|
||||
glfwGetDisplayIntegerParam( displayHandle, GLFW_DISPLAY_PARAM_I_SCREEN_Y_POS )
|
||||
glfwGetMonitorStringParam( monitorHandle, GLFW_MONITOR_PARAM_S_NAME ),
|
||||
glfwGetMonitorIntegerParam( monitorHandle, GLFW_MONITOR_PARAM_I_PHYS_WIDTH ),
|
||||
glfwGetMonitorIntegerParam( monitorHandle, GLFW_MONITOR_PARAM_I_PHYS_HEIGHT ),
|
||||
glfwGetMonitorIntegerParam( monitorHandle, GLFW_MONITOR_PARAM_I_SCREEN_X_POS ),
|
||||
glfwGetMonitorIntegerParam( monitorHandle, GLFW_MONITOR_PARAM_I_SCREEN_Y_POS )
|
||||
);
|
||||
// List available video modes
|
||||
modecount = glfwGetVideoModes(displayHandle, modes, sizeof(modes) / sizeof(GLFWvidmode));
|
||||
modecount = glfwGetVideoModes(monitorHandle, modes, sizeof(modes) / sizeof(GLFWvidmode));
|
||||
printf( "Available modes:\n" );
|
||||
for( i = 0; i < modecount; i ++ )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user