After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 579312 - can't access GdkAtoms
can't access GdkAtoms
Status: RESOLVED WONTFIX
Product: gjs
Classification: Bindings
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gjs-maint
gjs-maint
Depends on: 712752
Blocks:
 
 
Reported: 2009-04-17 16:22 UTC by Tommi Komulainen
Modified: 2015-01-27 17:26 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Tommi Komulainen 2009-04-17 16:22:25 UTC
(need to add "Return value: (transfer none):" to gdk_atom_intern annotations)

const Gtk = imports.gi.Gtk;
const Gdk = imports.gi.Gdk;

Gtk.init(0, null);

let atom = Gdk.atom_intern("CLIPBOARD", false);
log("atom="+atom);


Above fails to reach log() and isn't even throwing any exceptions:

   JS G FUNC: Call is to function Gdk.atom_intern with argc 2, expected: 2 in args, 0 out args, 2 total args
   JS G FUNC: Converting jsval to GArgument utf8
   JS G FUNC: Converting jsval to GArgument boolean
   JS G FUNC: Converting GArgument interface to jsval
   JS G FUNC: gtype of SYMBOL is void
    JS G BXD: Wrapping struct Atom 0x45 with JSObject
     JS G NS: Resolve prop 'Atom' hook obj 0x8072900 priv 0x8054ed0
     JS G NS: Found info type STRUCT for 'Atom' in namespace 'Gdk'
   JS GI USE: { GI_INFO_TYPE_STRUCT, "Gdk", "", "Atom", .details = { .nothing = {} } },
     JS G NS: Resolve prop 'Atom' hook obj 0x8072900 priv 0x8054ed0
     JS G NS: Found info type STRUCT for 'Atom' in namespace 'Gdk'
   JS GI USE: { GI_INFO_TYPE_STRUCT, "Gdk", "", "Atom", .details = { .nothing = {} } },
   JS G REPO: Initializing dynamic class Atom 0x80ad5a0
    JS G BXD: boxed constructor, obj 0x80729a0 priv 0x80b1ea0
    JS G BXD: boxed instance __proto__ is 0x80723e0
    JS G BXD: boxed instance constructing proto 1, obj class _private_Gdk_Atom proto class Object
    JS G BXD: Defined class Atom prototype is 0x80729a0 class 0x80ad5a0 in object 0x8072900
   JS G REPO: Constructing instance of dynamic class _private_Gdk_Atom 0x80ad5a0 from proto 0x80729a0
    JS G BXD: boxed constructor, obj 0x80729c0 priv 0x80b1eb0
    JS G BXD: boxed instance __proto__ is 0x80729a0
    JS G BXD: boxed instance constructing proto 0, obj class _private_Gdk_Atom proto class _private_Gdk_Atom
    JS G BXD: JSObject created by directly allocating Atom
   JS G FUNC: Releasing GArgument utf8 in param
   JS G FUNC: Releasing GArgument boolean in param
      JS CTX: Script evaluation failed
      JS CTX: JS_EvaluateScript() failed but no exception message?
      JS CTX: Script evaluation succeeded
JS_EvaluateScript() failed but no exception message?
Comment 1 Jonas Danielsson 2013-11-19 16:32:53 UTC
This is still the case, you get the warning:

 Gjs-WARNING **: JS ERROR: Error: Can't create a Javascript object for Atom; no way to copy

Can this be fixed? Is it a matter of the Gdk side or something that could be handled by gjs? I would be willing to look into it if I got some pointers.

I want to be able to copy to clipboard from gjs, is there another way?

Jonas
Comment 2 Jasper St. Pierre (not reading bugmail) 2013-11-19 16:43:25 UTC
We need a better clipboard API in GTK+, really.

GdkAtoms are opaque struct types, which we can't refcount in gjs safely.
Comment 3 Jonas Danielsson 2013-11-20 09:36:47 UTC
I see :)

How do you think a patch that added something like:

GdkClipboard * gtk_clipboard_for_name (GdkDisplay *display, const char *name);

Would be welcomed? A function that does the GdkAtom dance on the inside.
Comment 4 Jasper St. Pierre (not reading bugmail) 2013-11-20 14:03:40 UTC
I'm not sure. X is the only thing with two clipboards; all other systems (including Mir) just have one. You might have better luck with separate methods like gtk_clipboard_get (); and gtk_clipboard_get_primary_selection (); or similar, and on other platforms they both return the same thing.
Comment 5 Jonas Danielsson 2013-11-20 16:57:05 UTC
Thank you!

Added a bug: bug 712752
Comment 6 Bastien Nocera 2015-01-22 15:21:00 UTC
I would close this bug as WONTFIX, as the real goal is getting access to clipboards from introspected languages, not raw GdkAtom access.
Comment 7 Bastien Nocera 2015-01-27 17:26:45 UTC
The patch in bug 712752 got merged, which means that the primary use case for the functionality requested in this bug is now covered.

I'll now close this as per comment 6. Please file a new bug should any other uses of GdkAtom be warranted from applications.