How to check if Workbench titlebar is enabled or disabled ?

14 posts / 0 new
Last post
TSK
TSK's picture
Offline
Last seen: 5 months 3 weeks ago
Joined: 2011-06-28 02:06
How to check if Workbench titlebar is enabled or disabled ?

Is there a way to check if Workbench titlebar is enabled or disabled ?

mritter0
mritter0's picture
Offline
Last seen: 1 year 10 months ago
Joined: 2014-04-21 21:15
Re: How to check if Workbench titlebar is enabled or disabled ?

DefaultPubScreen=IIntuition->LockPubScreen(NULL);

TopEdge=DefaultPubScreen->BarHeight;

If TopEdge is 0, it is disabled?

TSK
TSK's picture
Offline
Last seen: 5 months 3 weeks ago
Joined: 2011-06-28 02:06
Re: How to check if Workbench titlebar is enabled or disabled ?

No, BarHeight has a value always. What I meant is the setting in Workbench prefs to set the titlebar: visible, disabled or auto.

xenic
xenic's picture
Offline
Last seen: 1 year 11 months ago
Joined: 2011-05-07 04:52
Re: How to check if Workbench titlebar is enabled or disabled ?

@TSK
I checked the SDK and don't see any obvious way to get those settings. I'm not sure how useful they could be since the user can change them at any time and your program might be opened on some other public screen.

The only way I can see to tell what the toolbar settings are is to check ENV:Sys/workbench.prefs, which change whenever those toolbar settings are changed by the user.

EDIT: Now that I think of it, the user might be using Dopus5 in Workbench replacement mode; in which case Workbench wouldn't even be present.

X1000 - OS 4.1FE

trixie
trixie's picture
Offline
Last seen: 5 months 3 hours ago
Joined: 2011-02-03 13:58
Re: How to check if Workbench titlebar is enabled or disabled ?

@xenic

I'm not sure how useful they could be

For example, a taskbar-like program may want to decide whether it should display its GUI over or below the WB title bar (AmiDock has such a setting AFAIR).

AmigaOne X5000-020 / 2GB RAM / Sapphire Pulse Radeon RX 560 / AmigaOS 4.1 Final Edition Update 2

xenic
xenic's picture
Offline
Last seen: 1 year 11 months ago
Joined: 2011-05-07 04:52
Re: How to check if Workbench titlebar is enabled or disabled ?

@trixie
O.K. That makes sense. However, those Workbench titlebar settings (Visible,Hidden,Automatic) don't actually affect the WorkBench screen titlebar. They only affect the Workbench backdrop window. If you disable (uncheck) the Workbench/BackDrop window then the screen titlebar is present regardless of the titlebar settings in Workbench prefs. In addition, AmiDock is an OS4 system commodity and probably has access to private internal Workbench settings. Since nobody has pointed out any 'legal' way to determine if there is a screen titlebar visible and there are numerous user settings and customization that can affect the Workbench titlebar display, I don't see any way for TSK to get the status of the screen titlebar.

X1000 - OS 4.1FE

jabirulo
jabirulo's picture
Offline
Last seen: 1 hour 23 min ago
Joined: 2013-05-30 00:53
Re: How to check if Workbench titlebar is enabled or disabled ?

Not sure if using intuition.library's'GetScreenAttr()' and looking in 'SA_Quiet - (BOOL) see ShowTitle()' will help.

ShowTitle -- Set the screen title bar display mode.

ULONG scr_has_title;
GetScreenAttrs(, SA_Quiet, &scr_has_title, TAG_DONE);

AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonHD6570/SSD120GB/DVDRW :-P

xenic
xenic's picture
Offline
Last seen: 1 year 11 months ago
Joined: 2011-05-07 04:52
Re: How to check if Workbench titlebar is enabled or disabled ?

