clayrisser / gtk-node Goto Github PK
View Code? Open in Web Editor NEWNode bindings for Gtk3
License: MIT License
Node bindings for Gtk3
License: MIT License
This issue is for discussion about a project roadmap. I've had several requests to create one.
@nuxlli, would you mind confirming that it still supports mac. Your change broke it on linux, but I fixed it.
This issue is for discussion on a contribution guide. I've had several requests to create one.
Currently, node-gtk3 is being implemented at a pretty high level. If you look at the current demo, the window is automatically being created and attached to the application. Is this too high level? I want it to be easy to use, but don't want to sacrifice flexibility.
const app = new App({
title: 'Node Gtk3',
height: 200,
width: 200
});
app.run();
This is were i'm up to. Promises, callbacks, setTimouts etc. all work now, but the program seg faults after a few seconds unfortuantly. I've added some comments on why I think this happens
init() {
loop.startLoop();
return new Promise((resolve, reject) => {
// assign the ffi callback to 'this' so we retain a reference
// after this.init() finishes. If we don't do this Node
// will garbage collect it and we will get a segmentation
// fault when C calls into it.
this.onActivate = ffi.Callback('void', [type.GtkWidgetPtr], (windowPtr) => {
this.window = new Window({ pointer: windowPtr });
resolve(this.window);
});
app.register_on_activate(this.onActivate);
// If we call app.init() then it blocks the main loop
// forever and out program halts.
// If we call app.init.async() then FFI will call the
// foreign function in another thread (https://github.com/node-ffi/node-ffi/wiki/Node-FFI-Tutorial#async-library-calls)
// My guess is that it will be scheduled on one of the
// threads that LibUV controls for IO tasks.
// This means we avoid blocking the event loop but this
// results in a segmentation fault after some time and
// I can't figure out why. My only guess is that it's a
// multi-thread issue with GTK???
app.init.async(this.pointer, () => null);
});
}
Promises appear to break ffi. My temporary solution is to use old fashioned callbacks. If anyone had any insight on this, please let me know. I've filled an issue to ffi at the link below.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.