[comp.windows.x] Xman menu

jta@bilbo.locus (Jim Anderson) (04/21/89)

Xman's habit of popping up a menu when you move the cursor through it's
title bar is INCREDIBLY annoying.  Is there a way to require a click in
this area to bring up the offending menu?

kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) (04/22/89)

> Xman's habit of popping up a menu when you move the cursor through it's
> title bar is INCREDIBLY annoying.  Is there a way to require a click in
> this area to bring up the offending menu?

Fixed in the next release :-) Seriously though, Xman will have real pull down
and popup menus in the version released in X11R4.  For now though you will 
have to live with it.

						Chris D. Peterson     
						MIT X Consortium 

jchaney@moniz.bcm.tmc.edu (05/08/89)

>> Xman's habit of popping up a menu when you move the cursor through it's
>> title bar is INCREDIBLY annoying.  Is there a way to require a click in
>> this area to bring up the offending menu?

>Fixed in the next release :-) Seriously though, Xman will have real pull down
>and popup menus in the version released in X11R4.  For now though you will
>have to live with it.

I always liked xman but HATED the menus always appearing when ever I moved
my cursor through the window.  I have a I have enclosed a patch for
that.  The entire patch is one word in one file.  EnterWindowMask is
changed to ButtonPressMask in the file buttons.c.  With this change
you need to button down to have the menu appear.  Any button will do.

Enjoy.



*** buttons.c.orig	Mon May  8 10:08:47 1989
--- buttons.c	Mon May  8 10:34:16 1989
***************
*** 212,218 ****
  
    XtPanedSetMinMax( man_globals->label, 2 ,
  		   Height( man_globals->label ) );
!   XtAddEventHandler(man_globals->label, (Cardinal) EnterWindowMask,
  		    FALSE ,PopUpMenu, NULL);
  
  /* Create Directory */
--- 212,218 ----
  
    XtPanedSetMinMax( man_globals->label, 2 ,
  		   Height( man_globals->label ) );
!   XtAddEventHandler(man_globals->label, (Cardinal) ButtonPressMask,
  		    FALSE ,PopUpMenu, NULL);
  
  /* Create Directory */
				R. Jesse Chaney, jchaney@bcm.tmc.edu
				Office of VPIT
				Baylor College of Medicine
				Houston, Texas 77030

steve@acorn.co.uk (Steve "Daffy" Hunt) (05/11/89)

In article <8904211857.AA26536@expo.lcs.mit.edu> kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) writes:
>
>> Xman's habit of popping up a menu when you move the cursor through it's
>> title bar is INCREDIBLY annoying.  Is there a way to require a click in
>> this area to bring up the offending menu?
>
>Fixed in the next release :-) Seriously though, Xman will have real pull down
>and popup menus in the version released in X11R4.  For now though you will 
>have to live with it.
>
>						Chris D. Peterson     
>						MIT X Consortium 

(Sorry this is so late; I had a BIG comp.windows.x backlog!)

Here is a fix to this problem that I wrote ages ago
for R2, and just brought up to date for R3.  It
replaces the much-hated pop-up menu with a static
control panel and IMHO makes xman a good deal friendlier.

Cut on the line, run it through "sh" to produce two
files, "xmanpatch" and "xmanpatch.README".  Apply the
patches in the normal way.

Please let me know if it all fails horribly!

	Enjoy
		Steve Hunt.


------------------ CUT HERE -------------------


