tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* using VNC for CDE login, keyboard mapping
@ 2003-02-19 15:08 Lucio Chiappetti
  2003-04-04 10:25 ` which CDE workspace am I in ? Lucio Chiappetti
  0 siblings, 1 reply; 3+ messages in thread
From: Lucio Chiappetti @ 2003-02-19 15:08 UTC (permalink / raw)


Anyvody familiar with VNC on Alpha ? If so can you solve the following
problem ?

I want to use VNC to access a CDE display (inclusive of dtlogin) on a
"server" machine (I plan to remove the console screen of it when this
succeeds) from my "viewer" machine.

- The viewer machine currently has an old version of the OS (Digital Unix
  3.2) and a 3.3.2 VNC binary distribution from the original ORL site
  (which I always used).

- The server machine has a newer version of the OS (Tru64 4.0g)
  recently installed and the 3.3.3r1 VNC binary distribution just
  installed from
  ftp://public.arl.arizona.edu/pub/sware/vnc-current_osf.tgz

(1) running a full CDE session

  In the past I used my Unix VNC viewer to connect mainly to PC server
  sessions started manually, or to NT sessions started in service mode
  (i.e. passing thru a login screen), or to Unix (HPUX or Solaris) servers
  started manually on the remote machine or via rsh (this means my
  viewer "jumps in" a CDE session of the user who started the server).

  Now I want to run the VNC server at boot, and that it displays the
  dtlogin screen when I connect from the viewer.

  I managed to do that as follows :

    a) the VNC server shall be started as
       vncserver -once -query servername:1

    b) the xstartup file (in the /.vnc directory of root) shall be
       a zero-size file

    c) the /etc/dt/config/Xservers shall contain an additional line
       besides the default one, in order to use XDMCP

       :0   Local local@console /usr/bin/X11/X :0
       :1   Local local@none    XXX :1 YYY -once -query servername

    d) here I am not really sure about what should go in the second
       field (I wrote VNC instead of Local, but could write anything)

       and also I am not sure about the third field (local@none)

       YYY for me is -geometry 1268x1024 (the idea is that I could
       run full screen as the two Alphas are identical)

       XXX is /myownpath/myvncserver which is a copy of the vncserver
       script where I commented out the lines in sub SanityCheck which
       give trouble at boot

  I tested the above by trial and errors, and apparently I am able to
  connect with a viewer and get a nearly normal CDE login screen (no
  dxconsole though).

  I get the login mask, I can type the username and see it echoed
  correctly (so AT THIS STAGE the keyboard works !!!), then type the
  password (and it also is recognised since I am logged in). After that I
  cannot work because of the following keyboard problem.

(2) keyboard problem

  I can use the mouse in menus and graphical clients, but when I type
  something in a terminal window (dxterm) in the VNC screen I get
  rubbish : e.g. I type a and get 3, I type x and get 7, I type carriage
  return and get a comma ....

  ... it is impossible to work !

  I added to my root menu the "xev" and "dxkeycaps" programs. The latter
  behaves funny (comes out with the kbd layout but with no text at all)

  xev works, and it shows the same problem, e.g.
  key "a" is keycode 38 keysim ox33 which gives "3".

  Since I discovered that the numeric keypad numbers and enter key work,
  I prepared some scripts called 1, 2, 3 etc.

  One of them does a xmodmap -pk > file, and the other one issues the
  xmodmap -display :1 /.dxkeycaps (which is the same command normally
  issued by the .login procedure on the default display).

  Issuing it explicitly on VNC display :1 has no effect to cure the
  problem. Also the result of xmodmap -pk look similar when generated
  in the VNC session, in a normal session on the new Alpha, or on
  my old Alpha (there are some little differences but none affecting
  the main keys ... the most noticeable and strange is that the first
  line says "There are 4 KeySyms per KeyCode" on both cases on the new
  Alpha, and "There are 2 KeySyms per KeyCode" on my old one !

  I cannot swear that the problem with the keyboard has been always there.
  I installed VNC on the 4.0g system last Friday, and I tested it very
  quickly. I had the impression it worked, but cannot swear that I tried
  to type something, or just tested opening and closing windows, changing
  workspaces and other window manager functions.

  I suspect it worked before I tried the tests to run a full CDE session
  inclusive of login. Maybe there is something which went amiss and I
  forgot to repristinate (despite of many reboots and xlogin stop/start).

  I have no keyboard problem now during the VNC+dtlogin phase !!

  But I have this keyboard problem even I start VNC at user level
  on the server with

    vncserver -nolisten local :1

  and connect to it from the 3.2 machine as   vncviewer servername:1

  I do not have the problem if my viewer connects to a Solaris server
  started in the same way. But connecting to the new server I have the
  problem with any viewer on any machine, even a viewer on the same
  machine as the server !!


----------------------------------------------------------------------------
Lucio Chiappetti - IASF/CNR - via Bassini 15 - I-20133 Milano (Italy)
----------------------------------------------------------------------------
"There are no news of scientific discoveries  done by administration boards,
presidents or directors general"
                     L.Maiani - CERN & INFN - Corriere della Sera 06/02/2003
----------------------------------------------------------------------------
For more info : http://www.mi.iasf.cnr.it/~lucio/personal.html
----------------------------------------------------------------------------



^ permalink raw reply	[flat|nested] 3+ messages in thread

* which CDE workspace am I in ?
  2003-02-19 15:08 using VNC for CDE login, keyboard mapping Lucio Chiappetti
@ 2003-04-04 10:25 ` Lucio Chiappetti
  2003-04-04 15:59   ` PARTIAL SUMMARY: " Lucio Chiappetti
  0 siblings, 1 reply; 3+ messages in thread
From: Lucio Chiappetti @ 2003-04-04 10:25 UTC (permalink / raw)


I have customized my CDE session (under Tru64 4.0g) to have a look I like,
i.e. I got rid of the control panel altogether, and use the root menu to
switch from one workspace to another. Essentially I get a traditional
Motif session with 4 workspaces.

I have assigned to each workspace a different background colour, but I'd
like to have a better way to tell me which workspace I am in, with a name
either as

  - a little icon with the workspace name
  - a script which could set an environment variable (which I could then
    use to annotate the title bar of my terminals, they currently say
    "Host xxxx : user yyy on terminal zzz" and I could easily add
    "on workspace www" if I'd a way to get it.

Can this be done ?

----------------------------------------------------------------------------
Lucio Chiappetti - IASF/CNR - via Bassini 15 - I-20133 Milano (Italy)
----------------------------------------------------------------------------
L'Italia ripudia la guerra [...] come    Italy repudiates war {...] as a
mezzo di risoluzione delle controversie  way of resolution of  international
internazionali                           controversies
                [Art. 11 Constitution of the Italian Republic]
----------------------------------------------------------------------------
For more info : http://www.mi.iasf.cnr.it/~lucio/personal.html
----------------------------------------------------------------------------



^ permalink raw reply	[flat|nested] 3+ messages in thread

* PARTIAL SUMMARY: which CDE workspace am I in ?
  2003-04-04 10:25 ` which CDE workspace am I in ? Lucio Chiappetti
