2 *----------------------------------------------------------------------------
3 * egalaxtouch class for poseidon
4 *----------------------------------------------------------------------------
5 * By Chris Hodges <chrisly@platon42.de>
10 #include "egalaxtouch.class.h"
11 #include <proto/timer.h>
14 static const STRPTR libname
= MOD_NAME_STRING
;
16 static int libInit(LIBBASETYPEPTR nh
)
18 struct NepClassHid
*nch
;
19 struct NepHidBase
*ret
= NULL
;
21 KPRINTF(10, ("libInit nh: 0x%08lx SysBase: 0x%08lx\n", nh
, SysBase
));
23 nh
->nh_UtilityBase
= OpenLibrary("utility.library", 39);
25 #define UtilityBase nh->nh_UtilityBase
29 NewList(&nh
->nh_Bindings
);
30 nch
= &nh
->nh_DummyNCH
;
31 nch
->nch_ClsBase
= nh
;
32 nch
->nch_Interface
= NULL
;
33 nch
->nch_CDC
= AllocVec(sizeof(struct ClsDevCfg
), MEMF_PUBLIC
|MEMF_CLEAR
);
40 CloseLibrary(UtilityBase
);
43 KPRINTF(20, ("libInit: OpenLibrary(\"utility.library\", 39) failed!\n"));
46 KPRINTF(10, ("libInit: Ok\n"));
47 return(ret
? TRUE
: FALSE
);
50 static int libOpen(LIBBASETYPEPTR nh
)
52 KPRINTF(10, ("libOpen nh: 0x%08lx\n", nh
));
57 static int libExpunge(LIBBASETYPEPTR nh
)
59 KPRINTF(10, ("libExpunge nh: 0x%08lx\n", nh
));
60 CloseLibrary((struct Library
*) UtilityBase
);
61 FreeVec(nh
->nh_DummyNCH
.nch_CDC
);
65 ADD2INITLIB(libInit
, 0)
66 ADD2OPENLIB(libOpen
, 0)
67 ADD2EXPUNGELIB(libExpunge
, 0)
72 * ***********************************************************************
73 * * Library functions *
74 * ***********************************************************************
83 struct AutoBindData ClassBinds
[] =
96 /* /// "usbAttemptDeviceBinding()" */
97 struct NepClassHid
* usbAttemptDeviceBinding(struct NepHidBase
*nh
, struct PsdDevice
*pd
)
100 struct AutoBindData
*abd
= ClassBinds
;
104 KPRINTF(1, ("nepHidAttemptDeviceBinding(%08lx)\n", pd
));
105 if((ps
= OpenLibrary("poseidon.library", 4)))
107 psdGetAttrs(PGA_DEVICE
, pd
,
108 DA_VendorID
, &vendid
,
109 DA_ProductID
, &prodid
,
112 while(abd
->abd_VendID
)
114 if((vendid
== abd
->abd_VendID
) && (prodid
== abd
->abd_ProdID
))
116 return(usbForceDeviceBinding(nh
, pd
));
125 /* /// "usbForceDeviceBinding()" */
126 struct NepClassHid
* usbForceDeviceBinding(struct NepHidBase
*nh
, struct PsdDevice
*pd
)
129 struct NepClassHid
*nch
;
130 struct ClsDevCfg
*cdc
;
134 struct Task
*tmptask
;
136 KPRINTF(1, ("nepHidForceDeviceBinding(%08lx)\n", pd
));
137 if((ps
= OpenLibrary("poseidon.library", 4)))
139 psdGetAttrs(PGA_DEVICE
, pd
,
140 DA_ProductName
, &devname
,
141 DA_IDString
, &devidstr
,
143 if((nch
= psdAllocVec(sizeof(struct NepClassHid
))))
145 nch
->nch_ClsBase
= nh
;
146 nch
->nch_CDC
= cdc
= psdAllocVec(sizeof(struct ClsDevCfg
));
155 nch
->nch_Device
= pd
;
156 nch
->nch_DevIDString
= devidstr
;
158 nLoadBindingConfig(nch
);
160 psdSafeRawDoFmt(buf
, 64, "egalaxtouch.class<%08lx>", nch
);
161 nch
->nch_ReadySignal
= SIGB_SINGLE
;
162 nch
->nch_ReadySigTask
= FindTask(NULL
);
163 SetSignal(0, SIGF_SINGLE
);
164 if((tmptask
= psdSpawnSubTask(buf
, nHidTask
, nch
)))
166 psdBorrowLocksWait(tmptask
, 1UL<<nch
->nch_ReadySignal
);
169 nch
->nch_ReadySigTask
= NULL
;
170 //FreeSignal(nch->nch_ReadySignal);
171 psdAddErrorMsg(RETURN_OK
, (STRPTR
) libname
,
172 "Touching the sky with '%s'!",
176 AddTail(&nh
->nh_Bindings
, &nch
->nch_Node
);
182 nch
->nch_ReadySigTask
= NULL
;
183 //FreeSignal(nch->nch_ReadySignal);
184 psdFreeVec(nch
->nch_CDC
);
193 /* /// "usbReleaseDeviceBinding()" */
194 void usbReleaseDeviceBinding(struct NepHidBase
*nh
, struct NepClassHid
*nch
)
199 KPRINTF(1, ("nepHidReleaseDeviceBinding(%08lx)\n", nch
));
200 if((ps
= OpenLibrary("poseidon.library", 4)))
203 nch
->nch_ReadySignal
= SIGB_SINGLE
;
204 nch
->nch_ReadySigTask
= FindTask(NULL
);
207 Signal(nch
->nch_GUITask
, SIGBREAKF_CTRL_C
);
210 while(nch
->nch_GUITask
)
212 Wait(1L<<nch
->nch_ReadySignal
);
218 Signal(nch
->nch_Task
, SIGBREAKF_CTRL_C
);
223 Wait(1L<<nch
->nch_ReadySignal
);
225 //FreeSignal(nch->nch_ReadySignal);
226 psdGetAttrs(PGA_DEVICE
, nch
->nch_Device
, DA_ProductName
, &devname
, TAG_END
);
227 psdAddErrorMsg(RETURN_OK
, (STRPTR
) libname
,
228 "Couldn't keep in touch with '%s'!",
231 Remove(&nch
->nch_Node
);
233 psdFreeVec(nch
->nch_CDC
);
240 /* /// "usbGetAttrsA()" */
241 AROS_LH3(LONG
, usbGetAttrsA
,
242 AROS_LHA(ULONG
, type
, D0
),
243 AROS_LHA(APTR
, usbstruct
, A0
),
244 AROS_LHA(struct TagItem
*, tags
, A1
),
245 LIBBASETYPEPTR
, nh
, 5, nep
)
252 KPRINTF(1, ("nepHidGetAttrsA(%ld, %08lx, %08lx)\n", type
, usbstruct
, tags
));
256 if((ti
= FindTagItem(UCCA_Priority
, tags
)))
258 *((SIPTR
*) ti
->ti_Data
) = 0;
261 if((ti
= FindTagItem(UCCA_Description
, tags
)))
263 *((STRPTR
*) ti
->ti_Data
) = "Support for eGalax Touchscreens";
266 if((ti
= FindTagItem(UCCA_HasClassCfgGUI
, tags
)))
268 *((IPTR
*) ti
->ti_Data
) = TRUE
;
271 if((ti
= FindTagItem(UCCA_HasBindingCfgGUI
, tags
)))
273 *((IPTR
*) ti
->ti_Data
) = TRUE
;
276 if((ti
= FindTagItem(UCCA_AfterDOSRestart
, tags
)))
278 *((IPTR
*) ti
->ti_Data
) = FALSE
;
281 if((ti
= FindTagItem(UCCA_UsingDefaultCfg
, tags
)))
283 *((IPTR
*) ti
->ti_Data
) = nh
->nh_DummyNCH
.nch_UsingDefaultCfg
;
289 if((ti
= FindTagItem(UCBA_UsingDefaultCfg
, tags
)))
291 *((IPTR
*) ti
->ti_Data
) = ((struct NepClassHid
*) usbstruct
)->nch_UsingDefaultCfg
;
301 /* /// "usbSetAttrsA()" */
302 AROS_LH3(LONG
, usbSetAttrsA
,
303 AROS_LHA(ULONG
, type
, D0
),
304 AROS_LHA(APTR
, usbstruct
, A0
),
305 AROS_LHA(struct TagItem
*, tags
, A1
),
306 LIBBASETYPEPTR
, nh
, 6, nep
)
314 /* /// "usbDoMethodA()" */
315 AROS_LH2(IPTR
, usbDoMethodA
,
316 AROS_LHA(ULONG
, methodid
, D0
),
317 AROS_LHA(IPTR
*, methoddata
, A1
),
318 LIBBASETYPEPTR
, nh
, 7, nep
)
322 struct NepClassHid
*nch
;
324 KPRINTF(10, ("Do Method %ld\n", methodid
));
327 case UCM_AttemptDeviceBinding
:
328 return((IPTR
) usbAttemptDeviceBinding(nh
, (struct PsdDevice
*) methoddata
[0]));
330 case UCM_ForceDeviceBinding
:
331 return((IPTR
) usbForceDeviceBinding(nh
, (struct PsdDevice
*) methoddata
[0]));
333 case UCM_ReleaseDeviceBinding
:
334 usbReleaseDeviceBinding(nh
, (struct NepClassHid
*) methoddata
[0]);
337 case UCM_OpenCfgWindow
:
338 return(nOpenBindingCfgWindow(nh
, &nh
->nh_DummyNCH
));
340 case UCM_OpenBindingCfgWindow
:
341 return(nOpenBindingCfgWindow(nh
, (struct NepClassHid
*) methoddata
[0]));
343 case UCM_ConfigChangedEvent
:
344 nLoadClassConfig(nh
);
346 nch
= (struct NepClassHid
*) nh
->nh_Bindings
.lh_Head
;
347 while(nch
->nch_Node
.ln_Succ
)
349 nLoadBindingConfig(nch
);
350 nch
= (struct NepClassHid
*) nch
->nch_Node
.ln_Succ
;
363 /* /// "nLoadClassConfig()" */
364 BOOL
nLoadClassConfig(struct NepHidBase
*nh
)
366 struct NepClassHid
*nch
= &nh
->nh_DummyNCH
;
368 struct ClsDevCfg
*cdc
;
369 struct PsdIFFContext
*pic
;
371 KPRINTF(10, ("Loading Class Config...\n"));
372 if(!(ps
= OpenLibrary("poseidon.library", 4)))
378 /* Create default config */
379 nch
->nch_CDC
->cdc_ChunkID
= AROS_LONG2BE(MAKE_ID('E','G','T','S'));
380 nch
->nch_CDC
->cdc_Length
= AROS_LONG2BE(sizeof(struct ClsDevCfg
)-8);
381 nch
->nch_CDC
->cdc_MinX
= 0;
382 nch
->nch_CDC
->cdc_MinY
= 0;
383 nch
->nch_CDC
->cdc_MaxX
= 2047;
384 nch
->nch_CDC
->cdc_MaxY
= 2047;
385 nch
->nch_CDC
->cdc_RMBDelay
= 20;
386 nch
->nch_CDC
->cdc_RMBTolerance
= 20;
387 nch
->nch_CDC
->cdc_RMBMode
= 1;
388 nch
->nch_UsingDefaultCfg
= TRUE
;
389 /* try to load default config */
390 pic
= psdGetClsCfg(libname
);
393 cdc
= psdGetCfgChunk(pic
, AROS_LONG2BE(nch
->nch_CDC
->cdc_ChunkID
));
396 CopyMem(((UBYTE
*) cdc
) + 8, ((UBYTE
*) nch
->nch_CDC
) + 8, min(AROS_LONG2BE(cdc
->cdc_Length
), AROS_LONG2BE(nch
->nch_CDC
->cdc_Length
)));
398 nch
->nch_UsingDefaultCfg
= FALSE
;
407 /* /// "nLoadBindingConfig()" */
408 BOOL
nLoadBindingConfig(struct NepClassHid
*nch
)
410 struct NepHidBase
*nh
= nch
->nch_ClsBase
;
412 struct ClsDevCfg
*cdc
;
413 struct PsdIFFContext
*pic
;
415 KPRINTF(10, ("Loading Binding Config...\n"));
420 //nLoadClassConfig(nh);
421 *nch
->nch_CDC
= *nh
->nh_DummyNCH
.nch_CDC
;
422 nch
->nch_UsingDefaultCfg
= TRUE
;
424 if(!(ps
= OpenLibrary("poseidon.library", 4)))
431 pic
= psdGetUsbDevCfg(libname
, nch
->nch_DevIDString
, NULL
);
434 cdc
= psdGetCfgChunk(pic
, AROS_LONG2BE(nch
->nch_CDC
->cdc_ChunkID
));
437 CopyMem(((UBYTE
*) cdc
) + 8, ((UBYTE
*) nch
->nch_CDC
) + 8, min(AROS_LONG2BE(cdc
->cdc_Length
), AROS_LONG2BE(nch
->nch_CDC
->cdc_Length
)));
439 nch
->nch_UsingDefaultCfg
= FALSE
;
448 /* /// "nOpenBindingCfgWindow()" */
449 LONG
nOpenBindingCfgWindow(struct NepHidBase
*nh
, struct NepClassHid
*nch
)
452 KPRINTF(10, ("Opening GUI...\n"));
453 if(!(ps
= OpenLibrary("poseidon.library", 4)))
458 if(!nch
->nch_GUITask
)
460 if((nch
->nch_GUITask
= psdSpawnSubTask(MOD_NAME_STRING
" GUI", nGUITask
, nch
)))
473 /**************************************************************************/
476 #define ps nch->nch_Base
478 #define TimerBase nch->nch_TimerBase
480 #define IntuitionBase nch->nch_HIntBase
482 /* /// "nHidTask()" */
483 AROS_UFH0(void, nHidTask
)
487 struct NepClassHid
*nch
;
500 ULONG xrange
, yrange
;
503 UBYTE packet
[5] = { 0, 0, 0, 0, 0 };
508 struct timeval tmptime
;
510 if((nch
= nAllocHid()))
513 if(nch
->nch_ReadySigTask
)
515 Signal(nch
->nch_ReadySigTask
, 1L<<nch
->nch_ReadySignal
);
518 sigmask
= (1L<<nch
->nch_TaskMsgPort
->mp_SigBit
)|SIGBREAKF_CTRL_C
;
519 buf
= nch
->nch_EP1Buf
;
520 psdSendPipe(nch
->nch_EP1Pipe
, buf
, nch
->nch_EP1PktSize
);
523 sigs
= Wait(sigmask
);
524 while((pp
= (struct PsdPipe
*) GetMsg(nch
->nch_TaskMsgPort
)))
526 if(pp
== nch
->nch_EP1Pipe
)
528 ioerr
= psdGetPipeError(pp
);
529 if(ioerr
== UHIOERR_RUNTPACKET
)
531 KPRINTF(1, ("This should never happen. Something is wrong with the lowlevel driver!"));
536 KPRINTF(1, ("Data: %08lx %08lx\n", (*(ULONG
*) buf
), ((ULONG
*) buf
)[1]));
537 len
= psdGetPipeActual(pp
);
550 packet
[packetpos
] = *bufptr
;
558 buts
= packet
[0] & 1;
560 xpos
= (packet
[1]<<7)|packet
[2];
561 ypos
= 2047 - ((packet
[3]<<7)|packet
[4]);
562 KPRINTF(2, ("Raw Coords %ld, %ld, %02lx, %ld\n", xpos
, ypos
, packet
[0], nch
->nch_RMBState
));
563 switch(nch
->nch_CDC
->cdc_Rotate
)
582 if(nch
->nch_CDC
->cdc_Mirror
& 1)
586 if(nch
->nch_CDC
->cdc_Mirror
& 2)
591 if(nch
->nch_TrackDims
)
595 if(xpos
< nch
->nch_CDC
->cdc_MinX
)
597 nch
->nch_CDC
->cdc_MinX
= xpos
;
600 if(xpos
> nch
->nch_CDC
->cdc_MaxX
)
602 nch
->nch_CDC
->cdc_MaxX
= xpos
;
605 if(ypos
< nch
->nch_CDC
->cdc_MinY
)
607 nch
->nch_CDC
->cdc_MinY
= ypos
;
610 if(ypos
> nch
->nch_CDC
->cdc_MaxY
)
612 nch
->nch_CDC
->cdc_MaxY
= ypos
;
616 if(changed
&& nch
->nch_GUITask
)
618 Signal(nch
->nch_GUITask
, 1UL<<nch
->nch_TrackingSignal
);
622 if(xpos
< nch
->nch_CDC
->cdc_MinX
) xpos
= nch
->nch_CDC
->cdc_MinX
;
623 if(xpos
> nch
->nch_CDC
->cdc_MaxX
) xpos
= nch
->nch_CDC
->cdc_MaxX
;
624 if(ypos
< nch
->nch_CDC
->cdc_MinY
) ypos
= nch
->nch_CDC
->cdc_MinY
;
625 if(ypos
> nch
->nch_CDC
->cdc_MaxY
) ypos
= nch
->nch_CDC
->cdc_MaxY
;
627 xrange
= nch
->nch_CDC
->cdc_MaxX
- nch
->nch_CDC
->cdc_MinX
+ 1;
628 yrange
= nch
->nch_CDC
->cdc_MaxY
- nch
->nch_CDC
->cdc_MinY
+ 1;
630 xpos
-= nch
->nch_CDC
->cdc_MinX
;
631 ypos
-= nch
->nch_CDC
->cdc_MinY
;
633 if((buts
& 1) && (nch
->nch_CDC
->cdc_RMBMode
> 0))
635 if(nch
->nch_RMBState
== RMB_IDLE
)
637 nch
->nch_TouchSpotX
= xpos
;
638 nch
->nch_TouchSpotY
= ypos
;
639 GetSysTime(&nch
->nch_TouchTime
);
640 tmptime
.tv_secs
= nch
->nch_CDC
->cdc_RMBDelay
/ 10;
641 tmptime
.tv_micro
= (nch
->nch_CDC
->cdc_RMBDelay
% 10) * 100000;
642 AddTime(&nch
->nch_TouchTime
, &tmptime
);
643 nch
->nch_RMBState
= RMB_LMBDOWN
;
645 distx
= xpos
- nch
->nch_TouchSpotX
;
647 disty
= ypos
- nch
->nch_TouchSpotY
;
649 if(nch
->nch_RMBState
== RMB_LMBDOWN
)
651 if((distx
+ disty
> (nch
->nch_CDC
->cdc_RMBTolerance
* nch
->nch_CDC
->cdc_RMBTolerance
)))
653 // moved out of tolerance
654 nch
->nch_RMBState
= RMB_MOVEDTOOFAR
;
656 GetSysTime(&tmptime
);
657 if(CmpTime(&nch
->nch_TouchTime
, &tmptime
) >= 0)
659 // activate RMB, but release LMB first
660 nch
->nch_RMBState
= RMB_RMBDOWN
;
665 else if(nch
->nch_RMBState
== RMB_RMBDOWN_LMBUP
)
667 if(nch
->nch_CDC
->cdc_RMBMode
== 2)
669 nch
->nch_RMBState
= RMB_RMBDOWN_LAST
;
671 else if(nch
->nch_CDC
->cdc_RMBMode
== 3)
673 GetSysTime(&tmptime
);
674 if(DoubleClick(nch
->nch_TouchTime
.tv_secs
, nch
->nch_TouchTime
.tv_micro
, tmptime
.tv_secs
, tmptime
.tv_micro
))
676 nch
->nch_RMBState
= RMB_RMBDOWN_LAST
;
678 nch
->nch_RMBState
= RMB_RMBDOWN
;
679 GetSysTime(&nch
->nch_TouchTime
);
684 else if(nch
->nch_RMBState
>= RMB_RMBDOWN
)
689 switch(nch
->nch_CDC
->cdc_RMBMode
)
691 case 2: // 1-click sticky
692 case 3: // double click sticky
693 if(nch
->nch_RMBState
== RMB_RMBDOWN
)
695 nch
->nch_RMBState
= RMB_RMBDOWN_LMBUP
;
697 else if((nch
->nch_RMBState
== RMB_RMBDOWN_LAST
) || (nch
->nch_RMBState
< RMB_RMBDOWN
))
699 nch
->nch_RMBState
= RMB_IDLE
;
706 nch
->nch_RMBState
= RMB_IDLE
;
710 iecode
= IECODE_NOBUTTON
;
713 qualifier
|= IEQUALIFIER_LEFTBUTTON
;
717 qualifier
|= IEQUALIFIER_RBUTTON
;
719 if((buts
^oldbuts
) & 1)
721 iecode
= (buts
& 1) ? IECODE_LBUTTON
: IECODE_LBUTTON
|IECODE_UP_PREFIX
;
723 else if((buts
^oldbuts
) & 2)
725 iecode
= (buts
& 2) ? IECODE_RBUTTON
: IECODE_RBUTTON
|IECODE_UP_PREFIX
;
727 KPRINTF(1, ("Translated Coords %ld, %ld\n", xpos
, ypos
));
729 tagptr
= nch
->nch_TabTags
;
730 nch
->nch_FakeEvent
.ie_EventAddress
= &nch
->nch_TabletEvent
;
731 nch
->nch_TabletEvent
.ient_RangeX
= xrange
;
732 nch
->nch_TabletEvent
.ient_RangeY
= yrange
;
733 nch
->nch_TabletEvent
.ient_TabletX
= xpos
;
734 nch
->nch_TabletEvent
.ient_TabletY
= ypos
;
735 nch
->nch_TabletEvent
.ient_TagList
= (struct TagItem
*) tagptr
;
736 *tagptr
++ = TABLETA_ButtonBits
;
739 nch
->nch_FakeEvent
.ie_Class
= IECLASS_NEWPOINTERPOS
;
740 nch
->nch_FakeEvent
.ie_SubClass
= IESUBCLASS_NEWTABLET
;
741 nch
->nch_FakeEvent
.ie_Code
= IECODE_NOBUTTON
;
742 nch
->nch_FakeEvent
.ie_NextEvent
= NULL
;
743 nch
->nch_FakeEvent
.ie_Qualifier
= qualifier
;
744 nch
->nch_InpIOReq
->io_Data
= &nch
->nch_FakeEvent
;
745 nch
->nch_InpIOReq
->io_Length
= sizeof(struct InputEvent
);
746 nch
->nch_InpIOReq
->io_Command
= IND_WRITEEVENT
;
747 DoIO((struct IORequest
*) nch
->nch_InpIOReq
);
751 nch
->nch_FakeEvent
.ie_X
= 0;
752 nch
->nch_FakeEvent
.ie_Y
= 0;
753 nch
->nch_FakeEvent
.ie_Class
= IECLASS_RAWMOUSE
;
754 nch
->nch_FakeEvent
.ie_SubClass
= 0;
755 nch
->nch_FakeEvent
.ie_Code
= iecode
;
756 nch
->nch_FakeEvent
.ie_NextEvent
= NULL
;
757 nch
->nch_FakeEvent
.ie_Qualifier
= qualifier
|IEQUALIFIER_RELATIVEMOUSE
;
758 nch
->nch_InpIOReq
->io_Data
= &nch
->nch_FakeEvent
;
759 nch
->nch_InpIOReq
->io_Length
= sizeof(struct InputEvent
);
760 nch
->nch_InpIOReq
->io_Command
= IND_WRITEEVENT
;
761 DoIO((struct IORequest
*) nch
->nch_InpIOReq
);
769 KPRINTF(1, ("Int Pipe failed %ld\n", ioerr
));
772 psdSendPipe(nch
->nch_EP1Pipe
, buf
, nch
->nch_EP1PktSize
);
776 } while(!(sigs
& SIGBREAKF_CTRL_C
));
777 KPRINTF(20, ("Going down the river!\n"));
778 psdAbortPipe(nch
->nch_EP1Pipe
);
779 psdWaitPipe(nch
->nch_EP1Pipe
);
787 /* /// "nAllocHid()" */
788 struct NepClassHid
* nAllocHid(void)
790 struct Task
*thistask
;
791 struct NepClassHid
*nch
;
793 thistask
= FindTask(NULL
);
794 nch
= thistask
->tc_UserData
;
797 if(!(nch
->nch_Base
= OpenLibrary("poseidon.library", 4)))
802 if(!(nch
->nch_HIntBase
= OpenLibrary("intuition.library", 39)))
804 Alert(AG_OpenLib
|AO_Intuition
);
807 nch
->nch_Interface
= psdFindInterface(nch
->nch_Device
, NULL
, TAG_END
);
808 if(!nch
->nch_Interface
)
810 KPRINTF(1, ("Ooops!?! No interfaces defined?\n"));
814 psdGetAttrs(PGA_INTERFACE
, nch
->nch_Interface
,
815 IFA_InterfaceNum
, &nch
->nch_IfNum
,
818 nch
->nch_EP1
= psdFindEndpoint(nch
->nch_Interface
, NULL
,
820 EA_TransferType
, USEAF_INTERRUPT
,
824 KPRINTF(1, ("Ooops!?! No Endpoints defined?\n"));
827 psdGetAttrs(PGA_ENDPOINT
, nch
->nch_EP1
,
828 EA_MaxPktSize
, &nch
->nch_EP1PktSize
,
831 nch
->nch_TimerIOReq
.tr_node
.io_Message
.mn_Node
.ln_Type
= NT_REPLYMSG
;
832 nch
->nch_TimerIOReq
.tr_node
.io_Message
.mn_ReplyPort
= NULL
;
833 nch
->nch_TimerIOReq
.tr_node
.io_Message
.mn_Length
= sizeof(struct timerequest
);
834 if(OpenDevice("timer.device", UNIT_MICROHZ
, (struct IORequest
*) &nch
->nch_TimerIOReq
, 0))
836 Alert(AG_OpenDev
|AO_TimerDev
);
839 nch
->nch_TimerBase
= (struct Library
*) nch
->nch_TimerIOReq
.tr_node
.io_Device
;
841 if((nch
->nch_InpMsgPort
= CreateMsgPort()))
843 if((nch
->nch_InpIOReq
= (struct IOStdReq
*) CreateIORequest(nch
->nch_InpMsgPort
, sizeof(struct IOStdReq
))))
845 if(!OpenDevice("input.device", 0, (struct IORequest
*) nch
->nch_InpIOReq
, 0))
847 if((nch
->nch_TaskMsgPort
= CreateMsgPort()))
849 if((nch
->nch_EP0Pipe
= psdAllocPipe(nch
->nch_Device
, nch
->nch_TaskMsgPort
, NULL
)))
851 if((nch
->nch_EP1Pipe
= psdAllocPipe(nch
->nch_Device
, nch
->nch_TaskMsgPort
, nch
->nch_EP1
)))
853 if((nch
->nch_EP1Buf
= psdAllocVec(nch
->nch_EP1PktSize
)))
855 psdSetAttrs(PGA_PIPE
, nch
->nch_EP1Pipe
,
856 PPA_AllowRuntPackets
, TRUE
,
858 nch
->nch_Task
= thistask
;
861 psdFreePipe(nch
->nch_EP1Pipe
);
863 psdFreePipe(nch
->nch_EP0Pipe
);
865 DeleteMsgPort(nch
->nch_TaskMsgPort
);
867 CloseDevice((struct IORequest
*) nch
->nch_InpIOReq
);
869 DeleteIORequest((struct IORequest
*) nch
->nch_InpIOReq
);
871 DeleteMsgPort(nch
->nch_InpMsgPort
);
874 CloseLibrary(nch
->nch_HIntBase
);
875 CloseLibrary(nch
->nch_Base
);
877 nch
->nch_Task
= NULL
;
878 if(nch
->nch_ReadySigTask
)
880 Signal(nch
->nch_ReadySigTask
, 1L<<nch
->nch_ReadySignal
);
886 /* /// "nFreeHid()" */
887 void nFreeHid(struct NepClassHid
*nch
)
889 psdFreeVec(nch
->nch_EP1Buf
);
890 psdFreePipe(nch
->nch_EP1Pipe
);
891 psdFreePipe(nch
->nch_EP0Pipe
);
892 DeleteMsgPort(nch
->nch_TaskMsgPort
);
893 CloseDevice((struct IORequest
*) nch
->nch_InpIOReq
);
894 DeleteIORequest((struct IORequest
*) nch
->nch_InpIOReq
);
895 DeleteMsgPort(nch
->nch_InpMsgPort
);
896 CloseDevice((struct IORequest
*) &nch
->nch_TimerIOReq
);
897 CloseLibrary(nch
->nch_HIntBase
);
898 CloseLibrary(nch
->nch_Base
);
900 nch
->nch_Task
= NULL
;
901 if(nch
->nch_ReadySigTask
)
903 Signal(nch
->nch_ReadySigTask
, 1L<<nch
->nch_ReadySignal
);
908 /**************************************************************************/
910 static const char *MirrorStrings
[] =
919 static const char *RotateStrings
[] =
928 static const char *RMBModeStrings
[] =
931 "RMB until released",
932 "Next click releases RMB",
933 "Double click releases RMB",
937 /* /// "nGUITask()" */
938 AROS_UFH0(void, nGUITask
)
942 struct Task
*thistask
;
943 struct NepHidBase
*nh
;
944 struct NepClassHid
*nch
;
947 thistask
= FindTask(NULL
);
949 #define ps nch->nch_PsdBase
951 #define IntuitionBase nch->nch_IntBase
953 #define MUIMasterBase nch->nch_MUIBase
955 nch
= thistask
->tc_UserData
;
956 nh
= nch
->nch_ClsBase
;
958 ++nh
->nh_Library
.lib_OpenCnt
;
959 if(!(MUIMasterBase
= OpenLibrary(MUIMASTER_NAME
, MUIMASTER_VMIN
)))
961 KPRINTF(10, ("Couldn't open muimaster.library.\n"));
962 nGUITaskCleanup(nch
);
966 if(!(IntuitionBase
= OpenLibrary("intuition.library", 39)))
968 KPRINTF(10, ("Couldn't open intuition.library.\n"));
969 nGUITaskCleanup(nch
);
972 if(!(ps
= OpenLibrary("poseidon.library", 4)))
974 KPRINTF(10, ("Couldn't open poseidon.library.\n"));
975 nGUITaskCleanup(nch
);
979 nch
->nch_App
= ApplicationObject
,
980 MUIA_Application_Title
, (IPTR
)libname
,
981 MUIA_Application_Version
, (IPTR
)VERSION_STRING
,
982 MUIA_Application_Copyright
, (IPTR
)"©2004-2009 Chris Hodges",
983 MUIA_Application_Author
, (IPTR
)"Chris Hodges <chrisly@platon42.de>",
984 MUIA_Application_Description
, (IPTR
)"Settings for the egalaxtouch.class",
985 MUIA_Application_Base
, (IPTR
)"EGALAXTOUCH",
986 MUIA_Application_HelpFile
, (IPTR
)"HELP:Poseidon.guide",
987 MUIA_Application_Menustrip
, (IPTR
)MenustripObject
,
988 Child
, (IPTR
)MenuObjectT((IPTR
)"Project"),
989 Child
, (IPTR
)(nch
->nch_AboutMI
= MenuitemObject
,
990 MUIA_Menuitem_Title
, (IPTR
)"About...",
991 MUIA_Menuitem_Shortcut
, (IPTR
)"?",
994 Child
, (IPTR
)MenuObjectT((IPTR
)"Settings"),
995 Child
, (IPTR
)(nch
->nch_UseMI
= MenuitemObject
,
996 MUIA_Menuitem_Title
, (IPTR
)"Save",
997 MUIA_Menuitem_Shortcut
, (IPTR
)"S",
999 Child
, (IPTR
)(nch
->nch_SetDefaultMI
= MenuitemObject
,
1000 MUIA_Menuitem_Title
, (IPTR
)"Save as Default",
1001 MUIA_Menuitem_Shortcut
, (IPTR
)"D",
1003 Child
, (IPTR
)MenuitemObject
,
1004 MUIA_Menuitem_Title
, (IPTR
)NM_BARLABEL
,
1006 Child
, (IPTR
)(nch
->nch_MUIPrefsMI
= MenuitemObject
,
1007 MUIA_Menuitem_Title
, (IPTR
)"MUI Settings",
1008 MUIA_Menuitem_Shortcut
, (IPTR
)"M",
1013 SubWindow
, (IPTR
)(nch
->nch_MainWindow
= WindowObject
,
1014 MUIA_Window_ID
, MAKE_ID('M','A','I','N'),
1015 MUIA_Window_Title
, (IPTR
)libname
,
1016 MUIA_HelpNode
, (IPTR
)libname
,
1018 WindowContents
, (IPTR
)VGroup
,
1019 Child
, (IPTR
)VGroup
, GroupFrameT((IPTR
)(nch
->nch_Interface
? "Device Settings" : "Default Device Settings")),
1020 Child
, (IPTR
)VGroup
, GroupFrameT((IPTR
)"Touchscreen Calibration"),
1021 Child
, (IPTR
)ColGroup(4),
1022 Child
, (IPTR
)Label((IPTR
) "MinX:"),
1023 Child
, (IPTR
)(nch
->nch_MinXObj
= SliderObject
, SliderFrame
,
1025 MUIA_Numeric_Min
, 0,
1026 MUIA_Numeric_Max
, 1919,
1027 MUIA_Numeric_Value
, nch
->nch_CDC
->cdc_MinX
,
1029 Child
, (IPTR
)Label((IPTR
) "MaxX:"),
1030 Child
, (IPTR
)(nch
->nch_MaxXObj
= SliderObject
, SliderFrame
,
1032 MUIA_Numeric_Min
, 128,
1033 MUIA_Numeric_Max
, 2047,
1034 MUIA_Numeric_Value
, nch
->nch_CDC
->cdc_MaxX
,
1036 Child
, (IPTR
)Label((IPTR
) "MinY:"),
1037 Child
, (IPTR
)(nch
->nch_MinYObj
= SliderObject
, SliderFrame
,
1039 MUIA_Numeric_Min
, 0,
1040 MUIA_Numeric_Max
, 1919,
1041 MUIA_Numeric_Value
, nch
->nch_CDC
->cdc_MinY
,
1043 Child
, (IPTR
)Label((IPTR
) "MaxY:"),
1044 Child
, (IPTR
)(nch
->nch_MaxYObj
= SliderObject
, SliderFrame
,
1046 MUIA_Numeric_Min
, 128,
1047 MUIA_Numeric_Max
, 2047,
1048 MUIA_Numeric_Value
, nch
->nch_CDC
->cdc_MaxY
,
1050 Child
, (IPTR
)Label((IPTR
) "Mirror:"),
1051 Child
, (IPTR
)(nch
->nch_MirrorObj
= CycleObject
,
1052 MUIA_Cycle_Entries
, (IPTR
)MirrorStrings
,
1053 MUIA_Cycle_Active
, nch
->nch_CDC
->cdc_Mirror
,
1055 Child
, (IPTR
)Label((IPTR
) "Rotate:"),
1056 Child
, (IPTR
)(nch
->nch_RotateObj
= CycleObject
,
1057 MUIA_Cycle_Entries
, (IPTR
)RotateStrings
,
1058 MUIA_Cycle_Active
, nch
->nch_CDC
->cdc_Rotate
,
1061 Child
, (IPTR
)HGroup
,
1062 Child
, (IPTR
)(nch
->nch_TrackDimsObj
= ImageObject
, ImageButtonFrame
,
1063 MUIA_Background
, MUII_ButtonBack
,
1065 MUIA_InputMode
, MUIV_InputMode_Toggle
,
1066 MUIA_Image_Spec
, MUII_CheckMark
,
1067 MUIA_Image_FreeVert
, TRUE
,
1068 MUIA_Selected
, FALSE
,
1069 MUIA_ShowSelState
, FALSE
,
1071 Child
, (IPTR
)Label((IPTR
) "Track Dimensions by input (disables LMB/RMB)"),
1072 Child
, (IPTR
)HSpace(0),
1075 Child
, (IPTR
)ColGroup(2), GroupFrameT("Right Mouse Button Emulation"),
1076 Child
, (IPTR
)Label((IPTR
) "Mode:"),
1077 Child
, (IPTR
)(nch
->nch_RMBModeObj
= CycleObject
,
1078 MUIA_Cycle_Entries
, (IPTR
)RMBModeStrings
,
1079 MUIA_Cycle_Active
, nch
->nch_CDC
->cdc_RMBMode
,
1081 Child
, (IPTR
)Label((IPTR
) "Activation Delay:"),
1082 Child
, (IPTR
)(nch
->nch_RMBDelayObj
= SliderObject
, SliderFrame
,
1084 MUIA_Numeric_Min
, 5,
1085 MUIA_Numeric_Max
, 50,
1086 MUIA_Numeric_Value
, nch
->nch_CDC
->cdc_RMBDelay
,
1087 MUIA_Numeric_Format
, (IPTR
)"%ld00ms",
1089 Child
, (IPTR
)Label((IPTR
) "Allowed Jitter:"),
1090 Child
, (IPTR
)(nch
->nch_RMBToleranceObj
= SliderObject
, SliderFrame
,
1092 MUIA_Numeric_Min
, 0,
1093 MUIA_Numeric_Max
, 100,
1094 MUIA_Numeric_Value
, nch
->nch_CDC
->cdc_RMBTolerance
,
1095 MUIA_Numeric_Format
, (IPTR
)"%ld units",
1099 Child
, (IPTR
)VSpace(0),
1100 Child
, (IPTR
)HGroup
,
1101 MUIA_Group_SameWidth
, TRUE
,
1102 Child
, (IPTR
)(nch
->nch_UseObj
= TextObject
, ButtonFrame
,
1103 MUIA_ShowMe
, (IPTR
)nch
->nch_Interface
,
1104 MUIA_Background
, MUII_ButtonBack
,
1106 MUIA_InputMode
, MUIV_InputMode_RelVerify
,
1107 MUIA_Text_Contents
, (IPTR
)"\33c Save ",
1109 Child
, (IPTR
)(nch
->nch_SetDefaultObj
= TextObject
, ButtonFrame
,
1110 MUIA_Background
, MUII_ButtonBack
,
1112 MUIA_InputMode
, MUIV_InputMode_RelVerify
,
1113 MUIA_Text_Contents
, (IPTR
)(nch
->nch_Interface
? "\33c Save as Default " : "\33c Save Defaults "),
1115 Child
, (IPTR
)(nch
->nch_CloseObj
= TextObject
, ButtonFrame
,
1116 MUIA_Background
, MUII_ButtonBack
,
1118 MUIA_InputMode
, MUIV_InputMode_RelVerify
,
1119 MUIA_Text_Contents
, (IPTR
)"\33c Use ",
1128 KPRINTF(10, ("Couldn't create application\n"));
1129 nGUITaskCleanup(nch
);
1133 DoMethod(nch
->nch_MainWindow
, MUIM_Notify
, MUIA_Window_CloseRequest
, TRUE
,
1134 nch
->nch_App
, 2, MUIM_Application_ReturnID
, MUIV_Application_ReturnID_Quit
);
1135 DoMethod(nch
->nch_UseObj
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
1136 nch
->nch_App
, 2, MUIM_Application_ReturnID
, ID_STORE_CONFIG
);
1137 DoMethod(nch
->nch_SetDefaultObj
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
1138 nch
->nch_App
, 2, MUIM_Application_ReturnID
, ID_DEF_CONFIG
);
1139 DoMethod(nch
->nch_CloseObj
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
1140 nch
->nch_App
, 2, MUIM_Application_ReturnID
, MUIV_Application_ReturnID_Quit
);
1142 DoMethod(nch
->nch_MinXObj
, MUIM_Notify
, MUIA_Numeric_Value
, MUIV_EveryTime
,
1143 nch
->nch_App
, 2, MUIM_Application_ReturnID
, ID_UPDATE_LIMITSMIN
);
1144 DoMethod(nch
->nch_MaxXObj
, MUIM_Notify
, MUIA_Numeric_Value
, MUIV_EveryTime
,
1145 nch
->nch_App
, 2, MUIM_Application_ReturnID
, ID_UPDATE_LIMITSMAX
);
1146 DoMethod(nch
->nch_MinYObj
, MUIM_Notify
, MUIA_Numeric_Value
, MUIV_EveryTime
,
1147 nch
->nch_App
, 2, MUIM_Application_ReturnID
, ID_UPDATE_LIMITSMIN
);
1148 DoMethod(nch
->nch_MaxYObj
, MUIM_Notify
, MUIA_Numeric_Value
, MUIV_EveryTime
,
1149 nch
->nch_App
, 2, MUIM_Application_ReturnID
, ID_UPDATE_LIMITSMAX
);
1151 DoMethod(nch
->nch_MirrorObj
, MUIM_Notify
, MUIA_Cycle_Active
, MUIV_EveryTime
,
1152 nch
->nch_App
, 2, MUIM_Application_ReturnID
, ID_UPDATE_MIRRORROT
);
1153 DoMethod(nch
->nch_RotateObj
, MUIM_Notify
, MUIA_Cycle_Active
, MUIV_EveryTime
,
1154 nch
->nch_App
, 2, MUIM_Application_ReturnID
, ID_UPDATE_MIRRORROT
);
1155 DoMethod(nch
->nch_TrackDimsObj
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
1156 nch
->nch_App
, 2, MUIM_Application_ReturnID
, ID_UPDATE_MIRRORROT
);
1158 DoMethod(nch
->nch_RMBModeObj
, MUIM_Notify
, MUIA_Cycle_Active
, MUIV_EveryTime
,
1159 nch
->nch_App
, 2, MUIM_Application_ReturnID
, ID_UPDATE_MIRRORROT
);
1160 DoMethod(nch
->nch_RMBDelayObj
, MUIM_Notify
, MUIA_Numeric_Value
, MUIV_EveryTime
,
1161 nch
->nch_App
, 2, MUIM_Application_ReturnID
, ID_UPDATE_MIRRORROT
);
1162 DoMethod(nch
->nch_RMBToleranceObj
, MUIM_Notify
, MUIA_Numeric_Value
, MUIV_EveryTime
,
1163 nch
->nch_App
, 2, MUIM_Application_ReturnID
, ID_UPDATE_MIRRORROT
);
1165 DoMethod(nch
->nch_AboutMI
, MUIM_Notify
, MUIA_Menuitem_Trigger
, MUIV_EveryTime
,
1166 nch
->nch_App
, 2, MUIM_Application_ReturnID
, ID_ABOUT
);
1167 DoMethod(nch
->nch_UseMI
, MUIM_Notify
, MUIA_Menuitem_Trigger
, MUIV_EveryTime
,
1168 nch
->nch_App
, 2, MUIM_Application_ReturnID
, ID_STORE_CONFIG
);
1169 DoMethod(nch
->nch_SetDefaultMI
, MUIM_Notify
, MUIA_Menuitem_Trigger
, MUIV_EveryTime
,
1170 nch
->nch_App
, 2, MUIM_Application_ReturnID
, ID_DEF_CONFIG
);
1171 DoMethod(nch
->nch_MUIPrefsMI
, MUIM_Notify
, MUIA_Menuitem_Trigger
, MUIV_EveryTime
,
1172 nch
->nch_App
, 2, MUIM_Application_OpenConfigWindow
, 0);
1180 get(nch
->nch_App
, MUIA_Application_Iconified
, &iconify
);
1181 set(nch
->nch_MainWindow
, MUIA_Window_Open
, TRUE
);
1182 get(nch
->nch_MainWindow
, MUIA_Window_Open
, &isopen
);
1183 if(!(isopen
|| iconify
))
1185 nGUITaskCleanup(nch
);
1188 nch
->nch_TrackingSignal
= AllocSignal(-1);
1189 sigmask
= (1<<nch
->nch_TrackingSignal
);
1192 retid
= DoMethod(nch
->nch_App
, MUIM_Application_NewInput
, &sigs
);
1195 case ID_UPDATE_LIMITSMIN
:
1196 get(nch
->nch_MinXObj
, MUIA_Numeric_Value
, &nch
->nch_CDC
->cdc_MinX
);
1197 if(nch
->nch_CDC
->cdc_MinX
+ 128 >= nch
->nch_CDC
->cdc_MaxX
)
1199 set(nch
->nch_MaxXObj
, MUIA_Numeric_Value
, nch
->nch_CDC
->cdc_MinX
+ 128);
1201 get(nch
->nch_MinYObj
, MUIA_Numeric_Value
, &nch
->nch_CDC
->cdc_MinY
);
1202 if(nch
->nch_CDC
->cdc_MinY
+ 128 >= nch
->nch_CDC
->cdc_MaxY
)
1204 set(nch
->nch_MaxYObj
, MUIA_Numeric_Value
, nch
->nch_CDC
->cdc_MinY
+ 128);
1208 case ID_UPDATE_LIMITSMAX
:
1209 get(nch
->nch_MaxXObj
, MUIA_Numeric_Value
, &nch
->nch_CDC
->cdc_MaxX
);
1210 if(nch
->nch_CDC
->cdc_MinX
+ 128 >= nch
->nch_CDC
->cdc_MaxX
)
1212 set(nch
->nch_MinXObj
, MUIA_Numeric_Value
, nch
->nch_CDC
->cdc_MaxX
- 128);
1214 get(nch
->nch_MaxYObj
, MUIA_Numeric_Value
, &nch
->nch_CDC
->cdc_MaxY
);
1215 if(nch
->nch_CDC
->cdc_MinY
+ 128 >= nch
->nch_CDC
->cdc_MaxY
)
1217 set(nch
->nch_MinYObj
, MUIA_Numeric_Value
, nch
->nch_CDC
->cdc_MaxY
- 128);
1221 case ID_UPDATE_MIRRORROT
:
1223 ULONG trackdims
= 0;
1224 get(nch
->nch_MirrorObj
, MUIA_Cycle_Active
, &nch
->nch_CDC
->cdc_Mirror
);
1225 get(nch
->nch_RotateObj
, MUIA_Cycle_Active
, &nch
->nch_CDC
->cdc_Rotate
);
1226 get(nch
->nch_RMBModeObj
, MUIA_Cycle_Active
, &nch
->nch_CDC
->cdc_RMBMode
);
1227 get(nch
->nch_RMBDelayObj
, MUIA_Numeric_Value
, &nch
->nch_CDC
->cdc_RMBDelay
);
1228 get(nch
->nch_RMBToleranceObj
, MUIA_Numeric_Value
, &nch
->nch_CDC
->cdc_RMBTolerance
);
1229 get(nch
->nch_TrackDimsObj
, MUIA_Selected
, &trackdims
);
1232 if(!nch
->nch_TrackDims
)
1234 nch
->nch_CDC
->cdc_MinX
= 1024-64;
1235 nch
->nch_CDC
->cdc_MinY
= 1024-64;
1236 nch
->nch_CDC
->cdc_MaxX
= 1024+64;
1237 nch
->nch_CDC
->cdc_MaxY
= 1024+64;
1238 set(nch
->nch_MinXObj
, MUIA_Disabled
, TRUE
);
1239 set(nch
->nch_MaxXObj
, MUIA_Disabled
, TRUE
);
1240 set(nch
->nch_MinYObj
, MUIA_Disabled
, TRUE
);
1241 set(nch
->nch_MaxYObj
, MUIA_Disabled
, TRUE
);
1243 nch
->nch_TrackDims
= TRUE
;
1245 if(nch
->nch_TrackDims
)
1247 set(nch
->nch_MinXObj
, MUIA_Disabled
, FALSE
);
1248 set(nch
->nch_MaxXObj
, MUIA_Disabled
, FALSE
);
1249 set(nch
->nch_MinYObj
, MUIA_Disabled
, FALSE
);
1250 set(nch
->nch_MaxYObj
, MUIA_Disabled
, FALSE
);
1252 nch
->nch_TrackDims
= FALSE
;
1258 case ID_STORE_CONFIG
:
1259 case MUIV_Application_ReturnID_Quit
:
1260 if(retid
== ID_DEF_CONFIG
)
1262 pic
= psdGetClsCfg(libname
);
1265 psdSetClsCfg(libname
, NULL
);
1266 pic
= psdGetClsCfg(libname
);
1270 if(psdAddCfgEntry(pic
, nch
->nch_CDC
))
1272 psdSaveCfgToDisk(NULL
, FALSE
);
1278 pic
= psdGetUsbDevCfg(libname
, nch
->nch_DevIDString
, NULL
);
1281 psdSetUsbDevCfg(libname
, nch
->nch_DevIDString
, NULL
, NULL
);
1282 pic
= psdGetUsbDevCfg(libname
, nch
->nch_DevIDString
, NULL
);
1286 if(psdAddCfgEntry(pic
, nch
->nch_CDC
))
1288 if(retid
!= MUIV_Application_ReturnID_Quit
)
1290 psdSaveCfgToDisk(NULL
, FALSE
);
1292 retid
= MUIV_Application_ReturnID_Quit
;
1296 retid
= MUIV_Application_ReturnID_Quit
;
1301 MUI_RequestA(nch
->nch_App
, nch
->nch_MainWindow
, 0, NULL
, "Blimey!", VERSION_STRING
, NULL
);
1304 if(nch
->nch_TrackDims
)
1306 nnset(nch
->nch_MinXObj
, MUIA_Numeric_Value
, nch
->nch_CDC
->cdc_MinX
);
1307 nnset(nch
->nch_MaxXObj
, MUIA_Numeric_Value
, nch
->nch_CDC
->cdc_MaxX
);
1308 nnset(nch
->nch_MinYObj
, MUIA_Numeric_Value
, nch
->nch_CDC
->cdc_MinY
);
1309 nnset(nch
->nch_MaxYObj
, MUIA_Numeric_Value
, nch
->nch_CDC
->cdc_MaxY
);
1311 if(retid
== MUIV_Application_ReturnID_Quit
)
1317 sigs
= Wait(sigs
| sigmask
| SIGBREAKF_CTRL_C
);
1318 if(sigs
& SIGBREAKF_CTRL_C
)
1324 FreeSignal(nch
->nch_TrackingSignal
);
1325 nch
->nch_TrackingSignal
= -1;
1326 nch
->nch_TrackDims
= FALSE
;
1327 set(nch
->nch_MainWindow
, MUIA_Window_Open
, FALSE
);
1329 nGUITaskCleanup(nch
);
1335 /* /// "nGUITaskCleanup()" */
1336 void nGUITaskCleanup(struct NepClassHid
*nch
)
1340 MUI_DisposeObject(nch
->nch_App
);
1341 nch
->nch_App
= NULL
;
1345 CloseLibrary(MUIMasterBase
);
1346 MUIMasterBase
= NULL
;
1350 CloseLibrary(IntuitionBase
);
1351 IntuitionBase
= NULL
;
1359 nch
->nch_GUIBinding
= NULL
;
1360 nch
->nch_GUITask
= NULL
;
1361 if(nch
->nch_ReadySigTask
)
1363 Signal(nch
->nch_ReadySigTask
, 1L<<nch
->nch_ReadySignal
);
1365 --nch
->nch_ClsBase
->nh_Library
.lib_OpenCnt
;