feat: client 的任务栏标题点击行为根据 client 窗口的遮挡状态进行
- 当点击 client 在任务中的标题时,如果 client 被其他窗口遮挡,则将其显 示出来,否则切换其 minimize 属性 - 新增 rect 模块用于辅助判断 client 的遮挡状态,添加 rect_intersection/rect_subtract/rect_subtract_many 函数 - client 模块新增 client_get_obscured_state 计算 client 窗口被遮挡状态 - action 模块新增 change_client_state_dwim,实现上述的 client 状态切换
This commit is contained in:
20
src/action.c
20
src/action.c
@@ -118,3 +118,23 @@ void kill_client(const user_action_arg_t *arg) {
|
||||
client_kill(wm.client_focused);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 根据 client 的当前状态切换 client 下一状态
|
||||
* @description 如果当前 client 被遮挡了或者最小化了,则显示出来,否则最小化
|
||||
*/
|
||||
void change_client_state_dwim(const user_action_arg_t *arg) {
|
||||
client_t *client = (client_t *)arg->ptr;
|
||||
if (!client) return;
|
||||
|
||||
if (client != wm.client_stack_list &&
|
||||
client_get_obscured_state(client, wm.client_stack_list) !=
|
||||
obscured_none) {
|
||||
client_stack_raise(client);
|
||||
client_focus(client);
|
||||
return;
|
||||
}
|
||||
|
||||
client_set_minimize(client, !client->minimize);
|
||||
if (!client->minimize) client_stack_raise(client);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user