Re: Troubles in Commodity-land
Posted: Mon Dec 07, 2015 10:33 pm
That's good because it looks like my observations were incorrectOldFart wrote:Don't worry: I am not easily offended. Really not.

Support Forum
https://forum.hyperion-entertainment.com/
https://forum.hyperion-entertainment.com/viewtopic.php?t=3270
That's good because it looks like my observations were incorrectOldFart wrote:Don't worry: I am not easily offended. Really not.
We both learned a bit today, that's the upside.That's good because it looks like my observations were incorrect
Perhaps it's for the best. If Commodities library intercepted and ate mouse clicks, the system would become almost useless. Apparently mouse buttons only work as qualifiers. I tried hotkey HOTKEY "lbutton a" and it works. On the other hand it will use hotkey HOTKEY "ctrl c" which works as a hotkey but prevents copying text.OldFart wrote:
However, I'm still looking for a way to intercept mouseclicks. A filterpattern of "rawmouse mouse_leftpress" does not cut any cake, although it is accepted as a 'proper' pattern. It looks like there is still something missing, or? I keep on looking.
Hmmm, I'm sure you really thought that statement throughxenic wrote:Perhaps it's for the best. If Commodities library intercepted and ate mouse clicks, the system would become almost useless.OldFart wrote:
However, I'm still looking for a way to intercept mouseclicks. A filterpattern of "rawmouse mouse_leftpress" does not cut any cake, although it is accepted as a 'proper' pattern. It looks like there is still something missing, or? I keep on looking.
In the context of a hotkey I think that's probably true.Apparently mouse buttons only work as qualifiers.
CTRL-C for copying text? You may be in the wrong OSI tried hotkey HOTKEY "lbutton a" and it works. On the other hand it will use hotkey HOTKEY "ctrl c" which works as a hotkey but prevents copying text.
What exactly are you trying to do? If you want to act of a mouse key up or down event, a simple filter might not be the way to go.OldFart wrote:
However, I'm still looking for a way to intercept mouseclicks. A filterpattern of "rawmouse mouse_leftpress" does not cut any cake, although it is accepted as a 'proper' pattern. It looks like there is still something missing, or? I keep on looking.
OldFart
I said "intercepted and ate mouse clicks" which other commodities aren't doing or you wouldn't be able click on gadgets in the normal way. What I mean by "ate" is that a commodity is using a translate CxObject which prevents events from being passed to other commodities or applications.broadblues wrote: Hmmm, I'm sure you really thought that statement throughClickToFront? DepthToFront? BorderResize?
I think the context of this topic is hotkeys, but yes, in the context of hotkeys.In the context of a hotkey I think that's probably true.
I was thinking RAMIGA-C and wrote CTRL-C, both of which would be bad choices.CTRL-C for copying text? You may be in the wrong OS
It would stop you from sending a ctrl_C to shell program though.
Lots of choices not all good.
Try looking in one of the OS3 developer CD's for an example called "leftymouse". I haven't had a chance to examine it closely but it looks like it sets up a catch-all filter and then checks the CxMsg input event structure for mouse events.OldFart wrote: I keep on looking.
Code: Select all
/*
** main.c - Simple Keyword tester commodity
*/
#include <exec/libraries.h>
#include <libraries/commodities.h>
#include <dos/dos.h>
#include <proto/exec.h>
#include <proto/commodities.h>
#include <proto/dos.h>
#define ELSE_ERROR(Text) else {IDOS->Printf("ERROR: Failed to %s\n", Text);}
#define EVT_HOTKEY 1L
#define TEMPLATE "PATTERN/A"
enum ArgID {AID_PATTERN
,AID_LAST
};
struct NewBroker newbroker = { NB_VERSION
, "Amiga Keyworder"
, "A Simple Keyword tester"
, "A simple Keyword tester commodity"
, NBU_UNIQUE | NBU_NOTIFY
, 0
, 0
, NULL
, 0
};
int main(int argc, char *argv[])
{
IDOS->Printf("INFO : Setup commodity...\n");
STRPTR Args;
struct RDArgs *rda = IDOS->ReadArgs(TEMPLATE, (APTR)&Args, NULL);
if (rda != NULL)
{
newbroker.nb_Port = IExec->AllocSysObject(ASOT_PORT, TAG_END);
if (newbroker.nb_Port != NULL)
{
CxObj *broker = ICommodities->CxBroker(&newbroker, NULL);
uint32 cxsigflag = 1L << newbroker.nb_Port->mp_SigBit;
if (broker != NULL)
{
CxObj *filter = CxFilter(Args),
*sender,
*translate;
int32 CxErr;
if (filter != NULL)
{
ICommodities->AttachCxObj(broker, filter);
if (sender = CxSender(newbroker.nb_Port, EVT_HOTKEY))
{
ICommodities->AttachCxObj(filter, sender);
if (translate = CxTranslate(NULL))
{
ICommodities->AttachCxObj(filter, translate);
CxErr = ICommodities->CxObjError(filter);
if (CxErr == 0)
{
CxMsg *msg;
uint32 msgid,
msgtype,
sigrcvd;
ICommodities->ActivateCxObj(broker, 1L);
BOOL Done = FALSE;
IDOS->Printf("INFO : Here we go...\n");
while (Done == FALSE)
{
sigrcvd = IExec->Wait(SIGBREAKF_CTRL_C | cxsigflag);
while (msg = (CxMsg *)IExec->GetMsg(newbroker.nb_Port))
{
msgid = ICommodities->CxMsgID(msg);
msgtype = ICommodities->CxMsgType(msg);
IExec->ReplyMsg((struct Message *)msg);
switch (msgtype)
{
case CXM_IEVENT:
{
IDOS->Printf("An event, ");
switch(msgid)
{
case EVT_HOTKEY:
{
IDOS->Printf("you are notified due to [ %s ]\n", Args);
break;
}
default:
{
IDOS->Printf("which is unknown.\n");
}
}
break;
}
case CXM_COMMAND:
{
IDOS->Printf("A command: ");
switch(msgid)
{
case CXCMD_DISABLE:
{
IDOS->Printf("CXCMD_DISABLE\n");
ICommodities->ActivateCxObj(broker, 0L);
break;
}
case CXCMD_ENABLE:
{
IDOS->Printf("CXCMD_ENABLE\n");
ICommodities->ActivateCxObj(broker, 1L);
break;
}
case CXCMD_KILL:
{
IDOS->Printf("CXCMD_KILL\n");
Done = TRUE;
break;
}
case CXCMD_UNIQUE:
{
IDOS->Printf("CXCMD_UNIQUE\n");
Done = TRUE;
break;
}
default:
{
IDOS->Printf("Unknown msgid\n");
}
}
break;
}
default:
{
IDOS->Printf("Unknown msgtype\n");
}
}
if (sigrcvd & SIGBREAKF_CTRL_C)
{
Done = TRUE;
IDOS->Printf("CTRL C signal break\n");
}
}
}
while (msg = (CxMsg *)IExec->GetMsg(newbroker.nb_Port))
{
IExec->ReplyMsg((struct Message *)msg);
}
IDOS->Printf("INFO : ...and here we stopped\n");
}
else
{
IDOS->Printf("ERROR: %ld\n", CxErr);
}
}
ELSE_ERROR("Create translator");
}
ELSE_ERROR("Create sender");
}
ELSE_ERROR("Create filter");
ICommodities->DeleteCxObjAll(broker);
}
ELSE_ERROR("Create broker");
IExec->FreeSysObject(ASOT_PORT, newbroker.nb_Port);
}
ELSE_ERROR("Create MsgPort");
IDOS->FreeArgs(rda);
}
ELSE_ERROR("Read Arguments");
return 0;
}
/*
SWITCHES = -W \
-Werror \
-Wmissing-prototypes \
-Wsign-compare \
-Wundef \
-Wshadow \
-Wwrite-strings \
KTC : main.c
gcc main.c -lauto -o KTC $(SWITCHES)
*/
Uh, me??? Using tabs in code??? No, not me, definitly not. (Yikes!)I suggest you replace tabs with spaces in your text editor before posting