@ 2003-04-04 15:59   ` Lucio Chiappetti
  0 siblings, 0 replies; 3+ messages in thread
From: Lucio Chiappetti @ 2003-04-04 15:59 UTC (permalink / raw)


On Fri, 4 Apr 2003, Lucio Chiappetti wrote:

> ... I'd like to have a better way to tell me which workspace I am in,
> with a name either as
>
>   - a little icon with the workspace name
>   - a script which could set an environment variable [...]

I have discovered the man pages and the online documentation for dtksh,
and learned quite a bit about X (but not enough ?!)

I have therefore solved the second problem above. The first script
enclosed essentially flashes a little useless widget, but in the process
of doing so returns the workspace number to the terminal. I could
therefore use an assignment like set myswp=`myworkspacefast` (the name of
the script) and use it in my standard script to set window banners in
addition to host, username and tty.

But you know the saying "appetite comes while eating".

During my exercises I discovered I could keep the workspace number
permanently up (e.g. in the widget title bar). I could even have the
widget occupy all workspaces, and define a callback which automatically
updates the title whenever I change workspace.

This is exemplified by the second script, which is a sort of solution to
my first problem.

It has a little imperfection. When I call it (myworkspace.standalone),
I cannot force the window to appear where I want. It always appears in the
top left corner. Looks a window manager issue, but other applications
behave differently.

Also more appetite comes. I now want the above widget to come out at
login. I did several tries, like updating the .dt/session/home/dt.session
by hand, or calling up the CDE control panel, with no result. In
particular using the control panel "set home session" did not alter the
above file !

After which a more careful reading of man dtksh and of the example script
contained therein (which I stripped a lot) taught me that applications
to be saved in the home session require to be aware of that (or the
session manager has to be aware of the application)

So I copied back in (third script) the code in man dtksh. This way a "set
home session" writes the correct commands. It also saves a "session file"
which in my case is useless/redundant (it contains "Deiconified" and the
list of the 4 ws0 ws1 ws2 ws3).

BUT STILL WHEN I LOGIN THE WIDGET IS RESTARTED not only in the top
left corner but also ONLY IN WORKSPACE 1. This irrespective of the fact
that both the session file and my code tell it to occupy all workspaces
(one at a turn or all in a go).

I tried also some variations simplifying the code, ignoring the session
file, or forcing occupation of one workspace at a time, but in all cases
when started from login it occupies only workspace 1 (if I manually occupy
all wsp's it works, and if I call it manually it occupies all wsp's)

What's wrong ?

----------------------------------------------------------------------------
Lucio Chiappetti - IASF/CNR - via Bassini 15 - I-20133 Milano (Italy)
----------------------------------------------------------------------------
L'Italia ripudia la guerra [...] come    Italy repudiates war {...] as a
mezzo di risoluzione delle controversie  way of resolution of  international
internazionali                           controversies
                [Art. 11 Constitution of the Italian Republic]
----------------------------------------------------------------------------
For more info : http://www.mi.iasf.cnr.it/~lucio/personal.html
----------------------------------------------------------------------------

-------------------------------------------------------------------
Script 1 : This script returns the workspace number (1-4) to terminal
-------------------------------------------------------------------
#! /usr/dt/bin/dtksh
       XtInitialize TOPLEVEL wmProtTest Dtksh "$@"
       XtCreateManagedWidget DA da XmDrawingArea $TOPLEVEL
       XtSetValues $DA height:1  width:160
       XtSetValues $TOPLEVEL title:"prova"
       XtRealizeWidget $TOPLEVEL
       XtScreen MYSCREEN $DA
       XRootWindowOfScreen RW $MYSCREEN
       DtWsmGetCurrentWorkspace $(XtDisplay "-" $TOPLEVEL)  $RW CURRENT_WS_LIST
       XmGetAtomName NAME $(XtDisplay "-" $TOPLEVEL) $CURRENT_WS_LIST
           NUMBER=${NAME##ws}
           NUMBER=$(($NUMBER+1))
           echo $NUMBER
       XtSetValues $TOPLEVEL title:"workspace $NUMBER"
       XSync $(XtDisplay "-" $TOPLEVEL) False
       exit

-------------------------------------------------------------------
Script 2 : This script returns the workspace number (1-4) in a widget
-------------------------------------------------------------------
#! /usr/dt/bin/dtksh
       MyCallBack()
       {
           XmGetAtomName NAME $(XtDisplay "-" $TOPLEVEL) $CB_CALL_DATA
           NUMBER=${NAME##ws}
           NUMBER=$(($NUMBER+1))
       XtSetValues $TOPLEVEL title:"workspace $NUMBER"
       XSync $(XtDisplay "-" $TOPLEVEL) False
       }
       XtInitialize TOPLEVEL wmProtTest Dtksh "$@"
       XtCreateManagedWidget DA da XmDrawingArea $TOPLEVEL
       XtSetValues $DA height:1  width:160
       XtSetValues $DA x:+1065 y:+332
       XtSetValues $TOPLEVEL title:"prova"
       XmInternAtom SAVE_SESSION_ATOM $(XtDisplay "-" $TOPLEVEL) "WM_SAVE_YOURSELF" True
       XtRealizeWidget $TOPLEVEL
       XmAddWMProtocols $TOPLEVEL $SAVE_SESSION_ATOM
       XtScreen MYSCREEN $DA
       XRootWindowOfScreen RW $MYSCREEN
       DtWsmGetCurrentWorkspace $(XtDisplay "-" $TOPLEVEL)  $RW CURRENT_WS_LIST
       XmGetAtomName NAME $(XtDisplay "-" $TOPLEVEL) $CURRENT_WS_LIST
           NUMBER=${NAME##ws}
           NUMBER=$(($NUMBER+1))
       XtSetValues $TOPLEVEL title:"workspace $NUMBER"
       DtWsmOccupyAllWorkspaces $(XtDisplay "-" $TOPLEVEL) $(XtWindow "-" $TOPLEVEL)
       XSync $(XtDisplay "-" $TOPLEVEL) False
       DtWsmAddCurrentWorkspaceCallback NEW $DA MyCallBack
       XtMainLoop

-------------------------------------------------------------------
Script 3 : as script 2 but should be session management aware
-------------------------------------------------------------------
#! /usr/dt/bin/dtksh
#
#      this call back acts at change of workspace
       MyCallBack()
       {
           XmGetAtomName NAME $(XtDisplay "-" $TOPLEVEL) $CB_CALL_DATA
           NUMBER=${NAME##ws}
           NUMBER=$(($NUMBER+1))
       XtSetValues $TOPLEVEL title:"workspace $NUMBER"
       XSync $(XtDisplay "-" $TOPLEVEL) False
       }
#
#     this from the man page
       # Function invoked when the session is being ended by the user
       SessionCallback()
       {
         # Get the name of the file into which we should save our
         # session information
         if DtSessionSavePath $TOPLEVEL PATH SAVEFILE; then
           exec 9>$PATH
           # Save off whether we are currently in an iconified state
           if DtShellIsIconified $TOPLEVEL ; then
           print -u9 'Iconified'
           else
           print -u9 'Deiconified'
           fi
           # Save off the list of workspaces we currently reside in
           if DtWsmGetWorkspacesOccupied $(XtDisplay "-" $TOPLEVEL) $(XtWindow "-" $TOPLEVEL) CURRENT_WS_LIST ;
           then
           # Map the comma-separated list of atoms into
           # their string representation
           oldIFS=$IFS
           IFS=","
           for item in $CURRENT_WS_LIST;
           do
           XmGetAtomName NAME $(XtDisplay "-" $TOPLEVEL) $item
           print -u9 $NAME
           done
           IFS=$oldIFS
           fi
           exec 9<&-
           # Let the session manager know how to invoke us when
           # the session is restored
           DtSetStartupCommand $TOPLEVEL "/ouranos/cdeuser/myrealworkspace $SAVEFILE"
         else
           echo "DtSessionSavePath FAILED!!"
           exit -3
         fi
       }
       # Function invoked during a restore session; restores the
       # application to its previous state
       RestoreSession()
       {
         # Retrieve the path where our session file resides
         if DtSessionRestorePath $TOPLEVEL PATH $1; then
           exec 9<$PATH
           read -u9 ICONIFY
           # Extract and restore our iconified state
           case $ICONIFY in
           Iconified) DtSetIconifyHint $TOPLEVEL True;;
           *) DtSetIconifyHint $TOPLEVEL False;
            esac
           # Extract the list of workspaces we belong in, convert
           # them to atoms, and ask the workspace manager to relocate
           # us to those workspaces
           WS_LIST=""
           while read -u9 NAME
           do
           XmInternAtom ATOM $(XtDisplay "-" $TOPLEVEL) $NAME False
           if [ ${#WS_LIST} -gt 0 ]; then
           WS_LIST=$WS_LIST,$ATOM
           else
           WS_LIST=$ATOM
           fi
           done
           DtWsmSetWorkspacesOccupied $(XtDisplay "-" $TOPLEVEL) $(XtWindow "-" $TOPLEVEL) $WS_LIST
           exec 9<&-
          else
           echo "DtSessionRestorePath FAILED!!"
           exit -3
         fi
       }
#
#
#      MAIN
#
       XtInitialize TOPLEVEL wmProtTest Dtksh "$@"
       XtCreateManagedWidget DA da XmDrawingArea $TOPLEVEL
#      geometry, size is irrelevant, position is not honored ?
       XtSetValues $DA height:1  width:160
       XtSetValues $DA x:+1065 y:+332
#      just a title, it will be owerwritten later
       XtSetValues $TOPLEVEL title:"prova"
#      standard stuff from man page
       XmInternAtom SAVE_SESSION_ATOM $(XtDisplay "-" $TOPLEVEL) "WM_SAVE_YOURSELF" False
       # If a command-line argument was supplied, then treat it as the
       # name of the session file
       if (( $# > 0))
       then
         # Restore to the state specified in the passed-in session file
         XtSetValues $TOPLEVEL mappedWhenManaged:False
         XtRealizeWidget $TOPLEVEL
         XSync $(XtDisplay "-" $TOPLEVEL) False
         RestoreSession $1
         XtSetValues $TOPLEVEL mappedWhenManaged:True
         XtPopup $TOPLEVEL GrabNone
       else
         # This is not a session restore, so come up in the default state
         XtRealizeWidget $TOPLEVEL
         XSync $(XtDisplay "-" $TOPLEVEL) False
       fi
       # Register the fact that we are interested in participating in
       # session management
       XmAddWMProtocols $TOPLEVEL $SAVE_SESSION_ATOM
       XmAddWMProtocolCallback $TOPLEVEL $SAVE_SESSION_ATOM  SessionCallback
#      get the current workspace
       XtScreen MYSCREEN $DA
       XRootWindowOfScreen RW $MYSCREEN
       DtWsmGetCurrentWorkspace $(XtDisplay "-" $TOPLEVEL)  $RW CURRENT_WS_LIST
           XmGetAtomName NAME $(XtDisplay "-" $TOPLEVEL) $CURRENT_WS_LIST
#          change wsn in n+1 (ws0 is workspace 1 etc.)
           NUMBER=${NAME##ws}
           NUMBER=$(($NUMBER+1))
       XtSetValues $TOPLEVEL title:"workspace $NUMBER"
#      occupy all wsp, display and install the call back
       DtWsmOccupyAllWorkspaces $(XtDisplay "-" $TOPLEVEL) $(XtWindow "-" $TOPLEVEL)
       XSync $(XtDisplay "-" $TOPLEVEL) False
       DtWsmAddCurrentWorkspaceCallback NEW $DA MyCallBack
       XtMainLoop



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-04-04 15:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-19 15:08 using VNC for CDE login, keyboard mapping Lucio Chiappetti
2003-04-04 10:25 ` which CDE workspace am I in ? Lucio Chiappetti
2003-04-04 15:59   ` PARTIAL SUMMARY: " Lucio Chiappetti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox