Git Product home page Git Product logo

gtk-node's Introduction

node-gtk3 Pre Release

Gitter

This project is depricated in favor of https://github.com/Place1/node-gir. You can still contact me if you would like to contribute to node-gir. We're working very hard in our free time to make this project a reality.

Node bindings for Gtk3

Existing bindings are either abandoned or require custom runtime environments. This is an attempt to create support gtk bindings for the official node engine. This project is the foundation for react-gtk. Contributors are wanted and welcomed.

This project is using ffi to bind node to the gtk C libraries.

Please ★ this repo if you found it useful ★ ★ ★

Features

  • Supports official node engine

Usage

git clone https://github.com/jamrizzi/node-gtk3.git && cd node-gtk3
npm install
npm run demo

Dependancies

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -m 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

License

MIT License

Jam Risser © 2017

Credits

Changelog

0.0.2 (2017-09-06)

  • Added MacOS support
  • Refactored build system with nwb

0.0.1 (2017-06-07)

  • Initial release

gtk-node's People

Contributors

clayrisser avatar jamrizzi avatar nuxlli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

gtk-node's Issues

Project roadmap

This issue is for discussion about a project roadmap. I've had several requests to create one.

Promises don't work

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.

node-ffi/node-ffi#412

Segmentation fault

Place1@22ac86b
Place1@134758b

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);
    });
  }

Contribution guide

This issue is for discussion on a contribution guide. I've had several requests to create one.

How high level should node-gtk3 be?

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();

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.