Compare commits
37 Commits
be6ed1764f
...
2f9cabe4b2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2f9cabe4b2 | ||
|
|
e2ee985b8f | ||
|
|
4280f8e0bf | ||
|
|
c004f7460c | ||
|
|
03ee277ef6 | ||
|
|
a0824c05df | ||
|
|
e7cb4f77f3 | ||
|
|
e22cf99e74 | ||
|
|
8e4d3b7aac | ||
|
|
58d5938e14 | ||
|
|
4fda32bf1f | ||
|
|
d941e0078e | ||
|
|
9c8f9e3b38 | ||
|
|
cdcc64ab5f | ||
|
|
ecab47fe92 | ||
|
|
fce47b37d9 | ||
|
|
f2b9835243 | ||
|
|
407c9d74a4 | ||
|
|
8875156760 | ||
|
|
514c916678 | ||
|
|
f542d5d5e6 | ||
|
|
d85f4375c8 | ||
|
|
33a0fe2485 | ||
|
|
16296898ce | ||
|
|
5ba7da0570 | ||
|
|
17f1ae2463 | ||
|
|
64dc30dc31 | ||
|
|
0501719604 | ||
|
|
6010cea805 | ||
|
|
e09748764d | ||
|
|
5774df00e0 | ||
|
|
d32fecfd23 | ||
|
|
18ad32384b | ||
|
|
9d6436cf42 | ||
|
|
08097b0991 | ||
|
|
e0bc7fb5e4 | ||
|
|
1029936b18 |
@@ -106,7 +106,7 @@ cd wlroots
|
|||||||
meson build -Dprefix=/usr
|
meson build -Dprefix=/usr
|
||||||
sudo ninja -C build install
|
sudo ninja -C build install
|
||||||
|
|
||||||
git clone https://github.com/wlrfx/scenefx.git
|
git clone -b 0.4.1 https://github.com/wlrfx/scenefx.git
|
||||||
cd scenefx
|
cd scenefx
|
||||||
meson build -Dprefix=/usr
|
meson build -Dprefix=/usr
|
||||||
sudo ninja -C build install
|
sudo ninja -C build install
|
||||||
@@ -189,7 +189,10 @@ Here's an example of using the modules in a flake:
|
|||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||||
mango.url = "github:DreamMaoMao/mango";
|
mango = {
|
||||||
|
url = "github:DreamMaoMao/mango";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
outputs =
|
outputs =
|
||||||
inputs@{ self, flake-parts, ... }:
|
inputs@{ self, flake-parts, ... }:
|
||||||
|
|||||||
46
flake.lock
generated
46
flake.lock
generated
@@ -18,27 +18,6 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flake-utils": {
|
|
||||||
"inputs": {
|
|
||||||
"systems": [
|
|
||||||
"scenefx",
|
|
||||||
"systems"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1731533236,
|
|
||||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1750386251,
|
"lastModified": 1750386251,
|
||||||
@@ -79,18 +58,16 @@
|
|||||||
},
|
},
|
||||||
"scenefx": {
|
"scenefx": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils",
|
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
],
|
]
|
||||||
"systems": "systems"
|
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1762447505,
|
"lastModified": 1750785057,
|
||||||
"narHash": "sha256-VEBQ8KXkSS4c+kdAhmvq06lEd9WNeCXdRK1U+qSilFw=",
|
"narHash": "sha256-tGX6j4W91rcb+glXJo43sjPI9zQvPotonknG1BdihR4=",
|
||||||
"owner": "wlrfx",
|
"owner": "wlrfx",
|
||||||
"repo": "scenefx",
|
"repo": "scenefx",
|
||||||
"rev": "7f9e7409f6169fa637f1265895c121a8f8b70272",
|
"rev": "3a6cfb12e4ba97b43326357d14f7b3e40897adfc",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -98,21 +75,6 @@
|
|||||||
"repo": "scenefx",
|
"repo": "scenefx",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"systems": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1689347949,
|
|
||||||
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default-linux",
|
|
||||||
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default-linux",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": "root",
|
"root": "root",
|
||||||
|
|||||||
@@ -25,13 +25,12 @@
|
|||||||
|
|
||||||
perSystem = {
|
perSystem = {
|
||||||
config,
|
config,
|
||||||
system,
|
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (pkgs) callPackage;
|
inherit (pkgs) callPackage ;
|
||||||
mango = callPackage ./nix {
|
mango = callPackage ./nix {
|
||||||
scenefx = inputs.scenefx.packages.${system}.default;
|
inherit (inputs.scenefx.packages.${pkgs.stdenv.hostPlatform.system}) scenefx;
|
||||||
};
|
};
|
||||||
shellOverride = old: {
|
shellOverride = old: {
|
||||||
nativeBuildInputs = old.nativeBuildInputs ++ [];
|
nativeBuildInputs = old.nativeBuildInputs ++ [];
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
project('mango', ['c', 'cpp'],
|
project('mango', ['c', 'cpp'],
|
||||||
version : '0.10.5',
|
version : '0.10.6',
|
||||||
)
|
)
|
||||||
|
|
||||||
subdir('protocols')
|
subdir('protocols')
|
||||||
|
|||||||
@@ -26,6 +26,25 @@ in {
|
|||||||
xdg.portal = {
|
xdg.portal = {
|
||||||
enable = lib.mkDefault true;
|
enable = lib.mkDefault true;
|
||||||
|
|
||||||
|
config = {
|
||||||
|
mango = {
|
||||||
|
default = [
|
||||||
|
"gtk"
|
||||||
|
];
|
||||||
|
# except those
|
||||||
|
"org.freedesktop.impl.portal.Secret" = ["gnome-keyring"];
|
||||||
|
"org.freedesktop.impl.portal.ScreenCast" = ["wlr"];
|
||||||
|
"org.freedesktop.impl.portal.ScreenShot" = ["wlr"];
|
||||||
|
|
||||||
|
# wlr does not have this interface
|
||||||
|
"org.freedesktop.impl.portal.Inhibit" = [];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
extraPortals = with pkgs; [
|
||||||
|
xdg-desktop-portal-wlr
|
||||||
|
xdg-desktop-portal-gtk
|
||||||
|
];
|
||||||
|
|
||||||
wlr.enable = lib.mkDefault true;
|
wlr.enable = lib.mkDefault true;
|
||||||
|
|
||||||
configPackages = [cfg.package];
|
configPackages = [cfg.package];
|
||||||
|
|||||||
@@ -245,10 +245,6 @@ void buffer_set_effect(Client *c, BufferData data) {
|
|||||||
data.corner_location = CORNER_LOCATION_NONE;
|
data.corner_location = CORNER_LOCATION_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blur && !c->noblur) {
|
|
||||||
wlr_scene_blur_set_corner_radius(c->blur, border_radius,
|
|
||||||
data.corner_location);
|
|
||||||
}
|
|
||||||
wlr_scene_node_for_each_buffer(&c->scene_surface->node,
|
wlr_scene_node_for_each_buffer(&c->scene_surface->node,
|
||||||
scene_buffer_apply_effect, &data);
|
scene_buffer_apply_effect, &data);
|
||||||
}
|
}
|
||||||
@@ -353,19 +349,6 @@ void client_draw_shadow(Client *c) {
|
|||||||
wlr_scene_shadow_set_clipped_region(c->shadow, clipped_region);
|
wlr_scene_shadow_set_clipped_region(c->shadow, clipped_region);
|
||||||
}
|
}
|
||||||
|
|
||||||
void client_draw_blur(Client *c, struct wlr_box clip_box, struct ivec2 offset) {
|
|
||||||
if (blur && !c->noblur) {
|
|
||||||
if (c->scene_surface->node.enabled && !c->blur->node.enabled)
|
|
||||||
wlr_scene_node_set_enabled(&c->blur->node, true);
|
|
||||||
wlr_scene_node_set_position(&c->blur->node, offset.x, offset.y);
|
|
||||||
wlr_scene_blur_set_size(c->blur, clip_box.width - c->bw,
|
|
||||||
clip_box.height - c->bw);
|
|
||||||
} else {
|
|
||||||
if (c->blur->node.enabled)
|
|
||||||
wlr_scene_node_set_enabled(&c->blur->node, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void apply_border(Client *c) {
|
void apply_border(Client *c) {
|
||||||
if (!c || c->iskilling || !client_surface(c)->mapped)
|
if (!c || c->iskilling || !client_surface(c)->mapped)
|
||||||
return;
|
return;
|
||||||
@@ -463,7 +446,7 @@ struct ivec2 clip_to_hide(Client *c, struct wlr_box *clip_box) {
|
|||||||
int offsetx = 0, offsety = 0, offsetw = 0, offseth = 0;
|
int offsetx = 0, offsety = 0, offsetw = 0, offseth = 0;
|
||||||
struct ivec2 offset = {0, 0, 0, 0};
|
struct ivec2 offset = {0, 0, 0, 0};
|
||||||
|
|
||||||
if (!ISTILED(c) && !c->animation.tagining && !c->animation.tagouted &&
|
if (!ISSCROLLTILED(c) && !c->animation.tagining && !c->animation.tagouted &&
|
||||||
!c->animation.tagouting)
|
!c->animation.tagouting)
|
||||||
return offset;
|
return offset;
|
||||||
|
|
||||||
@@ -484,7 +467,7 @@ struct ivec2 clip_to_hide(Client *c, struct wlr_box *clip_box) {
|
|||||||
需要主要border超出屏幕的时候不计算如偏差之内而是
|
需要主要border超出屏幕的时候不计算如偏差之内而是
|
||||||
要等窗口表面超出才开始计算偏差
|
要等窗口表面超出才开始计算偏差
|
||||||
*/
|
*/
|
||||||
if (ISTILED(c) || c->animation.tagining || c->animation.tagouted ||
|
if (ISSCROLLTILED(c) || c->animation.tagining || c->animation.tagouted ||
|
||||||
c->animation.tagouting) {
|
c->animation.tagouting) {
|
||||||
if (left_out_offset > 0) {
|
if (left_out_offset > 0) {
|
||||||
offsetx = GEZERO(left_out_offset - bw);
|
offsetx = GEZERO(left_out_offset - bw);
|
||||||
@@ -512,7 +495,7 @@ struct ivec2 clip_to_hide(Client *c, struct wlr_box *clip_box) {
|
|||||||
offset.height = offseth;
|
offset.height = offseth;
|
||||||
|
|
||||||
if ((clip_box->width + bw <= 0 || clip_box->height + bw <= 0) &&
|
if ((clip_box->width + bw <= 0 || clip_box->height + bw <= 0) &&
|
||||||
(ISTILED(c) || c->animation.tagouting || c->animation.tagining)) {
|
(ISSCROLLTILED(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)) {
|
||||||
@@ -550,14 +533,12 @@ void client_apply_clip(Client *c, float factor) {
|
|||||||
|
|
||||||
apply_border(c);
|
apply_border(c);
|
||||||
client_draw_shadow(c);
|
client_draw_shadow(c);
|
||||||
client_draw_blur(c, clip_box, offset);
|
|
||||||
|
|
||||||
if (clip_box.width <= 0 || clip_box.height <= 0) {
|
if (clip_box.width <= 0 || clip_box.height <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_scene_subsurface_tree_set_clip(&c->scene_surface->node, &clip_box);
|
wlr_scene_subsurface_tree_set_clip(&c->scene_surface->node, &clip_box);
|
||||||
|
|
||||||
buffer_set_effect(c, (BufferData){1.0f, 1.0f, clip_box.width,
|
buffer_set_effect(c, (BufferData){1.0f, 1.0f, clip_box.width,
|
||||||
clip_box.height,
|
clip_box.height,
|
||||||
current_corner_location, true});
|
current_corner_location, true});
|
||||||
@@ -589,7 +570,6 @@ void client_apply_clip(Client *c, float factor) {
|
|||||||
// 应用窗口装饰
|
// 应用窗口装饰
|
||||||
apply_border(c);
|
apply_border(c);
|
||||||
client_draw_shadow(c);
|
client_draw_shadow(c);
|
||||||
client_draw_blur(c, clip_box, offset);
|
|
||||||
|
|
||||||
// 如果窗口剪切区域已经剪切到0,则不渲染窗口表面
|
// 如果窗口剪切区域已经剪切到0,则不渲染窗口表面
|
||||||
if (clip_box.width <= 0 || clip_box.height <= 0) {
|
if (clip_box.width <= 0 || clip_box.height <= 0) {
|
||||||
@@ -1011,10 +991,6 @@ void resize(Client *c, struct wlr_box geo, int interact) {
|
|||||||
apply_border(c);
|
apply_border(c);
|
||||||
client_get_clip(c, &clip);
|
client_get_clip(c, &clip);
|
||||||
wlr_scene_subsurface_tree_set_clip(&c->scene_surface->node, &clip);
|
wlr_scene_subsurface_tree_set_clip(&c->scene_surface->node, &clip);
|
||||||
if (blur && !c->noblur)
|
|
||||||
wlr_scene_blur_set_size(c->blur,
|
|
||||||
c->animation.current.width - 2 * c->bw,
|
|
||||||
c->animation.current.height - 2 * c->bw);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 如果不是工作区切换时划出去的窗口,就让动画的结束位置,就是上面的真实位置和大小
|
// 如果不是工作区切换时划出去的窗口,就让动画的结束位置,就是上面的真实位置和大小
|
||||||
|
|||||||
@@ -158,6 +158,12 @@ static bool scene_node_snapshot(struct wlr_scene_node *node, int lx, int ly,
|
|||||||
scene_buffer->corner_radius,
|
scene_buffer->corner_radius,
|
||||||
scene_buffer->corners);
|
scene_buffer->corners);
|
||||||
|
|
||||||
|
// wlr_scene_buffer_set_backdrop_blur_optimized(
|
||||||
|
// snapshot_buffer, scene_buffer->backdrop_blur_optimized);
|
||||||
|
// wlr_scene_buffer_set_backdrop_blur_ignore_transparent(
|
||||||
|
// snapshot_buffer, scene_buffer->backdrop_blur_ignore_transparent);
|
||||||
|
wlr_scene_buffer_set_backdrop_blur(snapshot_buffer, false);
|
||||||
|
|
||||||
snapshot_buffer->node.data = scene_buffer->node.data;
|
snapshot_buffer->node.data = scene_buffer->node.data;
|
||||||
|
|
||||||
struct wlr_scene_surface *scene_surface =
|
struct wlr_scene_surface *scene_surface =
|
||||||
@@ -192,8 +198,6 @@ static bool scene_node_snapshot(struct wlr_scene_node *node, int lx, int ly,
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WLR_SCENE_NODE_BLUR:
|
|
||||||
break;
|
|
||||||
case WLR_SCENE_NODE_OPTIMIZED_BLUR:
|
case WLR_SCENE_NODE_OPTIMIZED_BLUR:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -356,10 +356,6 @@ void layer_animation_next_tick(LayerSurface *l) {
|
|||||||
.height = height,
|
.height = height,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (blur && blur_layer && !l->noblur && l->blur)
|
|
||||||
wlr_scene_blur_set_size(l->blur, l->animation.current.width,
|
|
||||||
l->animation.current.height);
|
|
||||||
|
|
||||||
if (animation_passed >= 1.0) {
|
if (animation_passed >= 1.0) {
|
||||||
l->animation.running = false;
|
l->animation.running = false;
|
||||||
l->need_output_flush = false;
|
l->need_output_flush = false;
|
||||||
|
|||||||
@@ -814,8 +814,6 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value,
|
|||||||
} else if (strcmp(func_name, "focusdir") == 0) {
|
} else if (strcmp(func_name, "focusdir") == 0) {
|
||||||
func = focusdir;
|
func = focusdir;
|
||||||
(*arg).i = parse_direction(arg_value);
|
(*arg).i = parse_direction(arg_value);
|
||||||
} else if (strcmp(func_name, "togglerow") == 0) {
|
|
||||||
func = togglerow;
|
|
||||||
} else if (strcmp(func_name, "incnmaster") == 0) {
|
} else if (strcmp(func_name, "incnmaster") == 0) {
|
||||||
func = incnmaster;
|
func = incnmaster;
|
||||||
(*arg).i = atoi(arg_value);
|
(*arg).i = atoi(arg_value);
|
||||||
@@ -2276,35 +2274,53 @@ void parse_config_line(Config *config, const char *line) {
|
|||||||
|
|
||||||
void parse_config_file(Config *config, const char *file_path) {
|
void parse_config_file(Config *config, const char *file_path) {
|
||||||
FILE *file;
|
FILE *file;
|
||||||
// 检查路径是否以 ~/ 开头
|
char full_path[1024];
|
||||||
if (file_path[0] == '~' && (file_path[1] == '/' || file_path[1] == '\0')) {
|
|
||||||
|
if (file_path[0] == '.' && file_path[1] == '/') {
|
||||||
|
// Relative path
|
||||||
|
|
||||||
|
const char *mangoconfig = getenv("MANGOCONFIG");
|
||||||
|
if (mangoconfig && mangoconfig[0] != '\0') {
|
||||||
|
snprintf(full_path, sizeof(full_path), "%s/%s", mangoconfig,
|
||||||
|
file_path + 1);
|
||||||
|
} else {
|
||||||
const char *home = getenv("HOME");
|
const char *home = getenv("HOME");
|
||||||
if (!home) {
|
if (!home) {
|
||||||
fprintf(stderr, "Error: HOME environment variable not set.\n");
|
fprintf(stderr, "Error: HOME environment variable not set.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
snprintf(full_path, sizeof(full_path), "%s/.config/mango/%s", home,
|
||||||
// 构建完整路径(家目录 + / + 原路径去掉 ~)
|
file_path + 1);
|
||||||
char full_path[1024];
|
}
|
||||||
snprintf(full_path, sizeof(full_path), "%s%s", home, file_path + 1);
|
|
||||||
|
|
||||||
file = fopen(full_path, "r");
|
file = fopen(full_path, "r");
|
||||||
if (!file) {
|
|
||||||
perror("Error opening file");
|
} else if (file_path[0] == '~' &&
|
||||||
|
(file_path[1] == '/' || file_path[1] == '\0')) {
|
||||||
|
// Home directory
|
||||||
|
|
||||||
|
const char *home = getenv("HOME");
|
||||||
|
if (!home) {
|
||||||
|
fprintf(stderr, "Error: HOME environment variable not set.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
snprintf(full_path, sizeof(full_path), "%s%s", home, file_path + 1);
|
||||||
|
file = fopen(full_path, "r");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
// Absolute path
|
||||||
file = fopen(file_path, "r");
|
file = fopen(file_path, "r");
|
||||||
|
}
|
||||||
|
|
||||||
if (!file) {
|
if (!file) {
|
||||||
perror("Error opening file");
|
perror("Error opening file");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
char line[512];
|
char line[512];
|
||||||
while (fgets(line, sizeof(line), file)) {
|
while (fgets(line, sizeof(line), file)) {
|
||||||
if (line[0] == '#' || line[0] == '\n')
|
if (line[0] == '#' || line[0] == '\n') {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
parse_config_line(config, line);
|
parse_config_line(config, line);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3112,6 +3128,12 @@ void reapply_monitor_rules(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reapply_cursor_style(void) {
|
||||||
|
if (cursor_mgr)
|
||||||
|
wlr_xcursor_manager_destroy(cursor_mgr);
|
||||||
|
cursor_mgr = wlr_xcursor_manager_create(config.cursor_theme, cursor_size);
|
||||||
|
}
|
||||||
|
|
||||||
void reapply_border(void) {
|
void reapply_border(void) {
|
||||||
Client *c = NULL;
|
Client *c = NULL;
|
||||||
|
|
||||||
@@ -3213,6 +3235,7 @@ void reset_option(void) {
|
|||||||
set_env();
|
set_env();
|
||||||
run_exec();
|
run_exec();
|
||||||
|
|
||||||
|
reapply_cursor_style();
|
||||||
reapply_border();
|
reapply_border();
|
||||||
reapply_keyboard();
|
reapply_keyboard();
|
||||||
reapply_pointer();
|
reapply_pointer();
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ int minimized(const Arg *arg);
|
|||||||
int restore_minimized(const Arg *arg);
|
int restore_minimized(const Arg *arg);
|
||||||
int toggle_scratchpad(const Arg *arg);
|
int toggle_scratchpad(const Arg *arg);
|
||||||
int focusdir(const Arg *arg);
|
int focusdir(const Arg *arg);
|
||||||
int togglerow(const Arg *arg);
|
|
||||||
int toggleoverview(const Arg *arg);
|
int toggleoverview(const Arg *arg);
|
||||||
int set_proportion(const Arg *arg);
|
int set_proportion(const Arg *arg);
|
||||||
int switch_proportion_preset(const Arg *arg);
|
int switch_proportion_preset(const Arg *arg);
|
||||||
|
|||||||
@@ -80,8 +80,12 @@ int defaultgaps(const Arg *arg) {
|
|||||||
|
|
||||||
int exchange_client(const Arg *arg) {
|
int exchange_client(const Arg *arg) {
|
||||||
Client *c = selmon->sel;
|
Client *c = selmon->sel;
|
||||||
if (!c || c->isfloating || c->isfullscreen || c->ismaximizescreen)
|
if (!c || c->isfloating)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if ((c->isfullscreen || c->ismaximizescreen) && !is_scroller_layout(c->mon))
|
||||||
|
return 0;
|
||||||
|
|
||||||
exchange_two_client(c, direction_select(arg));
|
exchange_two_client(c, direction_select(arg));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -121,29 +125,6 @@ int focusdir(const Arg *arg) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int togglerow(const Arg *arg) {
|
|
||||||
// Toggle between top and bottom row in dual-scroller layout
|
|
||||||
if (!selmon || !selmon->sel || !is_row_layout(selmon))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
Client *c = selmon->sel;
|
|
||||||
|
|
||||||
// Only toggle for tiled windows
|
|
||||||
if (c->isfloating || !ISSCROLLTILED(c) || !VISIBLEON(c, selmon))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
// Toggle the row (0 <-> 1)
|
|
||||||
if (c->dual_scroller_row == 0) {
|
|
||||||
c->dual_scroller_row = 1;
|
|
||||||
} else {
|
|
||||||
c->dual_scroller_row = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Trigger a relayout
|
|
||||||
arrange(selmon, false);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int focuslast(const Arg *arg) {
|
int focuslast(const Arg *arg) {
|
||||||
|
|
||||||
Client *c = NULL;
|
Client *c = NULL;
|
||||||
@@ -520,7 +501,7 @@ int setlayout(const Arg *arg) {
|
|||||||
for (jk = 0; jk < LENGTH(layouts); jk++) {
|
for (jk = 0; jk < LENGTH(layouts); jk++) {
|
||||||
if (strcmp(layouts[jk].name, arg->v) == 0) {
|
if (strcmp(layouts[jk].name, arg->v) == 0) {
|
||||||
selmon->pertag->ltidxs[selmon->pertag->curtag] = &layouts[jk];
|
selmon->pertag->ltidxs[selmon->pertag->curtag] = &layouts[jk];
|
||||||
|
clear_fullscreen_and_maximized_state(selmon);
|
||||||
arrange(selmon, false);
|
arrange(selmon, false);
|
||||||
printstatus();
|
printstatus();
|
||||||
return 0;
|
return 0;
|
||||||
@@ -924,7 +905,7 @@ int switch_layout(const Arg *arg) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
clear_fullscreen_and_maximized_state(selmon);
|
||||||
arrange(selmon, false);
|
arrange(selmon, false);
|
||||||
printstatus();
|
printstatus();
|
||||||
return 0;
|
return 0;
|
||||||
@@ -935,6 +916,7 @@ int switch_layout(const Arg *arg) {
|
|||||||
selmon->pertag->ltidxs[selmon->pertag->curtag]->name) == 0) {
|
selmon->pertag->ltidxs[selmon->pertag->curtag]->name) == 0) {
|
||||||
selmon->pertag->ltidxs[selmon->pertag->curtag] =
|
selmon->pertag->ltidxs[selmon->pertag->curtag] =
|
||||||
jk == LENGTH(layouts) - 1 ? &layouts[0] : &layouts[jk + 1];
|
jk == LENGTH(layouts) - 1 ? &layouts[0] : &layouts[jk + 1];
|
||||||
|
clear_fullscreen_and_maximized_state(selmon);
|
||||||
arrange(selmon, false);
|
arrange(selmon, false);
|
||||||
printstatus();
|
printstatus();
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -258,6 +258,7 @@ void dwl_ipc_output_set_layout(struct wl_client *client,
|
|||||||
index = 0;
|
index = 0;
|
||||||
|
|
||||||
monitor->pertag->ltidxs[monitor->pertag->curtag] = &layouts[index];
|
monitor->pertag->ltidxs[monitor->pertag->curtag] = &layouts[index];
|
||||||
|
clear_fullscreen_and_maximized_state(monitor);
|
||||||
arrange(monitor, false);
|
arrange(monitor, false);
|
||||||
printstatus();
|
printstatus();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,7 +146,6 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
|
|||||||
Client *c = NULL;
|
Client *c = NULL;
|
||||||
Client **tempClients = NULL; // 初始化为 NULL
|
Client **tempClients = NULL; // 初始化为 NULL
|
||||||
int last = -1;
|
int last = -1;
|
||||||
bool constrain_to_row = tc->mon && is_row_layout(tc->mon);
|
|
||||||
|
|
||||||
// 第一次遍历,计算客户端数量
|
// 第一次遍历,计算客户端数量
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
@@ -250,7 +249,7 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LEFT:
|
case LEFT:
|
||||||
if (!ignore_align || constrain_to_row) {
|
if (!ignore_align) {
|
||||||
for (int _i = 0; _i <= last; _i++) {
|
for (int _i = 0; _i <= last; _i++) {
|
||||||
if (tempClients[_i]->geom.x < sel_x &&
|
if (tempClients[_i]->geom.x < sel_x &&
|
||||||
tempClients[_i]->geom.y == sel_y &&
|
tempClients[_i]->geom.y == sel_y &&
|
||||||
@@ -266,7 +265,7 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!tempFocusClients && !constrain_to_row) {
|
if (!tempFocusClients) {
|
||||||
for (int _i = 0; _i <= last; _i++) {
|
for (int _i = 0; _i <= last; _i++) {
|
||||||
if (tempClients[_i]->geom.x < sel_x) {
|
if (tempClients[_i]->geom.x < sel_x) {
|
||||||
int dis_x = tempClients[_i]->geom.x - sel_x;
|
int dis_x = tempClients[_i]->geom.x - sel_x;
|
||||||
@@ -282,7 +281,7 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RIGHT:
|
case RIGHT:
|
||||||
if (!ignore_align || constrain_to_row) {
|
if (!ignore_align) {
|
||||||
for (int _i = 0; _i <= last; _i++) {
|
for (int _i = 0; _i <= last; _i++) {
|
||||||
if (tempClients[_i]->geom.x > sel_x &&
|
if (tempClients[_i]->geom.x > sel_x &&
|
||||||
tempClients[_i]->geom.y == sel_y &&
|
tempClients[_i]->geom.y == sel_y &&
|
||||||
@@ -298,7 +297,7 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!tempFocusClients && !constrain_to_row) {
|
if (!tempFocusClients) {
|
||||||
for (int _i = 0; _i <= last; _i++) {
|
for (int _i = 0; _i <= last; _i++) {
|
||||||
if (tempClients[_i]->geom.x > sel_x) {
|
if (tempClients[_i]->geom.x > sel_x) {
|
||||||
int dis_x = tempClients[_i]->geom.x - sel_x;
|
int dis_x = tempClients[_i]->geom.x - sel_x;
|
||||||
@@ -327,11 +326,12 @@ Client *direction_select(const Arg *arg) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (tc && (tc->isfullscreen || tc->ismaximizescreen) &&
|
if (tc && (tc->isfullscreen || tc->ismaximizescreen) &&
|
||||||
!is_scroller_layout(selmon)) {
|
(!is_scroller_layout(selmon) || tc->isfloating)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return find_client_by_direction(tc, arg, true, is_scroller_layout(selmon));
|
return find_client_by_direction(
|
||||||
|
tc, arg, true, is_scroller_layout(selmon) && !selmon->isoverview);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We probably should change the name of this, it sounds like
|
/* We probably should change the name of this, it sounds like
|
||||||
|
|||||||
@@ -115,6 +115,10 @@ void xytonode(double x, double y, struct wlr_surface **psurface, Client **pc,
|
|||||||
surface = wlr_scene_surface_try_from_buffer(
|
surface = wlr_scene_surface_try_from_buffer(
|
||||||
wlr_scene_buffer_from_node(node))
|
wlr_scene_buffer_from_node(node))
|
||||||
->surface;
|
->surface;
|
||||||
|
else if (node->type == WLR_SCENE_NODE_RECT) {
|
||||||
|
surface = NULL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* start from the topmost layer,
|
/* start from the topmost layer,
|
||||||
find a sureface that can be focused by pointer,
|
find a sureface that can be focused by pointer,
|
||||||
|
|||||||
@@ -23,19 +23,6 @@ bool is_scroller_layout(Monitor *m) {
|
|||||||
if (m->pertag->ltidxs[m->pertag->curtag]->id == VERTICAL_SCROLLER)
|
if (m->pertag->ltidxs[m->pertag->curtag]->id == VERTICAL_SCROLLER)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (m->pertag->ltidxs[m->pertag->curtag]->id == DUAL_SCROLLER)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool is_row_layout(Monitor *m) {
|
|
||||||
// Layout has independent horizontal rows where navigation should be constrained
|
|
||||||
// LEFT/RIGHT: stay within same row (same Y)
|
|
||||||
// UP/DOWN: move between rows
|
|
||||||
if (m->pertag->ltidxs[m->pertag->curtag]->id == DUAL_SCROLLER)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -498,8 +498,6 @@ void resize_tile_client(Client *grabc, bool isdrag, int offsetx, int offsety,
|
|||||||
resize_tile_scroller(grabc, isdrag, offsetx, offsety, time, false);
|
resize_tile_scroller(grabc, isdrag, offsetx, offsety, time, false);
|
||||||
} else if (current_layout->id == VERTICAL_SCROLLER) {
|
} else if (current_layout->id == VERTICAL_SCROLLER) {
|
||||||
resize_tile_scroller(grabc, isdrag, offsetx, offsety, time, true);
|
resize_tile_scroller(grabc, isdrag, offsetx, offsety, time, true);
|
||||||
} else if (current_layout->id == DUAL_SCROLLER) {
|
|
||||||
resize_tile_scroller(grabc, isdrag, offsetx, offsety, time, false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -301,8 +301,7 @@ void scroller(Monitor *m) {
|
|||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
c = tempClients[i];
|
c = tempClients[i];
|
||||||
if (root_client == c) {
|
if (root_client == c) {
|
||||||
if (!c->is_pending_open_animation &&
|
if (c->geom.x >= m->w.x + scroller_structs &&
|
||||||
c->geom.x >= m->w.x + scroller_structs &&
|
|
||||||
c->geom.x + c->geom.width <=
|
c->geom.x + c->geom.width <=
|
||||||
m->w.x + m->w.width - scroller_structs) {
|
m->w.x + m->w.width - scroller_structs) {
|
||||||
need_scroller = false;
|
need_scroller = false;
|
||||||
@@ -378,212 +377,6 @@ void scroller(Monitor *m) {
|
|||||||
free(tempClients); // 最后释放内存
|
free(tempClients); // 最后释放内存
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dual-row scroller layout with independent scrolling
|
|
||||||
// Top row: 30% of screen height, Bottom row: 70% of screen height
|
|
||||||
void dual_scroller(Monitor *m) {
|
|
||||||
unsigned int i, n_top = 0, n_bottom = 0, n_total = 0;
|
|
||||||
|
|
||||||
Client *c = NULL;
|
|
||||||
Client **top_row_clients = NULL;
|
|
||||||
Client **bottom_row_clients = NULL;
|
|
||||||
struct wlr_box target_geom;
|
|
||||||
|
|
||||||
unsigned int cur_gappih = enablegaps ? m->gappih : 0;
|
|
||||||
unsigned int cur_gappoh = enablegaps ? m->gappoh : 0;
|
|
||||||
unsigned int cur_gappov = enablegaps ? m->gappov : 0;
|
|
||||||
unsigned int cur_gappiv = enablegaps ? m->gappiv : 0;
|
|
||||||
|
|
||||||
cur_gappih =
|
|
||||||
smartgaps && m->visible_scroll_tiling_clients == 1 ? 0 : cur_gappih;
|
|
||||||
cur_gappoh =
|
|
||||||
smartgaps && m->visible_scroll_tiling_clients == 1 ? 0 : cur_gappoh;
|
|
||||||
cur_gappov =
|
|
||||||
smartgaps && m->visible_scroll_tiling_clients == 1 ? 0 : cur_gappov;
|
|
||||||
cur_gappiv =
|
|
||||||
smartgaps && m->visible_scroll_tiling_clients == 1 ? 0 : cur_gappiv;
|
|
||||||
|
|
||||||
unsigned int max_client_width =
|
|
||||||
m->w.width - 2 * scroller_structs - cur_gappih;
|
|
||||||
|
|
||||||
n_total = m->visible_scroll_tiling_clients;
|
|
||||||
|
|
||||||
if (n_total == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// First pass: count clients per row and assign unassigned clients
|
|
||||||
wl_list_for_each(c, &clients, link) {
|
|
||||||
if (VISIBLEON(c, m) && ISSCROLLTILED(c)) {
|
|
||||||
// Assign to bottom row by default if not assigned
|
|
||||||
if (c->dual_scroller_row == -1) {
|
|
||||||
c->dual_scroller_row = 1; // Default to bottom row
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c->dual_scroller_row == 0) {
|
|
||||||
n_top++;
|
|
||||||
} else {
|
|
||||||
n_bottom++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Allocate arrays for each row
|
|
||||||
if (n_top > 0) {
|
|
||||||
top_row_clients = malloc(n_top * sizeof(Client *));
|
|
||||||
if (!top_row_clients) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (n_bottom > 0) {
|
|
||||||
bottom_row_clients = malloc(n_bottom * sizeof(Client *));
|
|
||||||
if (!bottom_row_clients) {
|
|
||||||
free(top_row_clients);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fill row arrays
|
|
||||||
unsigned int top_idx = 0, bottom_idx = 0;
|
|
||||||
wl_list_for_each(c, &clients, link) {
|
|
||||||
if (VISIBLEON(c, m) && ISSCROLLTILED(c)) {
|
|
||||||
if (c->dual_scroller_row == 0) {
|
|
||||||
top_row_clients[top_idx++] = c;
|
|
||||||
} else {
|
|
||||||
bottom_row_clients[bottom_idx++] = c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calculate row heights (30% top, 70% bottom)
|
|
||||||
unsigned int top_row_height = (unsigned int)((m->w.height - 2 * cur_gappov - cur_gappiv) * 0.3);
|
|
||||||
unsigned int bottom_row_height = m->w.height - 2 * cur_gappov - cur_gappiv - top_row_height;
|
|
||||||
unsigned int top_row_y = m->w.y + cur_gappov;
|
|
||||||
unsigned int bottom_row_y = top_row_y + top_row_height + cur_gappiv;
|
|
||||||
|
|
||||||
// Helper function to layout a single row
|
|
||||||
void layout_row(Client **row_clients, unsigned int n_row, unsigned int row_y,
|
|
||||||
unsigned int row_height, bool is_top_row) {
|
|
||||||
if (n_row == 0) return;
|
|
||||||
|
|
||||||
Client *root_client = NULL;
|
|
||||||
int focus_index = -1;
|
|
||||||
bool need_scroller = false;
|
|
||||||
|
|
||||||
// Find focused client in this row
|
|
||||||
for (i = 0; i < n_row; i++) {
|
|
||||||
if (row_clients[i] == m->sel) {
|
|
||||||
root_client = row_clients[i];
|
|
||||||
focus_index = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If no focused client in this row, keep current scroll position
|
|
||||||
if (!root_client && n_row > 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if scrolling is needed
|
|
||||||
if (root_client && !root_client->is_pending_open_animation &&
|
|
||||||
root_client->geom.x >= m->w.x + scroller_structs &&
|
|
||||||
root_client->geom.x + root_client->geom.width <=
|
|
||||||
m->w.x + m->w.width - scroller_structs) {
|
|
||||||
need_scroller = false;
|
|
||||||
} else {
|
|
||||||
need_scroller = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (start_drag_window)
|
|
||||||
need_scroller = false;
|
|
||||||
|
|
||||||
// Layout focused client
|
|
||||||
if (focus_index >= 0 && root_client) {
|
|
||||||
target_geom.height = row_height;
|
|
||||||
target_geom.width = max_client_width * root_client->scroller_proportion;
|
|
||||||
target_geom.y = row_y;
|
|
||||||
|
|
||||||
// Handle fullscreen and maximize
|
|
||||||
if (root_client->isfullscreen) {
|
|
||||||
target_geom.height = m->m.height;
|
|
||||||
target_geom.width = m->m.width;
|
|
||||||
target_geom.y = m->m.y;
|
|
||||||
target_geom.x = m->m.x;
|
|
||||||
resize(root_client, target_geom, 0);
|
|
||||||
} else if (root_client->ismaximizescreen) {
|
|
||||||
target_geom.height = m->w.height - 2 * cur_gappov;
|
|
||||||
target_geom.width = m->w.width - 2 * cur_gappoh;
|
|
||||||
target_geom.y = m->w.y + cur_gappov;
|
|
||||||
target_geom.x = m->w.x + cur_gappoh;
|
|
||||||
resize(root_client, target_geom, 0);
|
|
||||||
} else if (need_scroller) {
|
|
||||||
// Determine if we should center
|
|
||||||
bool should_center = (scroller_focus_center ||
|
|
||||||
((!m->prevsel ||
|
|
||||||
(ISSCROLLTILED(m->prevsel) &&
|
|
||||||
(m->prevsel->scroller_proportion * max_client_width) +
|
|
||||||
(root_client->scroller_proportion * max_client_width) >
|
|
||||||
m->w.width - 2 * scroller_structs - cur_gappih)) &&
|
|
||||||
scroller_prefer_center));
|
|
||||||
|
|
||||||
// Top row: never center
|
|
||||||
if (is_top_row) {
|
|
||||||
should_center = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (should_center) {
|
|
||||||
target_geom.x = m->w.x + (m->w.width - target_geom.width) / 2;
|
|
||||||
} else {
|
|
||||||
target_geom.x = root_client->geom.x > m->w.x + (m->w.width) / 2
|
|
||||||
? m->w.x + (m->w.width -
|
|
||||||
root_client->scroller_proportion *
|
|
||||||
max_client_width -
|
|
||||||
scroller_structs)
|
|
||||||
: m->w.x + scroller_structs;
|
|
||||||
}
|
|
||||||
resize(root_client, target_geom, 0);
|
|
||||||
} else {
|
|
||||||
target_geom.x = root_client->geom.x;
|
|
||||||
resize(root_client, target_geom, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Layout clients to the left of focused
|
|
||||||
for (i = focus_index - 1; i >= 0 && i < n_row; i--) {
|
|
||||||
c = row_clients[i];
|
|
||||||
target_geom.width = max_client_width * c->scroller_proportion;
|
|
||||||
target_geom.height = row_height;
|
|
||||||
target_geom.y = row_y;
|
|
||||||
|
|
||||||
if (!c->isfullscreen && !c->ismaximizescreen) {
|
|
||||||
target_geom.x = row_clients[i + 1]->geom.x - cur_gappih - target_geom.width;
|
|
||||||
resize(c, target_geom, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Layout clients to the right of focused
|
|
||||||
for (i = focus_index + 1; i < n_row; i++) {
|
|
||||||
c = row_clients[i];
|
|
||||||
target_geom.width = max_client_width * c->scroller_proportion;
|
|
||||||
target_geom.height = row_height;
|
|
||||||
target_geom.y = row_y;
|
|
||||||
|
|
||||||
if (!c->isfullscreen && !c->ismaximizescreen) {
|
|
||||||
target_geom.x = row_clients[i - 1]->geom.x + cur_gappih + row_clients[i - 1]->geom.width;
|
|
||||||
resize(c, target_geom, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Layout both rows independently
|
|
||||||
layout_row(top_row_clients, n_top, top_row_y, top_row_height, true);
|
|
||||||
layout_row(bottom_row_clients, n_bottom, bottom_row_y, bottom_row_height, false);
|
|
||||||
|
|
||||||
// Cleanup
|
|
||||||
free(top_row_clients);
|
|
||||||
free(bottom_row_clients);
|
|
||||||
}
|
|
||||||
|
|
||||||
void center_tile(Monitor *m) {
|
void center_tile(Monitor *m) {
|
||||||
unsigned int i, n = 0, h, r, ie = enablegaps, mw, mx, my, oty, ety, tw;
|
unsigned int i, n = 0, h, r, ie = enablegaps, mw, mx, my, oty, ety, tw;
|
||||||
Client *c = NULL;
|
Client *c = NULL;
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ static void vertical_overview(Monitor *m);
|
|||||||
static void vertical_grid(Monitor *m);
|
static void vertical_grid(Monitor *m);
|
||||||
static void vertical_scroller(Monitor *m);
|
static void vertical_scroller(Monitor *m);
|
||||||
static void vertical_deck(Monitor *mon);
|
static void vertical_deck(Monitor *mon);
|
||||||
static void dual_scroller(Monitor *mon);
|
|
||||||
|
|
||||||
/* layout(s) */
|
/* layout(s) */
|
||||||
Layout overviewlayout = {"", overview, "overview"};
|
Layout overviewlayout = {"", overview, "overview"};
|
||||||
@@ -28,7 +27,6 @@ enum {
|
|||||||
VERTICAL_GRID,
|
VERTICAL_GRID,
|
||||||
VERTICAL_DECK,
|
VERTICAL_DECK,
|
||||||
RIGHT_TILE,
|
RIGHT_TILE,
|
||||||
DUAL_SCROLLER,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Layout layouts[] = {
|
Layout layouts[] = {
|
||||||
@@ -46,5 +44,4 @@ Layout layouts[] = {
|
|||||||
{"VT", vertical_tile, "vertical_tile", VERTICAL_TILE}, // 垂直平铺布局
|
{"VT", vertical_tile, "vertical_tile", VERTICAL_TILE}, // 垂直平铺布局
|
||||||
{"VG", vertical_grid, "vertical_grid", VERTICAL_GRID}, // 垂直格子布局
|
{"VG", vertical_grid, "vertical_grid", VERTICAL_GRID}, // 垂直格子布局
|
||||||
{"VK", vertical_deck, "vertical_deck", VERTICAL_DECK}, // 垂直卡片布局
|
{"VK", vertical_deck, "vertical_deck", VERTICAL_DECK}, // 垂直卡片布局
|
||||||
{"DS", dual_scroller, "dual_scroller", DUAL_SCROLLER}, // 双行滚动布局
|
|
||||||
};
|
};
|
||||||
@@ -263,8 +263,7 @@ void vertical_scroller(Monitor *m) {
|
|||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
c = tempClients[i];
|
c = tempClients[i];
|
||||||
if (root_client == c) {
|
if (root_client == c) {
|
||||||
if (!c->is_pending_open_animation &&
|
if (c->geom.y >= m->w.y + scroller_structs &&
|
||||||
c->geom.y >= m->w.y + scroller_structs &&
|
|
||||||
c->geom.y + c->geom.height <=
|
c->geom.y + c->geom.height <=
|
||||||
m->w.y + m->w.height - scroller_structs) {
|
m->w.y + m->w.height - scroller_structs) {
|
||||||
need_scroller = false;
|
need_scroller = false;
|
||||||
|
|||||||
90
src/mango.c
90
src/mango.c
@@ -285,7 +285,6 @@ struct Client {
|
|||||||
struct wlr_scene_tree *scene;
|
struct wlr_scene_tree *scene;
|
||||||
struct wlr_scene_rect *border; /* top, bottom, left, right */
|
struct wlr_scene_rect *border; /* top, bottom, left, right */
|
||||||
struct wlr_scene_shadow *shadow;
|
struct wlr_scene_shadow *shadow;
|
||||||
struct wlr_scene_blur *blur;
|
|
||||||
struct wlr_scene_tree *scene_surface;
|
struct wlr_scene_tree *scene_surface;
|
||||||
struct wl_list link;
|
struct wl_list link;
|
||||||
struct wl_list flink;
|
struct wl_list flink;
|
||||||
@@ -375,7 +374,6 @@ struct Client {
|
|||||||
double old_master_mfact_per, old_master_inner_per, old_stack_innder_per;
|
double old_master_mfact_per, old_master_inner_per, old_stack_innder_per;
|
||||||
double old_scroller_pproportion;
|
double old_scroller_pproportion;
|
||||||
bool ismaster;
|
bool ismaster;
|
||||||
int dual_scroller_row; // 0 = top row, 1 = bottom row, -1 = not set
|
|
||||||
bool cursor_in_upper_half, cursor_in_left_half;
|
bool cursor_in_upper_half, cursor_in_left_half;
|
||||||
bool isleftstack;
|
bool isleftstack;
|
||||||
int tearing_hint;
|
int tearing_hint;
|
||||||
@@ -425,7 +423,6 @@ typedef struct {
|
|||||||
struct wlr_scene_tree *scene;
|
struct wlr_scene_tree *scene;
|
||||||
struct wlr_scene_tree *popups;
|
struct wlr_scene_tree *popups;
|
||||||
struct wlr_scene_shadow *shadow;
|
struct wlr_scene_shadow *shadow;
|
||||||
struct wlr_scene_blur *blur;
|
|
||||||
struct wlr_scene_layer_surface_v1 *scene_layer;
|
struct wlr_scene_layer_surface_v1 *scene_layer;
|
||||||
struct wl_list link;
|
struct wl_list link;
|
||||||
struct wl_list fadeout_link;
|
struct wl_list fadeout_link;
|
||||||
@@ -722,7 +719,6 @@ static struct wlr_scene_tree *
|
|||||||
wlr_scene_tree_snapshot(struct wlr_scene_node *node,
|
wlr_scene_tree_snapshot(struct wlr_scene_node *node,
|
||||||
struct wlr_scene_tree *parent);
|
struct wlr_scene_tree *parent);
|
||||||
static bool is_scroller_layout(Monitor *m);
|
static bool is_scroller_layout(Monitor *m);
|
||||||
static bool is_row_layout(Monitor *m);
|
|
||||||
static void create_output(struct wlr_backend *backend, void *data);
|
static void create_output(struct wlr_backend *backend, void *data);
|
||||||
static void get_layout_abbr(char *abbr, const char *full_name);
|
static void get_layout_abbr(char *abbr, const char *full_name);
|
||||||
static void apply_named_scratchpad(Client *target_client);
|
static void apply_named_scratchpad(Client *target_client);
|
||||||
@@ -741,6 +737,7 @@ static void refresh_monitors_workspaces_status(Monitor *m);
|
|||||||
static void init_client_properties(Client *c);
|
static void init_client_properties(Client *c);
|
||||||
static float *get_border_color(Client *c);
|
static float *get_border_color(Client *c);
|
||||||
static void request_fresh_all_monitors(void);
|
static void request_fresh_all_monitors(void);
|
||||||
|
static void clear_fullscreen_and_maximized_state(Monitor *m);
|
||||||
|
|
||||||
#include "data/static_keymap.h"
|
#include "data/static_keymap.h"
|
||||||
#include "dispatch/bind_declare.h"
|
#include "dispatch/bind_declare.h"
|
||||||
@@ -938,11 +935,25 @@ void applybounds(Client *c, struct wlr_box *bbox) {
|
|||||||
c->geom.y = bbox->y;
|
c->geom.y = bbox->y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void clear_fullscreen_and_maximized_state(Monitor *m) {
|
||||||
|
Client *fc = NULL;
|
||||||
|
wl_list_for_each(fc, &clients, link) {
|
||||||
|
if (fc && VISIBLEON(fc, m) && ISFULLSCREEN(fc)) {
|
||||||
|
clear_fullscreen_flag(fc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*清除全屏标志,还原全屏时清0的border*/
|
/*清除全屏标志,还原全屏时清0的border*/
|
||||||
void clear_fullscreen_flag(Client *c) {
|
void clear_fullscreen_flag(Client *c) {
|
||||||
|
|
||||||
if (is_scroller_layout(c->mon))
|
if ((c->mon->pertag->ltidxs[get_tags_first_tag_num(c->tags)]->id ==
|
||||||
|
SCROLLER ||
|
||||||
|
c->mon->pertag->ltidxs[get_tags_first_tag_num(c->tags)]->id ==
|
||||||
|
VERTICAL_SCROLLER) &&
|
||||||
|
!c->isfloating) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (c->isfullscreen) {
|
if (c->isfullscreen) {
|
||||||
setfullscreen(c, false);
|
setfullscreen(c, false);
|
||||||
@@ -2132,16 +2143,12 @@ static void iter_layer_scene_buffers(struct wlr_scene_buffer *buffer, int sx,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LayerSurface *l = (LayerSurface *)user_data;
|
wlr_scene_buffer_set_backdrop_blur(buffer, true);
|
||||||
|
wlr_scene_buffer_set_backdrop_blur_ignore_transparent(buffer, true);
|
||||||
wlr_scene_node_set_enabled(&l->blur->node, true);
|
|
||||||
wlr_scene_blur_set_transparency_mask_source(l->blur, buffer);
|
|
||||||
wlr_scene_blur_set_size(l->blur, l->geom.width, l->geom.height);
|
|
||||||
|
|
||||||
if (blur_optimized) {
|
if (blur_optimized) {
|
||||||
wlr_scene_blur_set_should_only_blur_bottom_layer(l->blur, true);
|
wlr_scene_buffer_set_backdrop_blur_optimized(buffer, true);
|
||||||
} else {
|
} else {
|
||||||
wlr_scene_blur_set_should_only_blur_bottom_layer(l->blur, false);
|
wlr_scene_buffer_set_backdrop_blur_optimized(buffer, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2186,19 +2193,15 @@ void maplayersurfacenotify(struct wl_listener *listener, void *data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 初始化阴影
|
// 初始化阴影
|
||||||
if (layer_surface->current.layer != ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM &&
|
if (layer_surface->current.exclusive_zone == 0 &&
|
||||||
|
layer_surface->current.layer != ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM &&
|
||||||
layer_surface->current.layer != ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND) {
|
layer_surface->current.layer != ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND) {
|
||||||
if (layer_surface->current.exclusive_zone == 0) {
|
|
||||||
l->shadow = wlr_scene_shadow_create(l->scene, 0, 0, border_radius,
|
l->shadow = wlr_scene_shadow_create(l->scene, 0, 0, border_radius,
|
||||||
shadows_blur, shadowscolor);
|
shadows_blur, shadowscolor);
|
||||||
wlr_scene_node_lower_to_bottom(&l->shadow->node);
|
wlr_scene_node_lower_to_bottom(&l->shadow->node);
|
||||||
wlr_scene_node_set_enabled(&l->shadow->node, true);
|
wlr_scene_node_set_enabled(&l->shadow->node, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
l->blur = wlr_scene_blur_create(l->scene, 0, 0);
|
|
||||||
wlr_scene_node_lower_to_bottom(&l->blur->node);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 初始化动画
|
// 初始化动画
|
||||||
if (animations && layer_animations && !l->noanim) {
|
if (animations && layer_animations && !l->noanim) {
|
||||||
l->animation.duration = animation_duration_open;
|
l->animation.duration = animation_duration_open;
|
||||||
@@ -2207,6 +2210,15 @@ void maplayersurfacenotify(struct wl_listener *listener, void *data) {
|
|||||||
}
|
}
|
||||||
// 刷新布局,让窗口能感应到exclude_zone变化以及设置独占表面
|
// 刷新布局,让窗口能感应到exclude_zone变化以及设置独占表面
|
||||||
arrangelayers(l->mon);
|
arrangelayers(l->mon);
|
||||||
|
|
||||||
|
// 按需交互layer需要像正常窗口一样抢占非独占layer的焦点
|
||||||
|
if (!exclusive_focus &&
|
||||||
|
l->layer_surface->current.keyboard_interactive ==
|
||||||
|
ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND) {
|
||||||
|
focusclient(NULL, 0);
|
||||||
|
client_notify_enter(l->layer_surface->surface,
|
||||||
|
wlr_seat_get_keyboard(seat));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void commitlayersurfacenotify(struct wl_listener *listener, void *data) {
|
void commitlayersurfacenotify(struct wl_listener *listener, void *data) {
|
||||||
@@ -2253,8 +2265,7 @@ void commitlayersurfacenotify(struct wl_listener *listener, void *data) {
|
|||||||
if (!l->noblur &&
|
if (!l->noblur &&
|
||||||
layer_surface->current.layer != ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM &&
|
layer_surface->current.layer != ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM &&
|
||||||
layer_surface->current.layer !=
|
layer_surface->current.layer !=
|
||||||
ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND &&
|
ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND) {
|
||||||
l->blur) {
|
|
||||||
|
|
||||||
wlr_scene_node_for_each_buffer(&l->scene->node,
|
wlr_scene_node_for_each_buffer(&l->scene->node,
|
||||||
iter_layer_scene_buffers, l);
|
iter_layer_scene_buffers, l);
|
||||||
@@ -2773,7 +2784,6 @@ createnotify(struct wl_listener *listener, void *data) {
|
|||||||
c = toplevel->base->data = ecalloc(1, sizeof(*c));
|
c = toplevel->base->data = ecalloc(1, sizeof(*c));
|
||||||
c->surface.xdg = toplevel->base;
|
c->surface.xdg = toplevel->base;
|
||||||
c->bw = borderpx;
|
c->bw = borderpx;
|
||||||
c->dual_scroller_row = -1; // Not assigned to a row yet
|
|
||||||
|
|
||||||
LISTEN(&toplevel->base->surface->events.commit, &c->commit, commitnotify);
|
LISTEN(&toplevel->base->surface->events.commit, &c->commit, commitnotify);
|
||||||
LISTEN(&toplevel->base->surface->events.map, &c->map, mapnotify);
|
LISTEN(&toplevel->base->surface->events.map, &c->map, mapnotify);
|
||||||
@@ -3593,15 +3603,15 @@ static void iter_xdg_scene_buffers(struct wlr_scene_buffer *buffer, int sx,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (blur && c && !c->noblur) {
|
if (blur && c && !c->noblur) {
|
||||||
wlr_scene_node_set_enabled(&c->blur->node, true);
|
wlr_scene_buffer_set_backdrop_blur(buffer, true);
|
||||||
// wlr_scene_blur_set_transparency_mask_source(c->blur, buffer);
|
wlr_scene_buffer_set_backdrop_blur_ignore_transparent(buffer, false);
|
||||||
if (blur_optimized) {
|
if (blur_optimized) {
|
||||||
wlr_scene_blur_set_should_only_blur_bottom_layer(c->blur, true);
|
wlr_scene_buffer_set_backdrop_blur_optimized(buffer, true);
|
||||||
} else {
|
} else {
|
||||||
wlr_scene_blur_set_should_only_blur_bottom_layer(c->blur, false);
|
wlr_scene_buffer_set_backdrop_blur_optimized(buffer, false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
wlr_scene_node_set_enabled(&c->blur->node, false);
|
wlr_scene_buffer_set_backdrop_blur(buffer, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3716,9 +3726,6 @@ mapnotify(struct wl_listener *listener, void *data) {
|
|||||||
c->shadow = wlr_scene_shadow_create(c->scene, 0, 0, border_radius,
|
c->shadow = wlr_scene_shadow_create(c->scene, 0, 0, border_radius,
|
||||||
shadows_blur, shadowscolor);
|
shadows_blur, shadowscolor);
|
||||||
|
|
||||||
c->blur = wlr_scene_blur_create(c->scene_surface, 0, 0);
|
|
||||||
wlr_scene_node_lower_to_bottom(&c->blur->node);
|
|
||||||
|
|
||||||
wlr_scene_node_lower_to_bottom(&c->shadow->node);
|
wlr_scene_node_lower_to_bottom(&c->shadow->node);
|
||||||
wlr_scene_node_set_enabled(&c->shadow->node, true);
|
wlr_scene_node_set_enabled(&c->shadow->node, true);
|
||||||
|
|
||||||
@@ -3726,7 +3733,7 @@ mapnotify(struct wl_listener *listener, void *data) {
|
|||||||
// tile at the top
|
// tile at the top
|
||||||
wl_list_insert(&clients, &c->link); // 新窗口是master,头部入栈
|
wl_list_insert(&clients, &c->link); // 新窗口是master,头部入栈
|
||||||
else if (selmon && is_scroller_layout(selmon) &&
|
else if (selmon && is_scroller_layout(selmon) &&
|
||||||
selmon->visible_tiling_clients > 0) {
|
selmon->visible_scroll_tiling_clients > 0) {
|
||||||
|
|
||||||
if (selmon->sel && ISSCROLLTILED(selmon->sel) &&
|
if (selmon->sel && ISSCROLLTILED(selmon->sel) &&
|
||||||
VISIBLEON(selmon->sel, selmon)) {
|
VISIBLEON(selmon->sel, selmon)) {
|
||||||
@@ -3736,11 +3743,6 @@ mapnotify(struct wl_listener *listener, void *data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (at_client) {
|
if (at_client) {
|
||||||
// For row-based layouts, assign new client to same row as focused client
|
|
||||||
if (is_row_layout(selmon) && at_client->dual_scroller_row >= 0) {
|
|
||||||
c->dual_scroller_row = at_client->dual_scroller_row;
|
|
||||||
}
|
|
||||||
|
|
||||||
at_client->link.next->prev = &c->link;
|
at_client->link.next->prev = &c->link;
|
||||||
c->link.prev = &at_client->link;
|
c->link.prev = &at_client->link;
|
||||||
c->link.next = at_client->link.next;
|
c->link.next = at_client->link.next;
|
||||||
@@ -4565,7 +4567,7 @@ void setmaximizescreen(Client *c, int maximizescreen) {
|
|||||||
maximizescreen_box.width = c->mon->w.width - 2 * gappoh;
|
maximizescreen_box.width = c->mon->w.width - 2 * gappoh;
|
||||||
maximizescreen_box.height = c->mon->w.height - 2 * gappov;
|
maximizescreen_box.height = c->mon->w.height - 2 * gappov;
|
||||||
wlr_scene_node_raise_to_top(&c->scene->node); // 将视图提升到顶层
|
wlr_scene_node_raise_to_top(&c->scene->node); // 将视图提升到顶层
|
||||||
if (!is_scroller_layout(c->mon))
|
if (!is_scroller_layout(c->mon) || c->isfloating)
|
||||||
resize(c, maximizescreen_box, 0);
|
resize(c, maximizescreen_box, 0);
|
||||||
c->ismaximizescreen = 1;
|
c->ismaximizescreen = 1;
|
||||||
} else {
|
} else {
|
||||||
@@ -4575,9 +4577,8 @@ void setmaximizescreen(Client *c, int maximizescreen) {
|
|||||||
setfloating(c, 1);
|
setfloating(c, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_scene_node_reparent(&c->scene->node, layers[maximizescreen ? LyrTile
|
wlr_scene_node_reparent(&c->scene->node,
|
||||||
: c->isfloating ? LyrTop
|
layers[c->isfloating ? LyrTop : LyrTile]);
|
||||||
: LyrTile]);
|
|
||||||
if (!c->ismaximizescreen) {
|
if (!c->ismaximizescreen) {
|
||||||
set_size_per(c->mon, c);
|
set_size_per(c->mon, c);
|
||||||
}
|
}
|
||||||
@@ -4623,7 +4624,7 @@ void setfullscreen(Client *c, int fullscreen) // 用自定义全屏代理自带
|
|||||||
|
|
||||||
c->bw = 0;
|
c->bw = 0;
|
||||||
wlr_scene_node_raise_to_top(&c->scene->node); // 将视图提升到顶层
|
wlr_scene_node_raise_to_top(&c->scene->node); // 将视图提升到顶层
|
||||||
if (!is_scroller_layout(c->mon))
|
if (!is_scroller_layout(c->mon) || c->isfloating)
|
||||||
resize(c, c->mon->m, 1);
|
resize(c, c->mon->m, 1);
|
||||||
c->isfullscreen = 1;
|
c->isfullscreen = 1;
|
||||||
} else {
|
} else {
|
||||||
@@ -5199,7 +5200,11 @@ unsigned int want_restore_fullscreen(Client *target_client) {
|
|||||||
Client *c = NULL;
|
Client *c = NULL;
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
if (c && c != target_client && c->tags == target_client->tags &&
|
if (c && c != target_client && c->tags == target_client->tags &&
|
||||||
c == selmon->sel) {
|
c == selmon->sel &&
|
||||||
|
c->mon->pertag->ltidxs[get_tags_first_tag_num(c->tags)]->id !=
|
||||||
|
SCROLLER &&
|
||||||
|
c->mon->pertag->ltidxs[get_tags_first_tag_num(c->tags)]->id !=
|
||||||
|
VERTICAL_SCROLLER) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5797,7 +5802,6 @@ void createnotifyx11(struct wl_listener *listener, void *data) {
|
|||||||
c = xsurface->data = ecalloc(1, sizeof(*c));
|
c = xsurface->data = ecalloc(1, sizeof(*c));
|
||||||
c->surface.xwayland = xsurface;
|
c->surface.xwayland = xsurface;
|
||||||
c->type = X11;
|
c->type = X11;
|
||||||
c->dual_scroller_row = -1; // Not assigned to a row yet
|
|
||||||
/* Listen to the various events it can emit */
|
/* Listen to the various events it can emit */
|
||||||
LISTEN(&xsurface->events.associate, &c->associate, associatex11);
|
LISTEN(&xsurface->events.associate, &c->associate, associatex11);
|
||||||
LISTEN(&xsurface->events.destroy, &c->destroy, destroynotify);
|
LISTEN(&xsurface->events.destroy, &c->destroy, destroynotify);
|
||||||
|
|||||||
Reference in New Issue
Block a user