Removed GLFW_SYSTEM_KEYS from the GLFW API

Rationale: Disabling system commands is inherently
dangerous, and should not be encouraged. Also, it's very
difficult to define and implement a reliable and
consistent cross-platform mechanism.
diff --git a/include/GL/glfw3.h b/include/GL/glfw3.h
index 191633a..52ab1a7 100644
--- a/include/GL/glfw3.h
+++ b/include/GL/glfw3.h
@@ -434,8 +434,7 @@
 #define GLFW_CURSOR_MODE          0x00030001
 #define GLFW_STICKY_KEYS          0x00030002
 #define GLFW_STICKY_MOUSE_BUTTONS 0x00030003
-#define GLFW_SYSTEM_KEYS          0x00030004
-#define GLFW_KEY_REPEAT           0x00030005
+#define GLFW_KEY_REPEAT           0x00030004
 
 /* GLFW_CURSOR_MODE values */
 #define GLFW_CURSOR_NORMAL       0x00040001
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 5d066b7..783a2c3 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -13,7 +13,7 @@
 if (_GLFW_COCOA_NSGL)
     set(glfw_HEADERS ${common_HEADERS} cocoa_platform.h)
     set(glfw_SOURCES ${common_SOURCES} cocoa_clipboard.m cocoa_fullscreen.m
-                     cocoa_gamma.c cocoa_init.m cocoa_input.m cocoa_joystick.m
+                     cocoa_gamma.c cocoa_init.m cocoa_joystick.m
                      cocoa_opengl.m cocoa_time.c cocoa_window.m)
 
     if (GLFW_NATIVE_API)
@@ -25,7 +25,7 @@
 elseif (_GLFW_WIN32_WGL)
     set(glfw_HEADERS ${common_HEADERS} win32_platform.h)
     set(glfw_SOURCES ${common_SOURCES} win32_clipboard.c win32_fullscreen.c
-                     win32_gamma.c win32_init.c win32_input.c win32_joystick.c
+                     win32_gamma.c win32_init.c win32_joystick.c
                      win32_opengl.c win32_time.c win32_window.c)
 
     if (GLFW_NATIVE_API)
@@ -34,7 +34,7 @@
 elseif (_GLFW_X11_GLX)
     set(glfw_HEADERS ${common_HEADERS} x11_platform.h)
     set(glfw_SOURCES ${common_SOURCES} x11_clipboard.c x11_fullscreen.c
-                     x11_gamma.c x11_init.c x11_input.c x11_joystick.c
+                     x11_gamma.c x11_init.c x11_joystick.c
                      x11_keysym2unicode.c x11_opengl.c x11_time.c x11_window.c)
 
     if (GLFW_NATIVE_API)
