Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions java/org/cef/browser/CefBrowser_N.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,20 @@
import org.cef.callback.CefPdfPrintCallback;
import org.cef.callback.CefRunFileDialogCallback;
import org.cef.callback.CefStringVisitor;
import org.cef.event.CefKeyEvent;
import org.cef.event.CefMouseEvent;
import org.cef.event.CefMouseWheelEvent;
import org.cef.handler.CefClientHandler;
import org.cef.handler.CefDialogHandler.FileDialogMode;
import org.cef.handler.CefRenderHandler;
import org.cef.handler.CefWindowHandler;
import org.cef.misc.CefPdfPrintSettings;
import org.cef.network.CefRequest;

import java.awt.Canvas;
import java.awt.Component;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Window;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent;
import java.awt.event.WindowEvent;
import java.util.Vector;

Expand Down Expand Up @@ -595,7 +594,7 @@ protected final void invalidate() {
* Send a key event.
* @param e The event to send.
*/
protected final void sendKeyEvent(KeyEvent e) {
protected final void sendKeyEvent(CefKeyEvent e) {
try {
N_SendKeyEvent(e);
} catch (UnsatisfiedLinkError ule) {
Expand All @@ -607,7 +606,7 @@ protected final void sendKeyEvent(KeyEvent e) {
* Send a mouse event.
* @param e The event to send.
*/
protected final void sendMouseEvent(MouseEvent e) {
protected final void sendMouseEvent(CefMouseEvent e) {
try {
N_SendMouseEvent(e);
} catch (UnsatisfiedLinkError ule) {
Expand All @@ -619,7 +618,7 @@ protected final void sendMouseEvent(MouseEvent e) {
* Send a mouse wheel event.
* @param e The event to send.
*/
protected final void sendMouseWheelEvent(MouseWheelEvent e) {
protected final void sendMouseWheelEvent(CefMouseWheelEvent e) {
try {
N_SendMouseWheelEvent(e);
} catch (UnsatisfiedLinkError ule) {
Expand Down Expand Up @@ -801,9 +800,9 @@ private final native void N_Find(
private final native void N_ReplaceMisspelling(String word);
private final native void N_WasResized(int width, int height);
private final native void N_Invalidate();
private final native void N_SendKeyEvent(KeyEvent e);
private final native void N_SendMouseEvent(MouseEvent e);
private final native void N_SendMouseWheelEvent(MouseWheelEvent e);
private final native void N_SendKeyEvent(CefKeyEvent e);
private final native void N_SendMouseEvent(CefMouseEvent e);
private final native void N_SendMouseWheelEvent(CefMouseWheelEvent e);
private final native void N_DragTargetDragEnter(
CefDragData dragData, Point pos, int modifiers, int allowed_ops);
private final native void N_DragTargetDragOver(Point pos, int modifiers, int allowed_ops);
Expand Down
40 changes: 40 additions & 0 deletions java/org/cef/event/CefKeyEvent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package org.cef.event;

public class CefKeyEvent {
/* id constants */
public static final int KEY_PRESS = 1;
public static final int KEY_RELEASE = 0;
public static final int KEY_TYPE = 2;

// intentionally leaving these public for now
// may remove the getters, or maybe add setters, or maybe move to private
// not sure yet
public int keyCode;
public int id;
public int modifiers;
public char keyChar;
public long scancode;

public CefKeyEvent(int id, int keyCode, char keyChar, int modifiers) {
this.id = id;
this.keyCode = keyCode;
this.keyChar = keyChar;
this.modifiers = modifiers;
}

public int getID() {
return id;
}

public int getModifiers() {
return modifiers;
}

public char getKeyChar() {
return keyChar;
}

public int getKeyCode() {
return keyCode;
}
}
54 changes: 54 additions & 0 deletions java/org/cef/event/CefMouseEvent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package org.cef.event;

public class CefMouseEvent {
/* id constants */
public static final int MOUSE_MOVED = 503;
public static final int MOUSE_EXIT = 505;
/* modifier constants */
public static final int BUTTON1_MASK = 0x10;
public static final int BUTTON2_MASK = 0x20;
public static final int BUTTON3_MASK = 0x40;

// intentionally leaving these public for now
// may remove the getters, or maybe add setters, or maybe move to private
// not sure yet
public int id;
public int x;
public int y;
public int modifiers;
public int clickCount;
public int button;

public CefMouseEvent(int id, int x, int y, int clickCount, int button, int modifiers) {
this.id = id;
this.x = x;
this.y = y;
this.clickCount = clickCount;
this.button = button;
this.modifiers = modifiers;
}

public int getID() {
return id;
}

public int getX() {
return x;
}

public int getY() {
return y;
}

public int getModifiers() {
return modifiers;
}

public int getClickCount() {
return clickCount;
}

public int getButton() {
return button;
}
}
49 changes: 49 additions & 0 deletions java/org/cef/event/CefMouseWheelEvent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package org.cef.event;

public class CefMouseWheelEvent {
/* id constants */
public static final int WHEEL_UNIT_SCROLL = 0;
public static final int WHEEL_BLOCK_SCROLL = 1;

// intentionally leaving these public for now
// may remove the getters, or maybe add setters, or maybe move to private
// not sure yet
public int id;
public int delta;
public int x;
public int y;
public int modifiers;
public int amount = 32; // TODO: might want to make this change dependent on system?

public CefMouseWheelEvent(int id, int x, int y, int delta, int modifiers) {
this.id = id;
this.x = x;
this.y = y;
this.delta = delta;
this.modifiers = modifiers;
}

public int getScrollType() {
return id;
}

public int getWheelRotation() {
return delta;
}

public int getX() {
return x;
}

public int getY() {
return y;
}

public int getModifiers() {
return modifiers;
}

public int getUnitsToScroll() {
return amount * delta;
}
}
1 change: 0 additions & 1 deletion java/org/cef/handler/CefResourceHandlerAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import org.cef.callback.CefCallback;
import org.cef.misc.IntRef;
import org.cef.misc.StringRef;
import org.cef.network.CefCookie;
import org.cef.network.CefRequest;
import org.cef.network.CefResponse;

Expand Down
Loading