format code
This commit is contained in:
@@ -379,10 +379,10 @@ static inline int client_surface_wants_focus(Client *c) {
|
|||||||
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_SPLASH,
|
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_SPLASH,
|
||||||
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_DESKTOP,
|
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_DESKTOP,
|
||||||
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_TOOLTIP,
|
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_TOOLTIP,
|
||||||
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_UTILITY
|
WLR_XWAYLAND_NET_WM_WINDOW_TYPE_UTILITY};
|
||||||
};
|
|
||||||
// 检查窗口类型是否需要禁止焦点
|
// 检查窗口类型是否需要禁止焦点
|
||||||
for (size_t i = 0; i < sizeof(no_focus_types)/sizeof(no_focus_types[0]); ++i) {
|
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])) {
|
if (wlr_xwayland_surface_has_window_type(surface, no_focus_types[i])) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -214,12 +214,12 @@ typedef struct {
|
|||||||
typedef void (*FuncType)(const Arg *);
|
typedef void (*FuncType)(const Arg *);
|
||||||
Config config;
|
Config config;
|
||||||
|
|
||||||
|
|
||||||
void parse_config_file(Config *config, const char *file_path);
|
void parse_config_file(Config *config, const char *file_path);
|
||||||
|
|
||||||
// Helper function to trim whitespace from start and end of a string
|
// Helper function to trim whitespace from start and end of a string
|
||||||
void trim_whitespace(char *str) {
|
void trim_whitespace(char *str) {
|
||||||
if (str == NULL || *str == '\0') return;
|
if (str == NULL || *str == '\0')
|
||||||
|
return;
|
||||||
|
|
||||||
// Trim leading space
|
// Trim leading space
|
||||||
char *start = str;
|
char *start = str;
|
||||||
@@ -697,22 +697,26 @@ void parse_config_line(Config *config, const char *line) {
|
|||||||
} else if (strcmp(key, "animation_curve_move") == 0) {
|
} else if (strcmp(key, "animation_curve_move") == 0) {
|
||||||
int num = parse_double_array(value, config->animation_curve_move, 4);
|
int num = parse_double_array(value, config->animation_curve_move, 4);
|
||||||
if (num != 4) {
|
if (num != 4) {
|
||||||
fprintf(stderr, "Error: Failed to parse animation_curve_move: %s\n", value);
|
fprintf(stderr, "Error: Failed to parse animation_curve_move: %s\n",
|
||||||
|
value);
|
||||||
}
|
}
|
||||||
} else if (strcmp(key, "animation_curve_open") == 0) {
|
} else if (strcmp(key, "animation_curve_open") == 0) {
|
||||||
int num = parse_double_array(value, config->animation_curve_open, 4);
|
int num = parse_double_array(value, config->animation_curve_open, 4);
|
||||||
if (num != 4) {
|
if (num != 4) {
|
||||||
fprintf(stderr, "Error: Failed to parse animation_curve_open: %s\n", value);
|
fprintf(stderr, "Error: Failed to parse animation_curve_open: %s\n",
|
||||||
|
value);
|
||||||
}
|
}
|
||||||
} else if (strcmp(key, "animation_curve_tag") == 0) {
|
} else if (strcmp(key, "animation_curve_tag") == 0) {
|
||||||
int num = parse_double_array(value, config->animation_curve_tag, 4);
|
int num = parse_double_array(value, config->animation_curve_tag, 4);
|
||||||
if (num != 4) {
|
if (num != 4) {
|
||||||
fprintf(stderr, "Error: Failed to parse animation_curve_tag: %s\n", value);
|
fprintf(stderr, "Error: Failed to parse animation_curve_tag: %s\n",
|
||||||
|
value);
|
||||||
}
|
}
|
||||||
} else if (strcmp(key, "animation_curve_close") == 0) {
|
} else if (strcmp(key, "animation_curve_close") == 0) {
|
||||||
int num = parse_double_array(value, config->animation_curve_close, 4);
|
int num = parse_double_array(value, config->animation_curve_close, 4);
|
||||||
if (num != 4) {
|
if (num != 4) {
|
||||||
fprintf(stderr, "Error: Failed to parse animation_curve_close: %s\n", value);
|
fprintf(stderr, "Error: Failed to parse animation_curve_close: %s\n",
|
||||||
|
value);
|
||||||
}
|
}
|
||||||
} else if (strcmp(key, "scroller_structs") == 0) {
|
} else if (strcmp(key, "scroller_structs") == 0) {
|
||||||
config->scroller_structs = atoi(value);
|
config->scroller_structs = atoi(value);
|
||||||
@@ -729,7 +733,7 @@ void parse_config_line(Config *config, const char *line) {
|
|||||||
} else if (strcmp(key, "focus_cross_tag") == 0) {
|
} else if (strcmp(key, "focus_cross_tag") == 0) {
|
||||||
config->focus_cross_tag = atoi(value);
|
config->focus_cross_tag = atoi(value);
|
||||||
} else if (strcmp(key, "no_border_when_single") == 0) {
|
} else if (strcmp(key, "no_border_when_single") == 0) {
|
||||||
config->no_border_when_single= atoi(value);
|
config->no_border_when_single = atoi(value);
|
||||||
} else if (strcmp(key, "snap_distance") == 0) {
|
} else if (strcmp(key, "snap_distance") == 0) {
|
||||||
config->snap_distance = atoi(value);
|
config->snap_distance = atoi(value);
|
||||||
} else if (strcmp(key, "enable_floating_snap") == 0) {
|
} else if (strcmp(key, "enable_floating_snap") == 0) {
|
||||||
@@ -1113,28 +1117,31 @@ void parse_config_line(Config *config, const char *line) {
|
|||||||
}
|
}
|
||||||
config->window_rules_count++;
|
config->window_rules_count++;
|
||||||
} else if (strcmp(key, "monitorrule") == 0) {
|
} else if (strcmp(key, "monitorrule") == 0) {
|
||||||
config->monitor_rules =
|
config->monitor_rules =
|
||||||
realloc(config->monitor_rules,
|
realloc(config->monitor_rules,
|
||||||
(config->monitor_rules_count + 1) * sizeof(ConfigMonitorRule));
|
(config->monitor_rules_count + 1) * sizeof(ConfigMonitorRule));
|
||||||
if (!config->monitor_rules) {
|
if (!config->monitor_rules) {
|
||||||
fprintf(stderr, "Error: Failed to allocate memory for monitor rules\n");
|
fprintf(stderr, "Error: Failed to allocate memory for monitor rules\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigMonitorRule *rule = &config->monitor_rules[config->monitor_rules_count];
|
ConfigMonitorRule *rule =
|
||||||
memset(rule, 0, sizeof(ConfigMonitorRule));
|
&config->monitor_rules[config->monitor_rules_count];
|
||||||
|
memset(rule, 0, sizeof(ConfigMonitorRule));
|
||||||
|
|
||||||
// 临时存储每个字段的原始字符串
|
// 临时存储每个字段的原始字符串
|
||||||
char raw_name[256], raw_layout[256];
|
char raw_name[256], raw_layout[256];
|
||||||
char raw_mfact[256], raw_nmaster[256], raw_rr[256];
|
char raw_mfact[256], raw_nmaster[256], raw_rr[256];
|
||||||
char raw_scale[256], raw_x[256], raw_y[256];
|
char raw_scale[256], raw_x[256], raw_y[256];
|
||||||
|
|
||||||
// 先读取所有字段为字符串
|
// 先读取所有字段为字符串
|
||||||
int parsed = sscanf(value, "%255[^,],%255[^,],%255[^,],%255[^,],%255[^,],%255[^,],%255[^,],%255s",
|
int parsed = sscanf(
|
||||||
raw_name, raw_mfact, raw_nmaster, raw_layout,
|
value,
|
||||||
raw_rr, raw_scale, raw_x, raw_y);
|
"%255[^,],%255[^,],%255[^,],%255[^,],%255[^,],%255[^,],%255[^,],%255s",
|
||||||
|
raw_name, raw_mfact, raw_nmaster, raw_layout, raw_rr, raw_scale, raw_x,
|
||||||
|
raw_y);
|
||||||
|
|
||||||
if (parsed == 8) {
|
if (parsed == 8) {
|
||||||
// 修剪每个字段的空格
|
// 修剪每个字段的空格
|
||||||
trim_whitespace(raw_name);
|
trim_whitespace(raw_name);
|
||||||
trim_whitespace(raw_mfact);
|
trim_whitespace(raw_mfact);
|
||||||
@@ -1679,7 +1686,7 @@ void override_config(void) {
|
|||||||
scroller_focus_center = config.scroller_focus_center;
|
scroller_focus_center = config.scroller_focus_center;
|
||||||
focus_cross_monitor = config.focus_cross_monitor;
|
focus_cross_monitor = config.focus_cross_monitor;
|
||||||
focus_cross_tag = config.focus_cross_tag;
|
focus_cross_tag = config.focus_cross_tag;
|
||||||
no_border_when_single= config.no_border_when_single;
|
no_border_when_single = config.no_border_when_single;
|
||||||
snap_distance = config.snap_distance;
|
snap_distance = config.snap_distance;
|
||||||
enable_floating_snap = config.enable_floating_snap;
|
enable_floating_snap = config.enable_floating_snap;
|
||||||
swipe_min_threshold = config.swipe_min_threshold;
|
swipe_min_threshold = config.swipe_min_threshold;
|
||||||
@@ -1779,7 +1786,7 @@ void set_value_default() {
|
|||||||
config.scroller_prefer_center = scroller_prefer_center;
|
config.scroller_prefer_center = scroller_prefer_center;
|
||||||
config.focus_cross_monitor = focus_cross_monitor;
|
config.focus_cross_monitor = focus_cross_monitor;
|
||||||
config.focus_cross_tag = focus_cross_tag;
|
config.focus_cross_tag = focus_cross_tag;
|
||||||
config.no_border_when_single= no_border_when_single;
|
config.no_border_when_single = no_border_when_single;
|
||||||
config.snap_distance = snap_distance;
|
config.snap_distance = snap_distance;
|
||||||
config.enable_floating_snap = enable_floating_snap;
|
config.enable_floating_snap = enable_floating_snap;
|
||||||
config.swipe_min_threshold = swipe_min_threshold;
|
config.swipe_min_threshold = swipe_min_threshold;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// TODO: remove this file in the future, replace all global variables with config.xxx
|
// TODO: remove this file in the future, replace all global variables with
|
||||||
|
// config.xxx
|
||||||
|
|
||||||
/* speedie's maomao config */
|
/* speedie's maomao config */
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,9 @@ void fibonacci(Monitor *mon, int s) {
|
|||||||
c->isfullscreen || c->ismaxmizescreen || c->animation.tagouting)
|
c->isfullscreen || c->ismaxmizescreen || c->animation.tagouting)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
c->bw = mon->visible_clients == 1 && no_border_when_single && smartgaps ? 0 : borderpx;
|
c->bw = mon->visible_clients == 1 && no_border_when_single && smartgaps
|
||||||
|
? 0
|
||||||
|
: borderpx;
|
||||||
if ((i % 2 && nh / 2 > 2 * c->bw) || (!(i % 2) && nw / 2 > 2 * c->bw)) {
|
if ((i % 2 && nh / 2 > 2 * c->bw) || (!(i % 2) && nw / 2 > 2 * c->bw)) {
|
||||||
if (i < n - 1) {
|
if (i < n - 1) {
|
||||||
if (i % 2) {
|
if (i % 2) {
|
||||||
@@ -147,7 +149,9 @@ void grid(Monitor *m) {
|
|||||||
|
|
||||||
if (n == 1) {
|
if (n == 1) {
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
c->bw = m->visible_clients == 1 && no_border_when_single && smartgaps ? 0 : borderpx;
|
c->bw = m->visible_clients == 1 && no_border_when_single && smartgaps
|
||||||
|
? 0
|
||||||
|
: borderpx;
|
||||||
if (VISIBLEON(c, c->mon) && !c->iskilling && !c->animation.tagouting &&
|
if (VISIBLEON(c, c->mon) && !c->iskilling && !c->animation.tagouting &&
|
||||||
c->mon == selmon) {
|
c->mon == selmon) {
|
||||||
cw = (m->w.width - 2 * overviewgappo) * 0.7;
|
cw = (m->w.width - 2 * overviewgappo) * 0.7;
|
||||||
@@ -167,7 +171,9 @@ void grid(Monitor *m) {
|
|||||||
ch = (m->w.height - 2 * overviewgappo) * 0.65;
|
ch = (m->w.height - 2 * overviewgappo) * 0.65;
|
||||||
i = 0;
|
i = 0;
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
c->bw = m->visible_clients == 1 && no_border_when_single && smartgaps ? 0 : borderpx;
|
c->bw = m->visible_clients == 1 && no_border_when_single && smartgaps
|
||||||
|
? 0
|
||||||
|
: borderpx;
|
||||||
if (VISIBLEON(c, c->mon) && !c->iskilling && !c->animation.tagouting &&
|
if (VISIBLEON(c, c->mon) && !c->iskilling && !c->animation.tagouting &&
|
||||||
c->mon == selmon) {
|
c->mon == selmon) {
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
@@ -211,7 +217,9 @@ void grid(Monitor *m) {
|
|||||||
// 调整每个客户端的位置和大小
|
// 调整每个客户端的位置和大小
|
||||||
i = 0;
|
i = 0;
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
c->bw = m->visible_clients == 1 && no_border_when_single && smartgaps ? 0 : borderpx;
|
c->bw = m->visible_clients == 1 && no_border_when_single && smartgaps
|
||||||
|
? 0
|
||||||
|
: borderpx;
|
||||||
if (VISIBLEON(c, c->mon) && !c->iskilling && !c->animation.tagouting &&
|
if (VISIBLEON(c, c->mon) && !c->iskilling && !c->animation.tagouting &&
|
||||||
c->mon == selmon) {
|
c->mon == selmon) {
|
||||||
cx = m->w.x + (i % cols) * (cw + overviewgappi);
|
cx = m->w.x + (i % cols) * (cw + overviewgappi);
|
||||||
@@ -229,10 +237,7 @@ void grid(Monitor *m) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void deck(Monitor *m) {
|
||||||
void
|
|
||||||
deck(Monitor *m)
|
|
||||||
{
|
|
||||||
unsigned int mw, my;
|
unsigned int mw, my;
|
||||||
int i, n = 0;
|
int i, n = 0;
|
||||||
Client *c;
|
Client *c;
|
||||||
@@ -246,9 +251,8 @@ deck(Monitor *m)
|
|||||||
cur_gappoh = smartgaps && m->visible_clients == 1 ? 0 : cur_gappoh;
|
cur_gappoh = smartgaps && m->visible_clients == 1 ? 0 : cur_gappoh;
|
||||||
cur_gappov = smartgaps && m->visible_clients == 1 ? 0 : cur_gappov;
|
cur_gappov = smartgaps && m->visible_clients == 1 ? 0 : cur_gappov;
|
||||||
|
|
||||||
wl_list_for_each(c, &clients, link)
|
wl_list_for_each(c, &clients, link) if (VISIBLEON(c, m) && !c->isfloating &&
|
||||||
if (VISIBLEON(c, m) && !c->isfloating && !c->isfullscreen)
|
!c->isfullscreen) n++;
|
||||||
n++;
|
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -267,21 +271,24 @@ deck(Monitor *m)
|
|||||||
continue;
|
continue;
|
||||||
if (i < m->nmaster) {
|
if (i < m->nmaster) {
|
||||||
// Master area clients
|
// Master area clients
|
||||||
resize(c, (struct wlr_box){
|
resize(c,
|
||||||
.x = m->w.x + cur_gappoh,
|
(struct wlr_box){.x = m->w.x + cur_gappoh,
|
||||||
.y = m->w.y + cur_gappov + my,
|
.y = m->w.y + cur_gappov + my,
|
||||||
.width = mw,
|
.width = mw,
|
||||||
.height = (m->w.height - cur_gappov - my - cur_gappiv) / (MIN(n, m->nmaster) - i)
|
.height =
|
||||||
}, 0);
|
(m->w.height - cur_gappov - my - cur_gappiv) /
|
||||||
|
(MIN(n, m->nmaster) - i)},
|
||||||
|
0);
|
||||||
my += c->geom.height + cur_gappiv;
|
my += c->geom.height + cur_gappiv;
|
||||||
} else {
|
} else {
|
||||||
// Stack area clients
|
// Stack area clients
|
||||||
resize(c, (struct wlr_box){
|
resize(c,
|
||||||
.x = m->w.x + mw + cur_gappoh + cur_gappih,
|
(struct wlr_box){.x = m->w.x + mw + cur_gappoh + cur_gappih,
|
||||||
.y = m->w.y + cur_gappov,
|
.y = m->w.y + cur_gappov,
|
||||||
.width = m->w.width - mw - 2 * cur_gappoh - cur_gappih,
|
.width =
|
||||||
.height = m->w.height - 2 * cur_gappov
|
m->w.width - mw - 2 * cur_gappoh - cur_gappih,
|
||||||
}, 0);
|
.height = m->w.height - 2 * cur_gappov},
|
||||||
|
0);
|
||||||
if (c == focustop(m))
|
if (c == focustop(m))
|
||||||
wlr_scene_node_raise_to_top(&c->scene->node);
|
wlr_scene_node_raise_to_top(&c->scene->node);
|
||||||
}
|
}
|
||||||
@@ -458,16 +465,16 @@ void tile(Monitor *m) {
|
|||||||
else
|
else
|
||||||
mw = m->w.width - 2 * cur_gappov + cur_gappiv * ie;
|
mw = m->w.width - 2 * cur_gappov + cur_gappiv * ie;
|
||||||
i = 0;
|
i = 0;
|
||||||
my = ty =cur_gappoh ;
|
my = ty = cur_gappoh;
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
if (!VISIBLEON(c, m) || c->iskilling || c->animation.tagouting ||
|
if (!VISIBLEON(c, m) || c->iskilling || c->animation.tagouting ||
|
||||||
c->isfloating || c->isfullscreen || c->ismaxmizescreen)
|
c->isfloating || c->isfullscreen || c->ismaxmizescreen)
|
||||||
continue;
|
continue;
|
||||||
if (i < selmon->pertag->nmasters[selmon->pertag->curtag]) {
|
if (i < selmon->pertag->nmasters[selmon->pertag->curtag]) {
|
||||||
r = MIN(n, selmon->pertag->nmasters[selmon->pertag->curtag]) - i;
|
r = MIN(n, selmon->pertag->nmasters[selmon->pertag->curtag]) - i;
|
||||||
h = (m->w.height - my -cur_gappoh - cur_gappih * ie * (r - 1)) / r;
|
h = (m->w.height - my - cur_gappoh - cur_gappih * ie * (r - 1)) / r;
|
||||||
resize(c,
|
resize(c,
|
||||||
(struct wlr_box){.x = m->w.x + cur_gappov ,
|
(struct wlr_box){.x = m->w.x + cur_gappov,
|
||||||
.y = m->w.y + my,
|
.y = m->w.y + my,
|
||||||
.width = mw - cur_gappiv * ie,
|
.width = mw - cur_gappiv * ie,
|
||||||
.height = h},
|
.height = h},
|
||||||
@@ -475,7 +482,7 @@ void tile(Monitor *m) {
|
|||||||
my += c->geom.height + cur_gappih * ie;
|
my += c->geom.height + cur_gappih * ie;
|
||||||
} else {
|
} else {
|
||||||
r = n - i;
|
r = n - i;
|
||||||
h = (m->w.height - ty -cur_gappoh - cur_gappih * ie * (r - 1)) / r;
|
h = (m->w.height - ty - cur_gappoh - cur_gappih * ie * (r - 1)) / r;
|
||||||
resize(c,
|
resize(c,
|
||||||
(struct wlr_box){.x = m->w.x + mw + cur_gappov,
|
(struct wlr_box){.x = m->w.x + mw + cur_gappov,
|
||||||
.y = m->w.y + ty,
|
.y = m->w.y + ty,
|
||||||
|
|||||||
81
src/maomao.c
81
src/maomao.c
@@ -794,8 +794,8 @@ static struct wlr_xwayland *xwayland;
|
|||||||
|
|
||||||
#include "client/client.h"
|
#include "client/client.h"
|
||||||
#include "config/parse_config.h"
|
#include "config/parse_config.h"
|
||||||
#include "text_input/ime.h"
|
|
||||||
#include "layout/layout.h"
|
#include "layout/layout.h"
|
||||||
|
#include "text_input/ime.h"
|
||||||
|
|
||||||
struct vec2 calculate_animation_curve_at(double t, int type) {
|
struct vec2 calculate_animation_curve_at(double t, int type) {
|
||||||
struct vec2 point;
|
struct vec2 point;
|
||||||
@@ -1086,11 +1086,11 @@ void apply_border(Client *c, struct wlr_box clip_box, int offsetx,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(no_border_when_single && c->mon->visible_clients == 1) {
|
if (no_border_when_single && c->mon->visible_clients == 1) {
|
||||||
hit_no_border = true;
|
hit_no_border = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hit_no_border && smartgaps) {
|
if (hit_no_border && smartgaps) {
|
||||||
c->bw = 0;
|
c->bw = 0;
|
||||||
} else if (hit_no_border && !smartgaps) {
|
} else if (hit_no_border && !smartgaps) {
|
||||||
set_rect_size(c->border[0], 0, 0);
|
set_rect_size(c->border[0], 0, 0);
|
||||||
@@ -1100,7 +1100,7 @@ void apply_border(Client *c, struct wlr_box clip_box, int offsetx,
|
|||||||
wlr_scene_node_set_position(&c->scene_surface->node, c->bw, c->bw);
|
wlr_scene_node_set_position(&c->scene_surface->node, c->bw, c->bw);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
} else if(!c->isfullscreen && VISIBLEON(c, c->mon)) {
|
} else if (!c->isfullscreen && VISIBLEON(c, c->mon)) {
|
||||||
c->bw = c->isnoborder ? 0 : borderpx;
|
c->bw = c->isnoborder ? 0 : borderpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1122,29 +1122,30 @@ void apply_border(Client *c, struct wlr_box clip_box, int offsetx,
|
|||||||
clip_box.height - 2 * c->bw);
|
clip_box.height - 2 * c->bw);
|
||||||
} else if (c->animation.current.x + c->animation.current.width >
|
} else if (c->animation.current.x + c->animation.current.width >
|
||||||
c->mon->m.x + c->mon->m.width) {
|
c->mon->m.x + c->mon->m.width) {
|
||||||
set_rect_size(
|
set_rect_size(c->border[3],
|
||||||
c->border[3],
|
GEZERO(c->bw - GEZERO(c->animation.current.x +
|
||||||
GEZERO(c->bw - GEZERO(c->animation.current.x + c->animation.current.width -
|
c->animation.current.width -
|
||||||
c->mon->m.x - c->mon->m.width)),
|
c->mon->m.x - c->mon->m.width)),
|
||||||
clip_box.height - 2 * c->bw);
|
clip_box.height - 2 * c->bw);
|
||||||
set_rect_size(c->border[0], clip_box.width + c->bw, GEZERO(c->bw - offsety));
|
set_rect_size(c->border[0], clip_box.width + c->bw,
|
||||||
set_rect_size(
|
GEZERO(c->bw - offsety));
|
||||||
c->border[1], clip_box.width + c->bw,
|
set_rect_size(c->border[1], clip_box.width + c->bw,
|
||||||
GEZERO(c->bw - GEZERO(c->animation.current.y + c->animation.current.height -
|
GEZERO(c->bw - GEZERO(c->animation.current.y +
|
||||||
|
c->animation.current.height -
|
||||||
c->mon->m.y - c->mon->m.height)));
|
c->mon->m.y - c->mon->m.height)));
|
||||||
} else if (c->animation.current.y < c->mon->m.y) {
|
} else if (c->animation.current.y < c->mon->m.y) {
|
||||||
set_rect_size(c->border[0], clip_box.width, GEZERO(c->bw - offsety));
|
set_rect_size(c->border[0], clip_box.width, GEZERO(c->bw - offsety));
|
||||||
} else if (c->animation.current.y + c->animation.current.height >
|
} else if (c->animation.current.y + c->animation.current.height >
|
||||||
c->mon->m.y + c->mon->m.height) {
|
c->mon->m.y + c->mon->m.height) {
|
||||||
set_rect_size(
|
set_rect_size(c->border[1], clip_box.width,
|
||||||
c->border[1], clip_box.width,
|
GEZERO(c->bw - GEZERO(c->animation.current.y +
|
||||||
GEZERO(c->bw - GEZERO(c->animation.current.y + c->animation.current.height -
|
c->animation.current.height -
|
||||||
c->mon->m.y - c->mon->m.height)));
|
c->mon->m.y - c->mon->m.height)));
|
||||||
set_rect_size(c->border[2], GEZERO(c->bw - offsetx),
|
set_rect_size(c->border[2], GEZERO(c->bw - offsetx),
|
||||||
clip_box.height - c->bw);
|
clip_box.height - c->bw);
|
||||||
set_rect_size(
|
set_rect_size(c->border[3],
|
||||||
c->border[3],
|
GEZERO(c->bw - GEZERO(c->animation.current.x +
|
||||||
GEZERO(c->bw - GEZERO(c->animation.current.x + c->animation.current.width -
|
c->animation.current.width -
|
||||||
c->mon->m.x - c->mon->m.width)),
|
c->mon->m.x - c->mon->m.width)),
|
||||||
clip_box.height - c->bw);
|
clip_box.height - c->bw);
|
||||||
}
|
}
|
||||||
@@ -1180,7 +1181,8 @@ struct uvec2 clip_to_hide(Client *c, struct wlr_box *clip_box) {
|
|||||||
c->mon->m.x + c->mon->m.width) {
|
c->mon->m.x + c->mon->m.width) {
|
||||||
clip_box->width = clip_box->width -
|
clip_box->width = clip_box->width -
|
||||||
(c->animation.current.x + c->animation.current.width -
|
(c->animation.current.x + c->animation.current.width -
|
||||||
c->mon->m.x - c->mon->m.width) - c->bw;
|
c->mon->m.x - c->mon->m.width) -
|
||||||
|
c->bw;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c->animation.current.y <= c->mon->m.y) {
|
if (c->animation.current.y <= c->mon->m.y) {
|
||||||
@@ -1191,14 +1193,16 @@ struct uvec2 clip_to_hide(Client *c, struct wlr_box *clip_box) {
|
|||||||
c->mon->m.y + c->mon->m.height) {
|
c->mon->m.y + c->mon->m.height) {
|
||||||
clip_box->height = clip_box->height -
|
clip_box->height = clip_box->height -
|
||||||
(c->animation.current.y + c->animation.current.height -
|
(c->animation.current.y + c->animation.current.height -
|
||||||
c->mon->m.y - c->mon->m.height) - c->bw;
|
c->mon->m.y - c->mon->m.height) -
|
||||||
|
c->bw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
offset.x = offsetx;
|
offset.x = offsetx;
|
||||||
offset.y = offsety;
|
offset.y = offsety;
|
||||||
|
|
||||||
if ((clip_box->width <= 0 || clip_box->height <= 0) && (ISTILED(c) || c->animation.tagouting || c->animation.tagining)) {
|
if ((clip_box->width <= 0 || clip_box->height <= 0) &&
|
||||||
|
(ISTILED(c) || c->animation.tagouting || c->animation.tagining)) {
|
||||||
c->is_clip_to_hide = true;
|
c->is_clip_to_hide = true;
|
||||||
wlr_scene_node_set_enabled(&c->scene->node, false);
|
wlr_scene_node_set_enabled(&c->scene->node, false);
|
||||||
} else if (c->is_clip_to_hide && VISIBLEON(c, c->mon)) {
|
} else if (c->is_clip_to_hide && VISIBLEON(c, c->mon)) {
|
||||||
@@ -1758,7 +1762,8 @@ applyrulesgeom(Client *c) {
|
|||||||
c->geom.width = r->width > 0 ? r->width : c->geom.width;
|
c->geom.width = r->width > 0 ? r->width : c->geom.width;
|
||||||
c->geom.height = r->height > 0 ? r->height : c->geom.height;
|
c->geom.height = r->height > 0 ? r->height : c->geom.height;
|
||||||
// 重新计算居中的坐标
|
// 重新计算居中的坐标
|
||||||
if(r->offsetx || r->offsety || (!client_is_x11(c) || client_surface_wants_focus(c)))
|
if (r->offsetx || r->offsety ||
|
||||||
|
(!client_is_x11(c) || client_surface_wants_focus(c)))
|
||||||
c->geom = setclient_coordinate_center(c->geom, r->offsetx, r->offsety);
|
c->geom = setclient_coordinate_center(c->geom, r->offsetx, r->offsety);
|
||||||
hit = r->height > 0 || r->width > 0 || r->offsetx != 0 || r->offsety != 0
|
hit = r->height > 0 || r->width > 0 || r->offsetx != 0 || r->offsety != 0
|
||||||
? 1
|
? 1
|
||||||
@@ -1821,8 +1826,10 @@ applyrules(Client *c) {
|
|||||||
c->geom.width = r->width > 0 ? r->width : c->geom.width;
|
c->geom.width = r->width > 0 ? r->width : c->geom.width;
|
||||||
c->geom.height = r->height > 0 ? r->height : c->geom.height;
|
c->geom.height = r->height > 0 ? r->height : c->geom.height;
|
||||||
// 重新计算居中的坐标
|
// 重新计算居中的坐标
|
||||||
if(r->offsetx || r->offsety || (!client_is_x11(c) || client_surface_wants_focus(c)))
|
if (r->offsetx || r->offsety ||
|
||||||
c->geom = setclient_coordinate_center(c->geom, r->offsetx, r->offsety);
|
(!client_is_x11(c) || client_surface_wants_focus(c)))
|
||||||
|
c->geom =
|
||||||
|
setclient_coordinate_center(c->geom, r->offsetx, r->offsety);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3726,7 +3733,7 @@ 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)) {
|
if (c && client_is_x11(c) && !client_surface_wants_focus(c)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4303,7 +4310,7 @@ mapnotify(struct wl_listener *listener, void *data) {
|
|||||||
|
|
||||||
client_get_geometry(c, &c->geom);
|
client_get_geometry(c, &c->geom);
|
||||||
|
|
||||||
if(client_is_unmanaged(c) || !client_surface_wants_focus(c)) {
|
if (client_is_unmanaged(c) || !client_surface_wants_focus(c)) {
|
||||||
c->bw = 0;
|
c->bw = 0;
|
||||||
c->isnoborder = 1;
|
c->isnoborder = 1;
|
||||||
} else {
|
} else {
|
||||||
@@ -5292,8 +5299,8 @@ void setcursor(struct wl_listener *listener, void *data) {
|
|||||||
last_cursor.hotspot_x = event->hotspot_x;
|
last_cursor.hotspot_x = event->hotspot_x;
|
||||||
last_cursor.hotspot_y = event->hotspot_y;
|
last_cursor.hotspot_y = event->hotspot_y;
|
||||||
if (!cursor_hidden)
|
if (!cursor_hidden)
|
||||||
wlr_cursor_set_surface(cursor, event->surface,
|
wlr_cursor_set_surface(cursor, event->surface, event->hotspot_x,
|
||||||
event->hotspot_x, event->hotspot_y);
|
event->hotspot_y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5330,7 +5337,7 @@ setfloating(Client *c, int floating) {
|
|||||||
target_box.width = target_box.width * 0.8;
|
target_box.width = target_box.width * 0.8;
|
||||||
}
|
}
|
||||||
// 重新计算居中的坐标
|
// 重新计算居中的坐标
|
||||||
if(!client_is_x11(c) || client_surface_wants_focus(c))
|
if (!client_is_x11(c) || client_surface_wants_focus(c))
|
||||||
target_box = setclient_coordinate_center(target_box, 0, 0);
|
target_box = setclient_coordinate_center(target_box, 0, 0);
|
||||||
backup_box = c->geom;
|
backup_box = c->geom;
|
||||||
hit = applyrulesgeom(c);
|
hit = applyrulesgeom(c);
|
||||||
@@ -6152,8 +6159,6 @@ void tagmon(const Arg *arg) {
|
|||||||
|
|
||||||
void overview(Monitor *m) { grid(m); }
|
void overview(Monitor *m) { grid(m); }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 目标窗口有其他窗口和它同个tag就返回0
|
// 目标窗口有其他窗口和它同个tag就返回0
|
||||||
unsigned int want_restore_fullscreen(Client *target_client) {
|
unsigned int want_restore_fullscreen(Client *target_client) {
|
||||||
Client *c = NULL;
|
Client *c = NULL;
|
||||||
@@ -6219,8 +6224,7 @@ void overview_restore(Client *c, const Arg *arg) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c->bw == 0 &&
|
if (c->bw == 0 && !c->isfullscreen) { // 如果是在ov模式中创建的窗口,没有bw记录
|
||||||
!c->isfullscreen) { // 如果是在ov模式中创建的窗口,没有bw记录
|
|
||||||
c->bw = c->isnoborder ? 0 : borderpx;
|
c->bw = c->isnoborder ? 0 : borderpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6271,9 +6275,7 @@ void set_proportion(const Arg *arg) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void handlecursoractivity(void) {
|
||||||
handlecursoractivity(void)
|
|
||||||
{
|
|
||||||
wl_event_source_timer_update(hide_source, cursor_hide_timeout * 1000);
|
wl_event_source_timer_update(hide_source, cursor_hide_timeout * 1000);
|
||||||
|
|
||||||
if (!cursor_hidden)
|
if (!cursor_hidden)
|
||||||
@@ -6285,13 +6287,11 @@ handlecursoractivity(void)
|
|||||||
wlr_cursor_set_xcursor(cursor, cursor_mgr,
|
wlr_cursor_set_xcursor(cursor, cursor_mgr,
|
||||||
wlr_cursor_shape_v1_name(last_cursor.shape));
|
wlr_cursor_shape_v1_name(last_cursor.shape));
|
||||||
else
|
else
|
||||||
wlr_cursor_set_surface(cursor, last_cursor.surface,
|
wlr_cursor_set_surface(cursor, last_cursor.surface, last_cursor.hotspot_x,
|
||||||
last_cursor.hotspot_x, last_cursor.hotspot_y);
|
last_cursor.hotspot_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int hidecursor(void *data) {
|
||||||
hidecursor(void *data)
|
|
||||||
{
|
|
||||||
wlr_cursor_unset_image(cursor);
|
wlr_cursor_unset_image(cursor);
|
||||||
cursor_hidden = true;
|
cursor_hidden = true;
|
||||||
return 1;
|
return 1;
|
||||||
@@ -6362,7 +6362,6 @@ void toggleoverview(const Arg *arg) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void togglefloating(const Arg *arg) {
|
void togglefloating(const Arg *arg) {
|
||||||
Client *sel = focustop(selmon);
|
Client *sel = focustop(selmon);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user