#!/bin/sh
# This is a shell archive -- extract with sh, not csh!
#
# To extract, remove all the lines above the line
# reading #!/bin/sh.  Then feed the rest of this file
# to /bin/sh.  There is an exit command at the end,
# so you do not need to remove any trailing junk.
#
# Overwrite check
if test -f xmanpatch.README
then
echo Will not overwrite existing file xmanpatch.README
else
echo Extracting xmanpatch.README, checksum=1123
sed -e '1,$s/^X//' << \ShArChIvE > xmanpatch.README
XX11r3 XMAN PATCHES.
X-------------------
X
XThese patches provide an alternative to Xman's pop-up
Xmain menu.  It is conditionally compiled on the CPP
Xflags CONTROLPANEL.
X
XWhat these patches do is modify the widget tree so that there
Xis a fixed button box at the top of the manpage.  Each of
Xthe buttons that used to be in the main menu now appear in the
Xbutton box.  The "section" and "search" submenus are untouched; I
Xdid consider having all of these available all the time (like
XXedit does) but I decided that it was a waste of screen space.
X
XNow, Xman changed A LOT between R2 and R3 so there may be
Xrepercussions that I have not noticed.  Be warned.
X
XI want no flames about the "hackiness" of it -- I did this
Xlong ago as my first attempt at modifying an Xt program.
XAll I will say is that it is in the spirit of Xman itself :-)
X
XSystem: X11R3, Patches 1-9.  You will find that the first hunk
Xof each patch will fail, because I have an extra $Header$ that
Xis not in the standard release.  Nothing serious.  Four files
Xare modified -- defs.h, buttons.c, handler.c and Imakefile.
X
X
X	Enjoy --  Steve Hunt @ Acorn, May 1989.
ShArChIvE
if test `wc -c <xmanpatch.README` -ne 1123
then
echo Extraction of xmanpatch.README suspect. Checksum was `wc -c <xmanpatch.README`, should have been 1123 1>&2
fi
# end of overwrite check
fi
# Overwrite check
if test -f xmanpatch
then
echo Will not overwrite existing file xmanpatch
else
echo Extracting xmanpatch, checksum=10569
sed -e '1,$s/^X//' << \ShArChIvE > xmanpatch
X*** /tmp/,SMSt1009523	Mon Feb 27 19:46:37 1989
X--- defs.h	Thu May 11 16:20:31 1989
X***************
X*** 57,64 ****
X--- 57,69 ----
X  
X  /* definitions of string to use for show both and show one. */
X  
X+ #ifdef CONTROLPANEL
X+ #define SHOW_BOTH "Show Both"
X+ #define SHOW_ONE "Show One"
X+ #else
X  #define SHOW_BOTH "Show Both Screens"
X  #define SHOW_ONE "Show One Screen"
X+ #endif
X  
X  /* 
X   * Things will not look right if you change these names to make 
X*** /tmp/,SMSt1009528	Mon Feb 27 19:46:24 1989
X--- buttons.c	Thu May 11 16:20:08 1989
X***************
X*** 2,8 ****
X   * xman - X window system manual page display program.
X   *
X   * $XConsortium: buttons.c,v 1.3 89/01/06 18:41:51 kit Exp $
X!  * $Header: /smsc/x11:clients/xman/buttons.c:x11.-1  1.2  $
X   *
X   * Copyright 1987, 1988 Massachusetts Institute of Technology
X   *
X--- 2,8 ----
X   * xman - X window system manual page display program.
X   *
X   * $XConsortium: buttons.c,v 1.3 89/01/06 18:41:51 kit Exp $
X!  * $Header: /smsc/x11:clients/xman/buttons.c:x11  1.3  $
X   *
X   * Copyright 1987, 1988 Massachusetts Institute of Technology
X   *
X***************
X*** 44,49 ****
X--- 44,56 ----
X  #define TOPBUTTONS 3
X  #define TOPARGS 5
X  
X+ #ifdef CONTROLPANEL
X+ extern void sectioncontrolCallback(), searchcontrolCallback(), directorycontrolCallback(),
X+ 
X+ 	manpagecontrolCallback(), helpcontrolCallback(), bothcontrolCallback(),
X+ 	removecontrolCallback(), opencontrolCallback(), quitcontrolCallback();
X+ #endif
X+ 
X  void
X  MakeTopMenuWidget()
X  {
X***************
X*** 176,181 ****
X--- 183,192 ----
X    Arg arglist[MANPAGEARGS];	/* An argument list for widget creation */
X    Cardinal num_args;		/* The number of arguments in the list. */
X    Widget top, pane, section,search;	/* Widgets */
X+ #ifdef CONTROLPANEL
X+   Widget controlbox, sectioncontrol, directorycontrol, manpagecontrol, bothcontrol,
X+          helpcontrol, searchcontrol, removecontrol, opencontrol, quitcontrol;
X+ #endif
X    ManPageWidgets * mpw = &(man_globals->manpagewidgets);
X  
X    num_args = (Cardinal) 0;
X***************
X*** 212,220 ****
X--- 223,293 ----
X  
X    XtPanedSetMinMax( man_globals->label, 2 ,
X  		   Height( man_globals->label ) );
X+ #ifndef CONTROLPANEL
X    XtAddEventHandler(man_globals->label, (Cardinal) EnterWindowMask,
X  		    FALSE ,PopUpMenu, NULL);
X+ #endif
X  
X+ #ifdef CONTROLPANEL
X+ 
X+ /* Create the control box full of buttons */
X+ {
X+   Arg cargs[2];
X+ 
X+   cargs[0].name = XtNskipAdjust; cargs[0].value = (XtArgVal) True;
X+   controlbox = XtCreateManagedWidget("controlbox", formWidgetClass,
X+ 				     pane, cargs, 1);
X+ /*  XtPanedSetMinMax (controlbox, 12, 12);*/
X+ 
X+   cargs[0].name = XtNfromHoriz; cargs[0].value = NULL;
X+   cargs[1].name = XtNhorizDistance; cargs[1].value = (XtArgVal) 4;
X+ 
X+   sectioncontrol = XtCreateManagedWidget("Section...", commandWidgetClass,
X+ 					 controlbox, cargs, 2);
X+   XtAddCallback (sectioncontrol, XtNcallback, sectioncontrolCallback, (caddr_t)man_globals);
X+   
X+   cargs[0].value = (XtArgVal) sectioncontrol;
X+   searchcontrol = XtCreateManagedWidget("Search...", commandWidgetClass,
X+ 					controlbox, cargs, 2);
X+   XtAddCallback (searchcontrol, XtNcallback, searchcontrolCallback, (caddr_t)man_globals);
X+   
X+   cargs[0].value = (XtArgVal) searchcontrol;
X+   directorycontrol = XtCreateManagedWidget("Directory", commandWidgetClass,
X+ 					   controlbox, cargs, 2);
X+   XtAddCallback (directorycontrol, XtNcallback, directorycontrolCallback, (caddr_t)man_globals);
X+   
X+   cargs[0].value = (XtArgVal) directorycontrol;
X+   manpagecontrol = XtCreateManagedWidget("Manpage", commandWidgetClass,
X+ 					 controlbox, cargs, 2);
X+   XtAddCallback (manpagecontrol, XtNcallback, manpagecontrolCallback, (caddr_t)man_globals);
X+   
X+   cargs[0].value = (XtArgVal) manpagecontrol;
X+   bothcontrol = XtCreateManagedWidget(SHOW_BOTH, commandWidgetClass, /* SHOW_BOTH in defs.h */
X+ 				      controlbox, cargs, 2);
X+   XtAddCallback (bothcontrol, XtNcallback, bothcontrolCallback, (caddr_t)man_globals);
X+   
X+   cargs[0].value = (XtArgVal) bothcontrol;
X+   helpcontrol = XtCreateManagedWidget("Help", commandWidgetClass,
X+ 				      controlbox, cargs, 2);
X+   XtAddCallback (helpcontrol, XtNcallback, helpcontrolCallback, (caddr_t)man_globals);
X+   
X+   cargs[0].value = (XtArgVal) helpcontrol;
X+   removecontrol = XtCreateManagedWidget("Remove", commandWidgetClass,
X+ 					controlbox, cargs, 2);
X+   XtAddCallback (removecontrol, XtNcallback, removecontrolCallback, (caddr_t)man_globals);
X+ 
X+   cargs[0].value = (XtArgVal) removecontrol;
X+   opencontrol = XtCreateManagedWidget("New View", commandWidgetClass,
X+ 				      controlbox, cargs, 2);
X+   XtAddCallback (opencontrol, XtNcallback, opencontrolCallback, (caddr_t)man_globals);
X+ 
X+   cargs[0].value = (XtArgVal) opencontrol;
X+   quitcontrol = XtCreateManagedWidget("Quit", commandWidgetClass,
X+ 				      controlbox, cargs, 2);
X+   XtAddCallback (quitcontrol, XtNcallback, quitcontrolCallback, (caddr_t)man_globals);
X+ }
X+ #endif
X+ 
X  /* Create Directory */
X  
X    if (full_instance) {
X***************
X*** 234,239 ****
X--- 307,323 ----
X  
X  /* Create Manpage */
X  
X+ #ifdef CONTROLPANEL
X+   /* hook my command widgets into the manpage global structure */
X+ 
X+   section = sectioncontrol;
X+   man_globals->put_up_directory = directorycontrol;
X+   man_globals->put_up_manpage = manpagecontrol;
X+   man_globals->help_button = helpcontrol;
X+   search = searchcontrol;
X+   man_globals->both_shown_button = bothcontrol;
X+ #endif CONTROLPANEL
X+ 
X    font_height = (resources.fonts.normal->max_bounds.ascent + 
X  		   resources.fonts.normal->max_bounds.descent);
X  
X***************
X*** 250,257 ****
X--- 334,344 ----
X  
X  /* make popup widgets. */
X  
X+ #ifndef CONTROLPANEL
X    MakeTopPopUpWidget(man_globals, man_globals->label, &section, &search,
X  		     full_instance);
X+ #endif
X+ 
X    if (full_instance) {
X      MakeDirPopUpWidget(man_globals, section);
X      MakeSearchWidget(man_globals, search);
X***************
X*** 267,273 ****
X--- 354,363 ----
X      XtSetSensitive(man_globals->put_up_directory,FALSE);
X      XtSetSensitive(man_globals->both_shown_button, FALSE); 
X      XtSetSensitive(man_globals->help_button, FALSE);       
X+ #ifndef CONTROLPANEL
X+     /* Don't want this if CONTROLPANEL, because we do not have vertically ranged buttons */
X      MakeLong( XtParent(man_globals->help_button) ); /* Fix top menu. */
X+ #endif
X    }
X  }
X  
X*** /tmp/,SMSt1009533	Mon Feb 27 19:46:50 1989
X--- handler.c	Thu May 11 16:21:15 1989
X***************
X*** 143,151 ****
X--- 143,264 ----
X    /* We have used this guy, pop down the menu. */
X    
X    XtPopdown(  XtParent(XtParent(w)) );
X+ }
X  
X+ #ifdef CONTROLPANEL
X  
X+ /* lots of callbacks.  They all receive manpage_globals as client_data. */
X+ 
X+ void sectioncontrolCallback (w)
X+ 	Widget w;
X+ {
X+ 	PopUpMenu(w,NULL,NULL);
X  }
X+ 
X+ void searchcontrolCallback (w)
X+ 	Widget w;
X+ {
X+ 	PopUpMenu(w,NULL,NULL);
X+ }
X+ 
X+ void directorycontrolCallback (w, g)
X+ 	Widget w;
X+ 	caddr_t g;
X+ {
X+ 	ManpageGlobals *man_globals = (ManpageGlobals *) g;
X+ 	w = w;
X+ 	ChangeLabel(man_globals->label,
X+ 		    man_globals->section_name[man_globals->current_directory]);
X+ 	XtUnmanageChild(man_globals->manpagewidgets.manpage);
X+ 	XtManageChild(man_globals->manpagewidgets.directory);
X+ }
X+ 
X+ void manpagecontrolCallback (w, g)
X+ 	Widget w;
X+ 	caddr_t g;
X+ {
X+ 	ManpageGlobals *man_globals = (ManpageGlobals *) g;
X+ 	w = w;
X+ 	ChangeLabel(man_globals->label,man_globals->manpage_title);
X+ 	XtUnmanageChild(man_globals->manpagewidgets.directory);
X+ 	XtManageChild(man_globals->manpagewidgets.manpage);
X+ }
X+ 
X+ void helpcontrolCallback (/*-w, g, junk-*/)
X+ /*-	Widget w; -*/
X+ /*-	caddr_t g, junk; -*/
X+ {
X+ 	PopupHelp();
X+ }
X+ 
X+ void bothcontrolCallback (w, g)
X+ 	Widget w;
X+ 	caddr_t g;
X+ {
X+ 	ManpageGlobals *man_globals = (ManpageGlobals *) g;
X+ 	char * label_str;
X+ 
X+ 	ChangeLabel(man_globals->label,
X+ 		    man_globals->section_name[man_globals->current_directory]);
X+ 	if (man_globals->both_shown == TRUE) {
X+ 		label_str = SHOW_BOTH;
X+ 		XtUnmanageChild(man_globals->manpagewidgets.manpage);
X+ 		man_globals->both_shown = FALSE;
X+ 	}
X+ 	else {
X+ 		Widget manpage,dir;
X+ 		
X+ 		manpage = man_globals->manpagewidgets.manpage;
X+ 		dir = man_globals->manpagewidgets.directory;
X+ 		
X+ 		label_str = SHOW_ONE;
X+ 		XtPanedSetMinMax(dir, resources.directory_height,
X+ 				 resources.directory_height);
X+ 		XtUnmanageChild(manpage);
X+ 		XtManageChild(dir);
X+ 		XtManageChild(manpage);
X+ 		man_globals->both_shown = TRUE;
X+ 		/* Allow it to be any size. */
X+ 		XtPanedSetMinMax(dir,1,10000);
X+ 	}
X+ 	/*
X+ 	 *  Pop the menu down, so the user does not see the resizing of the buttons. 
X+ 	 * XtPopDown is clever enought not do try to popdown unless the window
X+ 	 * is up so very little time is wasted in the extra popdown call later.
X+ 	 */
X+ 	ChangeLabel(man_globals->both_shown_button, label_str);
X+ 	/* if both are shown there is no need to switch between the two. */
X+ 	XtSetSensitive(man_globals->put_up_manpage,!man_globals->both_shown);
X+ 	XtSetSensitive(man_globals->put_up_directory,!man_globals->both_shown);
X+ 	MakeLong( XtParent(w) );
X+ }
X+ 
X+ void removecontrolCallback (w, g)
X+ 	Widget w;
X+ 	caddr_t g;
X+ {
X+ 	ManpageGlobals *man_globals = (ManpageGlobals *) g;
X+ 	KillManpage(man_globals);
X+ 	if (man_pages_shown == 0)
X+ 		Quit(w);
X+ }
X+ 
X+ void opencontrolCallback (/*-w, g, junk-*/)
X+ /*-	Widget w; -*/
X+ /*-	caddr_t g, junk; -*/
X+ {
X+ 	(void) CreateManpage();
X+ 	man_pages_shown++;
X+ }
X+ 
X+ void quitcontrolCallback (w/*-, g, junk-*/)
X+ 	Widget w;
X+ /*-	caddr_t g, junk; -*/
X+ {
X+ 	Quit(w);
X+ }
X+ 
X+ #endif
X  
X  /*	Function Name: PopUpMenu
X   *	Description: This function pops up the popup child of the given widget
X*** /tmp/,SMSt1009538	Thu Feb 23 14:51:24 1989
X--- Imakefile	Thu May 11 16:25:51 1989
X***************
X*** 25,31 ****
X  #
X  #  Original idea borrowed from an X10 implementation created by Barry Shein
X  #
X!         DEFINES = -DHELPFILE=\"$(LIBDIR)$(PATHSEP)xman.help\"
X  LOCAL_LIBRARIES = $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB)
X             SRCS = ScrollByL.c handler.c man.c pages.c buttons.c help.c menu.c \
X                    search.c globals.c main.c misc.c tkfuncs.c
X--- 25,31 ----
X  #
X  #  Original idea borrowed from an X10 implementation created by Barry Shein
X  #
X!         DEFINES = -DHELPFILE=\"$(LIBDIR)$(PATHSEP)xman.help\" -DCONTROLPANEL
X  LOCAL_LIBRARIES = $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB)
X             SRCS = ScrollByL.c handler.c man.c pages.c buttons.c help.c menu.c \
X                    search.c globals.c main.c misc.c tkfuncs.c
ShArChIvE
if test `wc -c <xmanpatch` -ne 10569
then
echo Extraction of xmanpatch suspect. Checksum was `wc -c <xmanpatch`, should have been 10569 1>&2
fi
# end of overwrite check
fi
#
# End of shell archive
#
exit 0