Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8087980: Add property to disable Monocle cursor #5

Closed
Closed
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -39,7 +39,7 @@ protected InputDeviceRegistry createInputDeviceRegistry() {

@Override
protected NativeCursor createCursor() {
return new NullCursor();
return logSelectedCursor(new NullCursor());
}

@Override
@@ -29,7 +29,8 @@

@Override
protected NativeCursor createCursor() {
return new DispmanCursor();
final NativeCursor c = useCursor ? new DispmanCursor() : new NullCursor();
return logSelectedCursor(c);
}

@Override
@@ -36,7 +36,7 @@ protected InputDeviceRegistry createInputDeviceRegistry() {

@Override
protected NativeCursor createCursor() {
return new NullCursor();
return logSelectedCursor(new NullCursor());
}

@Override
@@ -39,7 +39,8 @@ protected InputDeviceRegistry createInputDeviceRegistry() {

@Override
protected NativeCursor createCursor() {
return new SoftwareCursor();
final NativeCursor c = useCursor ? new SoftwareCursor() : new NullCursor();
return logSelectedCursor(c);
}

@Override
@@ -29,7 +29,8 @@

@Override
protected NativeCursor createCursor() {
return new MX6Cursor();
final NativeCursor c = useCursor ? new MX6Cursor() : new NullCursor();
return logSelectedCursor(c);
}

@Override
@@ -25,15 +25,33 @@

package com.sun.glass.ui.monocle;

import java.security.AccessController;
import java.security.PrivilegedAction;
import com.sun.javafx.logging.PlatformLogger;
import com.sun.javafx.logging.PlatformLogger.Level;
import com.sun.javafx.util.Logging;

/** Abstract of a platform on which JavaFX can run. */
public abstract class NativePlatform {

private static InputDeviceRegistry inputDeviceRegistry;
private final RunnableProcessor runnableProcessor;
private final PlatformLogger logger = Logging.getJavaFXLogger();

private NativeCursor cursor;
private NativeScreen screen;
protected AcceleratedScreen accScreen;


protected static final boolean useCursor =
AccessController.doPrivileged((PrivilegedAction<Boolean>) () -> {
final String str =
System.getProperty("monocle.cursor.enabled", "true");
return "true".equalsIgnoreCase(str);
});



protected NativePlatform() {
runnableProcessor = new RunnableProcessor();
}
@@ -129,4 +147,19 @@ public synchronized AcceleratedScreen getAcceleratedScreen(int[] attributes)
return accScreen;
}


/**
* Log the name of the supplied native cursor class if required.
*
* @param cursor the native cursor in use, null is permitted
* @return the passed in cursor
*/
protected NativeCursor logSelectedCursor(final NativeCursor cursor) {
if (logger.isLoggable(Level.FINE)) {
final String name = cursor == null ? null : cursor.getClass().getSimpleName();
logger.fine("Using native cursor: {0}", name);
}

This comment has been minimized.

Copy link
@jgneff

jgneff Nov 16, 2019

Contributor

Here you would call PlatformLogger.fine unconditionally, for example, instead of the conditional call to System.err.println.

return cursor;
}

}
@@ -29,7 +29,8 @@

@Override
protected NativeCursor createCursor() {
return new OMAPCursor();
final NativeCursor c = useCursor ? new OMAPCursor() : new NullCursor();
return logSelectedCursor(c);
}

@Override
@@ -61,10 +61,11 @@ protected InputDeviceRegistry createInputDeviceRegistry() {
*/
@Override
protected NativeCursor createCursor() {
if (x11Input) {
return new X11Cursor();
if (useCursor) {
final NativeCursor c = x11Input ? new X11Cursor() : new X11WarpingCursor();
return logSelectedCursor(c);
} else {
return new X11WarpingCursor();
return logSelectedCursor(new NullCursor());
}
}

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.