fix: The x11 window that should not be focused on miss judge
This commit is contained in:
@@ -363,6 +363,35 @@ static inline void client_set_suspended(Client *c, int suspended) {
|
|||||||
wlr_xdg_toplevel_set_suspended(c->surface.xdg->toplevel, suspended);
|
wlr_xdg_toplevel_set_suspended(c->surface.xdg->toplevel, suspended);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int client_surface_wants_focus(Client *c) {
|
||||||
|
|
||||||
|
#ifdef XWAYLAND
|
||||||
|
if (client_is_x11(c)) {
|
||||||
|
struct wlr_xwayland_surface *surface = c->surface.xwayland;
|
||||||
|
// 处理不需要焦点的窗口类型
|
||||||
|
const uint32_t no_focus_types[] = {
|
||||||
|
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_COMBO,
|
||||||
|
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_DND,
|
||||||
|
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_DROPDOWN_MENU,
|
||||||
|
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_MENU,
|
||||||
|
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_NOTIFICATION,
|
||||||
|
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_POPUP_MENU,
|
||||||
|
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_SPLASH,
|
||||||
|
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_DESKTOP,
|
||||||
|
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_TOOLTIP,
|
||||||
|
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_UTILITY
|
||||||
|
};
|
||||||
|
// 检查窗口类型是否需要禁止焦点
|
||||||
|
for (size_t i = 0; i < sizeof(no_focus_types)/sizeof(no_focus_types[0]); ++i) {
|
||||||
|
if (wlr_xwayland_surface_has_window_type(surface, no_focus_types[i])) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static inline int client_wants_focus(Client *c) {
|
static inline int client_wants_focus(Client *c) {
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
return client_is_unmanaged(c) &&
|
return client_is_unmanaged(c) &&
|
||||||
|
|||||||
@@ -3707,6 +3707,10 @@ void focusclient(Client *c, int lift) {
|
|||||||
if (c && c->animation.tagouting && !c->animation.tagouting)
|
if (c && c->animation.tagouting && !c->animation.tagouting)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if(c && client_is_x11(c) && !client_surface_wants_focus(c)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Raise client in stacking order if requested */
|
/* Raise client in stacking order if requested */
|
||||||
if (c && lift)
|
if (c && lift)
|
||||||
wlr_scene_node_raise_to_top(&c->scene->node); // 将视图提升到顶层
|
wlr_scene_node_raise_to_top(&c->scene->node); // 将视图提升到顶层
|
||||||
|
|||||||
Reference in New Issue
Block a user