c************
c   Description : X-Midas real-time control routines and queued message
c		  utilities.  These routines add real-time controls 
c		  widgets to the widget table and queue up, remove 
c		  messages from a global message queue.  Also contains
c		  routines for queueing up data streams messages and
c		  loop routines such as M$DO used for the main processing
c		  loop of a primitive.
c
c   Author :    JGS   4//90
c
c   $Revision: 1.3 $
c   $Modtime:   30 Jul 1997 17:54:54  $
c   
c************

	subroutine M$MTAG (Mx)
	include 'xprim.inc'
	character*128 string
c
	Mx.xtag = ' '
	Mx.ytag = ' '
	Mx.ztag = ' '
	Mx.xytag = ' '
c
	lt = M$GET_SWITCH('WIDX')
	if (lt.gt.0) write(Mx.xtag,99) lt
	lt = M$GET_SWITCH('WIDY')
	if (lt.gt.0) write(Mx.ytag,99) lt
	lt = M$GET_SWITCH('WIDZ')
	if (lt.gt.0) write(Mx.ztag,99) lt
	lt = M$GET_SWITCH('WIDXY')
	if (lt.gt.0) write(Mx.xytag,99) lt
	lt = M$GET_SWITCH('WID')
	if (lt.gt.0) write(Mx.xytag,99) lt
c
	lt = M$GET_USWITCH ('MTAG',string)
	if (lt.le.0) return
	i = INDEX(string,'(')
	if (string(lt:lt).ne.')') lt = lt+1
	string(lt:lt) = ','
	do while (i.lt.lt)
	  i1 = INDEX(string(i+1:lt),':')+i
	  i2 = INDEX(string(i+1:lt),',')+i
	  if (string(i+1:i1-1).eq.'X') then
	    Mx.xtag = string(i1+1:i2-1)
	  elseif (string(i+1:i1-1).eq.'Y') then
	    Mx.ytag = string(i1+1:i2-1)
	  elseif (string(i+1:i1-1).eq.'Z') then
	    Mx.ztag = string(i1+1:i2-1)
	  elseif (string(i+1:i1-1).eq.'XY') then
	    Mx.xytag = string(i1+1:i2-1)
	  elseif (string(i+1:i1-1).eq.'X+Y') then
	    Mx.xytag = string(i1+1:i2-1)
	  else
	    call M$ERROR ('Unknown mouse widget identifier tag')
	  endif
	  i = i2
	enddo
	return
  99	format (2hW_,i5.5)
	end
