Linux: Moved warp Atom from LinuxDisplay to LinuxMouse

This commit is contained in:
Elias Naur 2006-10-24 10:43:52 +00:00
parent a972dd272d
commit 2de75e4fd9
2 changed files with 6 additions and 11 deletions

View File

@ -89,7 +89,6 @@ final class LinuxDisplay implements DisplayImplementation {
private int current_displaymode_extension = NONE; private int current_displaymode_extension = NONE;
/** Atom used for the pointer warp messages */ /** Atom used for the pointer warp messages */
private long warp_atom;
private long delete_atom; private long delete_atom;
private PeerInfo peer_info; private PeerInfo peer_info;
@ -461,10 +460,6 @@ final class LinuxDisplay implements DisplayImplementation {
} }
private static native void nSwitchDisplayMode(long display, int screen, int extension, DisplayMode mode) throws LWJGLException; private static native void nSwitchDisplayMode(long display, int screen, int extension, DisplayMode mode) throws LWJGLException;
static long getWarpAtom() throws LWJGLException {
return internAtom("_LWJGL", false);
}
private static long internAtom(String atom_name, boolean only_if_exists) throws LWJGLException { private static long internAtom(String atom_name, boolean only_if_exists) throws LWJGLException {
incDisplay(); incDisplay();
try { try {
@ -473,7 +468,7 @@ final class LinuxDisplay implements DisplayImplementation {
decDisplay(); decDisplay();
} }
} }
private static native long nInternAtom(long display, String atom_name, boolean only_if_exists); static native long nInternAtom(long display, String atom_name, boolean only_if_exists);
public void resetDisplayMode() { public void resetDisplayMode() {
lockAWT(); lockAWT();
@ -555,7 +550,6 @@ final class LinuxDisplay implements DisplayImplementation {
public DisplayMode init() throws LWJGLException { public DisplayMode init() throws LWJGLException {
lockAWT(); lockAWT();
try { try {
warp_atom = getWarpAtom();
delete_atom = internAtom("WM_DELETE_WINDOW", false); delete_atom = internAtom("WM_DELETE_WINDOW", false);
current_displaymode_extension = getBestDisplayModeExtension(); current_displaymode_extension = getBestDisplayModeExtension();
if (current_displaymode_extension == NONE) if (current_displaymode_extension == NONE)
@ -709,10 +703,10 @@ final class LinuxDisplay implements DisplayImplementation {
return mouse.getButtonCount(); return mouse.getButtonCount();
} }
public void createMouse() { public void createMouse() throws LWJGLException {
lockAWT(); lockAWT();
try { try {
mouse = new LinuxMouse(getDisplay(), getWindow(), warp_atom); mouse = new LinuxMouse(getDisplay(), getWindow());
} finally { } finally {
unlockAWT(); unlockAWT();
} }

View File

@ -40,6 +40,7 @@ import java.nio.IntBuffer;
import java.nio.CharBuffer; import java.nio.CharBuffer;
import org.lwjgl.BufferUtils; import org.lwjgl.BufferUtils;
import org.lwjgl.LWJGLException;
import org.lwjgl.input.Mouse; import org.lwjgl.input.Mouse;
import java.nio.charset.CharsetDecoder; import java.nio.charset.CharsetDecoder;
@ -76,10 +77,10 @@ final class LinuxMouse {
private EventQueue event_queue; private EventQueue event_queue;
private long last_event_nanos; private long last_event_nanos;
public LinuxMouse(long display, long window, long warp_atom) { public LinuxMouse(long display, long window) throws LWJGLException {
this.display = display; this.display = display;
this.window = window; this.window = window;
this.warp_atom = warp_atom; this.warp_atom = LinuxDisplay.nInternAtom(display, "_LWJGL", false);
reset(); reset();
} }