1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-23 02:38:52 -05:00

Merge branch 'master' into multi-monitor

Conflicts:
	tests/iconify.c
This commit is contained in:
Camilla Berglund 2012-10-18 18:42:45 +02:00
commit c1bb1d8a6e
4 changed files with 33 additions and 17 deletions

View File

@ -729,7 +729,7 @@ static GLboolean createContext(_GLFWwindow* window,
else if (colorBits < 15) else if (colorBits < 15)
colorBits = 15; colorBits = 15;
if (wndconfig->clientAPI != GLFW_OPENGL_ES_API) if (wndconfig->clientAPI == GLFW_OPENGL_ES_API)
{ {
_glfwSetError(GLFW_VERSION_UNAVAILABLE, _glfwSetError(GLFW_VERSION_UNAVAILABLE,
"Cocoa/NSOpenGL: NSOpenGL does not support OpenGL ES"); "Cocoa/NSOpenGL: NSOpenGL does not support OpenGL ES");

View File

@ -411,7 +411,7 @@ static GLboolean createContext(_GLFWwindow* window,
if (wndconfig->glRobustness) if (wndconfig->glRobustness)
{ {
int strategy; int strategy = 0;
if (!window->WGL.ARB_create_context_robustness) if (!window->WGL.ARB_create_context_robustness)
{ {

View File

@ -248,6 +248,15 @@ static GLboolean createWindow(_GLFWwindow* window,
static void hideCursor(_GLFWwindow* window) static void hideCursor(_GLFWwindow* window)
{ {
// Un-grab cursor (in windowed mode only; in fullscreen mode we still
// want the cursor grabbed in order to confine the cursor to the window
// area)
if (window->X11.cursorGrabbed && window->monitor == NULL)
{
XUngrabPointer(_glfwLibrary.X11.display, CurrentTime);
window->X11.cursorGrabbed = GL_FALSE;
}
if (!window->X11.cursorHidden) if (!window->X11.cursorHidden)
{ {
XDefineCursor(_glfwLibrary.X11.display, XDefineCursor(_glfwLibrary.X11.display,
@ -290,7 +299,7 @@ static void showCursor(_GLFWwindow* window)
// Un-grab cursor (in windowed mode only; in fullscreen mode we still // Un-grab cursor (in windowed mode only; in fullscreen mode we still
// want the cursor grabbed in order to confine the cursor to the window // want the cursor grabbed in order to confine the cursor to the window
// area) // area)
if (window->X11.cursorGrabbed) if (window->X11.cursorGrabbed && window->monitor == NULL)
{ {
XUngrabPointer(_glfwLibrary.X11.display, CurrentTime); XUngrabPointer(_glfwLibrary.X11.display, CurrentTime);
window->X11.cursorGrabbed = GL_FALSE; window->X11.cursorGrabbed = GL_FALSE;

View File

@ -70,15 +70,28 @@ static void key_callback(GLFWwindow window, int key, int action)
static void window_size_callback(GLFWwindow window, int width, int height) static void window_size_callback(GLFWwindow window, int width, int height)
{ {
printf("%0.2f Size %ix%i\n", glfwGetTime(), width, height); printf("%0.2f Window resized to %ix%i\n", glfwGetTime(), width, height);
glViewport(0, 0, width, height); glViewport(0, 0, width, height);
} }
static void window_focus_callback(GLFWwindow window, int activated)
{
printf("%0.2f Window %s\n",
glfwGetTime(),
activated ? "activated" : "deactivated");
}
static void window_iconify_callback(GLFWwindow window, int iconified)
{
printf("%0.2f Window %s\n",
glfwGetTime(),
iconified ? "iconified" : "restored");
}
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
int width, height, ch; int width, height, ch;
GLboolean active = -1, iconified = -1;
GLFWmonitor monitor = NULL; GLFWmonitor monitor = NULL;
GLFWwindow window; GLFWwindow window;
@ -134,23 +147,17 @@ int main(int argc, char** argv)
glfwSetKeyCallback(key_callback); glfwSetKeyCallback(key_callback);
glfwSetWindowSizeCallback(window_size_callback); glfwSetWindowSizeCallback(window_size_callback);
glfwSetWindowCloseCallback(window_close_callback); glfwSetWindowCloseCallback(window_close_callback);
glfwSetWindowFocusCallback(window_focus_callback);
glfwSetWindowIconifyCallback(window_iconify_callback);
printf("Window is %s and %s\n",
glfwGetWindowParam(window, GLFW_ICONIFIED) ? "iconified" : "restored",
glfwGetWindowParam(window, GLFW_ACTIVE) ? "active" : "inactive");
glEnable(GL_SCISSOR_TEST); glEnable(GL_SCISSOR_TEST);
while (!closed) while (!closed)
{ {
if (iconified != glfwGetWindowParam(window, GLFW_ICONIFIED) ||
active != glfwGetWindowParam(window, GLFW_ACTIVE))
{
iconified = glfwGetWindowParam(window, GLFW_ICONIFIED);
active = glfwGetWindowParam(window, GLFW_ACTIVE);
printf("%0.2f %s %s\n",
glfwGetTime(),
iconified ? "Iconified" : "Restored",
active ? "Active" : "Inactive");
}
glfwGetWindowSize(window, &width, &height); glfwGetWindowSize(window, &width, &height);
glScissor(0, 0, width, height); glScissor(0, 0, width, height);