Subject: Re: bug#58771: 29.0.50; context submenu can not click when run emacs lucid build.

From: Mike Kupfer <[email-masked]>
Date: Thu, 12 Jan 2023 21:23:52 -0800

Eli Zaretskii wrote:

> > Cc: Feng Shu <[email-masked]>, Stephen Berman <[email-masked]>,
> >  [email-masked], Visuwesh <[email-masked]>
> > From: Mike Kupfer <[email-masked]>
> > Date: Wed, 11 Jan 2023 12:44:40 -0800
> > 
> > Po Lu wrote:
> > 
> > > I have a hunch.  If you touch globals.h in src, does it result in files
> > > under the lwlib directory being rebuilt?
> > 
> > Good call.  Nothing in lwlib gets rebuilt:
> 
> Which files in lwlib should be rebuilt?  And what do you see in
> lwlib/deps/ for those files?

We're particularly interested in seeing that lwlib/xlwmenu.o get rebuilt
when globals.h changes.  pop_up_menu() will not call XtGrabKeyboard() or
XtSetKeyboardFocus() if globals.f_lucid__menu_grab_keyboard is false.
And that seems to be what's behind all these intermittent problems with
Lucid popup menus.

lwlib/deps/xlwmenu.d looks okay to me, as it has:

xlwmenu.o: xlwmenu.c ../src/config.h ../src/conf_post.h ../src/lisp.h \
 ../lib/alloca.h ../lib/string.h ../lib/inttypes.h ../lib/attribute.h \
 ../lib/intprops.h ../lib/intprops-internal.h ../lib/verify.h \
 ../src/globals.h ../src/comp.h ../src/dynlib.h ../src/thread.h \
 ../src/regex-emacs.h ../src/lisp.h ../src/sysselect.h \
 ../lib/sys/select.h ../src/systhread.h ../lib/stdio.h xlwmenuP.h \

> Could it be that the root cause for this is that ALLOBJS is not
> defined in lwlib/Makefile.in?

I think you've identified the problem.  I tried hacking lwlib/Makefile
as follows:

--- Makefile~	2022-12-29 17:42:05.288751298 -0800
+++ Makefile	2023-01-12 21:08:24.717146041 -0800
@@ -57,6 +57,8 @@
 
 OBJS = lwlib.o $(TOOLKIT_OBJS) lwlib-utils.o
 
+ALLOBJS = $(OBJS)
+
 -include ${top_builddir}/src/verbose.mk
 
 AUTO_DEPEND = yes

Now, when I touch src/globals.h and run "make", xlwmenu.o does get
rebuilt.

...
make[2]: Entering directory '/home/kupfer/src/emacs-git/src'
make -C ../lwlib/ liblw.a
make[3]: Entering directory '/home/kupfer/src/emacs-git/lwlib'
  CC       lwlib.o
  CC       lwlib-Xlw.o
  CC       xlwmenu.o
  CC       lwlib-Xaw.o
  CC       lwlib-utils.o
  GEN      liblw.a
make[3]: Leaving directory '/home/kupfer/src/emacs-git/lwlib'
...

mike