@jabirulo
You have the right idea; the problem is an error in the GetScreenAttr() autodoc that has this line: " SA_Quiet - (BOOL) see ShowTitle().". The autodoc doesn't mention the SA_ShowTitle tag but that's the tag that should say "see ShowTitle()". The SA_ShowTitle tag works. Here is a short program I used to test it:

  1. /* gcc titlebar.c -o titlebar -lauto -Wall */
  2.  
  3. #include <proto/exec.h>
  4. #include <proto/dos.h>
  5. #include <proto/intuition.h>
  6.  
  7. int main(int argc, char **argv)
  8. {
  9. struct Screen *screen = NULL;
  10. uint32 mode = 0;
  11. uint32 result = 0;
  12.  
  13. if (!(screen = IIntuition->LockPubScreen("Workbench")))
  14. {
  15. IDOS->Printf("Failed to find Workbench screen\n");
  16. return RETURN_FAIL;
  17. }
  18.  
  19. result = IIntuition->GetScreenAttr(screen, SA_ShowTitle, &mode, sizeof(mode));
  20.  
  21. IDOS->Printf("Result: %ld Mode: %ld\n", result, mode);
  22.  
  23. IIntuition->UnlockPubScreen(NULL, screen);
  24.  
  25. return RETURN_OK;
  26. }

The program returns a Mode of 1 if the titlebar is visible and 0 if it's hidden.
Hopefully, TSK hasn't given up on this topic and sees our posts.

X1000 - OS 4.1FE

TSK
TSK's picture
Offline
Last seen: 5 months 3 weeks ago
Joined: 2011-06-28 02:06
Re: How to check if Workbench titlebar is enabled or disabled ?

Thanks a lot ! I didn't realize there's the SA_ShowTitle tag.

I'm using this in FuelGauge to adjust positioning of the gauges automatically if the WB titlebar is visible or not because WB moves the volume icons depending on the titlebar but it doesn't change the snapshot coordinates in the icons themselves. Unfortunately when setting the titlebar to Auto then the icons are repositioned only once but not when the user hovers the mouse cursor on top to reveal the titlebar. So I added a new tooltype to FuelGauge to take care of the Auto mode.

broadblues
broadblues's picture
Offline
Last seen: 4 years 1 month ago
Joined: 2012-05-02 21:48
Re: How to check if Workbench titlebar is enabled or disabled ?

Given your usage case, an alternative might be to positiion your fuelguage gadget/windows realative to the Workbench wincow and not the screen?

What happens if the user leaves workbench back drop mode?

TSK
TSK's picture
Offline
Last seen: 5 months 3 weeks ago
Joined: 2011-06-28 02:06
Re: How to check if Workbench titlebar is enabled or disabled ?

FuelGauge works only when Workbench is in backdrop mode. There's no feature in Intuition to make a window to stay always in front of a particular window but always behind every other window. So it's impossible to make it to work in non-backdrop mode of the Workbench. I take everything GUI related stuff into account already. (The gauges are related to CurrentY of the struct DiskObject.)

thomas
thomas's picture
Offline
Last seen: 6 hours 42 min ago
Joined: 2011-05-16 14:23
Re: How to check if Workbench titlebar is enabled or disabled ?

There's no feature in Intuition to make a window to stay always in front of a particular window but always behind every other window. So it's impossible to make it to work in non-backdrop mode of the Workbench.

OS4 introduced WA_StayTop attribute. Check intuition.library/OpenWindow autodocs.

TSK
TSK's picture
Offline
Last seen: 5 months 3 weeks ago
Joined: 2011-06-28 02:06
Re: How to check if Workbench titlebar is enabled or disabled ?

