Scaling deskbar replicants...!

What needs to be done in order to do the scaling?
Looking at the implementations in the haiku src i only see small changes in the instantiate_deskbar_item() ctor where one has to add
(float maxWidth, float maxHeight)
and change
Deskbarview(BRect(0, 0, 15, 15)
Deskbarview(BRect(0, 0, maxWidth, maxHeight)
But that didn’t work and abviously wasn’t enough when i tried that with the bluetooth replicant, so what else needs to be done to get it right?

A quick look at the source code and I think changing the BRect should be enough.

If you have more than an instance of the bluetooth replicant on the system, could be the cause of the problem. You must have only one executable.

I have the exact same result with my own app where i have only one instance, see screenshot below.
As you can see there is a wide rectangle with a small portion of the icon.
It looks as if the Shelf? tries to load the whole “64x64”? bitmap as is (ie: with out scaling it first)? am i right to assume it’s something like that?


The shelf does not deal with bitmaps directly. It works with the view you give to it in instanciate_deskbar_item.

This view works like any other view in Haiku, it can draw a bitmap, or it can have buttons, menus, whatever you can fit there.

The chnage is that before, instanciate_deskbar_item would not give any hint about the size, and all replicants somewhat agreed on using 16x16 (with some exceptions, for example the PowerStatus replicant can be wider if you use the “show text” option).

So, the problem you get is likely something on your side. You are probably not doing the right thing with the parameters you got. As usual it’s hard to say more without a link to your sourcecode.

If you load a 64x64 bitmap and draw that in the view what you see is the expected result. You should load the image with the width,height passed by instantiate_deskbar_item and draw that in the view (this will give you the best aesthetical result).

My parametres are correct, please take a look at my Deskbariew.cpp.
If the only required changes are the ones discussed above, then i’m doing it right.

At line 225 you must use DeskbarView(BRect(0, 0, maxHeight - 1, maxHeight - 1)
maxWidth is 129 (for reference

If you want a square you must use maxHeight for the view Width.



This is very embarrassing :blush: , it was there all the time in front of eyes and i didn’t see it, unbelievable…!, it’s not a new pair of glasses :eyeglasses: that i need but magnifiers :mag:.
@janus2, @PulkoMandy thank you for helping me out with my silly mistake.

1 Like

There is an app for that. Deskbar->Applications->Magnify. :blush:

I already wear glasses i thought they were enough, :face_with_monocle: