@Override public void clearFocus () { _platform.graphics().canvas().setFocus(); }
@Override protected void paint () { makeCurrent(); super.paint(); canvas.swapBuffers(); }
public void run() { if (!shell.isDisposed()) { graphics.onBeforeFrame(); emitFrame(); graphics.onAfterFrame(); display.asyncExec(this); } } });
@Override protected JavaGraphics createGraphics (Config config) { Display.setAppName(config.appName); display = new Display(); shell = new Shell(display); shell.setLayout(new FillLayout()); shell.addShellListener(new ShellAdapter() { public void shellActivated (ShellEvent e) { onResume(); } public void shellDeactivated (ShellEvent e) { onPause(); } }); comp = new Composite(shell, SWT.NONE); comp.setLayout(null); return new SWTGraphics(this, config, comp); }
public SWTGraphics (SWTPlatform splat, final Composite comp) { super(splat); this.plat = splat; boolean isMac = "Mac OS X".equals(System.getProperty("os.name")); final Hack hack = isMac ? new SWTMacHack() : new Hack(); // special scale fiddling on Mac scaleChanged(hack.hackScale()); // create our GLCanvas GLData data = new GLData(); data.doubleBuffer = true; canvas = new GLCanvas(comp, SWT.NO_BACKGROUND | SWT.NO_REDRAW_RESIZE, data); hack.hackCanvas(canvas); canvas.setCurrent(); GL.createCapabilities(); comp.addListener(SWT.Resize, new Listener() { public void handleEvent(Event event) { // resize our GLCanvas to fill the window; we do manual layout so that other SWT widgets // can be overlaid on top of our GLCanvas Rectangle bounds = comp.getBounds(); comp.setBounds(bounds); canvas.setBounds(bounds); canvas.setCurrent(); hack.convertToBacking(canvas, bounds); viewportChanged(bounds.width, bounds.height); } }); plat.log().info("Setting size " + plat.config.width + "x" + plat.config.height); setSize(plat.config.width, plat.config.height, plat.config.fullscreen); }
private Point scaleCoord(Event event) { return platform.graphics().transformMouse(new Point(event.x, event.y)); }
@Override protected JavaGraphics createGraphics (Config config) { Display.setAppName(config.appName); display = new Display(); shell = new Shell(display); shell.setLayout(new FillLayout()); shell.addShellListener(new ShellAdapter() { public void shellActivated (ShellEvent e) { onResume(); } public void shellDeactivated (ShellEvent e) { onPause(); } }); comp = new Composite(shell, SWT.NONE); comp.setLayout(null); return new SWTGraphics(this, config, comp); }
public SWTGraphics (SWTPlatform splat, final Composite comp) { super(splat); this.plat = splat; boolean isMac = "Mac OS X".equals(System.getProperty("os.name")); final Hack hack = isMac ? new SWTMacHack() : new Hack(); // special scale fiddling on Mac scaleChanged(hack.hackScale()); // create our GLCanvas GLData data = new GLData(); data.doubleBuffer = true; canvas = new GLCanvas(comp, SWT.NO_BACKGROUND | SWT.NO_REDRAW_RESIZE, data); hack.hackCanvas(canvas); canvas.setCurrent(); GL.createCapabilities(); comp.addListener(SWT.Resize, new Listener() { public void handleEvent(Event event) { // resize our GLCanvas to fill the window; we do manual layout so that other SWT widgets // can be overlaid on top of our GLCanvas Rectangle bounds = comp.getBounds(); comp.setBounds(bounds); canvas.setBounds(bounds); canvas.setCurrent(); hack.convertToBacking(canvas, bounds); viewportChanged(bounds.width, bounds.height); } }); plat.log().info("Setting size " + plat.config.width + "x" + plat.config.height); setSize(plat.config.width, plat.config.height, plat.config.fullscreen); }
private Point scaleCoord(Event event) { return platform.graphics().transformMouse(new Point(event.x, event.y)); }
/** Creates a new SWT platform and prepares it for operation. */ public SWTPlatform (Config config) { super(config); Display.setAppName(config.appName); display = new Display(); shell = new Shell(display); shell.setLayout(new FillLayout()); shell.addShellListener(new ShellAdapter() { public void shellActivated (ShellEvent e) { dispatchEvent(lifecycle, Lifecycle.RESUME); } public void shellDeactivated (ShellEvent e) { dispatchEvent(lifecycle, Lifecycle.PAUSE); } }); comp = new Composite(shell, SWT.NONE); comp.setLayout(null); graphics = new SWTGraphics(this, comp); input = new SWTInput(this); }
public void run() { if (!shell.isDisposed()) { graphics.onBeforeFrame(); emitFrame(); graphics.onAfterFrame(); display.asyncExec(this); } } });
@Override protected void paint () { makeCurrent(); super.paint(); canvas.swapBuffers(); }
@Override public void handleEvent (Event event) { if (event.widget == _platform.graphics().canvas() && (_kfc == null || _kfc.unfocusForLocation(new Point(event.x, event.y)))) { clearFocus(); } } });
/** Creates a new SWT platform and prepares it for operation. */ public SWTPlatform (Config config) { super(config); Display.setAppName(config.appName); display = new Display(); shell = new Shell(display); shell.setLayout(new FillLayout()); shell.addShellListener(new ShellAdapter() { public void shellActivated (ShellEvent e) { dispatchEvent(lifecycle, Lifecycle.RESUME); } public void shellDeactivated (ShellEvent e) { dispatchEvent(lifecycle, Lifecycle.PAUSE); } }); comp = new Composite(shell, SWT.NONE); comp.setLayout(null); graphics = new SWTGraphics(this, comp); input = new SWTInput(this); }
public void handleEvent(Event event) { // resize our GLCanvas to fill the window; we do manual layout so that other SWT widgets // can be overlaid on top of our GLCanvas Rectangle bounds = comp.getBounds(); comp.setBounds(bounds); canvas.setBounds(bounds); makeCurrent(); // SWTGraphics.this.platform.log().info("Resized " + bounds.width + "x" + bounds.height); ctx.setSize(ctx.scale.invScaledFloor(bounds.width), ctx.scale.invScaledFloor(bounds.height)); } });
public void handleEvent(Event event) { // resize our GLCanvas to fill the window; we do manual layout so that other SWT widgets // can be overlaid on top of our GLCanvas Rectangle bounds = comp.getBounds(); comp.setBounds(bounds); canvas.setBounds(bounds); makeCurrent(); // SWTGraphics.this.platform.log().info("Resized " + bounds.width + "x" + bounds.height); ctx.setSize(ctx.scale.invScaledFloor(bounds.width), ctx.scale.invScaledFloor(bounds.height)); } });
public SWTGraphics (SWTPlatform platform, JavaPlatform.Config config, final Composite comp) { super(platform, config); this.platform = platform; // create our GLCanvas GLData data = new GLData (); data.doubleBuffer = true; canvas = new GLCanvas(comp, SWT.NONE, data); makeCurrent(); comp.addListener(SWT.Resize, new Listener() { public void handleEvent(Event event) { // resize our GLCanvas to fill the window; we do manual layout so that other SWT widgets // can be overlaid on top of our GLCanvas Rectangle bounds = comp.getBounds(); comp.setBounds(bounds); canvas.setBounds(bounds); makeCurrent(); // SWTGraphics.this.platform.log().info("Resized " + bounds.width + "x" + bounds.height); ctx.setSize(ctx.scale.invScaledFloor(bounds.width), ctx.scale.invScaledFloor(bounds.height)); } }); // platform.log().info("Setting size " + config.width + "x" + config.height); platform.comp.setSize(ctx.scale.scaledCeil(config.width), ctx.scale.scaledCeil(config.height)); platform.shell.pack(); }
public SWTGraphics (SWTPlatform platform, JavaPlatform.Config config, final Composite comp) { super(platform, config); this.platform = platform; // create our GLCanvas GLData data = new GLData (); data.doubleBuffer = true; canvas = new GLCanvas(comp, SWT.NONE, data); makeCurrent(); comp.addListener(SWT.Resize, new Listener() { public void handleEvent(Event event) { // resize our GLCanvas to fill the window; we do manual layout so that other SWT widgets // can be overlaid on top of our GLCanvas Rectangle bounds = comp.getBounds(); comp.setBounds(bounds); canvas.setBounds(bounds); makeCurrent(); // SWTGraphics.this.platform.log().info("Resized " + bounds.width + "x" + bounds.height); ctx.setSize(ctx.scale.invScaledFloor(bounds.width), ctx.scale.invScaledFloor(bounds.height)); } }); // platform.log().info("Setting size " + config.width + "x" + config.height); platform.comp.setSize(ctx.scale.scaledCeil(config.width), ctx.scale.scaledCeil(config.height)); platform.shell.pack(); }