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