Debian Codegraph @

libSoXt/src/devices/SoXtMouse.c++

raw symbols SCIP
1 /*
2 *
3 * Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * Further, this software is distributed without any warranty that it is
16 * free of the rightful claim of any third person regarding infringement
17 * or the like. Any license provided herein, whether implied or
18 * otherwise, applies only to this software file. Patent licenses, if
19 * any, provided herein do not apply to combinations of this program with
20 * other software, or any other product whatsoever.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
27 * Mountain View, CA 94043, or:
28 *
29 * http://www.sgi.com
30 *
31 * For further information regarding this notice, see:
32 *
33 * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
34 *
35 */
36
37 /*
38 * Copyright (C) 1990,91,92 Silicon Graphics, Inc.
39 *
40 _______________________________________________________________________
41 ______________ S I L I C O N G R A P H I C S I N C . ____________
42 |
43 | $Revision: 1.1.1.1 $
44 |
45 | Classes:
46 | SoXtMouse
47 |
48 | Author(s): David Mott
49 |
50 ______________ S I L I C O N G R A P H I C S I N C . ____________
51 _______________________________________________________________________
52 */
53
54 #include <X11/X.h>
55 #include <Inventor/SbTime.h>cxx . . $ `<file>/lib/database/include/Inventor/SbTime.h`/
56 #include <Inventor/Xt/devices/SoXtMouse.h>cxx . . $ `<file>/libSoXt/include/Inventor/Xt/devices/SoXtMouse.h`/
57
58 ////////////////////////////////////////////////////////////////////////
59 //
60 // Description:
61 // Constructor.
62 //
63 // public
64 //
65 SoXtMousecxx . . $ SoXtMouse#::SoXtMousecxx . . $ SoXtMouse#SoXtMouse(2c44cd906ae4e829).(EventMaskcxx . . $ EventMask# whichEvents)
66 //
67 ////////////////////////////////////////////////////////////////////////
68 {
69 //??? for DEBUG, need to make sure the passed event mask is valid
70 //??? for this device
71 eventMaskcxx . . $ SoXtMouse#eventMask. = whichEvents;
72
73 // allocate the SoEvents we support here
74 loc2Eventcxx . . $ SoXtMouse#loc2Event. = new SoLocation2Eventcxx . . $ SoLocation2Event#;
75 buttonEventcxx . . $ SoXtMouse#buttonEvent. = new SoMouseButtonEventcxx . . $ SoMouseButtonEvent#;
76 }
77
78 ////////////////////////////////////////////////////////////////////////
79 //
80 // Description:
81 // Destructor.
82 //
83 // public
84 //
85 SoXtMousecxx . . $ SoXtMouse#::~cxx . . $ SoXtMouse#`~SoXtMouse`(49f6e7a06ebc5aa8).SoXtMousecxx . . $ SoXtMouse#()
86 //
87 ////////////////////////////////////////////////////////////////////////
88 {
89 delete loc2Eventcxx . . $ SoXtMouse#loc2Event.;
90 delete buttonEventcxx . . $ SoXtMouse#buttonEvent.;
91 }
92
93 ////////////////////////////////////////////////////////////////////////
94 //
95 // Description:
96 // This selects input for all mouse device events which occur in w.
97 // The callback routine is proc, and the callback data is clientData.
98 //
99 // virtual public
100 //
101 void
102 SoXtMousecxx . . $ SoXtMouse#::enablecxx . . $ SoXtMouse#enable(9c674ea9982a9afc).(
103 Widgetcxx . . $ Widget# w,
104 XtEventHandlercxx . . $ XtEventHandler# proc,
105 XtPointercxx . . $ XtPointer# clientData,
106 Windowcxx . . $ Window#)
107 //
108 ////////////////////////////////////////////////////////////////////////
109 {
110 XtAddEventHandler(w, eventMaskcxx . . $ SoXtMouse#eventMask., FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!, proc, clientData);
111 }
112
113 ////////////////////////////////////////////////////////////////////////
114 //
115 // Description:
116 // This unselects input for all mouse device events which occur in w,
117 // i.e. mouse events will no longer be recognized.
118 //
119 // virtual public
120 //
121 void
122 SoXtMousecxx . . $ SoXtMouse#::disablecxx . . $ SoXtMouse#disable(b8a5051fa1f1a67d).(
123 Widgetcxx . . $ Widget# w,
124 XtEventHandlercxx . . $ XtEventHandler# proc,
125 XtPointercxx . . $ XtPointer# clientData)
126 //
127 ////////////////////////////////////////////////////////////////////////
128 {
129 XtRemoveEventHandler(w, eventMaskcxx . . $ SoXtMouse#eventMask., FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!, proc, clientData);
130 }
131
132 ////////////////////////////////////////////////////////////////////////
133 //
134 // Description:
135 // This returns an SoEvent for the passed X event, if the event
136 // was generated by the mouse device.
137 //
138 // static public
139 //
140 const SoEventcxx . . $ SoEvent# *
141 SoXtMousecxx . . $ SoXtMouse#::translateEventcxx . . $ SoXtMouse#translateEvent(feae03549c58797f).(XAnyEventcxx . . $ XAnyEvent# *xe)
142 //
143 ////////////////////////////////////////////////////////////////////////
144 {
145 SoEventcxx . . $ SoEvent# *event = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
146
147 // switch on event type
148 switch (xe->typecxx . . $ $anonymous_type_17d7f07cf933eea7_53#type.) {
149 case ButtonPresscxx . . $ `<external>/1208737181511191802/X.h:183:9`!:
150 event = translateButtonEventcxx . . $ SoXtMouse#translateButtonEvent(a859cff3031538ae).((XButtonEventcxx . . $ XButtonEvent# *) xe, SoButtonEventcxx . . $ SoButtonEvent#::DOWNcxx . . $ SoButtonEvent#DOWN.);
151 break;
152
153 case ButtonReleasecxx . . $ `<external>/1208737181511191802/X.h:184:9`!:
154 event = translateButtonEventcxx . . $ SoXtMouse#translateButtonEvent(a859cff3031538ae).((XButtonEventcxx . . $ XButtonEvent# *) xe, SoButtonEventcxx . . $ SoButtonEvent#::UPcxx . . $ SoButtonEvent#UP.);
155 break;
156
157 case MotionNotifycxx . . $ `<external>/1208737181511191802/X.h:185:9`!:
158 event = translateMotionEventcxx . . $ SoXtMouse#translateMotionEvent(6e7a7ccbb103871e).((XMotionEventcxx . . $ XMotionEvent# *) xe);
159 break;
160
161 default:
162 break;
163 }
164
165 return event;
166 }
167
168 SoMouseButtonEventcxx . . $ SoMouseButtonEvent# *
169 SoXtMousecxx . . $ SoXtMouse#::translateButtonEventcxx . . $ SoXtMouse#translateButtonEvent(a859cff3031538ae).(XButtonEventcxx . . $ XButtonEvent# *be,
170 SoButtonEventcxx . . $ SoButtonEvent#::Statecxx . . $ SoButtonEvent#State# whichState)
171 {
172 SoMouseButtonEventcxx . . $ SoMouseButtonEvent#::Buttoncxx . . $ SoMouseButtonEvent#Button# whichButton;
173
174 if (be->buttoncxx . . $ $anonymous_type_17d7f07cf933eea7_23#button. == Button1cxx . . $ `<external>/1208737181511191802/X.h:259:9`!)
175 whichButton = SoMouseButtonEventcxx . . $ SoMouseButtonEvent#::BUTTON1cxx . . $ SoMouseButtonEvent#BUTTON1.;
176 else if (be->buttoncxx . . $ $anonymous_type_17d7f07cf933eea7_23#button. == Button2cxx . . $ `<external>/1208737181511191802/X.h:260:9`!)
177 whichButton = SoMouseButtonEventcxx . . $ SoMouseButtonEvent#::BUTTON2cxx . . $ SoMouseButtonEvent#BUTTON2.;
178 else if (be->buttoncxx . . $ $anonymous_type_17d7f07cf933eea7_23#button. == Button3cxx . . $ `<external>/1208737181511191802/X.h:261:9`!)
179 whichButton = SoMouseButtonEventcxx . . $ SoMouseButtonEvent#::BUTTON3cxx . . $ SoMouseButtonEvent#BUTTON3.;
180 else
181 whichButton = SoMouseButtonEventcxx . . $ SoMouseButtonEvent#::ANYcxx . . $ SoMouseButtonEvent#ANY.;
182
183 setEventPositioncxx . . $ SoXtDevice#setEventPosition(d2573e7a63a5e171).(buttonEventcxx . . $ SoXtMouse#buttonEvent., be->xcxx . . $ $anonymous_type_17d7f07cf933eea7_23#x., be->ycxx . . $ $anonymous_type_17d7f07cf933eea7_23#y.);
184 int32_t secs = be->timecxx . . $ $anonymous_type_17d7f07cf933eea7_23#time. / 1000;
185 buttonEventcxx . . $ SoXtMouse#buttonEvent.->setTimecxx . . $ SoEvent#setTime(146474f377668abe).(SbTimecxx . . $ SbTime#SbTime(a8896fd0f69df779).(secs, 1000 * (be->timecxx . . $ $anonymous_type_17d7f07cf933eea7_23#time. - 1000 * secs)));
186 buttonEventcxx . . $ SoXtMouse#buttonEvent.->setShiftDowncxx . . $ SoEvent#setShiftDown(d4f767463ce0a6b3).(be->statecxx . . $ $anonymous_type_17d7f07cf933eea7_23#state. & ShiftMaskcxx . . $ `<external>/1208737181511191802/X.h:221:9`!);
187 buttonEventcxx . . $ SoXtMouse#buttonEvent.->setCtrlDowncxx . . $ SoEvent#setCtrlDown(d4f767463ce0a6b3).(be->statecxx . . $ $anonymous_type_17d7f07cf933eea7_23#state. & ControlMaskcxx . . $ `<external>/1208737181511191802/X.h:223:9`!);
188 buttonEventcxx . . $ SoXtMouse#buttonEvent.->setAltDowncxx . . $ SoEvent#setAltDown(d4f767463ce0a6b3).(be->statecxx . . $ $anonymous_type_17d7f07cf933eea7_23#state. & Mod1Maskcxx . . $ `<external>/1208737181511191802/X.h:224:9`!);
189
190 buttonEventcxx . . $ SoXtMouse#buttonEvent.->setStatecxx . . $ SoButtonEvent#setState(42a56351aca31070).(whichState);
191 buttonEventcxx . . $ SoXtMouse#buttonEvent.->setButtoncxx . . $ SoMouseButtonEvent#setButton(f95c647a0687b41).(whichButton);
192
193 return buttonEventcxx . . $ SoXtMouse#buttonEvent.;
194 }
195
196 SoLocation2Eventcxx . . $ SoLocation2Event# *
197 SoXtMousecxx . . $ SoXtMouse#::translateMotionEventcxx . . $ SoXtMouse#translateMotionEvent(6e7a7ccbb103871e).(XMotionEventcxx . . $ XMotionEvent# *me)
198 {
199 setEventPositioncxx . . $ SoXtDevice#setEventPosition(d2573e7a63a5e171).(loc2Eventcxx . . $ SoXtMouse#loc2Event., me->xcxx . . $ $anonymous_type_17d7f07cf933eea7_24#x., me->ycxx . . $ $anonymous_type_17d7f07cf933eea7_24#y.);
200 int32_t secs = me->timecxx . . $ $anonymous_type_17d7f07cf933eea7_24#time. / 1000;
201 loc2Eventcxx . . $ SoXtMouse#loc2Event.->setTimecxx . . $ SoEvent#setTime(146474f377668abe).(SbTimecxx . . $ SbTime#SbTime(a8896fd0f69df779).(secs, 1000 * (me->timecxx . . $ $anonymous_type_17d7f07cf933eea7_24#time. - 1000 * secs)));
202 loc2Eventcxx . . $ SoXtMouse#loc2Event.->setShiftDowncxx . . $ SoEvent#setShiftDown(d4f767463ce0a6b3).(me->statecxx . . $ $anonymous_type_17d7f07cf933eea7_24#state. & ShiftMaskcxx . . $ `<external>/1208737181511191802/X.h:221:9`!);
203 loc2Eventcxx . . $ SoXtMouse#loc2Event.->setCtrlDowncxx . . $ SoEvent#setCtrlDown(d4f767463ce0a6b3).(me->statecxx . . $ $anonymous_type_17d7f07cf933eea7_24#state. & ControlMaskcxx . . $ `<external>/1208737181511191802/X.h:223:9`!);
204 loc2Eventcxx . . $ SoXtMouse#loc2Event.->setAltDowncxx . . $ SoEvent#setAltDown(d4f767463ce0a6b3).(me->statecxx . . $ $anonymous_type_17d7f07cf933eea7_24#state. & Mod1Maskcxx . . $ `<external>/1208737181511191802/X.h:224:9`!);
205
206 return loc2Eventcxx . . $ SoXtMouse#loc2Event.;
207 }
208
209
210