Skip to content

Commit 91987f2

Browse files
committed
Fixed canvas placement
1 parent 9df390d commit 91987f2

1 file changed

Lines changed: 10 additions & 20 deletions

File tree

  • java/libraries/lwjgl/src/processing/lwjgl

java/libraries/lwjgl/src/processing/lwjgl/PGL.java

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
package processing.lwjgl;
2525

26+
import java.awt.BorderLayout;
2627
import java.awt.Canvas;
2728
import java.nio.Buffer;
2829

@@ -273,39 +274,28 @@ public void updateOffscreen(PGL primary) {
273274

274275

275276
public void initPrimarySurface(int antialias) {
276-
// if (pg.parent.online) {
277-
// // RCP Application (Applet's, Webstart, Netbeans, ..) using JOGL may not
278-
// // be able to initialize JOGL before the first UI action, so initSingleton()
279-
// // is called with its argument set to false.
280-
// GLProfile.initSingleton(false);
281-
// } else {
282-
// if (PApplet.platform == PConstants.LINUX) {
283-
// // Special case for Linux, since the multithreading issues described for
284-
// // example here:
285-
// // http://forum.jogamp.org/QtJambi-JOGL-Ubuntu-Lucid-td909554.html
286-
// // have not been solved yet (at least for stable release b32 of JOGL2).
287-
// GLProfile.initSingleton(false);
288-
// } else {
289-
// GLProfile.initSingleton(true);
290-
// }
291-
// }
292-
293277
canvas = new Canvas();
294-
pg.parent.add(canvas);
295278

296279
canvas.setBounds(0, 0, pg.parent.width, pg.parent.height);
297280
canvas.setFocusable(true);
298281
canvas.requestFocus();
299-
canvas.setIgnoreRepaint(true);
282+
canvas.setIgnoreRepaint(true);
283+
pg.parent.setLayout(new BorderLayout());
284+
pg.parent.add(canvas, BorderLayout.CENTER);
300285

301286
try {
302287
Display.setParent(canvas);
303288
PixelFormat format = new PixelFormat(32, 0, 24, 8, antialias);
304289
Display.create(format);
305-
Display.setVSyncEnabled(false);
290+
Display.setVSyncEnabled(false);
306291
} catch (LWJGLException e) {
307292
e.printStackTrace();
308293
}
294+
295+
canvas.addMouseListener(pg.parent);
296+
canvas.addMouseMotionListener(pg.parent);
297+
canvas.addKeyListener(pg.parent);
298+
canvas.addFocusListener(pg.parent);
309299

310300
initialized = true;
311301
}

0 commit comments

Comments
 (0)