[comp.windows.news] Here Menu!

montnaro@spyder.crd.ge.com (Skip Montanaro) (12/14/89)

Open Look allows you to pin menus to the screen. Unfortunately, they become
just other windows, and are subject to being covered up.  Consequently,
pinned menus sometimes (for me, often) get covered up, so there's little use
pinning them in the first place.

I'd like to see a "Here Menu!" function that would cause any pinned menus to
float to the top of the stack. Given the existing mouse semantics, I suspect
it might best be tied to a PointButton double-click over the root window.
Some might prefer to have pinnable menus that won't let themselves get
covered up, thus preserving current mouse semantics.

Any comments?

--
Skip (montanaro@crdgw1.ge.com)

amanda@mermaid.intercon.com (Amanda Walker) (12/14/89)

In article <MONTNARO.89Dec13141843@spyder.crd.ge.com>,
montnaro@spyder.crd.ge.com (Skip Montanaro) writes:
> I'd like to see a "Here Menu!" function that would cause any pinned menus to
> float to the top of the stack. Given the existing mouse semantics, I suspect
> it might best be tied to a PointButton double-click over the root window.
> Some might prefer to have pinnable menus that won't let themselves get
> covered up, thus preserving current mouse semantics.

Well, the idea of pinned menus being windows that "float" on top of everything
except other pinned menus seems to work pretty well on the Mac.  It seems
a little odd for about the first 5 minutes, and then your brain figures out
what's going on and it becomes quite nice.  This does, however, involve 
redoing parts of the window manager, which could range from easy to
impossible, depending on how pinned menus are actually implemented.  My
first guess would be that under X11/NeWS, it wouldn't be too bad, but on
a vanilla X11 server it would be pretty difficult.

Amanda Walker
InterCon Systems Corporation
--

stef@zweig.sun.com (Stephane Payrard) (12/17/89)

In article <1626@intercon.com> amanda@mermaid.intercon.com (Amanda Walker) writes:

   Path: sun!newstop!texsun!texbell!wuarchive!uunet!intercon!amanda@mermaid.intercon.com
   From: amanda@mermaid.intercon.com (Amanda Walker)
   Newsgroups: comp.windows.news
   Date: 13 Dec 89 21:54:18 GMT
   References: <MONTNARO.89Dec13141843@spyder.crd.ge.com>
   Sender: news@intercon.com
   Reply-To: amanda@mermaid.intercon.com (Amanda Walker)
   Lines: 20

   In article <MONTNARO.89Dec13141843@spyder.crd.ge.com>,
   montnaro@spyder.crd.ge.com (Skip Montanaro) writes:
   > I'd like to see a "Here Menu!" function that would cause any pinned menus to
   > float to the top of the stack. Given the existing mouse semantics, I suspect
   > it might best be tied to a PointButton double-click over the root window.
   > Some might prefer to have pinnable menus that won't let themselves get
   > covered up, thus preserving current mouse semantics.

   Well, the idea of pinned menus being windows that "float" on top of everything
   except other pinned menus seems to work pretty well on the Mac.  It seems
   a little odd for about the first 5 minutes, and then your brain figures out
   what's going on and it becomes quite nice.  This does, however, involve 
   redoing parts of the window manager, which could range from easy to
   impossible, depending on how pinned menus are actually implemented.  My
   first guess would be that under X11/NeWS, it wouldn't be too bad, but on
   a vanilla X11 server it would be pretty difficult.


   Amanda Walker
   InterCon Systems Corporation
   --

More precisely, if you use pswm (the default window manager of
Open-Windows 1.0) it is quite easy. You can even do it without exiting
xnews!!!.  If you use another wondow manager (I mean a X-based window
manager) you don't deserve this improvement.  ;-)

The following code does exactly what Skip Montanaro
proposes: a double click on the frame-buffer brings any pinned menus
on top of the hierarchy of the sons of the framebuffer.
Just execute the code  and the trick is done.

If you want to get it each time I guess you can add it to your
.user.ps or .startup.ps.
If you want to do it cleanly, read NeWS Programmers Guide p 102.

If you want to make the modif avalaible to everyone on your site, edit
$OPENWINHOME/etc/NeWS/desktop.ps.  Keep a copy of the original in the
case you make a mistake.


A double click is a selection of Level 2. I have slightly edited the
(already too long!)  method `adjustto' to call in such a case my new
method `pinnedmenustotop'.

In case of overlapping pinned menus the top ones repaint many times.
It seems that in that case (shuffling canvases) xnews is not smart
enough to coalesce the Damage envents even if I parenthese
`pinnedmenutotop' wih blockinputqueue and unblokinputqueue.

I think we can avoid these unwanted repaints by shuffling more
skillfully the pinned menus.  Instead of calling canvastotop for each
pinned menu top to bottom, we need to call canvastotop for the top
menu and use insertcanvasbelow (or modifying the canvas key
/CanvasBelow) to insert the remaining menu top to bottom.

(left as an exercice) ;-)


        stef (stef@sun.com)







DesktopSelectable begin

    /pinnedmenustotop {
        framebuffer /TopChild get dup null ne {
            null exch
            {  
                dup null eq { exit }if
                dup isinstance? 
                { /ClassName 1 index send /OpenLookMenuFrame eq 
                    { dup } if
                } if
                /CanvasBelow get
            } loop pop
            { dup null ne
                { canvastotop } 
                { exit }ifelse
            } loop pop
        } if pop
        
    } def

    % Override
    %
    /adjustto { %  event selection => -
	gsave
        dup /Level get 2 ge {
            /pinnedmenustotop self send
        } {
	begin
	    framebuffer createoverlay setcanvas
	    erasepage
	    X null eq {
		dup ExtractCoords                           %
	    } if
	    Preview? {
		PaintSel
	    }{
                currentdict [
                    3 -1 roll
		    EventCoords
		    X Y 4 2 roll
                    % Here we massage the bounding box so that the
                    % bounding boxes of the canvas' are included.
                    % They are extended by one pixel on the bottom and
                    % right.  This adjustment ensures that the
                    % definition of "inside" the bounding box includes
                    % the edges.  If this were not done you would not
                    % be able to select canvases that were exactly on
                    % the right or bottom edges of the framebuffer.
                    %
		    points2rect                 % x y w h
                    exch 1 add exch             % x y w+1 h
                    3 -1 roll 1 sub 3 1 roll    % x y-1 w+1 h
                    1 add                       % x y-1 w+1 h+1
                    rect2points
		    /children- framebuffer send {      % x0 y0 x1 y1 can
			% Check whether the canvas is inside the
			% bounding box.
			dup /Mapped get {
			    5 copy true getbbox
			    7 index 4 index le          %  llx?
                            7 index 4 index le          %  llx? lly?
			    7 index 4 index ge          %  llx? lly? urx?
                            7 index 4 index ge          %  llx? lly? urx? ury?
			    and and and
			    [ 10 2 roll cleartomark                 % bool
			    {
				5 1 roll
			    }{
				pop
			    } ifelse
			}{
			    pop
			} ifelse
		    } forall
		    pop pop pop pop
		] /ToggleSelection SendToCanvases
		/X null def
	    } ifelse
	end
	grestore
            } ifelse
    } def


end % DesktopSelectable
 



--
--
Stephane Payrard -- stef@sun.com -- (415) 336 3726
Sun Microsystems -- 2550 Garcia Avenue --  M/S 16-40 -- Mountain View  CA 94043