Troubles in Commodity-land

A forum for general AmigaOS 4.x support questions that are not platform-specific
User avatar
trixie
Posts: 411
Joined: Thu Jun 30, 2011 3:54 pm
Location: Czech Republic

Re: Troubles in Commodity-land

Post 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.
The Rear Window blog

AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
User avatar
thomasrapp
Posts: 318
Joined: Sun Jun 19, 2011 12:22 am

Re: Troubles in Commodity-land

Post by thomasrapp »

And what is the preferred practice to provide an application with a handy keyboard shortcut?
User avatar
trixie
Posts: 411
Joined: Thu Jun 30, 2011 3:54 pm
Location: Czech Republic

Re: Troubles in Commodity-land

Post 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.
The Rear Window blog

AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
User avatar
OldFart
Posts: 104
Joined: Tue Jul 12, 2011 3:56 pm
Location: Groningen, Netherlands

Re: Troubles in Commodity-land

Post 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
X5000, appears to be sick. Dismantled jan 1, 2024.
Dead MicroA1
A1200 in ElBox, c/w Blizzard '040 @ 50MHz + SCSI module, ZIV-board c/w (o.a.) cv64/3d + flickerdoubler + FastATA-ZIV + Lots of SCSI gear, sitting idle.
RaspBerry Pi 2B, 3B, 4B/4Gb, 4B/8Gb
OrangePi 5+ 8Gb
ACER Windows 10
xenic
Posts: 1185
Joined: Sun Jun 19, 2011 1:06 am

Re: Troubles in Commodity-land

Post 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.
AmigaOne X1000 with 2GB memory - OS4.1 FE
User avatar
trixie
Posts: 411
Joined: Thu Jun 30, 2011 3:54 pm
Location: Czech Republic

Re: Troubles in Commodity-land

Post 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.
The Rear Window blog

AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
xenic
Posts: 1185
Joined: Sun Jun 19, 2011 1:06 am

Re: Troubles in Commodity-land

Post 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.
AmigaOne X1000 with 2GB memory - OS4.1 FE
User avatar
trixie
Posts: 411
Joined: Thu Jun 30, 2011 3:54 pm
Location: Czech Republic

Re: Troubles in Commodity-land

Post by trixie »

@xenic

So why don't you go and correct it instead of bitching about?
The Rear Window blog

AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
xenic
Posts: 1185
Joined: Sun Jun 19, 2011 1:06 am

Re: Troubles in Commodity-land

Post 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.
AmigaOne X1000 with 2GB memory - OS4.1 FE
xenic
Posts: 1185
Joined: Sun Jun 19, 2011 1:06 am

Re: Troubles in Commodity-land

Post 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.
AmigaOne X1000 with 2GB memory - OS4.1 FE
Post Reply