Begun integrating monitor and window.
diff --git a/examples/boing.c b/examples/boing.c
index a2094c5..8dc6ac9 100644
--- a/examples/boing.c
+++ b/examples/boing.c
@@ -581,7 +581,7 @@
glfwWindowHint(GLFW_DEPTH_BITS, 16);
- window = glfwCreateWindow( 400, 400, GLFW_WINDOWED, "Boing (classic Amiga demo)", NULL );
+ window = glfwCreateWindow( 400, 400, "Boing (classic Amiga demo)", NULL, NULL );
if (!window)
{
fprintf( stderr, "Failed to open GLFW window\n" );
diff --git a/examples/gears.c b/examples/gears.c
index cd3cdbb..d5d9325 100644
--- a/examples/gears.c
+++ b/examples/gears.c
@@ -345,7 +345,7 @@
glfwWindowHint(GLFW_DEPTH_BITS, 16);
- window = glfwCreateWindow( 300, 300, GLFW_WINDOWED, "Gears", NULL );
+ window = glfwCreateWindow( 300, 300, "Gears", NULL, NULL );
if (!window)
{
fprintf( stderr, "Failed to open GLFW window\n" );
diff --git a/examples/heightmap.c b/examples/heightmap.c
index 5139a49..43f8da8 100644
--- a/examples/heightmap.c
+++ b/examples/heightmap.c
@@ -587,7 +587,7 @@
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_FALSE);
- window = glfwCreateWindow(800, 600, GLFW_WINDOWED, "GLFW OpenGL3 Heightmap demo", NULL);
+ window = glfwCreateWindow(800, 600, "GLFW OpenGL3 Heightmap demo", NULL, NULL);
if (! window )
{
fprintf(stderr, "ERROR: Unable to create the OpenGL context and associated window\n");
diff --git a/examples/splitview.c b/examples/splitview.c
index 4a48a38..86339e4 100644
--- a/examples/splitview.c
+++ b/examples/splitview.c
@@ -459,7 +459,7 @@
glfwWindowHint(GLFW_DEPTH_BITS, 16);
// Open OpenGL window
- window = glfwCreateWindow(500, 500, GLFW_WINDOWED, "Split view demo", NULL);
+ window = glfwCreateWindow(500, 500, "Split view demo", NULL, NULL);
if (!window)
{
fprintf(stderr, "Failed to open GLFW window\n");
diff --git a/examples/triangle.c b/examples/triangle.c
index 615483a..6d15c7b 100644
--- a/examples/triangle.c
+++ b/examples/triangle.c
@@ -23,7 +23,7 @@
}
// Open a window and create its OpenGL context
- window = glfwCreateWindow(640, 480, GLFW_WINDOWED, "Spinning Triangle", NULL);
+ window = glfwCreateWindow(640, 480, "Spinning Triangle", NULL, NULL);
if (!window)
{
fprintf(stderr, "Failed to open GLFW window\n");
diff --git a/examples/wave.c b/examples/wave.c
index 668d54b..3dfce8e 100644
--- a/examples/wave.c
+++ b/examples/wave.c
@@ -406,7 +406,7 @@
glfwSetCursorPosCallback(cursor_position_callback);
glfwSetScrollCallback(scroll_callback);
- window = glfwCreateWindow(640, 480, GLFW_WINDOWED, "Wave Simulation", NULL);
+ window = glfwCreateWindow(640, 480, "Wave Simulation", NULL, NULL);
if (!window)
{
fprintf(stderr, "Could not open window\n");
diff --git a/include/GL/glfw3.h b/include/GL/glfw3.h
index 979c065..94ceaf8 100644
--- a/include/GL/glfw3.h
+++ b/include/GL/glfw3.h
@@ -375,10 +375,6 @@
* Other definitions
*************************************************************************/
-/* glfwCreateWindow modes */
-#define GLFW_WINDOWED 0x00010001
-#define GLFW_FULLSCREEN 0x00010002
-
/* glfwGetWindowParam tokens */
#define GLFW_ACTIVE 0x00020001
#define GLFW_ICONIFIED 0x00020002
@@ -548,7 +544,7 @@
/* Window handling */
GLFWAPI void glfwWindowHint(int target, int hint);
-GLFWAPI GLFWwindow glfwCreateWindow(int width, int height, int mode, const char* title, GLFWwindow share);
+GLFWAPI GLFWwindow glfwCreateWindow(int width, int height, const char* title, GLFWmonitor monitor, GLFWwindow share);
GLFWAPI void glfwDestroyWindow(GLFWwindow window);
GLFWAPI void glfwSetWindowTitle(GLFWwindow window, const char* title);
GLFWAPI void glfwGetWindowSize(GLFWwindow window, int* width, int* height);
diff --git a/readme.html b/readme.html
index bb74547..95cd247 100644
--- a/readme.html
+++ b/readme.html
@@ -297,7 +297,6 @@
<li>Changed <code>glfwGetVideoModes</code> to return a dynamic, unlimited number of video modes</li>
<li>Renamed <code>glfw.h</code> to <code>glfw3.h</code> to avoid conflicts with 2.x series</li>
<li>Renamed <code>glfwOpenWindowHint</code> to <code>glfwWindowHint</code></li>
- <li>Renamed <code>GLFW_WINDOW</code> token to <code>GLFW_WINDOWED</code></li>
<li>Renamed <code>GLFW_WINDOW_NO_RESIZE</code> to <code>GLFW_RESIZABLE</code></li>
<li>Renamed <code>GLFW_BUILD_DLL</code> to <code>_GLFW_BUILD_DLL</code></li>
<li>Renamed <code>version</code> test to <code>glfwinfo</code></li>
@@ -322,6 +321,7 @@
<li>Removed <code>glfwGetNumberOfProcessors</code> function</li>
<li>Removed <code>glfwGetGLVersion</code> function</li>
<li>Removed <code>GLFW_OPENED</code> window parameter</li>
+ <li>Removed <code>GLFW_WINDOW</code> and <code>GLFW_FULLSCREEN</code></li>
<li>Removed nonsensical key actions for Unicode character input</li>
<li>Removed <code>GLFWCALL</code> and <code>GLFWAPIENTRY</code> macros for stdcall calling convention</li>
<li>Removed <code>GLFW_ACCELERATED</code> window parameter</li>
diff --git a/src/cocoa_window.m b/src/cocoa_window.m
index efdc0c6..844175f 100644
--- a/src/cocoa_window.m
+++ b/src/cocoa_window.m
@@ -674,7 +674,9 @@
{
unsigned int styleMask = 0;
- if (wndconfig->mode == GLFW_WINDOWED)
+ if (wndconfig->monitor)
+ styleMask = NSBorderlessWindowMask;
+ else
{
styleMask = NSTitledWindowMask | NSClosableWindowMask |
NSMiniaturizableWindowMask;
@@ -682,8 +684,6 @@
if (wndconfig->resizable)
styleMask |= NSResizableWindowMask;
}
- else
- styleMask = NSBorderlessWindowMask;
window->NS.object = [[NSWindow alloc]
initWithContentRect:NSMakeRect(0, 0, window->width, window->height)
@@ -788,7 +788,7 @@
ADD_ATTR(NSOpenGLPFADoubleBuffer);
- if (wndconfig->mode == GLFW_FULLSCREEN)
+ if (wndconfig->monitor)
{
ADD_ATTR(NSOpenGLPFANoRecovery);
ADD_ATTR2(NSOpenGLPFAScreenMask,
@@ -919,7 +919,7 @@
[window->NSGL.context setView:[window->NS.object contentView]];
- if (wndconfig->mode == GLFW_FULLSCREEN)
+ if (wndconfig->monitor)
{
int bpp = colorBits + fbconfig->alphaBits;
@@ -952,7 +952,7 @@
{
[window->NS.object orderOut:nil];
- if (window->mode == GLFW_FULLSCREEN)
+ if (window->monitor)
{
[[window->NS.object contentView] exitFullScreenModeWithOptions:nil];
@@ -1121,7 +1121,7 @@
void _glfwPlatformSetCursorPos(_GLFWwindow* window, int x, int y)
{
- if (window->mode == GLFW_FULLSCREEN)
+ if (window->monitor)
{
CGPoint globalPoint = CGPointMake(x, y);
CGDisplayMoveCursorToPoint(CGMainDisplayID(), globalPoint);
diff --git a/src/internal.h b/src/internal.h
index b01707f..2b70226 100755
--- a/src/internal.h
+++ b/src/internal.h
@@ -129,6 +129,7 @@
GLboolean glDebug;
int glProfile;
int glRobustness;
+ _GLFWmonitor* monitor;
_GLFWwindow* share;
};
@@ -176,6 +177,7 @@
GLboolean visible; // GL_TRUE if this window is visible
int refreshRate; // monitor refresh rate
void* userPointer;
+ _GLFWmonitor* monitor;
// Window input state
GLboolean stickyKeys;
diff --git a/src/monitor.c b/src/monitor.c
index 990e375..e0b5e48 100644
--- a/src/monitor.c
+++ b/src/monitor.c
@@ -156,12 +156,20 @@
for (i = 0; i < _glfwLibrary.monitorCount; i++)
{
+ _GLFWwindow* window;
+
if (_glfwLibrary.monitors[i] == NULL)
continue;
// This monitor is no longer connected
_glfwLibrary.monitorCallback(_glfwLibrary.monitors[i],
GLFW_MONITOR_DISCONNECTED);
+
+ for (window = _glfwLibrary.windowListHead; window; window = window->next)
+ {
+ if (window->monitor == _glfwLibrary.monitors[i])
+ window->monitor = NULL;
+ }
}
_glfwDestroyMonitors();
diff --git a/src/win32_window.c b/src/win32_window.c
index 0b753db..d98978b 100644
--- a/src/win32_window.c
+++ b/src/win32_window.c
@@ -344,7 +344,7 @@
if (window->cursorMode == GLFW_CURSOR_CAPTURED)
showCursor(window);
- if (window->mode == GLFW_FULLSCREEN)
+ if (window->monitor)
{
if (!iconified)
{
@@ -367,7 +367,7 @@
if (window->cursorMode == GLFW_CURSOR_CAPTURED)
captureCursor(window);
- if (window->mode == GLFW_FULLSCREEN)
+ if (window->monitor)
{
if (!_glfwLibrary.Win32.monitor.modeChanged)
{
@@ -400,7 +400,7 @@
case SC_SCREENSAVE:
case SC_MONITORPOWER:
{
- if (window->mode == GLFW_FULLSCREEN)
+ if (window->monitor)
{
// We are running in fullscreen mode, so disallow
// screen saver and screen blanking
@@ -738,7 +738,7 @@
dwExStyle = WS_EX_APPWINDOW;
// Set window style, depending on fullscreen mode
- if (window->mode == GLFW_FULLSCREEN)
+ if (window->monitor)
{
dwStyle |= WS_POPUP;
@@ -775,7 +775,7 @@
// Adjust window position to working area (e.g. if the task bar is at
// the top of the display). Fullscreen windows are always opened in
// the upper left corner regardless of the desktop working area.
- if (window->mode == GLFW_FULLSCREEN)
+ if (window->monitor)
wa.left = wa.top = 0;
else
SystemParametersInfo(SPI_GETWORKAREA, 0, &wa, 0);
@@ -866,7 +866,7 @@
return GL_FALSE;
}
- if (window->mode == GLFW_FULLSCREEN)
+ if (window->monitor)
{
int bpp = fbconfig->redBits + fbconfig->greenBits + fbconfig->blueBits;
if (bpp < 15 || bpp >= 24)
@@ -962,7 +962,7 @@
return GL_FALSE;
}
- if (window->mode == GLFW_FULLSCREEN)
+ if (window->monitor)
{
// Place the window above all topmost windows
_glfwPlatformShowWindow(window);
@@ -982,7 +982,7 @@
{
destroyWindow(window);
- if (window->mode == GLFW_FULLSCREEN)
+ if (window->monitor)
{
if (_glfwLibrary.Win32.monitor.modeChanged)
{
@@ -1021,7 +1021,7 @@
{
GLboolean sizeChanged = GL_FALSE;
- if (window->mode == GLFW_FULLSCREEN)
+ if (window->monitor)
{
if (width > window->width || height > window->height)
{
diff --git a/src/window.c b/src/window.c
index f27fbef..3da4936 100644
--- a/src/window.c
+++ b/src/window.c
@@ -224,7 +224,8 @@
//========================================================================
GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
- int mode, const char* title,
+ const char* title,
+ GLFWmonitor monitor,
GLFWwindow share)
{
_GLFWfbconfig fbconfig;
@@ -257,7 +258,6 @@
fbconfig.samples = Max(_glfwLibrary.hints.samples, 0);
// Set up desired window config
- wndconfig.mode = mode;
wndconfig.title = title;
wndconfig.refreshRate = Max(_glfwLibrary.hints.refreshRate, 0);
wndconfig.resizable = _glfwLibrary.hints.resizable ? GL_TRUE : GL_FALSE;
@@ -268,6 +268,7 @@
wndconfig.glDebug = _glfwLibrary.hints.glDebug ? GL_TRUE : GL_FALSE;
wndconfig.glProfile = _glfwLibrary.hints.glProfile;
wndconfig.glRobustness = _glfwLibrary.hints.glRobustness ? GL_TRUE : GL_FALSE;
+ wndconfig.monitor = (_GLFWmonitor*) monitor;
wndconfig.share = share;
// Reset to default values for the next call
@@ -280,13 +281,6 @@
// Save the currently current context so it can be restored later
previous = glfwGetCurrentContext();
- if (mode != GLFW_WINDOWED && mode != GLFW_FULLSCREEN)
- {
- _glfwSetError(GLFW_INVALID_ENUM,
- "glfwCreateWindow: Invalid window mode");
- return GL_FALSE;
- }
-
// Check width & height
if (width > 0 && height <= 0)
{
@@ -320,10 +314,10 @@
// Remember window settings
window->width = width;
window->height = height;
- window->mode = mode;
window->resizable = wndconfig.resizable;
window->cursorMode = GLFW_CURSOR_NORMAL;
window->systemKeys = GL_TRUE;
+ window->monitor = (_GLFWmonitor*) monitor;
// Open the actual window and create its context
if (!_glfwPlatformCreateWindow(window, &wndconfig, &fbconfig))
@@ -364,10 +358,10 @@
// The GLFW specification states that fullscreen windows have the cursor
// captured by default
- if (mode == GLFW_FULLSCREEN)
+ if (wndconfig.monitor)
glfwSetInputMode(window, GLFW_CURSOR_MODE, GLFW_CURSOR_CAPTURED);
- if (mode == GLFW_WINDOWED && wndconfig.visible)
+ if (wndconfig.monitor == NULL && wndconfig.visible)
glfwShowWindow(window);
return window;
@@ -570,7 +564,7 @@
_glfwPlatformSetWindowSize(window, width, height);
- if (window->mode == GLFW_FULLSCREEN)
+ if (window->monitor)
{
// Refresh window parameters (may have changed due to changed video
// modes)
@@ -615,7 +609,7 @@
return;
}
- if (window->mode == GLFW_FULLSCREEN || window->iconified)
+ if (window->monitor || window->iconified)
{
// TODO: Figure out if this is an error
return;
@@ -665,7 +659,7 @@
_glfwPlatformRestoreWindow(window);
- if (window->mode == GLFW_FULLSCREEN)
+ if (window->monitor)
_glfwPlatformRefreshWindowParams(window);
}
@@ -684,7 +678,7 @@
return;
}
- if (window->mode == GLFW_FULLSCREEN)
+ if (window->monitor)
return;
_glfwPlatformShowWindow(window);
@@ -705,7 +699,7 @@
return;
}
- if (window->mode == GLFW_FULLSCREEN)
+ if (window->monitor)
return;
_glfwPlatformHideWindow(window);
diff --git a/src/x11_window.c b/src/x11_window.c
index 9c1ff8d..fe4ca70 100644
--- a/src/x11_window.c
+++ b/src/x11_window.c
@@ -107,7 +107,7 @@
ExposureMask | FocusChangeMask | VisibilityChangeMask |
EnterWindowMask | LeaveWindowMask;
- if (wndconfig->mode == GLFW_WINDOWED)
+ if (!wndconfig->monitor)
{
// The /only/ reason for setting the background pixel here is that
// otherwise our window won't get any decorations on systems using
@@ -138,7 +138,7 @@
}
}
- if (window->mode == GLFW_FULLSCREEN && !_glfwLibrary.X11.hasEWMH)
+ if (window->monitor && !_glfwLibrary.X11.hasEWMH)
{
// This is the butcher's way of removing window decorations
// Setting the override-redirect attribute on a window makes the window
@@ -851,7 +851,7 @@
}
#endif /*_GLFW_HAS_XRANDR*/
- if (wndconfig->mode == GLFW_FULLSCREEN)
+ if (wndconfig->monitor)
{
_glfwPlatformShowWindow(window);
enterFullscreenMode(window);
@@ -887,7 +887,7 @@
void _glfwPlatformDestroyWindow(_GLFWwindow* window)
{
- if (window->mode == GLFW_FULLSCREEN)
+ if (window->monitor)
leaveFullscreenMode(window);
_glfwDestroyContext(window);
@@ -959,7 +959,7 @@
rate = window->refreshRate;
- if (window->mode == GLFW_FULLSCREEN)
+ if (window->monitor)
{
// Get the closest matching video mode for the specified window size
mode = _glfwGetClosestVideoMode(&width, &height, &rate);
@@ -979,15 +979,17 @@
XFree(hints);
}
- // Change window size before changing fullscreen mode?
- if (window->mode == GLFW_FULLSCREEN && (width > window->width))
+ if (window->monitor)
{
- XResizeWindow(_glfwLibrary.X11.display, window->X11.handle, width, height);
- sizeChanged = GL_TRUE;
- }
+ // Change window size before changing fullscreen mode?
+ if (width > window->width)
+ {
+ XResizeWindow(_glfwLibrary.X11.display,
+ window->X11.handle,
+ width, height);
+ sizeChanged = GL_TRUE;
+ }
- if (window->mode == GLFW_FULLSCREEN)
- {
// Change video mode, keeping current refresh rate
_glfwSetVideoModeMODE(mode, window->refreshRate);
}
diff --git a/tests/accuracy.c b/tests/accuracy.c
index f3fb752..f9c485c 100644
--- a/tests/accuracy.c
+++ b/tests/accuracy.c
@@ -90,7 +90,7 @@
glfwSetWindowSizeCallback(window_size_callback);
glfwSetKeyCallback(key_callback);
- window = glfwCreateWindow(window_width, window_height, GLFW_WINDOWED, "", NULL);
+ window = glfwCreateWindow(window_width, window_height, "", NULL, NULL);
if (!window)
{
glfwTerminate();
diff --git a/tests/clipboard.c b/tests/clipboard.c
index f83bbfe..eafce3f 100644
--- a/tests/clipboard.c
+++ b/tests/clipboard.c
@@ -125,7 +125,7 @@
exit(EXIT_FAILURE);
}
- window = glfwCreateWindow(0, 0, GLFW_WINDOWED, "Clipboard Test", NULL);
+ window = glfwCreateWindow(0, 0, "Clipboard Test", NULL, NULL);
if (!window)
{
glfwTerminate();
diff --git a/tests/defaults.c b/tests/defaults.c
index 2877cfd..113ff55 100644
--- a/tests/defaults.c
+++ b/tests/defaults.c
@@ -85,7 +85,7 @@
glfwWindowHint(GLFW_VISIBLE, GL_FALSE);
- window = glfwCreateWindow(0, 0, GLFW_WINDOWED, "Defaults", NULL);
+ window = glfwCreateWindow(0, 0, "Defaults", NULL, NULL);
if (!window)
{
glfwTerminate();
diff --git a/tests/events.c b/tests/events.c
index f1e71f9..f30fd5d 100644
--- a/tests/events.c
+++ b/tests/events.c
@@ -399,7 +399,7 @@
glfwSetCharCallback(char_callback);
glfwSetMonitorCallback(monitor_callback);
- window = glfwCreateWindow(0, 0, GLFW_WINDOWED, "Event Linter", NULL);
+ window = glfwCreateWindow(0, 0, "Event Linter", NULL, NULL);
if (!window)
{
glfwTerminate();
diff --git a/tests/fsaa.c b/tests/fsaa.c
index 8fc8b60..060d0b7 100644
--- a/tests/fsaa.c
+++ b/tests/fsaa.c
@@ -98,7 +98,7 @@
glfwWindowHint(GLFW_FSAA_SAMPLES, samples);
- window = glfwCreateWindow(800, 400, GLFW_WINDOWED, "Aliasing Detector", NULL);
+ window = glfwCreateWindow(800, 400, "Aliasing Detector", NULL, NULL);
if (!window)
{
glfwTerminate();
diff --git a/tests/fsfocus.c b/tests/fsfocus.c
index 6ae0cb4..a00e4fa 100644
--- a/tests/fsfocus.c
+++ b/tests/fsfocus.c
@@ -82,7 +82,7 @@
exit(EXIT_FAILURE);
}
- window = glfwCreateWindow(640, 480, GLFW_FULLSCREEN, "Fullscreen focus", NULL);
+ window = glfwCreateWindow(640, 480, "Fullscreen focus", glfwGetPrimaryMonitor(), NULL);
if (!window)
{
glfwTerminate();
diff --git a/tests/gamma.c b/tests/gamma.c
index 82d9de9..aaed81d 100644
--- a/tests/gamma.c
+++ b/tests/gamma.c
@@ -97,7 +97,7 @@
int main(int argc, char** argv)
{
int width, height, ch;
- int mode = GLFW_WINDOWED;
+ GLFWmonitor monitor = NULL;
GLFWwindow window;
while ((ch = getopt(argc, argv, "fh")) != -1)
@@ -109,7 +109,7 @@
exit(EXIT_SUCCESS);
case 'f':
- mode = GLFW_FULLSCREEN;
+ monitor = glfwGetPrimaryMonitor();
break;
default:
@@ -124,10 +124,10 @@
exit(EXIT_FAILURE);
}
- if (mode == GLFW_FULLSCREEN)
+ if (monitor)
{
GLFWvidmode mode;
- glfwGetVideoMode(glfwGetPrimaryMonitor(), &mode);
+ glfwGetVideoMode(monitor, &mode);
width = mode.width;
height = mode.height;
}
@@ -137,7 +137,7 @@
height = 0;
}
- window = glfwCreateWindow(width, height, mode, "Gamma Test", NULL);
+ window = glfwCreateWindow(width, height, "Gamma Test", monitor, NULL);
if (!window)
{
glfwTerminate();
diff --git a/tests/glfwinfo.c b/tests/glfwinfo.c
index d11c861..be899ca 100644
--- a/tests/glfwinfo.c
+++ b/tests/glfwinfo.c
@@ -243,7 +243,7 @@
// We assume here that we stand a better chance of success by leaving all
// possible details of pixel format selection to GLFW
- window = glfwCreateWindow(0, 0, GLFW_WINDOWED, "Version", NULL);
+ window = glfwCreateWindow(0, 0, "Version", NULL, NULL);
if (!window)
exit(EXIT_FAILURE);
diff --git a/tests/iconify.c b/tests/iconify.c
index b96368e..b76a83b 100644
--- a/tests/iconify.c
+++ b/tests/iconify.c
@@ -78,8 +78,8 @@
int main(int argc, char** argv)
{
int width, height, ch;
- int mode = GLFW_WINDOWED;
GLboolean active = -1, iconified = -1;
+ GLFWmonitor monitor = NULL;
GLFWwindow window;
while ((ch = getopt(argc, argv, "fh")) != -1)
@@ -91,7 +91,7 @@
exit(EXIT_SUCCESS);
case 'f':
- mode = GLFW_FULLSCREEN;
+ monitor = glfwGetPrimaryMonitor();
break;
default:
@@ -106,12 +106,12 @@
exit(EXIT_FAILURE);
}
- if (mode == GLFW_FULLSCREEN)
+ if (monitor)
{
- GLFWvidmode current_mode;
- glfwGetVideoMode(glfwGetPrimaryMonitor(), ¤t_mode);
- width = current_mode.width;
- height = current_mode.height;
+ GLFWvidmode mode;
+ glfwGetVideoMode(monitor, &mode);
+ width = mode.width;
+ height = mode.height;
}
else
{
@@ -119,7 +119,7 @@
height = 0;
}
- window = glfwCreateWindow(width, height, mode, "Iconify", NULL);
+ window = glfwCreateWindow(width, height, "Iconify", monitor, NULL);
if (!window)
{
glfwTerminate();
diff --git a/tests/joysticks.c b/tests/joysticks.c
index 40202ce..78bcb70 100644
--- a/tests/joysticks.c
+++ b/tests/joysticks.c
@@ -186,7 +186,7 @@
exit(EXIT_FAILURE);
}
- window = glfwCreateWindow(0, 0, GLFW_WINDOWED, "Joystick Test", NULL);
+ window = glfwCreateWindow(0, 0, "Joystick Test", NULL, NULL);
if (!window)
{
glfwTerminate();
diff --git a/tests/modes.c b/tests/modes.c
index f206529..abb3033 100644
--- a/tests/modes.c
+++ b/tests/modes.c
@@ -144,7 +144,8 @@
format_mode(mode));
window_handle = glfwCreateWindow(mode->width, mode->height,
- GLFW_FULLSCREEN, "Video Mode Test",
+ "Video Mode Test",
+ glfwGetPrimaryMonitor(),
NULL);
if (!window_handle)
{
diff --git a/tests/peter.c b/tests/peter.c
index 59c917e..6515d2e 100644
--- a/tests/peter.c
+++ b/tests/peter.c
@@ -92,7 +92,7 @@
static GLboolean open_window(void)
{
- window_handle = glfwCreateWindow(0, 0, GLFW_WINDOWED, "Peter Detector", NULL);
+ window_handle = glfwCreateWindow(0, 0, "Peter Detector", NULL, NULL);
if (!window_handle)
return GL_FALSE;
diff --git a/tests/reopen.c b/tests/reopen.c
index 5d13718..c095424 100644
--- a/tests/reopen.c
+++ b/tests/reopen.c
@@ -41,19 +41,6 @@
static GLFWwindow window_handle = NULL;
static GLboolean closed = GL_FALSE;
-static const char* get_mode_name(int mode)
-{
- switch (mode)
- {
- case GLFW_WINDOWED:
- return "windowed";
- case GLFW_FULLSCREEN:
- return "fullscreen";
- default:
- return "unknown";
- }
-}
-
static void window_size_callback(GLFWwindow window, int width, int height)
{
glViewport(0, 0, width, height);
@@ -80,22 +67,18 @@
}
}
-static GLboolean open_window(int width, int height, int mode)
+static GLboolean open_window(int width, int height, GLFWmonitor monitor)
{
double base;
- if (!glfwInit())
- {
- fprintf(stderr, "Failed to initialize GLFW: %s\n", glfwErrorString(glfwGetError()));
- return GL_FALSE;
- }
-
base = glfwGetTime();
- window_handle = glfwCreateWindow(width, height, mode, "Window Re-opener", NULL);
+ window_handle = glfwCreateWindow(width, height, "Window Re-opener", monitor, NULL);
if (!window_handle)
{
- fprintf(stderr, "Failed to open %s mode GLFW window: %s\n", get_mode_name(mode), glfwErrorString(glfwGetError()));
+ fprintf(stderr, "Failed to open %s mode GLFW window: %s\n",
+ monitor ? "fullscreen" : "windowed",
+ glfwErrorString(glfwGetError()));
return GL_FALSE;
}
@@ -107,7 +90,7 @@
glfwSetKeyCallback(key_callback);
printf("Opening %s mode window took %0.3f seconds\n",
- get_mode_name(mode),
+ monitor ? "fullscreen" : "windowed",
glfwGetTime() - base);
return GL_TRUE;
@@ -121,17 +104,26 @@
window_handle = NULL;
printf("Closing window took %0.3f seconds\n", glfwGetTime() - base);
-
- glfwTerminate();
}
int main(int argc, char** argv)
{
int count = 0;
+ if (!glfwInit())
+ {
+ fprintf(stderr, "Failed to initialize GLFW: %s\n", glfwErrorString(glfwGetError()));
+ return GL_FALSE;
+ }
+
for (;;)
{
- if (!open_window(640, 480, (count & 1) ? GLFW_FULLSCREEN : GLFW_WINDOWED))
+ GLFWmonitor monitor = NULL;
+
+ if (count & 1)
+ monitor = glfwGetPrimaryMonitor();
+
+ if (!open_window(640, 480, monitor))
exit(EXIT_FAILURE);
glMatrixMode(GL_PROJECTION);
diff --git a/tests/sharing.c b/tests/sharing.c
index 64e6174..6989105 100644
--- a/tests/sharing.c
+++ b/tests/sharing.c
@@ -55,7 +55,7 @@
{
GLFWwindow window;
- window = glfwCreateWindow(WIDTH, HEIGHT, GLFW_WINDOWED, title, share);
+ window = glfwCreateWindow(WIDTH, HEIGHT, title, NULL, share);
if (!window)
return NULL;
diff --git a/tests/tearing.c b/tests/tearing.c
index a8d774a..734b96c 100644
--- a/tests/tearing.c
+++ b/tests/tearing.c
@@ -70,7 +70,7 @@
exit(EXIT_FAILURE);
}
- window = glfwCreateWindow(0, 0, GLFW_WINDOWED, "", NULL);
+ window = glfwCreateWindow(0, 0, "", NULL, NULL);
if (!window)
{
glfwTerminate();
diff --git a/tests/threads.c b/tests/threads.c
index 49e3739..9063cfe 100644
--- a/tests/threads.c
+++ b/tests/threads.c
@@ -90,9 +90,8 @@
for (i = 0; i < count; i++)
{
threads[i].window = glfwCreateWindow(200, 200,
- GLFW_WINDOWED,
threads[i].title,
- NULL);
+ NULL, NULL);
if (!threads[i].window)
{
fprintf(stderr, "Failed to open GLFW window: %s\n",
diff --git a/tests/title.c b/tests/title.c
index c753903..b151d75 100644
--- a/tests/title.c
+++ b/tests/title.c
@@ -47,7 +47,7 @@
exit(EXIT_FAILURE);
}
- window = glfwCreateWindow(0, 0, GLFW_WINDOWED, "English 日本語 русский язык 官話", NULL);
+ window = glfwCreateWindow(0, 0, "English 日本語 русский язык 官話", NULL, NULL);
if (!window)
{
fprintf(stderr, "Failed to open GLFW window: %s\n", glfwErrorString(glfwGetError()));
diff --git a/tests/windows.c b/tests/windows.c
index 894febe..46481df 100644
--- a/tests/windows.c
+++ b/tests/windows.c
@@ -55,7 +55,7 @@
for (i = 0; i < 4; i++)
{
- windows[i] = glfwCreateWindow(200, 200, GLFW_WINDOWED, titles[i], NULL);
+ windows[i] = glfwCreateWindow(200, 200, titles[i], NULL, NULL);
if (!windows[i])
{
fprintf(stderr, "Failed to open GLFW window: %s\n",