diff options
author | Johan Bjäreholt <johan@bjareho.lt> | 2020-06-24 07:55:42 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2020-07-01 17:21:57 +0200 |
commit | 1f8dbb320a9fdff9e59fb7641c4b5af56abc7074 (patch) | |
tree | 9af78a01388a90af03a50917d6c0a092b5a32944 | |
parent | output: simplify loop over layer surfaces (diff) | |
download | sway-1f8dbb320a9fdff9e59fb7641c4b5af56abc7074.tar.gz sway-1f8dbb320a9fdff9e59fb7641c4b5af56abc7074.tar.zst sway-1f8dbb320a9fdff9e59fb7641c4b5af56abc7074.zip |
tree/view: Make foreign-toplevel app_id fallback to class
It is not a part of the foreign-toplevel-management protocol to get the
class of a toplevel, only for getting the app_id.
For xwayland clients this is an issue because that means that you cannot
identify what application the toplevel refers to which is the point of
the app_id property.
By falling back to class when an app_id does not exist solves this problem.
Phoc also uses app_id and class interchangeably in their implementation
of foreign-toplevel-management, in fact they always do that and not only
for just this protocol.
https://source.puri.sm/Librem5/phoc/-/blob/c8d8a4c5440a6c1647b09dbd3bba7999f9cd433c/src/xwayland.c#L236
-rw-r--r-- | sway/tree/view.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c index fb397c42..53c11a32 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -738,10 +738,14 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface, | |||
738 | input_manager_set_focus(&view->container->node); | 738 | input_manager_set_focus(&view->container->node); |
739 | } | 739 | } |
740 | 740 | ||
741 | const char *app_id = view_get_app_id(view); | 741 | const char *app_id; |
742 | if (app_id != NULL) { | 742 | const char *class; |
743 | if ((app_id = view_get_app_id(view)) != NULL) { | ||
743 | wlr_foreign_toplevel_handle_v1_set_app_id( | 744 | wlr_foreign_toplevel_handle_v1_set_app_id( |
744 | view->foreign_toplevel, app_id); | 745 | view->foreign_toplevel, app_id); |
746 | } else if ((class = view_get_class(view)) != NULL) { | ||
747 | wlr_foreign_toplevel_handle_v1_set_app_id( | ||
748 | view->foreign_toplevel, class); | ||
745 | } | 749 | } |
746 | } | 750 | } |
747 | 751 | ||