From: kode@bpel.tutics.tut.ac.jp (Takashi KODERA)
Newsgroups: fj.windows.x
Subject: Question about Mouse events
Date: 14 Dec 92 15:09:35 GMT
Distribution: fj
Organization: BPEL-TUT, JAPAN


$@$O$8$a$^$7$F(J. $@>.;{!wK-665;=Q2J3XBg$H?=$7$^$9(J. 
X-Window$@$N%^%&(J$@%9%$%Y%s%H$K$D$$$F<ALd$5$;$F2<$5$$(J. 

$@8=:_(J, X-Window$@>e$G(JMotif$@$r;HMQ$7$F%"%W%j%1!<%7%g%s$r:n@.$7$F$$$k(J$@$N$G$9(J
$@$,(J, $@%^%&%9%$%Y%s%H$K4X$9$k=hM}$GLdBj$,H/@8$7$^$7$?(J.

$@6qBNE*$K$O(J, 

(1)   PointerMotionMask$@$r;H(J$@MQ$7$F(J, $@%^%&%9$N(J(x,y)$@:BI8$rI=<($7$F$$$k(J.
(2)   ButtonPressMask, Button1MotionMask, ButtonReleaseMask$@$r(J$@MQ$$$F(J, 
    $@2hLL>e$KI=<($5$l$?%0%i%U%#%C%/%9$N0\F0$r9T$J$&(J. 

$@$H$$$C$?=hM}$r9T$J$&$N$G$9$,(J, Button1$@$K(J$@$h$k%I%i%C%0$r9T$J$C$F$$$J$$$K$b(J
$@4X$o$i$:(J, Button1MotionMask$@$G;XDj$7$?4X?t$,8F$P$l$F$7$^$9$&$N$G$9(J. 

$@$=$3$G(J, $@4JC1$J%W%m%0%i%`$r5-=R$7$F$_$?$H$3$m(J, Xaw$@$rMQ$$$?$b$N$G$O$3$N(J
$@8=>]$O8+<u$1$i$l$:(J, Motif$@$rMQ$$(J$@$?$b$N$G$3$N8=>]$,H/@8$7$^$7$?(J. 

$@$3$l$O2?$,860x$J$N$G$7$g$&$+(J? $@0J2<$K$3$l$r:F8=$9$k4JC1$J%W%m%0%i%`$r(J$@<((J
$@$7$^$9(J. $@F0:n4D6-$O(JSparcStation2, SunOS-4.1.2 JLE1.1.2, X11R5-pl15(?)$@$G(J,
Xaw$@$rMQ$$$k$b$N$OF0:n$7$^$9(J$@$,(J, ASCIIopenware/Motif$@$rMQ$$$k$b$N$O@5>o$K(J
$@F0:n$7$^$;$s(J. $@%3%s%Q%$%i$OI8=`$N(Jcc$@$G$9(J. 

$@0J2<$O(JXaw$@$rMQ$$(J$@$?%W%m%0%i%`$N=PNO$G$9(J. 

pointer:event->type = 6		-> PointerMotionMask$@$K$h$k8F$S$@$7(J
pointer:event->type = 6		-> PointerMotionMask
press:event->type = 4		-> ButtonPressMask
pointer:event->type = 6		-> PointerMotionMask
button:event->type = 6		-> Button1MotionMask
pointer:event->type = 6		-> PointerMotionMask
button:event->type = 6		-> Button1MotionMask
press:event->type = 5		-> ButtonReleaseMask
pointer:event->type = 6		-> PointerMotionMask
pointer:event->type = 6		-> PointerMotionMask

$@$3$l$,(JMotif$@$r(J$@MQ$$$k$b$N$G$O(J, 

pointer:event->type = 6		-> PointerMotionMask$@$K$h$k8F$S$@$7(J
button:event->type = 6		-> Button1MotionMask
pointer:event->type = 6		-> PointerMotionMask
button:event->type = 6		-> Button1MotionMask
press:event->type = 4		-> ButtonPressMask
pointer:event->type = 6		-> PointerMotionMask
button:event->type = 6		-> Button1MotionMask
pointer:event->type = 6		-> PointerMotionMask
button:event->type = 6		-> Button1MotionMask
press:event->type = 5		-> ButtonReleaseMask
pointer:event->type = 6		-> PointerMotionMask
button:event->type = 6		-> Button1MotionMask
pointer:event->type = 6		-> PointerMotionMask
button:event->type = 6		-> Button1MotionMask

$@$H$$$&$h$&$K$J$j(J, $@C1$J$k(JPointerMotion$@$H(JButton1Motion$@$N6hJL$,$G$-$F$$$^(J
$@$;$s(J.

$@$3$l$r2sHr$9$k$K$O$I$&$9$l$P$h$$$N$G$7$g$&$+(J?
$@$I$&$+NI$$%"%I%P%$%9(J$@$r$*4j$$$7$^$9(J. (_o_)

$@0J2<$K(JXaw$@$rMQ$$$?%5%s%W%k%W%m%0%i%`$r<($7$^$9(J. 

--cut here----Xaw------cut here----Xaw------cut here----Xaw----
#include <stdio.h>

#include <X11/Xlib.h>
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>

#include <X11/Xaw/Cardinals.h>
#include <X11/Xaw/Simple.h>

void buttonMotionEvent(widget, client_data, event)
     Widget widget;
     XtPointer client_data;
     XEvent *event;
{
  printf("button:event->type = %d\n", event->type);
}

void pointerMotionEvent(widget, client_data, event)
     Widget widget;
     XtPointer client_data;
     XEvent *event;
{
  printf("pointer:event->type = %d\n", event->type);
}

void buttonPressEvent(widget, client_data, event)
     Widget widget;
     XtPointer client_data;
     XEvent *event;
{
  printf("press:event->type = %d\n", event->type);
}

void main(argc, argv)
     int argc;
     char **argv;
{
  Widget toplevel, frame;

  Cardinal n;
  Arg args[10];

  XtAppContext app_con;

  toplevel = XtAppInitialize(&app_con, "Test", NULL, ZERO, &argc, argv,
			     NULL, NULL, ZERO);

  n = 0;
  XtSetArg(args[n], XtNwidth, 100); n++;
  XtSetArg(args[n], XtNheight, 100); n++;
  frame = XtCreateManagedWidget("testSimple", simpleWidgetClass, toplevel, 
				args, n);

  XtAddEventHandler(frame, PointerMotionMask, FALSE, pointerMotionEvent, NULL);
  XtAddEventHandler(frame, ButtonPressMask, FALSE, buttonPressEvent, NULL);
  XtAddEventHandler(frame, Button1MotionMask, FALSE, buttonMotionEvent, NULL);
  XtAddEventHandler(frame, ButtonReleaseMask, FALSE, buttonPressEvent, NULL);

  XtRealizeWidget(toplevel);
  XtAppMainLoop(app_con);
}
--cut here----Xaw------cut here----Xaw------cut here----Xaw----

$@0J2<$K(JMotif$@$rMQ$$$?%5%s%W%k%W%m%0%i%`(J$@$r<($7$^$9(J. 

--cut here--Motif----cut here--Motif----cut here--Motif----cut-here--
#include <stdio.h>

#include <Xm/Xm.h>
#include <Xm/DrawingA.h>

void buttonMotionEvent(widget, client_data, event)
     Widget widget;
     XtPointer client_data;
     XEvent *event;
{
  printf("button:event->type = %d\n", event->type);
}

void pointerMotionEvent(widget, client_data, event)
     Widget widget;
     XtPointer client_data;
     XEvent *event;
{
  printf("pointer:event->type = %d\n", event->type);
}

void buttonPressEvent(widget, client_data, event)
     Widget widget;
     XtPointer client_data;
     XEvent *event;
{
  printf("press:event->type = %d\n", event->type);
}

void main(argc, argv)
     int argc;
     char **argv;
{
  Widget toplevel, frame;

  Cardinal n;
  Arg args[10];

  XtAppContext app_con;

  toplevel = XtAppInitialize(&app_con, "Test", NULL, 0, &argc, argv,
			     NULL, NULL, 0);

  n = 0;
  XtSetArg(args[n], XmNwidth, 100); n++;
  XtSetArg(args[n], XmNheight, 100); n++;
  frame = XtCreateManagedWidget("testDrawing", xmDrawingAreaWidgetClass,
				toplevel, args, n);

  XtAddEventHandler(frame, PointerMotionMask, FALSE, pointerMotionEvent, NULL);
  XtAddEventHandler(frame, ButtonPressMask, FALSE, buttonPressEvent, NULL);
  XtAddEventHandler(frame, Button1MotionMask, FALSE, buttonMotionEvent, NULL);
  XtAddEventHandler(frame, ButtonReleaseMask, FALSE, buttonPressEvent, NULL);

  XtRealizeWidget(toplevel);
  XtAppMainLoop(app_con);
}
--cut here--Motif----cut here--Motif----cut here--Motif----cut-here--

$@$J$K$H$>$*4j$$$7$^$9(J. 

--
----------------------------------------------------------------------------
   $@>.;{(J  $@5.(J ( Takashi Kodera )                                              
                     $@K-665;=Q2J3XBg3X(J $@>pJs9)3X@l96(J $@>pJs=hM}Bg9V:B(J $@110f8&5f<<(J
              TEL 0532(47)0111 ext.496,497 E-mail kode@bpel.tutics.tut.ac.jp
----------------------------------------------------------------------------
Newsgroups: fj.windows.x