"WA_StayTop (WA_Dummy + 0x45)
/* (BOOL) Make this window to always stay in front of all
* others. V50."

It makes the window to stay in front of ** all ** other windows not in front of any particular one.

You all have to believe I tested everything I could find from AmigaOS autodocs, header files and beyond many many years ago already.

jabirulo
jabirulo's picture
Offline
Last seen: 1 hour 23 min ago
Joined: 2013-05-30 00:53
Re: How to check if Workbench titlebar is enabled or disabled ?

And maybe is too much (re)work, but adding the gauge inside the disk icon/image?
Don't know if it's doable "in real time".

I use something alike on mixer docky icon, in the image (speaker) I show the % of volume:

  1. ..
  2. void DockyRender(struct DockyIFace *Self)
  3. {
  4. struct DockyData *dd = (struct DockyData *)((uint32)Self - Self->Data.NegativeSize);
  5. struct BitMap *tempBM = NULL;
  6. APTR lock2, *ba2;
  7. uint32 *bpr2;
  8. char tmp[4];
  9.  
  10. IUtility->SNPrintf(tmp, 4, "%ld",sliderVal[CurrentProp]);
  11.  
  12. tempBM = IGraphics->AllocBitMapTags(dd->real.width, dd->real.height, 32,
  13. BMATags_PixelFormat,PIXF_A8R8G8B8, TAG_END);
  14. if( (lock2=IGraphics->LockBitMapTags(tempBM, LBM_BytesPerRow,&bpr2, LBM_BaseAddress,&ba2, TAG_END)) )
  15. {// To pass the Alpha info from the DT object to the memory (RenderInfo) of the bitmap
  16. IIntuition->IDoMethod(picObject, PDTM_READPIXELARRAY,ba2,//ri.Memory,//ba2,
  17. PBPAFMT_ARGB, bpr2,//ri.BytesPerRow,//bpr2,
  18. 0, 0, dd->real.width, dd->real.height);
  19. IGraphics->UnlockBitMap(lock2);
  20. }
  21.  
  22. IGraphics->CompositeTags(COMPOSITE_Src_Over_Dest, tempBM, dd->rp->BitMap,
  23. COMPTAG_SrcWidth, dd->real.width,
  24. COMPTAG_SrcHeight, dd->real.height,
  25. COMPTAG_ScaleX, COMP_FLOAT_TO_FIX(dd->scaleImg),
  26. COMPTAG_ScaleY, COMP_FLOAT_TO_FIX(dd->scaleImg),
  27. COMPTAG_Flags, COMPFLAG_SrcFilter,
  28. TAG_DONE);
  29.  
  30. IGraphics->FreeBitMap(tempBM);
  31.  
  32. if(dd->freefont && !buttonMute[CurrentProp] && sliderVal[CurrentProp]!=0)
  33. {// Show volume value
  34. int32 i, xpos, ypos,
  35. tmp_len = IUtility->Strlen(tmp);
  36.  
  37. IGraphics->SetFont(dd->rp, dd->font);
  38.  
  39. xpos = (dd->size.width - IGraphics->TextLength(dd->rp, tmp, tmp_len)) >> 1; // centered
  40. ypos = dd->size.height - dd->font->tf_Baseline;
  41.  
  42. IGraphics->SetABPenDrMd(dd->rp, dd->bgndpen, dd->bgndpen, JAM1);
  43. for(i = 0; i < 3; i++)
  44. {// Create outline effect using color 'dd->bgndpen'
  45. IGraphics->Move(dd->rp, xpos-1, ypos+i);
  46. IGraphics->Text(dd->rp, tmp, tmp_len);
  47. IGraphics->Move(dd->rp, xpos, ypos+i);
  48. IGraphics->Text(dd->rp, tmp, tmp_len);
  49. IGraphics->Move(dd->rp, xpos+1, ypos+i);
  50. IGraphics->Text(dd->rp, tmp, tmp_len);
  51. }
  52.  
  53. IGraphics->SetABPenDrMd(dd->rp, dd->textpen, dd->bgndpen, JAM1);//JAM2);
  54. IGraphics->Move(dd->rp, xpos, ypos+1);
  55. IGraphics->Text(dd->rp, tmp, tmp_len);
  56. }
  57.  
  58. }
  59. ..

AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonHD6570/SSD120GB/DVDRW :-P

Log in or register to post comments