Skip to content

Commit 268cb70

Browse files
committedSep 20, 2024
Fix fullscreen tests
Add default clipboard functionality
1 parent ccd7c42 commit 268cb70

File tree

3 files changed

+40
-7
lines changed

3 files changed

+40
-7
lines changed
 

‎modules/javafx.graphics/src/main/java/com/sun/glass/ui/headless/HeadlessPlatformFactory.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -68,22 +68,21 @@ protected void pushToSystem(HashMap<String, Object> cacheData, int supportedActi
6868

6969
@Override
7070
protected void pushTargetActionToSystem(int actionDone) {
71-
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
7271
}
7372

7473
@Override
7574
protected Object popFromSystem(String mimeType) {
76-
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
75+
return null;
7776
}
7877

7978
@Override
8079
protected int supportedSourceActionsFromSystem() {
81-
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
80+
return Clipboard.ACTION_NONE;
8281
}
8382

8483
@Override
8584
protected String[] mimesFromSystem() {
86-
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
85+
return new String[0];
8786
}
8887
}
8988
}

‎modules/javafx.graphics/src/main/java/com/sun/glass/ui/headless/HeadlessView.java

+9-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.sun.glass.ui.Pixels;
44
import com.sun.glass.ui.View;
5+
import com.sun.glass.events.ViewEvent;
56
import com.sun.glass.ui.Window;
67
import java.util.Map;
78

@@ -70,14 +71,19 @@ protected void _uploadPixels(long ptr, Pixels pixels) {
7071

7172
@Override
7273
protected boolean _enterFullscreen(long ptr, boolean animate, boolean keepRatio, boolean hideCursor) {
73-
Window window = this.getWindow();
74-
window.maximize(true);
74+
HeadlessWindow window = (HeadlessWindow)this.getWindow();
75+
window.setFullscreen(true);
76+
notifyView(ViewEvent.FULLSCREEN_ENTER);
7577
return true;
7678
}
7779

7880
@Override
7981
protected void _exitFullscreen(long ptr, boolean animate) {
80-
throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
82+
HeadlessWindow window = (HeadlessWindow)this.getWindow();
83+
if (window != null) {
84+
window.setFullscreen(false);
85+
}
86+
notifyView(ViewEvent.FULLSCREEN_EXIT);
8187
}
8288

8389
@Override

‎modules/javafx.graphics/src/main/java/com/sun/glass/ui/headless/HeadlessWindow.java

+28
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,38 @@ protected boolean _maximize(long ptr, boolean maximize, boolean wasMaximized) {
7979
setState(State.NORMAL);
8080
}
8181
notifyResizeAndMove(newX, newY, newWidth, newHeight);
82+
if (maximize) {
83+
notifyResize(WindowEvent.MAXIMIZE, newWidth, newHeight);
84+
}
8285

8386
return maximize;
8487
}
8588

89+
boolean setFullscreen(boolean full) {
90+
int newX = 0;
91+
int newY = 0;
92+
int newWidth = 0;
93+
int newHeight = 0;
94+
if (full) {
95+
this.originalHeight = this.height;
96+
this.originalWidth = this.width;
97+
this.originalX = this.x;
98+
this.originalY = this.y;
99+
newX = 0;
100+
newY = 0;
101+
newWidth = screen.getWidth();
102+
newHeight = screen.getHeight();
103+
} else {
104+
newHeight = this.originalHeight;
105+
newWidth = this.originalWidth;
106+
newX = this.originalX;
107+
newY = this.originalY;
108+
}
109+
notifyResizeAndMove(newX, newY, newWidth, newHeight);
110+
111+
return full;
112+
}
113+
86114
@Override
87115
protected void _setBounds(long ptr, int x, int y, boolean xSet, boolean ySet, int w, int h, int cw, int ch, float xGravity, float yGravity) {
88116
int newWidth = 0;

0 commit comments

Comments
 (0)
Please sign in to comment.