An API to define app_id for wayland (Issue #24668)

12 views
Skip to first unread message

xenia

unread,
Jul 2, 2024, 1:54:39 PM (3 days ago) Jul 2
to wx-...@googlegroups.com, Subscribed

Description

See https://gitlab.com/kicad/code/kicad/-/issues/18322 for some context.

On wayland, there's an association called app_id between application windows and their desktop files that's important for the window system to be able to associate opened window back to the desktop file. On KDE plasma 6, as i've found out with kicad, what happens when the association is broken is that KDE doesn't know what the correct icons for the windows are, or when the app is done opening its first window, and this results in some mildly broken/inconsistent UI. Essentially, app_id is similar to WM_CLASS in X11, but the two aren't compatible (for some reason).

In GTK+ 3, the field that defines the app_id for wayland purposes is argv[0] passed to gtk_init_check. Alternatively, it can be defined in GtkApplication, which doesn't appear to be used in wxGTK. Thus for the kicad issue, the hotfix i've applied to my own versions is just rewriting argv[0] to match the desktop file name (without the .desktop part), and this fully makes the broken UI go away. There's similar facilities in Qt (but i'm not sure what the current state of wxQt is).

I would like wxWidgets to have an api for the app_id concept, which would map to the above low-level APIs on wxGTK and perhaps wxQt, and would be a no-op on mac and windows (unless there's some useful mapping there -- i'm not familiar with those APIs). I think some possible designs for this could be

  1. extend wxIMPLEMENT_APP with a second field, eg
wxIMPLEMENT_APP(MY_APP_CLASS, "org.me.myapp")
  1. define an optional or non-optional macro
wxDECLARE_APP_ID("org.me.myapp")
// might expand in user code to eg
const char* wxGetAppId() {
    return "org.me.myapp";
}
// this could then be called by wxEntry/wxInit to retrieve and apply the user app_id
  1. some other option. i'm happy to brainstorm solutions and draft any needed PRs for this issue

Another point that was raised on the KiCad issue was the possibility of wxWidgets implementing the recently merged xdg-toplevel-icon for wayland wxGTK. I can open a separate issue for that and draft PRs if there's interest.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24668@github.com>

VZ

unread,
Jul 3, 2024, 5:39:22 PM (2 days ago) Jul 3
to wx-...@googlegroups.com, Subscribed

We should indeed provide a convenient name of setting Wayland app_id, but ideally it would also work for Windows application IDs and maybe also Mac application bundle ID.

The most natural way to do it would be to add a {Get,Set}AppId() pair of member functions to wxApp, to go with the existing ones for {Set,Get}App{,Display}{,Vendor}Name() and also {Set,Get}ClassName(). Speaking of the latter, perhaps we could also repurpose it for this, as it doesn't seem to be used for anything any more, which would allow to add support for it in 3.2 branch too easily.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24668/2207356454@github.com>

Reply all
Reply to author
Forward
0 new messages