Re: GTK2 GdkNativeWindow compilation errors
"H. William Welliver" <[email protected]> Thu, 17 Apr 2025 16:04:57 -0400
| Newsgroups | gmane.comp.lang.pike.user |
|---|---|
| Message-ID | <[email protected]> |
--Apple-Mail=_2E9A6DD3-DD09-48A7-934B-C2EC3BF0EF2F Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hi Lance- Thanks for the assistance. I=E2=80=99ve attached the patch to this = message, it should detect the presence of GdkNativeWindow. Let me know = how it works for you (and the result of that test in the configure = output). =EF=BF=BC > On Apr 17, 2025, at 3:26=E2=80=AFPM, Lance Dillon = <[email protected]> wrote: >=20 > I could test >=20 > Yahoo Mail: Search, Organize, Conquer = <https://mail.onelink.me/107872968?pid=3Dnativeplacement&c=3DUS_Acquisitio= n_YMktg_315_SearchOrgConquer_EmailSignature&af_sub1=3DAcquisition&af_sub2=3D= US_YMktg&af_sub3=3D&af_sub4=3D100002039&af_sub5=3DC01_Email_Static_&af_ios= _store_cpp=3D0c38e4b0-a27e-40f9-a211-f4e2de32ab91&af_android_url=3Dhttps:/= /play.google.com/store/apps/details?id=3Dcom.yahoo.mobile.client.android.m= ail&listing=3Dsearch_organize_conquer> > On Thu, Apr 17, 2025 at 15:18, H. William Welliver > <[email protected]> wrote: > I compiled pike on a system that has a version of GTK2 that includes a = typedef for GdkNativeWindow that the GTK2 code doesn=E2=80=99t = specifically address. The compiler (a recent clang) errors on these = implicit casts to and from GdkNativeWindow (which I believe resolves to = a platform dependent pointer) and integers that the pike glue deals = with. I was able to solve the errors but wanted to get some feedback = before I commit it, as I get the impression that GdkNativeWindow was = something added somewhere along the way, so there probably may need to = be some configure glue added. Is anyone using the GTK2 module that might = be able to test these changes to see if they cause problems elsewhere? = Or should I commit a best-guess fix and wait to see how pikefarm reacts? >=20 > Bill --Apple-Mail=_2E9A6DD3-DD09-48A7-934B-C2EC3BF0EF2F Content-Type: multipart/mixed; boundary="Apple-Mail=_94631E42-95DE-46C8-9177-895180E704B3" --Apple-Mail=_94631E42-95DE-46C8-9177-895180E704B3 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 <html><head><meta http-equiv=3D"content-type" content=3D"text/html; = charset=3Dutf-8"></head><body style=3D"overflow-wrap: break-word; = -webkit-nbsp-mode: space; line-break: after-white-space;">Hi = Lance-<div><br></div><div>Thanks for the assistance. I=E2=80=99ve = attached the patch to this message, it should detect the presence of = GdkNativeWindow. Let me know how it works for you (and the result of = that test in the configure = output).</div><div><br></div><div></div></body></html>= --Apple-Mail=_94631E42-95DE-46C8-9177-895180E704B3 Content-Disposition: attachment; filename=GTK2-test-for-GdkNativeWindow.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="GTK2-test-for-GdkNativeWindow.patch" Content-Transfer-Encoding: 7bit diff --git a/src/post_modules/GTK2/configure.in b/src/post_modules/GTK2/configure.in index 1a770e7c5e..48ca86384b 100644 --- a/src/post_modules/GTK2/configure.in +++ b/src/post_modules/GTK2/configure.in @@ -392,6 +392,7 @@ LIBS="$LIBS $GTK_LIBS" AC_CHECK_HEADERS( gdk/gdkx.h gdk/gdkwin32.h gdk/gdkquartz.h ) AC_CHECK_FUNCS(gtk_tree_selection_unselect_range g_value_get_schar g_value_set_schar) +AC_CHECK_TYPES([GdkNativeWindow], [], [], [[#include <gdk/gdktypes.h>]]) AC_MSG_CHECKING([if g_signal_connect_data takes six args]) AC_CACHE_VAL(pgtk2_cv_g_signal_connect_has_six_args, [ diff --git a/src/post_modules/GTK2/source/gdkevent.pre b/src/post_modules/GTK2/source/gdkevent.pre index d1f230a7d9..c4390a33f1 100644 --- a/src/post_modules/GTK2/source/gdkevent.pre +++ b/src/post_modules/GTK2/source/gdkevent.pre @@ -149,7 +149,7 @@ mixed _index(string ind) if( is_same_string(index,_STR("selection")) ) RETURN_ATOM( e->selection.selection ); if( is_same_string(index,_STR("target")) ) RETURN_ATOM( e->selection.target ); if( is_same_string(index,_STR("property")) ) RETURN_ATOM( e->selection.property ); - if( is_same_string(index,_STR("requestor")) ) RETURN_INT( e->selection.requestor ); + if( is_same_string(index,_STR("requestor")) ) RETURN_INT( (INT_TYPE)e->selection.requestor ); break; case GDK_PROXIMITY_IN: @@ -422,7 +422,7 @@ mapping cast(string to) ref_push_string(_STR("selection")); push_atom( e->selection.selection ); ref_push_string(_STR("target")); push_atom( e->selection.target ); ref_push_string(_STR("property")); push_atom( e->selection.property ); - ref_push_string(_STR("requestor")); push_int( e->selection.requestor ); + ref_push_string(_STR("requestor")); push_int((INT_TYPE) e->selection.requestor ); break; case GDK_PROXIMITY_IN: diff --git a/src/post_modules/GTK2/source/gdkpixmap.pre b/src/post_modules/GTK2/source/gdkpixmap.pre index 7b1a90e020..a2ac5d879f 100644 --- a/src/post_modules/GTK2/source/gdkpixmap.pre +++ b/src/post_modules/GTK2/source/gdkpixmap.pre @@ -58,7 +58,11 @@ void create(int|object image) if (f) g_object_unref(i); } else if (args && TYPEOF(Pike_sp[-1]) == PIKE_T_INT) { +#ifdef HAVE_GDKNATIVEWINDOW + gp=gdk_pixmap_foreign_new((GdkNativeWindow)Pike_sp[-1].u.integer); +#else gp=gdk_pixmap_foreign_new(Pike_sp[-1].u.integer); +#endif /* HAVE_GDKNATIVEWINDOW */ THIS->obj=G_OBJECT(gp); if (!THIS->obj) Pike_error("Failed to find remote pixmap\n"); diff --git a/src/post_modules/GTK2/source/gdkwindow.pre b/src/post_modules/GTK2/source/gdkwindow.pre index 7b81266e38..2f24e84a29 100644 --- a/src/post_modules/GTK2/source/gdkwindow.pre +++ b/src/post_modules/GTK2/source/gdkwindow.pre @@ -16,7 +16,11 @@ void create(GDK2.Window|int parent, mapping|void attributes) GdkWindow *w; INT_TYPE id; get_all_args(NULL,args,"%i",&id); +#ifdef HAVE_GDKNATIVEWINDOW + w=gdk_window_foreign_new((GdkNativeWindow)id); +#else w=gdk_window_foreign_new(id); +#endif /* HAVE_GDKNATIVEWINDOW */ THIS->obj=G_OBJECT(w); if (!THIS->obj) Pike_error("The window with id 0x%lx does not exist\n", diff --git a/src/post_modules/GTK2/source/gtkplug.pre b/src/post_modules/GTK2/source/gtkplug.pre index 1bf7ade6da..f8501b24c3 100644 --- a/src/post_modules/GTK2/source/gtkplug.pre +++ b/src/post_modules/GTK2/source/gtkplug.pre @@ -26,7 +26,11 @@ void create(int|mapping(string:mixed) socket_id_or_props) pgtk2_verify_setup(); { if (TYPEOF(Pike_sp[-args]) == PIKE_T_INT) { +#ifdef HAVE_GDKNATIVEWINDOW + GdkNativeWindow id; +#else INT_TYPE id; +#endif /* HAVE_GDKNATIVEWINDOW */ GtkWidget *gp; get_all_args(NULL,args,"%i",&id); gp=gtk_plug_new(id); @@ -39,6 +43,18 @@ void create(int|mapping(string:mixed) socket_id_or_props) pgtk2__init_this_object(); } -int get_id(); +int get_id() //! Gets the window id of this widget. - +{ + pgtk2_verify_inited(); + { +#ifdef HAVE_GDKNATIVEWINDOW + GdkNativeWindow a1; +#else + INT_TYPE a1; +#endif /* HAVE_GDKNATIVEWINDOW */ + a1 = gtk_plug_get_id( GTK_PLUG(THIS->obj) ); + my_pop_n_elems(args); + PGTK_PUSH_INT( a1 ); + } +} diff --git a/src/post_modules/GTK2/source/gtksocket.pre b/src/post_modules/GTK2/source/gtksocket.pre index 0187220abd..711345a64b 100644 --- a/src/post_modules/GTK2/source/gtksocket.pre +++ b/src/post_modules/GTK2/source/gtksocket.pre @@ -51,14 +51,44 @@ int id() push_int64 (wid); } -void add_id(int wid); +void add_id(int wid) //! Adds an XEMBED client, such as a W(Plug), to the W(Socket). +{ +#ifdef HAVE_GDKNATIVEWINDOW + GdkNativeWindow a0; +#else + INT_TYPE a0; +#endif /* HAVE_GDKNATIVEWINDOW */ + + if( args < 1 ) + SIMPLE_WRONG_NUM_ARGS_ERROR(NULL, 1); +#ifdef HAVE_GDKNATIVEWINDOW + a0 = (GdkNativeWindow)PGTK_GETINT(&Pike_sp[0-args]); +#else + a0 = PGTK_GETINT(&Pike_sp[0-args]); +#endif /* HAVE_GDKNATIVEWINDOW */ + pgtk2_verify_inited(); + gtk_socket_add_id( GTK_SOCKET(THIS->obj), a0 ); + RETURN_THIS(); +} -int get_id(); +int get_id() //! Gets the window id of a W(Socket) widget, which can then be used //! to create a client embedded inside the socket, for instance with //! GTK2.Plug->create(). - +{ + pgtk2_verify_inited(); + { +#ifdef HAVE_GDKNATIVEWINDOW + GdkNativeWindow a1; +#else + INT_TYPE a1; +#endif /* HAVE_GDKNATIVEWINDOW */ + a1 = gtk_socket_get_id( GTK_SOCKET(THIS->obj) ); + my_pop_n_elems(args); + PGTK_PUSH_INT( a1 ); + } +} /* int has_plug() //! Returns true if this socket is occupied --Apple-Mail=_94631E42-95DE-46C8-9177-895180E704B3 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 <html><head><meta http-equiv=3D"content-type" content=3D"text/html; = charset=3Dutf-8"></head><body style=3D"overflow-wrap: break-word; = -webkit-nbsp-mode: space; line-break: after-white-space;"><div><br = id=3D"lineBreakAtBeginningOfMessage"><div><br><blockquote = type=3D"cite"><div>On Apr 17, 2025, at 3:26=E2=80=AFPM, Lance Dillon = <[email protected]> wrote:</div><br = class=3D"Apple-interchange-newline"><div>I could test<br><br><div = id=3D"ymail_android_signature"><a id=3D"ymail_android_signature_link" = href=3D"https://mail.onelink.me/107872968?pid=3Dnativeplacement&c=3DUS= _Acquisition_YMktg_315_SearchOrgConquer_EmailSignature&af_sub1=3DAcqui= sition&af_sub2=3DUS_YMktg&af_sub3=3D&af_sub4=3D100002039&a= f_sub5=3DC01_Email_Static_&af_ios_store_cpp=3D0c38e4b0-a27e-40f9-a211-= f4e2de32ab91&af_android_url=3Dhttps://play.google.com/store/apps/detai= ls?id=3Dcom.yahoo.mobile.client.android.mail&listing=3Dsearch_organize= _conquer">Yahoo Mail: Search, Organize, Conquer</a></div> <br> = <blockquote style=3D"margin: 0 0 20px 0;"> <div = style=3D"font-family:Roboto, sans-serif; color:#6D00F6;"> <div>On Thu, = Apr 17, 2025 at 15:18, H. William = Welliver</div><div><[email protected]> wrote:</div> </div> <div = style=3D"padding: 10px 0 0 20px; margin: 10px 0 0 0; border-left: 1px = solid #6D00F6;"> <div dir=3D"ltr">I compiled pike on a system that has a = version of GTK2 that includes a typedef for GdkNativeWindow that the = GTK2 code doesn=E2=80=99t specifically address. The compiler (a recent = clang) errors on these implicit casts to and from GdkNativeWindow (which = I believe resolves to a platform dependent pointer) and integers that = the pike glue deals with. I was able to solve the errors but wanted to = get some feedback before I commit it, as I get the impression that = GdkNativeWindow was something added somewhere along the way, so there = probably may need to be some configure glue added. Is anyone using the = GTK2 module that might be able to test these changes to see if they = cause problems elsewhere? Or should I commit a best-guess fix and wait = to see how pikefarm reacts?<br></div><div dir=3D"ltr"><br></div><div = dir=3D"ltr">Bill<br></div> </div> = </blockquote></div></blockquote></div><br></div></body></html>= --Apple-Mail=_94631E42-95DE-46C8-9177-895180E704B3-- --Apple-Mail=_2E9A6DD3-DD09-48A7-934B-C2EC3BF0EF2F--