AmiDock & RMB

This forum is for general developer support questions.
Post Reply
zzd10h
Posts: 546
Joined: Sun Sep 16, 2012 6:40 am
Location: France

AmiDock & RMB

Post by zzd10h »

Hello,
I have 2 questions related to RMB and AmiDock.

1) when I RMB on AmiDock, all the dockies are frozen (for example, CPUClock). Of course, when I RMB on Workbench, AmiDock don't stop to work.
Is it normal ? Is it deactivable ?

2) Is this RMB event trappable in C ?
I can use DOCKYSET_DoubleClick, DOCKYSET_Click, DOCKYSET_ObjectClick and DOCKYSET_DockClick to detect left mouse click but I find nothing for Right mouse button.

My problem is that for 2 of my dockies
-CPUDock (try to put cpuwatcher in docky)
-NetDock (try to open a MUI window, without event loop)

it crashs AmiDock in CLASSES:popumenu.class as soon that I RMB (for my NetDock, crashs only when the external window is opened).

http://zzd10h.amiga-ng.org/NetDock/NetD ... _KO_01.jpg

http://zzd10h.amiga-ng.org/NetDock/NetD ... _KO_02.jpg

If I close the extern window (by detecting a DockCLick or ObjectCLick) it works but it will be better to be able to detect Right click

Thanks for your help
http://apps.amistore.net/zTools
X1000 - AmigaOS 4.1.6 / 4.1 FE
User avatar
javierdlr
Beta Tester
Beta Tester
Posts: 389
Joined: Sun Jun 19, 2011 11:13 pm
Location: Donostia (GUIPUZCOA) - Spain
Contact:

Re: AmiDock & RMB

Post by javierdlr »

You can download KeymapSwitcher, It has Context menus (RMB) support/enabled.

Code: Select all

BOOL _docky_DockyGet(struct DockyIFace *Self, uint32 msgType, uint32 *msgData)
..
  case DOCKYGET_ContextMenu:  // RMB is pressed
  {
   Object *contextMenu = (Object *)msgData;
#ifdef DDEBUG
IDOS->Printf("[DOCKYGET_ContextMenu]\n");
#endif
   Object *subMenu = IIntuition->NewObject(NULL, "popupmenu.class", TAG_END);

   Object *itemSM = IIntuition->NewObject(NULL, "popupmenuitem.class",
                                 PMIA_Title,   "Mode",
                                 PMIA_SubMenu, subMenu,
                                TAG_END);

   Object *itemS1 = IIntuition->NewObject(NULL, "popupmenuitem.class",
                                 PMIA_Title,   "PopUp",
                                 PMIA_ID,      MENU_OPT1,
                                 PMIA_CheckIt, TRUE,
                                 PMIA_Checked, !WinMode,
                                TAG_END);

   Object *itemS2 = IIntuition->NewObject(NULL, "popupmenuitem.class",
                                 PMIA_Title,   "Window",
                                 PMIA_ID,      MENU_OPT2,
                                 PMIA_CheckIt, TRUE,
                                 PMIA_Checked, WinMode,
                                TAG_END);

   Object *item3 = IIntuition->NewObject(NULL, "popupmenuitem.class",
                                PMIA_Title, "Settings...",
                                PMIA_ID,    MENU_PREFS,
                               TAG_END);

//   Object *itemBar = IIntuition->NewObject(NULL, "popupmenuitem.class", PMIA_Title,~0, TAG_END);

   IIntuition->IDoMethod(subMenu, OM_ADDMEMBER, itemS1); // mode popup
   IIntuition->IDoMethod(subMenu, OM_ADDMEMBER, itemS2); // mode window
   IIntuition->IDoMethod(contextMenu, OM_ADDMEMBER, itemSM); // Submenu string 'Mode'
   if(WinMode) IIntuition->IDoMethod(contextMenu, OM_ADDMEMBER, item3); // Settings...
//   IIntuition->IDoMethod(contextMenu, OM_ADDMEMBER, itemBar);
  }
  break;
..


BOOL _docky_DockySet(struct DockyIFace *Self, uint32 msgType, uint32 msgData)
{
 struct DockyData *dd = (struct DockyData *)((uint32)Self - Self->Data.NegativeSize);
..
  case DOCKYSET_ContextMenuResult:  // objetc/option from RMB menu choosed
  {
   Object *o = (Object *)msgData;
#ifdef DOCKY_DEBUG
IDOS->Printf("[DOCKYSET_ContextMenuResult]\n");
#endif
   if(o)
   {
    IIntuition->GetAttr(PMIA_ID, o, (uint32 *)&dd->km_item);
#ifdef DDEBUG
IDOS->Printf("KeyMapSwitcher: item=%ld\n",dd->km_item);
#endif
    switch(dd->km_item)
    {
     case MENU_OPT1: WinMode = FALSE; // PopUp mode
     break;
     case MENU_OPT2: WinMode = TRUE; // Window mode
     break;
     case MENU_PREFS:
     break;
    } // END switch(dd-km->item)

   } // END if(o)..
  }
  break;



Raziel

Re: AmiDock & RMB

Post by Raziel »

Oh...i thought you two were already in contact :-)

Yeah, docky powers combined
zzd10h
Posts: 546
Joined: Sun Sep 16, 2012 6:40 am
Location: France

Re: AmiDock & RMB

Post by zzd10h »

Thank you Javier,
I saw that yours worked perfectly.

but how do you detect if the mouse button is left or right one ?
EDIT, ah yes I understood, in case DOCKYGET_ContextMenu: thx will try tomorrow
 ;
By the way, I succeed to make MUI window works with NetDock by closing the MUI external window when mouse is outside the docky (DOCKYSET_MouseIsOverDocky)

Now it works, my MUI window is opened and closed if the mouse is inside or outside NetDock ;)

edit : better to have info window beside the mouse cursor (with Thomas Claus NetDock pictures set)
http://zzd10h.amiga-ng.org/NetDock/NetD ... iInfo2.jpg

I have to see if it's applicable to CPUDocky too, tomorrow is another day...

Edit : I forgot to say that I auto-close the MUI window when I click inside my docky to avoid the çrash, of course.
Raziel, yes but as Javier doesn't seems to encounter my specific problem, I prefered to ask...

To sum up, is somebody knows
1) why AmiDock freezes himself when RMB is pressed ?
2) how to detect RMB in AmiDock ?

Thank you
http://apps.amistore.net/zTools
X1000 - AmigaOS 4.1.6 / 4.1 FE
Post Reply