Opened 15 months ago

Last modified 14 months ago

#18251 new enhancement

Add mechanism to BDeskbar to locate replicant views

Reported by: waddlesplash Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: Kits/Interface Kit Version: R1/beta4
Keywords: Cc:
Blocked By: #18206 Blocking:
Platform: All

Description

Seen with BeCJK in Chinese locale, among others, but the problem is really in input_server: https://xref.landonf.org/source/xref/haiku/src/servers/input/AddOnManager.cpp#584

A user on the forums pointed out that removing the B_TRANSLATE_SYSTEM_NAME from the main Deskbar window does solve the problem: https://discuss.haiku-os.org/t/how-to-input-chinese-word/13030/47

This problem is seen with Qt applications too, though, I assume because they use a similar mechanism to communicate with Deskbar icons: https://github.com/haikuports/haikuports/issues/4881

Change History (10)

comment:1 by waddlesplash, 15 months ago

I presume there are more than just input_server and Qt applications affected by this problem, though. How shall we solve it? Can we rely on having a looper name separate from the window title, and find the window that way, perhaps?

Even though Deskbar's window title is not actually visible, I don't think disabling its name translation is the proper solution here.

comment:2 by waddlesplash, 15 months ago

Possibly we should add a method to BDeskbar to fetch a messenger to the view of a particular replicant?

comment:3 by pulkomandy, 15 months ago

It should work to get the Deskbar team and simply use window 0. Or alternatively, a dedicated 'scripting suite' could be used: send a message to the BApplication asking it to return a pointer/messenger to the DeskBar window.

I would be OK with removing the translation still, as a binary/API compatibility thing.

It is strange that these add-ons manage to get a view added to the window, but then don't manage to get a pointer to the window from there? Couldn't they use their BView to find the parent window?

comment:4 by anthonylee, 15 months ago

The view created by Deskbar which loading input_server as a library and instantiated by the specific function.

So, in order to communicate with the view, getting BMessenger is the safe and simple way than script one, that's the input_server just did.

comment:5 by waddlesplash, 14 months ago

Blocking: 18206 added

comment:6 by waddlesplash, 14 months ago

Blocked By: 18206 added
Blocking: 18206 removed

comment:7 by waddlesplash, 14 months ago

Component: Servers/input_serverKits/Interface Kit
Summary: input_server cannot find Deskbar shelf when "Translate application names" is in useAdd mechanism to BDeskbar to locate replicant views
Type: bugenhancement

Initial problem worked around in hrev56788. But we should add a new API to BDeskbar so that this change can be undone in the long term.

comment:8 by jessicah, 14 months ago

Can't we have two names, the untranslated and translated name, and then the scripting system solely uses the untranslated name?

comment:9 by waddlesplash, 14 months ago

Scripting works on window titles. There's not any distinction between "window title" and "window name" (and I don't know why there would be.)

comment:10 by pulkomandy, 14 months ago

The code in BWindow actually does a lot of efforts to keep them in sync. Setting the window title will rename the thread, rename the BHandler, etc.

But I think we can fix this without having to change the name at all.

The replicant itself should be able to get it simply by calling Looper() from its AttahcedToWindow() method.

If the app that adds the replicant needs a handle to the window to communicate with it, it should be able to get it from the reply to the kMsgAddAddOn or kMsgAddView message used to add something to Deskbar. Seems like a reasonably simple change to BDeskBar::AddItem: we already get the reply message there, we just need to find the looper which sent it, and allow the caller app to get a BMessenger to it in return.

Note: See TracTickets for help on using tickets.