Index: trunk/LWJGL/src/java/org/lwjgl/opengl/KeyboardEventQueue.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/KeyboardEventQueue.java	(revision 3774)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/KeyboardEventQueue.java	(working copy)
@@ -59,6 +59,8 @@
 	private int deferred_key_location;
 	private byte deferred_key_state;
 	private int deferred_character;
+	
+	private boolean hasNukedKeys;
 
 	static {
 		KEY_MAP[KeyEvent.VK_0] = Keyboard.KEY_0;
@@ -273,9 +275,23 @@
 
 	public synchronized void poll(ByteBuffer key_down_buffer) {
 		flushDeferredEvent();
-		int old_position = key_down_buffer.position();
-		key_down_buffer.put(key_states);
-		key_down_buffer.position(old_position);
+		if(Display.isActive()) {
+			if(hasNukedKeys)
+				hasNukedKeys = false;
+			
+			int old_position = key_down_buffer.position();
+			key_down_buffer.put(key_states);
+			key_down_buffer.position(old_position);
+		}
+		else if(!hasNukedKeys) {
+			for(int a = 0; a < key_states.length; a++)
+				key_states[a] = (byte)0;
+			
+			for(int a = 0; a < key_down_buffer.remaining(); a++)
+				key_down_buffer.put(a, (byte)0);
+			
+			hasNukedKeys = true;
+		}
 	}
 
 	public synchronized void copyEvents(ByteBuffer dest) {
Index: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxKeyboard.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxKeyboard.java	(revision 3774)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxKeyboard.java	(working copy)
@@ -79,6 +79,8 @@
 	private int deferred_event_keycode;
 	private long deferred_nanos;
 	private byte deferred_key_state;
+	
+	private boolean hasNukedKeys;
 
 	LinuxKeyboard(long display, long window) {
 		long modifier_map = getModifierMapping(display);
@@ -172,9 +174,23 @@
 
 	public void poll(ByteBuffer keyDownBuffer) {
 		flushDeferredEvent();
-		int old_position = keyDownBuffer.position();
-		keyDownBuffer.put(key_down_buffer);
-		keyDownBuffer.position(old_position);
+		if(Display.isActive()) {
+			if(hasNukedKeys)
+				hasNukedKeys = false;
+			
+			int old_position = keyDownBuffer.position();
+			keyDownBuffer.put(key_down_buffer);
+			keyDownBuffer.position(old_position);
+		}
+		else if(!hasNukedKeys) {
+			for(int a = 0; a < key_down_buffer.length; a++)
+				key_down_buffer[a] = (byte)0;
+			
+			for(int a = 0; a < keyDownBuffer.remaining(); a++)
+				keyDownBuffer.put(a, (byte)0);
+			
+			hasNukedKeys = true;
+		}
 	}
 
 	private void putKeyboardEvent(int keycode, byte state, int ch, long nanos, boolean repeat) {
Index: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java	(revision 3774)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java	(working copy)
@@ -53,6 +53,7 @@
 	private static final int GAMMA_LENGTH = 256;
 
 	private static final int WM_MOVE                          = 0x0003;
+	private static final int WM_WINDOWPOSCHANGING             = 0x0046;
 	private static final int WM_CANCELMODE                    = 0x001F;
 	private static final int WM_MOUSEMOVE                     = 0x0200;
 	private static final int WM_LBUTTONDOWN                   = 0x0201;
@@ -1012,7 +1013,11 @@
 					captureMouse = -1;
 				}
 				return 0;
+			case WM_WINDOWPOSCHANGING:
 			case WM_MOVE:
+				if(keyboard != null)
+					keyboard.nukeKeys();
+				
 				x = (int)(short)(lParam & 0xFFFF);
 				y = (int)(short)(lParam >> 16);
 				return defWindowProc(hwnd, msg, wParam, lParam);
Index: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsKeyboard.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsKeyboard.java	(revision 3774)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsKeyboard.java	(working copy)
@@ -62,6 +62,8 @@
 	private int retained_char;
 	private long retained_millis;
 	private boolean retained_repeat;
+	
+	private boolean hasNukedKeys;
 
 	WindowsKeyboard(long hwnd) throws LWJGLException {
 		this.hwnd = hwnd;
@@ -87,11 +89,29 @@
 			}
 		}
 	}
-
+	
+	protected void nukeKeys() {
+		for(int a = 0; a < key_down_buffer.length; a++)
+			key_down_buffer[a] = (byte)0;
+	}
+	
 	public void poll(ByteBuffer keyDownBuffer) {
-		int old_position = keyDownBuffer.position();
-		keyDownBuffer.put(key_down_buffer);
-		keyDownBuffer.position(old_position);
+		if(Display.isActive()) {
+			if(hasNukedKeys)
+				hasNukedKeys = false;
+			
+			int old_position = keyDownBuffer.position();
+			keyDownBuffer.put(key_down_buffer);
+			keyDownBuffer.position(old_position);
+		}
+		else if(!hasNukedKeys) {
+			nukeKeys();
+			
+			for(int a = 0; a < keyDownBuffer.remaining(); a++)
+				keyDownBuffer.put(a, (byte)0);
+			
+			hasNukedKeys = true;
+		}
 	}
 
 	private static native int MapVirtualKey(int uCode, int uMapType);
