-
Notifications
You must be signed in to change notification settings - Fork 9
Getting window size #29
Comments
Are you sure you don't have a On Tue, Jul 26, 2016 at 4:01 PM, Marcus Olovsson notifications@github.com
|
Ah sorry, forgot to mention, I've tried that as well. It only returns undefined for me. Just to double-check that I didn't do anything wrong, I made an isolated example:
|
Weird, maybe it's one of those parts missing from the module, which has been kinda, and unfortunately, abandoned. This one though, works without problem via jsgtk #!/usr/bin/env jsgtk
var
Gtk = require('Gtk'),
settings,
win
;
Gtk.init(null);
win = new Gtk.Window({
title: 'jsgtk',
window_position: Gtk.WindowPosition.CENTER
});
win.connect('check-resize', function() {
console.log(win.get_size());
});
win.connect('show', Gtk.main);
win.connect('destroy', Gtk.main_quit);
win.set_default_size(200, 80);
win.add(new Gtk.Label({label: 'Hello Gtk+'}));
win.show_all(); |
Yeah, I haven't gotten that much time to work on this, and I haven't convinced anyone at Endless that this is something we should spend time on. |
I wonder if I should just flag this as deprecated on both npm and the README It's such a pity GJS folks never even thought about helping us, neither here nor in the jsgtk repo. This is for now, I believe, a won't fix, but just to provide how at least #!/usr/bin/env jsgtk
const Gtk = require('Gtk');
Gtk.init(null);
const win = new Gtk.Window({
title: 'jsgtk',
windowPosition: Gtk.WindowPosition.CENTER
});
win
.on('check-resize', () => {
console.log(win.getSize());
})
.on('show', Gtk.main)
.on('destroy', Gtk.mainQuit)
;
win.setDefaultSize(200, 80);
win.add(new Gtk.Label({label: 'Hello Gtk+'}));
win.showAll(); |
Too bad, my reasoning for using node-gtk instead of jsgtk was that the project I'm working on is a cross-platform one (with other modules for gui on other platforms), and it felt like it would make sense to use the same interpreter. I wish I could contribute to this project but my C++-fu isn't very good, I haven't even figured out how to build the project. I'll try jsgtk for now, we'll see if I can revisit this project in the future. Thanks for the quick response! |
Everyone that tried to hook into Gtk3 seems to be maintained by a niche ... that unfortunately want to keep it for a niche. Sad idea/repo/potentials story is sad |
Google didn't abandon GTK+, they still use it for file picker dialogs and such. I think there's a bit of hope now inside Endless to devote resources this to it with some new development, so I'm talking with a few colleagues right now. |
Like both of you have mentioned, it seems to be low demand right now, but I believe it still has potential. But sadly I think we can still forget to get any help from the Gtk3 maintainers, it simply feels like something that has to be maintained by someone who use it. I hope I can help in the future but I need to study building node-modules first :) |
Just to mention, my fork of this does does handle the const gtk = require('node-gtk').require('Gtk', '3.0')
gtk.init();
win = new gtk.Window()
// …
win.getAllocation() // => GdkRectangle {}
win.getAllocation().width // => 600
win.getAllocation().height // => 731 |
Hello!
I've tried this library and it seems to work for the most part! I'm having some trouble though that I hope someone can guide me with. I'm trying to figure out the size of a GtkWindow when a user resizes it. I found a signal that works, 'check-resize', but I can't figure out how to get the actual size of the window.
It seems like GTK isn't tracking this by itself, but via GDK, so it seems like the easiest way would normally be using the
get_allocation
method and then read width and height from there. However, it seems like I can't get this from node-gtk.Of course, get_request_size doesn't work since it's not the actual size of the window.
Does anyone have any suggestions for how I can access the size in node-gtk?
The text was updated successfully, but these errors were encountered: