Page 2 of 7
Re: Troubles in Commodity-land
Posted: Fri Dec 04, 2015 2:24 pm
by trixie
broadblues wrote:
A "commodity" that is just a normal app with a popup key is arguably not a true commodity.
Exactly. This is why I added, many months ago, the following note at the beginning of the Commodities Library wiki page:
In the past, some developers turned their programs into commodities only to provide them with a handy keyboard shortcut to bring up/close their GUI. Please note that such practice is actually a misuse of the commodities framework.
Re: Troubles in Commodity-land
Posted: Fri Dec 04, 2015 4:04 pm
by thomasrapp
And what is the preferred practice to provide an application with a handy keyboard shortcut?
Re: Troubles in Commodity-land
Posted: Fri Dec 04, 2015 5:20 pm
by trixie
@thomas
AFAIK there is none at the moment. But registering as a commodity, installing a handler in the CX network and tapping the input stream is hardly a nice way to achieve such functionality. Image all programs doing this!
A possible system solution would be something along the lines of what I implemented in my (unfinished, sadly) application.class. The class runs a CX events subscription server, which applications can contact and "subscribe" to receive a particular event from the commodities network. This way applications can use global hotkeys without installing their own commodities handlers: only ONE handler is required (the CX subscription server, which is in fact a commodity created by the class). This seems to work quite well, testing with the class torso I have here.
Re: Troubles in Commodity-land
Posted: Fri Dec 04, 2015 5:23 pm
by OldFart
@salass00:
To eat an event you just attach a CxTranslate(NULL) to your filter object.
Information like this is sorely lacking from the wiki.
On a related note: if I want to intercept both lefthand mouse button AND righthand mousebutton events, do I then need to specify 2 CxFilters as well as 2 CxSenders? Or can things be combined into 1 filter pattern like "rawmouse lefthandbutton | righthandbutton" (with disregard to the correct naming)?
@maintainer-of-commodities-wiki:
The generic regular expression, as presented in the wiki contains probably an error:
Code: Select all
[class] { [-] (qualifier | synonym) ) } [ [-] upstroke] [highmap | ANSICode]
Right after 'synonym' there is 1 parentesis too many (or somwhere else 1 should be added...).
I think it should read like this:
Code: Select all
[class] { [-] (qualifier | synonym)} [ [-] upstroke] [highmap | ANSICode]
OldFart
Re: Troubles in Commodity-land
Posted: Fri Dec 04, 2015 6:06 pm
by xenic
trixie wrote:broadblues wrote:
A "commodity" that is just a normal app with a popup key is arguably not a true commodity.
Exactly. This is why I added, many months ago, the following note at the beginning of the Commodities Library wiki page:
In the past, some developers turned their programs into commodities only to provide them with a handy keyboard shortcut to bring up/close their GUI. Please note that such practice is actually a misuse of the commodities framework.
It seems like it's way to late for such a restriction. If you check in your Exchange commodity, you will see many major applications like Odyssey, YAM, MUIBase, Directory Opus etc. Considering the already extensive use of Commodity hotkeys, I'd like a way to find out what hotkeys are already in use and being eaten. I had to do trial-and-error testing to find a working hotkey for my commodity.
Re: Troubles in Commodity-land
Posted: Fri Dec 04, 2015 6:29 pm
by trixie
xenic wrote:It seems like it's way to late for such a restriction.
It's not a restriction - it's a reminder that commodities were designed for something else. And no, it's never too late.
Re: Troubles in Commodity-land
Posted: Fri Dec 04, 2015 6:41 pm
by xenic
OldFart wrote:Information like this is sorely lacking from the wiki.
Correcting or improving the WIKI information and examples would be preferable to adding restrictions and warnings.
Re: Troubles in Commodity-land
Posted: Fri Dec 04, 2015 6:42 pm
by trixie
@xenic
So why don't you go and correct it instead of bitching about?
Re: Troubles in Commodity-land
Posted: Fri Dec 04, 2015 6:44 pm
by xenic
trixie wrote:xenic wrote:It seems like it's way to late for such a restriction.
It's not a restriction - it's a reminder that commodities were designed for something else. And no, it's never too late.
Semantics.
Re: Troubles in Commodity-land
Posted: Fri Dec 04, 2015 7:05 pm
by xenic
trixie wrote:@xenic
So why don't you go and correct it instead of bitching about?
Complaining would have been a kinder description of my posts but it seems like you've reached the same level of frustration as I have when trying to write a program based on inaccurate or outdated documentation. I'll take a look at the PopShell.c example and see if I know how to replace the deprecated functions I complained about.