GNOME Bugzilla – Bug 565225
GtkPlug socket-window property should be writeable and G_PARAM_CONSTRUCT_ONLY.
Last modified: 2018-02-10 03:24:44 UTC
GtkPlug not allowing the socket-window property to be set at construction is awkward for language bindings, which often depend on being able to meaningfully construct the object using a single call to g_object_new, for example (in the JavaScript case) one might expect to be able to do something like the following: p = new Gtk.Plug({socket_window: win}).
Created attachment 125079 [details] [review] Make socket-window writeable at construction.
You need to check the window that the user gives you to see if it's in the same process as you and, if so, form an association with the GtkSocket (see how _gtk_plug_add_socket ()) does this. Also, if you're doing this then it probably makes sense to also expose a "socket-window-id" property (GdkNativeWindow type) and make that user-settable on construct to better match the _new() function.
+1 for general sanity of the idea, though.
oh. also, you should g_value_dup_object, unless your intention is to steal the user's reference. and maybe the properties shouldn't be construct-only, but rather always writable but have a g_return_if_fail (plug->socket_window == NULL); so you can't set the window more than once...
Created attachment 125082 [details] [review] A patch that works for the in-process case. This patch works for the in-process case. In addition it does g_return_if_fail(plug->socket_window == NULL) rather than being construct only.
We're moving to gitlab! As part of this move, we are closing bugs that haven't seen activity in more than 5 years. If this issue is still imporant to you and still relevant with GTK+ 3.22 or master, please consider creating a gitlab issue for it.