diff --git a/src/cocoa_input.m b/src/cocoa_input.m
deleted file mode 100644
index 11e1083..0000000
--- a/src/cocoa_input.m
+++ /dev/null
@@ -1,53 +0,0 @@
-//========================================================================
-// GLFW - An OpenGL library
-// Platform:    Cocoa
-// API Version: 3.0
-// WWW:         http://www.glfw.org/
-//------------------------------------------------------------------------
-// Copyright (c) 2009-2010 Camilla Berglund <elmindreda@elmindreda.org>
-//
-// This software is provided 'as-is', without any express or implied
-// warranty. In no event will the authors be held liable for any damages
-// arising from the use of this software.
-//
-// Permission is granted to anyone to use this software for any purpose,
-// including commercial applications, and to alter it and redistribute it
-// freely, subject to the following restrictions:
-//
-// 1. The origin of this software must not be misrepresented; you must not
-//    claim that you wrote the original software. If you use this software
-//    in a product, an acknowledgment in the product documentation would
-//    be appreciated but is not required.
-//
-// 2. Altered source versions must be plainly marked as such, and must not
-//    be misrepresented as being the original software.
-//
-// 3. This notice may not be removed or altered from any source
-//    distribution.
-//
-//========================================================================
-
-#include "internal.h"
-
-
-//////////////////////////////////////////////////////////////////////////
-//////                       GLFW platform API                      //////
-//////////////////////////////////////////////////////////////////////////
-
-//========================================================================
-// Enable and disable system keys
-//========================================================================
-
-void _glfwPlatformEnableSystemKeys(_GLFWwindow* window)
-{
-    // This is checked in cocoa_window.m; no action needed here
-}
-
-void _glfwPlatformDisableSystemKeys(_GLFWwindow* window)
-{
-    // This is checked in cocoa_window.m; no action needed here
-
-    // Note that it may not be possible to disable things like Exposé
-    // except in full-screen mode.
-}
-
diff --git a/src/cocoa_window.m b/src/cocoa_window.m
index 5e4c7d8..24ba662 100644
--- a/src/cocoa_window.m
+++ b/src/cocoa_window.m
@@ -455,8 +455,7 @@
 
         if ([event modifierFlags] & NSCommandKeyMask)
         {
-            if (window->systemKeys)
-                [super keyDown:event];
+            [super keyDown:event];
         }
         else
         {
diff --git a/src/input.c b/src/input.c
index 701da4f..46c9da6 100644
--- a/src/input.c
+++ b/src/input.c
@@ -116,24 +116,6 @@
 
 
 //========================================================================
-// Set system keys for the specified window
-//========================================================================
-
-static void setSystemKeys(_GLFWwindow* window, int enabled)
-{
-    if (window->systemKeys == enabled)
-        return;
-
-    if (enabled)
-        _glfwPlatformEnableSystemKeys(window);
-    else
-        _glfwPlatformDisableSystemKeys(window);
-
-    window->systemKeys = enabled;
-}
-
-
-//========================================================================
 // Set key repeat for the specified window
 //========================================================================
 
@@ -295,8 +277,6 @@
             return window->stickyKeys;
         case GLFW_STICKY_MOUSE_BUTTONS:
             return window->stickyMouseButtons;
-        case GLFW_SYSTEM_KEYS:
-            return window->systemKeys;
         case GLFW_KEY_REPEAT:
             return window->keyRepeat;
         default:
@@ -331,9 +311,6 @@
         case GLFW_STICKY_MOUSE_BUTTONS:
             setStickyMouseButtons(window, value ? GL_TRUE : GL_FALSE);
             break;
-        case GLFW_SYSTEM_KEYS:
-            setSystemKeys(window, value ? GL_TRUE : GL_FALSE);
-            break;
         case GLFW_KEY_REPEAT:
             setKeyRepeat(window, value ? GL_TRUE : GL_FALSE);
             break;
diff --git a/src/internal.h b/src/internal.h
index 2101ad2..50bfa4c 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -186,7 +186,6 @@
     GLboolean stickyKeys;
     GLboolean stickyMouseButtons;
     GLboolean keyRepeat;
-    GLboolean systemKeys;      // system keys enabled flag
     int       cursorPosX, cursorPosY;
     int       cursorMode;
     double    scrollX, scrollY;
diff --git a/src/win32_input.c b/src/win32_input.c
deleted file mode 100644
index 2178b14..0000000
--- a/src/win32_input.c
+++ /dev/null
@@ -1,132 +0,0 @@
-//========================================================================
-// GLFW - An OpenGL library
-// Platform:    Win32
-// API version: 3.0
-// WWW:         http://www.glfw.org/
-//------------------------------------------------------------------------
-// Copyright (c) 2002-2006 Marcus Geelnard
-// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
-//
-// This software is provided 'as-is', without any express or implied
-// warranty. In no event will the authors be held liable for any damages
-// arising from the use of this software.
-//
-// Permission is granted to anyone to use this software for any purpose,
-// including commercial applications, and to alter it and redistribute it
-// freely, subject to the following restrictions:
-//
-// 1. The origin of this software must not be misrepresented; you must not
-//    claim that you wrote the original software. If you use this software
-//    in a product, an acknowledgment in the product documentation would
-//    be appreciated but is not required.
-//
-// 2. Altered source versions must be plainly marked as such, and must not
-//    be misrepresented as being the original software.
-//
-// 3. This notice may not be removed or altered from any source
-//    distribution.
-//
-//========================================================================
-
-#include "internal.h"
-
-
-//========================================================================
-// Low level keyboard hook (system callback) function
-// Used to disable system keys under Windows NT
-//========================================================================
-
-static LRESULT CALLBACK keyboardHook(int nCode, WPARAM wParam, LPARAM lParam)
-{
-    BOOL syskeys = FALSE;
-    PKBDLLHOOKSTRUCT p;
-
-    // We are only looking for keyboard events - interpret lParam as a
-    // pointer to a KBDLLHOOKSTRUCT
-    p = (PKBDLLHOOKSTRUCT) lParam;
-
-    if (nCode == HC_ACTION)
-    {
-        // We have a keyboard event
-
-        switch (wParam)
-        {
-            case WM_KEYDOWN:
-            case WM_SYSKEYDOWN:
-            case WM_KEYUP:
-            case WM_SYSKEYUP:
-                // Detect: ALT+TAB, ALT+ESC, ALT+F4, CTRL+ESC,
-                // LWIN, RWIN, APPS (mysterious menu key)
-                syskeys = (p->vkCode == VK_TAB &&
-                           p->flags & LLKHF_ALTDOWN) ||
-                          (p->vkCode == VK_ESCAPE &&
-                           p->flags & LLKHF_ALTDOWN) ||
-                          (p->vkCode == VK_F4 &&
-                           p->flags & LLKHF_ALTDOWN) ||
-                          (p->vkCode == VK_ESCAPE &&
-                           (GetKeyState(VK_CONTROL) & 0x8000)) ||
-                          p->vkCode == VK_LWIN ||
-                          p->vkCode == VK_RWIN ||
-                          p->vkCode == VK_APPS;
-                break;
-
-            default:
-                break;
-        }
-    }
-
-    // Was it a system key combination (e.g. ALT+TAB)?
-    if (syskeys)
-    {
-        _GLFWwindow* window = _glfwLibrary.activeWindow;
-
-        // Pass the key event to our window message loop
-        if (window)
-            PostMessage(window->Win32.handle, (UINT) wParam, p->vkCode, 0);
-
-        // We've taken care of it - don't let the system know about this
-        // key event
-        return 1;
-    }
-    else
-    {
-        // It's a harmless key press, let the system deal with it
-        return CallNextHookEx(_glfwLibrary.Win32.keyboardHook, nCode, wParam, lParam);
-    }
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-//////                       GLFW platform API                      //////
-//////////////////////////////////////////////////////////////////////////
-
-//========================================================================
-// Enable system keys
-//========================================================================
-
-void _glfwPlatformEnableSystemKeys(_GLFWwindow* window)
-{
-    UNREFERENCED_PARAMETER(window);
-
-    if (_glfwLibrary.Win32.keyboardHook != NULL)
-    {
-        UnhookWindowsHookEx(_glfwLibrary.Win32.keyboardHook);
-        _glfwLibrary.Win32.keyboardHook = NULL;
-    }
-}
-
-
-//========================================================================
-// Disable system keys
-//========================================================================
-
-void _glfwPlatformDisableSystemKeys(_GLFWwindow* window)
-{
-    UNREFERENCED_PARAMETER(window);
-
-    _glfwLibrary.Win32.keyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL,
-                                                       keyboardHook,
-                                                       _glfwLibrary.Win32.instance,
-                                                       0);
-}
-
diff --git a/src/win32_platform.h b/src/win32_platform.h
index ba10039..217fc2c 100644
--- a/src/win32_platform.h
+++ b/src/win32_platform.h
@@ -176,7 +176,6 @@
 {
     HINSTANCE                 instance;     // Instance of the application
     ATOM                      classAtom;    // Window class atom
-    HHOOK                     keyboardHook; // Keyboard hook handle
     DWORD                     foregroundLockTimeout;
     char*                     clipboardString;
 
diff --git a/src/window.c b/src/window.c
index 986a0cb..73bc169 100644
--- a/src/window.c
+++ b/src/window.c
@@ -297,7 +297,6 @@
     window->mode       = mode;
     window->resizable  = wndconfig.resizable;
     window->cursorMode = GLFW_CURSOR_NORMAL;
-    window->systemKeys = GL_TRUE;
 
     // Open the actual window and create its context
     if (!_glfwPlatformCreateWindow(window, &wndconfig, &fbconfig))
diff --git a/src/x11_input.c b/src/x11_input.c
deleted file mode 100644
index 2ea8b8c..0000000
--- a/src/x11_input.c
+++ /dev/null
@@ -1,65 +0,0 @@
-//========================================================================
-// GLFW - An OpenGL library
-// Platform:    X11
-// API version: 3.0
-// WWW:         http://www.glfw.org/
-//------------------------------------------------------------------------
-// Copyright (c) 2002-2006 Marcus Geelnard
-// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
-//
-// This software is provided 'as-is', without any express or implied
-// warranty. In no event will the authors be held liable for any damages
-// arising from the use of this software.
-//
-// Permission is granted to anyone to use this software for any purpose,
-// including commercial applications, and to alter it and redistribute it
-// freely, subject to the following restrictions:
-//
-// 1. The origin of this software must not be misrepresented; you must not
-//    claim that you wrote the original software. If you use this software
-//    in a product, an acknowledgment in the product documentation would
-//    be appreciated but is not required.
-//
-// 2. Altered source versions must be plainly marked as such, and must not
-//    be misrepresented as being the original software.
-//
-// 3. This notice may not be removed or altered from any source
-//    distribution.
-//
-//========================================================================
-
-#include "internal.h"
-
-
-//////////////////////////////////////////////////////////////////////////
-//////                       GLFW platform API                      //////
-//////////////////////////////////////////////////////////////////////////
-
-//========================================================================
-// Enable system keys
-//========================================================================
-
-void _glfwPlatformEnableSystemKeys(_GLFWwindow* window)
-{
-    if (window->X11.keyboardGrabbed)
-    {
-        XUngrabKeyboard(_glfwLibrary.X11.display, CurrentTime);
-        window->X11.keyboardGrabbed = GL_FALSE;
-    }
-}
-
-
-//========================================================================
-// Disable system keys
-//========================================================================
-
-void _glfwPlatformDisableSystemKeys(_GLFWwindow* window)
-{
-    if (XGrabKeyboard(_glfwLibrary.X11.display, window->X11.handle,
-                      True, GrabModeAsync, GrabModeAsync, CurrentTime)
-        == GrabSuccess)
-    {
-        window->X11.keyboardGrabbed = GL_TRUE;
-    }
-}
-
diff --git a/src/x11_platform.h b/src/x11_platform.h
index e289721..e577c22 100644
--- a/src/x11_platform.h
+++ b/src/x11_platform.h
@@ -135,7 +135,6 @@
 
     // Various platform specific internal variables
     GLboolean     overrideRedirect; // True if window is OverrideRedirect
-    GLboolean     keyboardGrabbed;  // True if keyboard is currently grabbed
     GLboolean     cursorGrabbed;    // True if cursor is currently grabbed
     GLboolean     cursorHidden;     // True if cursor is currently hidden
     GLboolean     cursorCentered;   // True if cursor was moved since last poll
diff --git a/tests/events.c b/tests/events.c
index 9379ded..4e3002c 100644
--- a/tests/events.c
+++ b/tests/events.c
@@ -42,7 +42,6 @@
 
 // These must match the input mode defaults
 static GLboolean keyrepeat  = GL_FALSE;
-static GLboolean systemkeys = GL_TRUE;
 static GLboolean closeable = GL_TRUE;
 
 // Event index
@@ -320,15 +319,6 @@
             break;
         }
 
-        case GLFW_KEY_S:
-        {
-            systemkeys = !systemkeys;
-            glfwSetInputMode(window, GLFW_SYSTEM_KEYS, systemkeys);
-
-            printf("(( system keys %s ))\n", systemkeys ? "enabled" : "disabled");
-            break;
-        }
-
         case GLFW_KEY_C:
         {
             closeable = !closeable;
@@ -393,7 +383,6 @@
     printf("Window size should be %ix%i\n", width, height);
 
     printf("Key repeat should be %s\n", keyrepeat ? "enabled" : "disabled");
-    printf("System keys should be %s\n", systemkeys ? "enabled" : "disabled");
 
     printf("Main loop starting\n");