Skip to content

Commit f831107

Browse files
committed
fix getComponent() in AWT, tweak JOGL to compile properly
1 parent 5037024 commit f831107

5 files changed

Lines changed: 25 additions & 8 deletions

File tree

core/src/processing/core/PSurface.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ public Frame initFrame(PApplet sketch, Color backgroundColor,
9797
//public void initImage(PGraphics gr, int wide, int high);
9898
// create pixel buffer, called from allocate() to produce a compatible image for rendering efficiently
9999
// public void initImage(PGraphics gr);
100+
100101
public Component getComponent();
101102

102103
/**

core/src/processing/core/PSurfaceAWT.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,12 @@ public void initImage(PGraphics graphics) {
803803
*/
804804

805805

806+
@Override
807+
public Component getComponent() {
808+
return canvas;
809+
}
810+
811+
806812
@Override
807813
public void setSmooth(int level) {
808814
}

core/todo.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ _ may be cause of some of the display placement issues w/ multiple displays
1414
_ seem to recall one of the bugs mentioning stacked displays
1515
_ need to change to iterate through display rectangles
1616
_ tweak mode ColorSelector is broken (uses getComponent())
17+
_ closing a sketch window manually (not hitting Stop) not killing sketch
18+
_ at least with the Java2D renderer
1719

1820

1921
rendering/performance/surface

java/libraries/jogl/src/processing/jogl/PSurfaceJOGL.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import java.awt.Canvas;
44
import java.awt.Color;
5+
import java.awt.Component;
56
import java.awt.EventQueue;
67
import java.awt.Frame;
78
import java.awt.Rectangle;
@@ -60,24 +61,26 @@ public class PSurfaceJOGL implements PSurface {
6061
Throwable drawException;
6162
Object waitObject = new Object();
6263

64+
NewtCanvasAWT canvas;
65+
66+
6367
public PSurfaceJOGL(PGraphics graphics) {
6468
this.graphics = graphics;
6569
this.pgl = (PJOGL) ((PGraphicsOpenGL)graphics).pgl;
6670
}
6771

68-
public void initOffscreen() {
72+
public void initOffscreen(PApplet sketch) {
6973
// TODO Auto-generated method stub
70-
7174
}
7275

73-
public Canvas initCanvas(PApplet sketch) {
76+
public Canvas initComponent(PApplet sketch) {
7477
this.sketch = sketch;
7578

7679
sketchWidth = sketch.sketchWidth();
7780
sketchHeight = sketch.sketchHeight();
7881

7982
if (window != null) {
80-
NewtCanvasAWT canvas = new NewtCanvasAWT(window);
83+
canvas = new NewtCanvasAWT(window);
8184
canvas.setBounds(0, 0, window.getWidth(), window.getHeight());
8285
// canvas.setBackground(new Color(pg.backgroundColor, true));
8386
canvas.setFocusable(true);
@@ -424,6 +427,10 @@ public void setSize(int width, int height) {
424427
}
425428
}
426429

430+
public Component getComponent() {
431+
return canvas;
432+
}
433+
427434
public void setSmooth(int level) {
428435
pgl.reqNumSamples = level;
429436
GLCapabilities caps = new GLCapabilities(profile);
@@ -453,10 +460,6 @@ public void requestFocus() {
453460

454461
}
455462

456-
public void blit() {
457-
// TODO Auto-generated method stub
458-
}
459-
460463
class DrawListener implements GLEventListener {
461464
public void display(GLAutoDrawable drawable) {
462465
pgl.getGL(drawable);

todo.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ _ Error message changes from "function" to "method"
1010
_ https://github.com/processing/processing/issues/3225
1111

1212

13+
_ move processing-java inside the Java Mode?
14+
_ make a Tool that installs it for all platforms, not just OS X
15+
_ not really part of the 'build' anymore
1316
_ fix this error message: Experimental Mode: Yikes! Can't find "processing.opengl" library! Line: 2 in tab: particle_signature_30_01
1417
_ 'ant clean' not removing old versions created by dist
1518
_ finish adding 'examples' contribs
@@ -41,6 +44,8 @@ _ break out a gui package (get class count down in .app)
4144
_ remove deprecated methods
4245
_ do the right thing on passing around List vs ArrayList and others
4346
_ PreferencesFrame is a misnomer (not a frame itself)
47+
_ change to PreferencesDialog, and make it a dialog?
48+
_ move Library to LibraryContribution and into contrib?
4449

4550

4651
gui

0 commit comments

Comments
 (0)