Compare commits
35 Commits
feature/du
...
be6ed1764f
| Author | SHA1 | Date | |
|---|---|---|---|
| be6ed1764f | |||
| 3de0ce410a | |||
| deae7862e3 | |||
| ccb2a99bfb | |||
| 7641a65a89 | |||
| 6b75a50ed5 | |||
| f18e43c2c6 | |||
|
|
8ab59c1aca | ||
|
|
b3578344dc | ||
|
|
389f417a3b | ||
|
|
d2e0df024d | ||
|
|
bd6a71f05e | ||
|
|
cfb66111de | ||
|
|
94e47bc3b0 | ||
|
|
43424152f3 | ||
|
|
0ff4d94365 | ||
|
|
ade00f88f0 | ||
|
|
7ed12cf921 | ||
|
|
64d8764f58 | ||
|
|
d0a51f4785 | ||
|
|
7552e77781 | ||
|
|
c206693257 | ||
|
|
11dfab478a | ||
|
|
3cfcaa21c0 | ||
|
|
276560840b | ||
|
|
ee789613ff | ||
|
|
8ac331aa64 | ||
|
|
e59b9c10b5 | ||
|
|
9fecdb6c3a | ||
|
|
c51cf7d6cc | ||
|
|
a42939f0c2 | ||
|
|
fbdf7fdb34 | ||
|
|
16dc4fa9cd | ||
|
|
9b97d11c83 | ||
|
|
58790c0e53 |
32
README.md
32
README.md
@@ -71,8 +71,6 @@ https://github.com/user-attachments/assets/014c893f-115c-4ae9-8342-f9ae3e9a0df0
|
||||
- hwdata
|
||||
- seatd
|
||||
- pcre2
|
||||
- xorg-xwayland
|
||||
- libxcb
|
||||
|
||||
## Arch Linux
|
||||
The package is in the Arch User Repository and is availble for manual download [here](https://aur.archlinux.org/packages/mangowc-git) or through a AUR helper like yay:
|
||||
@@ -82,6 +80,7 @@ yay -S mangowc-git
|
||||
```
|
||||
|
||||
## Gentoo Linux
|
||||
|
||||
The package is in the community-maintained repository called GURU.
|
||||
First, add GURU repository:
|
||||
|
||||
@@ -99,16 +98,6 @@ Finally, install the package:
|
||||
emerge --ask --verbose gui-wm/mangowc
|
||||
```
|
||||
|
||||
## Fedora Linux
|
||||
The package is in the third-party Terra repository.
|
||||
First, add the [Terra Repository](https://terra.fyralabs.com/).
|
||||
|
||||
Then, install the package:
|
||||
|
||||
```bash
|
||||
dnf install mangowc
|
||||
```
|
||||
|
||||
## Other
|
||||
|
||||
```bash
|
||||
@@ -117,7 +106,7 @@ cd wlroots
|
||||
meson build -Dprefix=/usr
|
||||
sudo ninja -C build install
|
||||
|
||||
git clone -b 0.4.1 https://github.com/wlrfx/scenefx.git
|
||||
git clone https://github.com/wlrfx/scenefx.git
|
||||
cd scenefx
|
||||
meson build -Dprefix=/usr
|
||||
sudo ninja -C build install
|
||||
@@ -181,9 +170,7 @@ git clone https://github.com/DreamMaoMao/mango-config.git ~/.config/mango
|
||||
|
||||
## Config Documentation
|
||||
|
||||
Refer to the repo wiki [wiki](https://github.com/DreamMaoMao/mango/wiki/)
|
||||
|
||||
or the website docs [docs](https://mangowc.vercel.app/docs)
|
||||
Refer to the [wiki](https://github.com/DreamMaoMao/mango/wiki/)
|
||||
|
||||
# NixOS + Home-manager
|
||||
|
||||
@@ -202,10 +189,7 @@ Here's an example of using the modules in a flake:
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
mango = {
|
||||
url = "github:DreamMaoMao/mango";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
mango.url = "github:DreamMaoMao/mango";
|
||||
};
|
||||
outputs =
|
||||
inputs@{ self, flake-parts, ... }:
|
||||
@@ -261,6 +245,14 @@ Here's an example of using the modules in a flake:
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
# Sponsor
|
||||
|
||||
My current device is a bit outdated and doesn't support certain features like HDR or VRR. If you'd like to support this project, here's how you can help. Thanks!
|
||||
|
||||

|
||||
|
||||
|
||||
# Packaging mango
|
||||
|
||||
To package mango for other distributions, you can check the reference setup for:
|
||||
|
||||
@@ -57,7 +57,6 @@ scroller_prefer_center=0
|
||||
edge_scroller_pointer_focus=1
|
||||
scroller_default_proportion_single=1.0
|
||||
scroller_proportion_preset=0.5,0.8,1.0
|
||||
dual_scroller_default_split_ratio=0.3
|
||||
|
||||
# Master-Stack Layout Setting
|
||||
new_is_master=1
|
||||
@@ -238,10 +237,6 @@ bind=CTRL+ALT,Down,resizewin,+0,+50
|
||||
bind=CTRL+ALT,Left,resizewin,-50,+0
|
||||
bind=CTRL+ALT,Right,resizewin,+50,+0
|
||||
|
||||
# dual-scroller split adjustment (increase/decrease top row height)
|
||||
# bind=SUPER+SHIFT,Equal,adjust_dual_scroller_split,0.05
|
||||
# bind=SUPER+SHIFT,Minus,adjust_dual_scroller_split,-0.05
|
||||
|
||||
# Mouse Button Bindings
|
||||
# NONE mode key only work in ov mode
|
||||
mousebind=SUPER,btn_left,moveresize,curmove
|
||||
|
||||
46
flake.lock
generated
46
flake.lock
generated
@@ -18,6 +18,27 @@
|
||||
"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": {
|
||||
"locked": {
|
||||
"lastModified": 1750386251,
|
||||
@@ -58,16 +79,18 @@
|
||||
},
|
||||
"scenefx": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
],
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1750785057,
|
||||
"narHash": "sha256-tGX6j4W91rcb+glXJo43sjPI9zQvPotonknG1BdihR4=",
|
||||
"lastModified": 1762447505,
|
||||
"narHash": "sha256-VEBQ8KXkSS4c+kdAhmvq06lEd9WNeCXdRK1U+qSilFw=",
|
||||
"owner": "wlrfx",
|
||||
"repo": "scenefx",
|
||||
"rev": "3a6cfb12e4ba97b43326357d14f7b3e40897adfc",
|
||||
"rev": "7f9e7409f6169fa637f1265895c121a8f8b70272",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -75,6 +98,21 @@
|
||||
"repo": "scenefx",
|
||||
"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",
|
||||
|
||||
@@ -25,12 +25,13 @@
|
||||
|
||||
perSystem = {
|
||||
config,
|
||||
system,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (pkgs) callPackage ;
|
||||
inherit (pkgs) callPackage;
|
||||
mango = callPackage ./nix {
|
||||
inherit (inputs.scenefx.packages.${pkgs.stdenv.hostPlatform.system}) scenefx;
|
||||
scenefx = inputs.scenefx.packages.${system}.default;
|
||||
};
|
||||
shellOverride = old: {
|
||||
nativeBuildInputs = old.nativeBuildInputs ++ [];
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
project('mango', ['c', 'cpp'],
|
||||
version : '0.10.7',
|
||||
version : '0.10.5',
|
||||
)
|
||||
|
||||
subdir('protocols')
|
||||
|
||||
@@ -86,7 +86,7 @@ static void noop_description(void *data, struct wl_output *wl_output,
|
||||
const char *description) {}
|
||||
|
||||
// 将 n 转换为 9 位二进制字符串,结果存入 buf(至少长度 10)
|
||||
void bin_str_9bits(char *buf, uint32_t n) {
|
||||
void bin_str_9bits(char *buf, unsigned int n) {
|
||||
for (int i = 8; i >= 0; i--) {
|
||||
*buf++ = ((n >> i) & 1) ? '1' : '0';
|
||||
}
|
||||
@@ -268,7 +268,7 @@ static void dwl_ipc_output_kb_layout(void *data,
|
||||
static void
|
||||
dwl_ipc_output_scalefactor(void *data,
|
||||
struct zdwl_ipc_output_v2 *dwl_ipc_output,
|
||||
const uint32_t scalefactor) {
|
||||
const unsigned int scalefactor) {
|
||||
if (!Aflag)
|
||||
return;
|
||||
char *output_name = data;
|
||||
|
||||
@@ -26,25 +26,6 @@ in {
|
||||
xdg.portal = {
|
||||
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;
|
||||
|
||||
configPackages = [cfg.package];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
void client_actual_size(Client *c, uint32_t *width, uint32_t *height) {
|
||||
void client_actual_size(Client *c, unsigned int *width, unsigned int *height) {
|
||||
*width = c->animation.current.width - c->bw;
|
||||
|
||||
*height = c->animation.current.height - c->bw;
|
||||
@@ -183,8 +183,8 @@ void scene_buffer_apply_effect(struct wlr_scene_buffer *buffer, int sx, int sy,
|
||||
|
||||
if (buffer_data->should_scale) {
|
||||
|
||||
uint32_t surface_width = surface->current.width;
|
||||
uint32_t surface_height = surface->current.height;
|
||||
unsigned int surface_width = surface->current.width;
|
||||
unsigned int surface_height = surface->current.height;
|
||||
|
||||
surface_width = buffer_data->width_scale < 1
|
||||
? surface_width
|
||||
@@ -245,6 +245,10 @@ void buffer_set_effect(Client *c, BufferData data) {
|
||||
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,
|
||||
scene_buffer_apply_effect, &data);
|
||||
}
|
||||
@@ -270,7 +274,7 @@ void client_draw_shadow(Client *c) {
|
||||
? CORNER_LOCATION_NONE
|
||||
: CORNER_LOCATION_ALL;
|
||||
|
||||
uint32_t bwoffset = c->bw != 0 && hit_no_border ? c->bw : 0;
|
||||
unsigned int bwoffset = c->bw != 0 && hit_no_border ? c->bw : 0;
|
||||
|
||||
uint32_t width, height;
|
||||
client_actual_size(c, &width, &height);
|
||||
@@ -349,6 +353,19 @@ void client_draw_shadow(Client *c) {
|
||||
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) {
|
||||
if (!c || c->iskilling || !client_surface(c)->mapped)
|
||||
return;
|
||||
@@ -446,7 +463,7 @@ struct ivec2 clip_to_hide(Client *c, struct wlr_box *clip_box) {
|
||||
int offsetx = 0, offsety = 0, offsetw = 0, offseth = 0;
|
||||
struct ivec2 offset = {0, 0, 0, 0};
|
||||
|
||||
if (!ISSCROLLTILED(c) && !c->animation.tagining && !c->animation.tagouted &&
|
||||
if (!ISTILED(c) && !c->animation.tagining && !c->animation.tagouted &&
|
||||
!c->animation.tagouting)
|
||||
return offset;
|
||||
|
||||
@@ -467,7 +484,7 @@ struct ivec2 clip_to_hide(Client *c, struct wlr_box *clip_box) {
|
||||
需要主要border超出屏幕的时候不计算如偏差之内而是
|
||||
要等窗口表面超出才开始计算偏差
|
||||
*/
|
||||
if (ISSCROLLTILED(c) || c->animation.tagining || c->animation.tagouted ||
|
||||
if (ISTILED(c) || c->animation.tagining || c->animation.tagouted ||
|
||||
c->animation.tagouting) {
|
||||
if (left_out_offset > 0) {
|
||||
offsetx = GEZERO(left_out_offset - bw);
|
||||
@@ -495,7 +512,7 @@ struct ivec2 clip_to_hide(Client *c, struct wlr_box *clip_box) {
|
||||
offset.height = offseth;
|
||||
|
||||
if ((clip_box->width + bw <= 0 || clip_box->height + bw <= 0) &&
|
||||
(ISSCROLLTILED(c) || c->animation.tagouting || c->animation.tagining)) {
|
||||
(ISTILED(c) || c->animation.tagouting || c->animation.tagining)) {
|
||||
c->is_clip_to_hide = true;
|
||||
wlr_scene_node_set_enabled(&c->scene->node, false);
|
||||
} else if (c->is_clip_to_hide && VISIBLEON(c, c->mon)) {
|
||||
@@ -533,12 +550,14 @@ void client_apply_clip(Client *c, float factor) {
|
||||
|
||||
apply_border(c);
|
||||
client_draw_shadow(c);
|
||||
client_draw_blur(c, clip_box, offset);
|
||||
|
||||
if (clip_box.width <= 0 || clip_box.height <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
wlr_scene_subsurface_tree_set_clip(&c->scene_surface->node, &clip_box);
|
||||
|
||||
buffer_set_effect(c, (BufferData){1.0f, 1.0f, clip_box.width,
|
||||
clip_box.height,
|
||||
current_corner_location, true});
|
||||
@@ -546,7 +565,7 @@ void client_apply_clip(Client *c, float factor) {
|
||||
}
|
||||
|
||||
// 获取窗口动画实时位置矩形
|
||||
uint32_t width, height;
|
||||
unsigned int width, height;
|
||||
client_actual_size(c, &width, &height);
|
||||
|
||||
// 计算出除了边框的窗口实际剪切大小
|
||||
@@ -570,6 +589,7 @@ void client_apply_clip(Client *c, float factor) {
|
||||
// 应用窗口装饰
|
||||
apply_border(c);
|
||||
client_draw_shadow(c);
|
||||
client_draw_blur(c, clip_box, offset);
|
||||
|
||||
// 如果窗口剪切区域已经剪切到0,则不渲染窗口表面
|
||||
if (clip_box.width <= 0 || clip_box.height <= 0) {
|
||||
@@ -630,16 +650,17 @@ void fadeout_client_animation_next_tick(Client *c) {
|
||||
|
||||
int type = c->animation.action = c->animation.action;
|
||||
double factor = find_animation_curve_at(animation_passed, type);
|
||||
uint32_t width = c->animation.initial.width +
|
||||
(c->current.width - c->animation.initial.width) * factor;
|
||||
uint32_t height =
|
||||
unsigned int width =
|
||||
c->animation.initial.width +
|
||||
(c->current.width - c->animation.initial.width) * factor;
|
||||
unsigned int height =
|
||||
c->animation.initial.height +
|
||||
(c->current.height - c->animation.initial.height) * factor;
|
||||
|
||||
uint32_t x = c->animation.initial.x +
|
||||
(c->current.x - c->animation.initial.x) * factor;
|
||||
uint32_t y = c->animation.initial.y +
|
||||
(c->current.y - c->animation.initial.y) * factor;
|
||||
unsigned int x = c->animation.initial.x +
|
||||
(c->current.x - c->animation.initial.x) * factor;
|
||||
unsigned int y = c->animation.initial.y +
|
||||
(c->current.y - c->animation.initial.y) * factor;
|
||||
|
||||
wlr_scene_node_set_position(&c->scene->node, x, y);
|
||||
|
||||
@@ -695,16 +716,17 @@ void client_animation_next_tick(Client *c) {
|
||||
double sx = 0, sy = 0;
|
||||
struct wlr_surface *surface = NULL;
|
||||
|
||||
uint32_t width = c->animation.initial.width +
|
||||
(c->current.width - c->animation.initial.width) * factor;
|
||||
uint32_t height =
|
||||
unsigned int width =
|
||||
c->animation.initial.width +
|
||||
(c->current.width - c->animation.initial.width) * factor;
|
||||
unsigned int height =
|
||||
c->animation.initial.height +
|
||||
(c->current.height - c->animation.initial.height) * factor;
|
||||
|
||||
uint32_t x = c->animation.initial.x +
|
||||
(c->current.x - c->animation.initial.x) * factor;
|
||||
uint32_t y = c->animation.initial.y +
|
||||
(c->current.y - c->animation.initial.y) * factor;
|
||||
unsigned int x = c->animation.initial.x +
|
||||
(c->current.x - c->animation.initial.x) * factor;
|
||||
unsigned int y = c->animation.initial.y +
|
||||
(c->current.y - c->animation.initial.y) * factor;
|
||||
|
||||
wlr_scene_node_set_position(&c->scene->node, x, y);
|
||||
c->animation.current = (struct wlr_box){
|
||||
@@ -989,6 +1011,10 @@ void resize(Client *c, struct wlr_box geo, int interact) {
|
||||
apply_border(c);
|
||||
client_get_clip(c, &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;
|
||||
}
|
||||
// 如果不是工作区切换时划出去的窗口,就让动画的结束位置,就是上面的真实位置和大小
|
||||
|
||||
@@ -33,33 +33,33 @@ void init_baked_points(void) {
|
||||
baked_points_focus =
|
||||
calloc(BAKED_POINTS_COUNT, sizeof(*baked_points_focus));
|
||||
|
||||
for (uint32_t i = 0; i < BAKED_POINTS_COUNT; i++) {
|
||||
for (unsigned int i = 0; i < BAKED_POINTS_COUNT; i++) {
|
||||
baked_points_move[i] = calculate_animation_curve_at(
|
||||
(double)i / (BAKED_POINTS_COUNT - 1), MOVE);
|
||||
}
|
||||
for (uint32_t i = 0; i < BAKED_POINTS_COUNT; i++) {
|
||||
for (unsigned int i = 0; i < BAKED_POINTS_COUNT; i++) {
|
||||
baked_points_open[i] = calculate_animation_curve_at(
|
||||
(double)i / (BAKED_POINTS_COUNT - 1), OPEN);
|
||||
}
|
||||
for (uint32_t i = 0; i < BAKED_POINTS_COUNT; i++) {
|
||||
for (unsigned int i = 0; i < BAKED_POINTS_COUNT; i++) {
|
||||
baked_points_tag[i] = calculate_animation_curve_at(
|
||||
(double)i / (BAKED_POINTS_COUNT - 1), TAG);
|
||||
}
|
||||
for (uint32_t i = 0; i < BAKED_POINTS_COUNT; i++) {
|
||||
for (unsigned int i = 0; i < BAKED_POINTS_COUNT; i++) {
|
||||
baked_points_close[i] = calculate_animation_curve_at(
|
||||
(double)i / (BAKED_POINTS_COUNT - 1), CLOSE);
|
||||
}
|
||||
for (uint32_t i = 0; i < BAKED_POINTS_COUNT; i++) {
|
||||
for (unsigned int i = 0; i < BAKED_POINTS_COUNT; i++) {
|
||||
baked_points_focus[i] = calculate_animation_curve_at(
|
||||
(double)i / (BAKED_POINTS_COUNT - 1), FOCUS);
|
||||
}
|
||||
}
|
||||
|
||||
double find_animation_curve_at(double t, int type) {
|
||||
uint32_t down = 0;
|
||||
uint32_t up = BAKED_POINTS_COUNT - 1;
|
||||
unsigned int down = 0;
|
||||
unsigned int up = BAKED_POINTS_COUNT - 1;
|
||||
|
||||
uint32_t middle = (up + down) / 2;
|
||||
unsigned int middle = (up + down) / 2;
|
||||
struct dvec2 *baked_points;
|
||||
if (type == MOVE) {
|
||||
baked_points = baked_points_move;
|
||||
@@ -158,12 +158,6 @@ static bool scene_node_snapshot(struct wlr_scene_node *node, int lx, int ly,
|
||||
scene_buffer->corner_radius,
|
||||
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;
|
||||
|
||||
struct wlr_scene_surface *scene_surface =
|
||||
@@ -198,6 +192,8 @@ static bool scene_node_snapshot(struct wlr_scene_node *node, int lx, int ly,
|
||||
|
||||
break;
|
||||
}
|
||||
case WLR_SCENE_NODE_BLUR:
|
||||
break;
|
||||
case WLR_SCENE_NODE_OPTIMIZED_BLUR:
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
void layer_actual_size(LayerSurface *l, uint32_t *width, uint32_t *height) {
|
||||
void layer_actual_size(LayerSurface *l, unsigned int *width,
|
||||
unsigned int *height) {
|
||||
struct wlr_box box;
|
||||
|
||||
if (l->animation.running) {
|
||||
@@ -212,8 +213,9 @@ void layer_scene_buffer_apply_effect(struct wlr_scene_buffer *buffer, int sx,
|
||||
|
||||
struct wlr_surface *surface = scene_surface->surface;
|
||||
|
||||
uint32_t surface_width = surface->current.width * buffer_data->width_scale;
|
||||
uint32_t surface_height =
|
||||
unsigned int surface_width =
|
||||
surface->current.width * buffer_data->width_scale;
|
||||
unsigned int surface_height =
|
||||
surface->current.height * buffer_data->height_scale;
|
||||
|
||||
if (surface_height > 0 && surface_width > 0) {
|
||||
@@ -243,16 +245,17 @@ void fadeout_layer_animation_next_tick(LayerSurface *l) {
|
||||
|
||||
int type = l->animation.action = l->animation.action;
|
||||
double factor = find_animation_curve_at(animation_passed, type);
|
||||
uint32_t width = l->animation.initial.width +
|
||||
(l->current.width - l->animation.initial.width) * factor;
|
||||
uint32_t height =
|
||||
unsigned int width =
|
||||
l->animation.initial.width +
|
||||
(l->current.width - l->animation.initial.width) * factor;
|
||||
unsigned int height =
|
||||
l->animation.initial.height +
|
||||
(l->current.height - l->animation.initial.height) * factor;
|
||||
|
||||
uint32_t x = l->animation.initial.x +
|
||||
(l->current.x - l->animation.initial.x) * factor;
|
||||
uint32_t y = l->animation.initial.y +
|
||||
(l->current.y - l->animation.initial.y) * factor;
|
||||
unsigned int x = l->animation.initial.x +
|
||||
(l->current.x - l->animation.initial.x) * factor;
|
||||
unsigned int y = l->animation.initial.y +
|
||||
(l->current.y - l->animation.initial.y) * factor;
|
||||
|
||||
wlr_scene_node_set_position(&l->scene->node, x, y);
|
||||
|
||||
@@ -307,16 +310,17 @@ void layer_animation_next_tick(LayerSurface *l) {
|
||||
int type = l->animation.action == NONE ? MOVE : l->animation.action;
|
||||
double factor = find_animation_curve_at(animation_passed, type);
|
||||
|
||||
uint32_t width = l->animation.initial.width +
|
||||
(l->current.width - l->animation.initial.width) * factor;
|
||||
uint32_t height =
|
||||
unsigned int width =
|
||||
l->animation.initial.width +
|
||||
(l->current.width - l->animation.initial.width) * factor;
|
||||
unsigned int height =
|
||||
l->animation.initial.height +
|
||||
(l->current.height - l->animation.initial.height) * factor;
|
||||
|
||||
uint32_t x = l->animation.initial.x +
|
||||
(l->current.x - l->animation.initial.x) * factor;
|
||||
uint32_t y = l->animation.initial.y +
|
||||
(l->current.y - l->animation.initial.y) * factor;
|
||||
unsigned int x = l->animation.initial.x +
|
||||
(l->current.x - l->animation.initial.x) * factor;
|
||||
unsigned int y = l->animation.initial.y +
|
||||
(l->current.y - l->animation.initial.y) * factor;
|
||||
|
||||
double opacity = MIN(fadein_begin_opacity +
|
||||
animation_passed * (1.0 - fadein_begin_opacity),
|
||||
@@ -352,6 +356,10 @@ void layer_animation_next_tick(LayerSurface *l) {
|
||||
.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) {
|
||||
l->animation.running = false;
|
||||
l->need_output_flush = false;
|
||||
|
||||
@@ -153,6 +153,20 @@ static inline void client_get_geometry(Client *c, struct wlr_box *geom) {
|
||||
*geom = c->surface.xdg->geometry;
|
||||
}
|
||||
|
||||
static inline Client *get_client_from_surface(struct wlr_surface *surface) {
|
||||
if (!surface)
|
||||
return NULL;
|
||||
|
||||
// 从 surface 的 data 指针获取 scene tree
|
||||
struct wlr_scene_tree *scene_tree = surface->data;
|
||||
if (!scene_tree)
|
||||
return NULL;
|
||||
|
||||
// 从 scene tree 的 node data 获取 Client
|
||||
Client *c = scene_tree->node.data;
|
||||
return c;
|
||||
}
|
||||
|
||||
static inline Client *client_get_parent(Client *c) {
|
||||
Client *p = NULL;
|
||||
#ifdef XWAYLAND
|
||||
@@ -512,16 +526,16 @@ static inline void client_set_size_bound(Client *c) {
|
||||
if (!size_hints)
|
||||
return;
|
||||
|
||||
if ((uint32_t)c->geom.width - 2 * c->bw < size_hints->min_width &&
|
||||
if ((unsigned int)c->geom.width - 2 * c->bw < size_hints->min_width &&
|
||||
size_hints->min_width > 0)
|
||||
c->geom.width = size_hints->min_width + 2 * c->bw;
|
||||
if ((uint32_t)c->geom.height - 2 * c->bw < size_hints->min_height &&
|
||||
if ((unsigned int)c->geom.height - 2 * c->bw < size_hints->min_height &&
|
||||
size_hints->min_height > 0)
|
||||
c->geom.height = size_hints->min_height + 2 * c->bw;
|
||||
if ((uint32_t)c->geom.width - 2 * c->bw > size_hints->max_width &&
|
||||
if ((unsigned int)c->geom.width - 2 * c->bw > size_hints->max_width &&
|
||||
size_hints->max_width > 0)
|
||||
c->geom.width = size_hints->max_width + 2 * c->bw;
|
||||
if ((uint32_t)c->geom.height - 2 * c->bw > size_hints->max_height &&
|
||||
if ((unsigned int)c->geom.height - 2 * c->bw > size_hints->max_height &&
|
||||
size_hints->max_height > 0)
|
||||
c->geom.height = size_hints->max_height + 2 * c->bw;
|
||||
return;
|
||||
@@ -530,19 +544,19 @@ static inline void client_set_size_bound(Client *c) {
|
||||
|
||||
toplevel = c->surface.xdg->toplevel;
|
||||
state = toplevel->current;
|
||||
if ((uint32_t)c->geom.width - 2 * c->bw < state.min_width &&
|
||||
if ((unsigned int)c->geom.width - 2 * c->bw < state.min_width &&
|
||||
state.min_width > 0) {
|
||||
c->geom.width = state.min_width + 2 * c->bw;
|
||||
}
|
||||
if ((uint32_t)c->geom.height - 2 * c->bw < state.min_height &&
|
||||
if ((unsigned int)c->geom.height - 2 * c->bw < state.min_height &&
|
||||
state.min_height > 0) {
|
||||
c->geom.height = state.min_height + 2 * c->bw;
|
||||
}
|
||||
if ((uint32_t)c->geom.width - 2 * c->bw > state.max_width &&
|
||||
if ((unsigned int)c->geom.width - 2 * c->bw > state.max_width &&
|
||||
state.max_width > 0) {
|
||||
c->geom.width = state.max_width + 2 * c->bw;
|
||||
}
|
||||
if ((uint32_t)c->geom.height - 2 * c->bw > state.max_height &&
|
||||
if ((unsigned int)c->geom.height - 2 * c->bw > state.max_height &&
|
||||
state.max_height > 0) {
|
||||
c->geom.height = state.max_height + 2 * c->bw;
|
||||
}
|
||||
|
||||
@@ -82,13 +82,14 @@ void wl_list_append(struct wl_list *list, struct wl_list *object) {
|
||||
wl_list_insert(list->prev, object);
|
||||
}
|
||||
|
||||
uint32_t get_now_in_ms(void) {
|
||||
unsigned int get_now_in_ms(void) {
|
||||
struct timespec now;
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
|
||||
return timespec_to_ms(&now);
|
||||
}
|
||||
|
||||
uint32_t timespec_to_ms(struct timespec *ts) {
|
||||
return (uint32_t)ts->tv_sec * 1000 + (uint32_t)ts->tv_nsec / 1000000;
|
||||
unsigned int timespec_to_ms(struct timespec *ts) {
|
||||
return (unsigned int)ts->tv_sec * 1000 +
|
||||
(unsigned int)ts->tv_nsec / 1000000;
|
||||
}
|
||||
|
||||
@@ -6,5 +6,5 @@ void *ecalloc(size_t nmemb, size_t size);
|
||||
int fd_set_nonblock(int fd);
|
||||
int regex_match(const char *pattern_mb, const char *str_mb);
|
||||
void wl_list_append(struct wl_list *list, struct wl_list *object);
|
||||
uint32_t get_now_in_ms(void);
|
||||
uint32_t timespec_to_ms(struct timespec *ts);
|
||||
unsigned int get_now_in_ms(void);
|
||||
unsigned int timespec_to_ms(struct timespec *ts);
|
||||
@@ -1,5 +1,4 @@
|
||||
#include <ctype.h>
|
||||
#include <libgen.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
@@ -43,7 +42,6 @@ typedef struct {
|
||||
bool isdefaultmode;
|
||||
bool islockapply;
|
||||
bool isreleaseapply;
|
||||
bool ispassapply;
|
||||
} KeyBinding;
|
||||
|
||||
typedef struct {
|
||||
@@ -54,7 +52,7 @@ typedef struct {
|
||||
typedef struct {
|
||||
const char *id;
|
||||
const char *title;
|
||||
uint32_t tags;
|
||||
unsigned int tags;
|
||||
int isfloating;
|
||||
int isfullscreen;
|
||||
float scroller_proportion;
|
||||
@@ -126,29 +124,29 @@ KeyBinding default_key_bindings[] = {CHVT(1), CHVT(2), CHVT(3), CHVT(4),
|
||||
CHVT(9), CHVT(10), CHVT(11), CHVT(12)};
|
||||
|
||||
typedef struct {
|
||||
uint32_t mod;
|
||||
uint32_t button;
|
||||
unsigned int mod;
|
||||
unsigned int button;
|
||||
int (*func)(const Arg *);
|
||||
Arg arg;
|
||||
} MouseBinding;
|
||||
|
||||
typedef struct {
|
||||
uint32_t mod;
|
||||
uint32_t dir;
|
||||
unsigned int mod;
|
||||
unsigned int dir;
|
||||
int (*func)(const Arg *);
|
||||
Arg arg;
|
||||
} AxisBinding;
|
||||
|
||||
typedef struct {
|
||||
uint32_t fold;
|
||||
unsigned int fold;
|
||||
int (*func)(const Arg *);
|
||||
Arg arg;
|
||||
} SwitchBinding;
|
||||
|
||||
typedef struct {
|
||||
uint32_t mod;
|
||||
uint32_t motion;
|
||||
uint32_t fingers_count;
|
||||
unsigned int mod;
|
||||
unsigned int motion;
|
||||
unsigned int fingers_count;
|
||||
int (*func)(const Arg *);
|
||||
Arg arg;
|
||||
} GestureBinding;
|
||||
@@ -202,7 +200,6 @@ typedef struct {
|
||||
int scroller_focus_center;
|
||||
int scroller_prefer_center;
|
||||
int edge_scroller_pointer_focus;
|
||||
float dual_scroller_default_split_ratio;
|
||||
int focus_cross_monitor;
|
||||
int exchange_cross_monitor;
|
||||
int scratchpad_cross_monitor;
|
||||
@@ -213,7 +210,7 @@ typedef struct {
|
||||
int snap_distance;
|
||||
int enable_floating_snap;
|
||||
int drag_tile_to_tile;
|
||||
uint32_t swipe_min_threshold;
|
||||
unsigned int swipe_min_threshold;
|
||||
float focused_opacity;
|
||||
float unfocused_opacity;
|
||||
float *scroller_proportion_preset;
|
||||
@@ -222,21 +219,21 @@ typedef struct {
|
||||
char **circle_layout;
|
||||
int circle_layout_count;
|
||||
|
||||
uint32_t new_is_master;
|
||||
unsigned int new_is_master;
|
||||
float default_mfact;
|
||||
uint32_t default_nmaster;
|
||||
unsigned int default_nmaster;
|
||||
int center_master_overspread;
|
||||
int center_when_single_stack;
|
||||
|
||||
uint32_t hotarea_size;
|
||||
uint32_t enable_hotarea;
|
||||
uint32_t ov_tab_mode;
|
||||
unsigned int hotarea_size;
|
||||
unsigned int enable_hotarea;
|
||||
unsigned int ov_tab_mode;
|
||||
int overviewgappi;
|
||||
int overviewgappo;
|
||||
uint32_t cursor_hide_timeout;
|
||||
unsigned int cursor_hide_timeout;
|
||||
|
||||
uint32_t axis_bind_apply_timeout;
|
||||
uint32_t focus_on_activate;
|
||||
unsigned int axis_bind_apply_timeout;
|
||||
unsigned int focus_on_activate;
|
||||
int inhibit_regardless_of_visibility;
|
||||
int sloppyfocus;
|
||||
int warpcursor;
|
||||
@@ -244,7 +241,7 @@ typedef struct {
|
||||
/* keyboard */
|
||||
int repeat_rate;
|
||||
int repeat_delay;
|
||||
uint32_t numlockon;
|
||||
unsigned int numlockon;
|
||||
|
||||
/* Trackpad */
|
||||
int disable_trackpad;
|
||||
@@ -256,13 +253,13 @@ typedef struct {
|
||||
int disable_while_typing;
|
||||
int left_handed;
|
||||
int middle_button_emulation;
|
||||
uint32_t accel_profile;
|
||||
unsigned int accel_profile;
|
||||
double accel_speed;
|
||||
uint32_t scroll_method;
|
||||
uint32_t scroll_button;
|
||||
uint32_t click_method;
|
||||
uint32_t send_events_mode;
|
||||
uint32_t button_map;
|
||||
unsigned int scroll_method;
|
||||
unsigned int scroll_button;
|
||||
unsigned int click_method;
|
||||
unsigned int send_events_mode;
|
||||
unsigned int button_map;
|
||||
|
||||
int blur;
|
||||
int blur_layer;
|
||||
@@ -272,18 +269,18 @@ typedef struct {
|
||||
int shadows;
|
||||
int shadow_only_floating;
|
||||
int layer_shadows;
|
||||
uint32_t shadows_size;
|
||||
unsigned int shadows_size;
|
||||
float shadows_blur;
|
||||
int shadows_position_x;
|
||||
int shadows_position_y;
|
||||
float shadowscolor[4];
|
||||
|
||||
int smartgaps;
|
||||
uint32_t gappih;
|
||||
uint32_t gappiv;
|
||||
uint32_t gappoh;
|
||||
uint32_t gappov;
|
||||
uint32_t borderpx;
|
||||
unsigned int gappih;
|
||||
unsigned int gappiv;
|
||||
unsigned int gappoh;
|
||||
unsigned int gappov;
|
||||
unsigned int borderpx;
|
||||
float scratchpad_width_ratio;
|
||||
float scratchpad_height_ratio;
|
||||
float rootcolor[4];
|
||||
@@ -334,7 +331,7 @@ typedef struct {
|
||||
int exec_once_count;
|
||||
|
||||
char *cursor_theme;
|
||||
uint32_t cursor_size;
|
||||
unsigned int cursor_size;
|
||||
|
||||
int single_scratchpad;
|
||||
int xwayland_persistence;
|
||||
@@ -342,7 +339,6 @@ typedef struct {
|
||||
int adaptive_sync;
|
||||
int allow_tearing;
|
||||
int allow_shortcuts_inhibit;
|
||||
int allow_lock_transparent;
|
||||
|
||||
struct xkb_rule_names xkb_rules;
|
||||
|
||||
@@ -445,9 +441,6 @@ void parse_bind_flags(const char *str, KeyBinding *kb) {
|
||||
case 'r':
|
||||
kb->isreleaseapply = true;
|
||||
break;
|
||||
case 'p':
|
||||
kb->ispassapply = true;
|
||||
break;
|
||||
default:
|
||||
// 忽略其他字符或可根据需要处理错误
|
||||
break;
|
||||
@@ -795,7 +788,7 @@ void convert_hex_to_rgba(float *color, unsigned long int hex) {
|
||||
color[3] = (hex & 0xFF) / 255.0f;
|
||||
}
|
||||
|
||||
uint32_t parse_num_type(char *str) {
|
||||
unsigned int parse_num_type(char *str) {
|
||||
switch (str[0]) {
|
||||
case '-':
|
||||
return NUM_TYPE_MINUS;
|
||||
@@ -829,9 +822,6 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value,
|
||||
} else if (strcmp(func_name, "setmfact") == 0) {
|
||||
func = setmfact;
|
||||
(*arg).f = atof(arg_value);
|
||||
} else if (strcmp(func_name, "adjust_dual_scroller_split") == 0) {
|
||||
func = adjust_dual_scroller_split;
|
||||
(*arg).f = atof(arg_value);
|
||||
} else if (strcmp(func_name, "zoom") == 0) {
|
||||
func = zoom;
|
||||
} else if (strcmp(func_name, "exchange_client") == 0) {
|
||||
@@ -999,31 +989,7 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value,
|
||||
(*arg).i = atoi(arg_value2);
|
||||
} else if (strcmp(func_name, "view") == 0) {
|
||||
func = bind_to_view;
|
||||
|
||||
uint32_t mask = 0;
|
||||
char *token;
|
||||
char *arg_copy = strdup(arg_value);
|
||||
|
||||
if (arg_copy != NULL) {
|
||||
char *saveptr = NULL;
|
||||
token = strtok_r(arg_copy, "|", &saveptr);
|
||||
|
||||
while (token != NULL) {
|
||||
int num = atoi(token);
|
||||
if (num > 0 && num <= LENGTH(tags)) {
|
||||
mask |= (1 << (num - 1));
|
||||
}
|
||||
token = strtok_r(NULL, "|", &saveptr);
|
||||
}
|
||||
|
||||
free(arg_copy);
|
||||
}
|
||||
|
||||
if (mask) {
|
||||
(*arg).ui = mask;
|
||||
} else {
|
||||
(*arg).ui = atoi(arg_value);
|
||||
}
|
||||
(*arg).ui = 1 << (atoi(arg_value) - 1);
|
||||
(*arg).i = atoi(arg_value2);
|
||||
} else if (strcmp(func_name, "viewcrossmon") == 0) {
|
||||
func = viewcrossmon;
|
||||
@@ -1201,8 +1167,6 @@ void parse_option(Config *config, char *key, char *value) {
|
||||
config->scroller_prefer_center = atoi(value);
|
||||
} else if (strcmp(key, "edge_scroller_pointer_focus") == 0) {
|
||||
config->edge_scroller_pointer_focus = atoi(value);
|
||||
} else if (strcmp(key, "dual_scroller_default_split_ratio") == 0) {
|
||||
config->dual_scroller_default_split_ratio = atof(value);
|
||||
} else if (strcmp(key, "focus_cross_monitor") == 0) {
|
||||
config->focus_cross_monitor = atoi(value);
|
||||
} else if (strcmp(key, "exchange_cross_monitor") == 0) {
|
||||
@@ -1259,8 +1223,6 @@ void parse_option(Config *config, char *key, char *value) {
|
||||
config->allow_tearing = atoi(value);
|
||||
} else if (strcmp(key, "allow_shortcuts_inhibit") == 0) {
|
||||
config->allow_shortcuts_inhibit = atoi(value);
|
||||
} else if (strcmp(key, "allow_lock_transparent") == 0) {
|
||||
config->allow_lock_transparent = atoi(value);
|
||||
} else if (strcmp(key, "no_border_when_single") == 0) {
|
||||
config->no_border_when_single = atoi(value);
|
||||
} else if (strcmp(key, "no_radius_when_single") == 0) {
|
||||
@@ -1968,7 +1930,7 @@ void parse_option(Config *config, char *key, char *value) {
|
||||
|
||||
config->exec_once_count++;
|
||||
|
||||
} else if (regex_match("^bind[s|l|r|p]*$", key)) {
|
||||
} else if (regex_match("^bind[s|l|r]*$", key)) {
|
||||
config->key_bindings =
|
||||
realloc(config->key_bindings,
|
||||
(config->key_bindings_count + 1) * sizeof(KeyBinding));
|
||||
@@ -2314,55 +2276,35 @@ void parse_config_line(Config *config, const char *line) {
|
||||
|
||||
void parse_config_file(Config *config, const char *file_path) {
|
||||
FILE *file;
|
||||
char full_path[1024];
|
||||
|
||||
if (file_path[0] == '.' && file_path[1] == '/') {
|
||||
// Relative path
|
||||
|
||||
if (cli_config_path) {
|
||||
char *config_path = strdup(cli_config_path);
|
||||
char *config_dir = dirname(config_path);
|
||||
snprintf(full_path, sizeof(full_path), "%s/%s", config_dir,
|
||||
file_path + 1);
|
||||
free(config_path);
|
||||
} else {
|
||||
const char *home = getenv("HOME");
|
||||
if (!home) {
|
||||
fprintf(stderr, "Error: HOME environment variable not set.\n");
|
||||
return;
|
||||
}
|
||||
snprintf(full_path, sizeof(full_path), "%s/.config/mango/%s", home,
|
||||
file_path + 1);
|
||||
}
|
||||
file = fopen(full_path, "r");
|
||||
|
||||
} else if (file_path[0] == '~' &&
|
||||
(file_path[1] == '/' || file_path[1] == '\0')) {
|
||||
// Home directory
|
||||
|
||||
// 检查路径是否以 ~/ 开头
|
||||
if (file_path[0] == '~' && (file_path[1] == '/' || file_path[1] == '\0')) {
|
||||
const char *home = getenv("HOME");
|
||||
if (!home) {
|
||||
fprintf(stderr, "Error: HOME environment variable not set.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// 构建完整路径(家目录 + / + 原路径去掉 ~)
|
||||
char full_path[1024];
|
||||
snprintf(full_path, sizeof(full_path), "%s%s", home, file_path + 1);
|
||||
|
||||
file = fopen(full_path, "r");
|
||||
|
||||
if (!file) {
|
||||
perror("Error opening file");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// Absolute path
|
||||
file = fopen(file_path, "r");
|
||||
}
|
||||
|
||||
if (!file) {
|
||||
perror("Error opening file");
|
||||
return;
|
||||
if (!file) {
|
||||
perror("Error opening file");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
char line[512];
|
||||
while (fgets(line, sizeof(line), file)) {
|
||||
if (line[0] == '#' || line[0] == '\n') {
|
||||
if (line[0] == '#' || line[0] == '\n')
|
||||
continue;
|
||||
}
|
||||
parse_config_line(config, line);
|
||||
}
|
||||
|
||||
@@ -2692,8 +2634,6 @@ void override_config(void) {
|
||||
edge_scroller_pointer_focus =
|
||||
CLAMP_INT(config.edge_scroller_pointer_focus, 0, 1);
|
||||
scroller_structs = CLAMP_INT(config.scroller_structs, 0, 1000);
|
||||
dual_scroller_default_split_ratio =
|
||||
CLAMP_FLOAT(config.dual_scroller_default_split_ratio, 0.1f, 0.9f);
|
||||
|
||||
// 主从布局设置
|
||||
default_mfact = CLAMP_FLOAT(config.default_mfact, 0.1f, 0.9f);
|
||||
@@ -2715,7 +2655,6 @@ void override_config(void) {
|
||||
adaptive_sync = CLAMP_INT(config.adaptive_sync, 0, 1);
|
||||
allow_tearing = CLAMP_INT(config.allow_tearing, 0, 2);
|
||||
allow_shortcuts_inhibit = CLAMP_INT(config.allow_shortcuts_inhibit, 0, 1);
|
||||
allow_lock_transparent = CLAMP_INT(config.allow_lock_transparent, 0, 1);
|
||||
axis_bind_apply_timeout =
|
||||
CLAMP_INT(config.axis_bind_apply_timeout, 0, 1000);
|
||||
focus_on_activate = CLAMP_INT(config.focus_on_activate, 0, 1);
|
||||
@@ -2883,7 +2822,6 @@ void set_value_default() {
|
||||
config.scroller_focus_center = scroller_focus_center;
|
||||
config.scroller_prefer_center = scroller_prefer_center;
|
||||
config.edge_scroller_pointer_focus = edge_scroller_pointer_focus;
|
||||
config.dual_scroller_default_split_ratio = dual_scroller_default_split_ratio;
|
||||
config.focus_cross_monitor = focus_cross_monitor;
|
||||
config.exchange_cross_monitor = exchange_cross_monitor;
|
||||
config.scratchpad_cross_monitor = scratchpad_cross_monitor;
|
||||
@@ -2895,7 +2833,6 @@ void set_value_default() {
|
||||
config.adaptive_sync = adaptive_sync;
|
||||
config.allow_tearing = allow_tearing;
|
||||
config.allow_shortcuts_inhibit = allow_shortcuts_inhibit;
|
||||
config.allow_lock_transparent = allow_lock_transparent;
|
||||
config.no_border_when_single = no_border_when_single;
|
||||
config.no_radius_when_single = no_radius_when_single;
|
||||
config.snap_distance = snap_distance;
|
||||
@@ -3054,9 +2991,11 @@ void parse_config(void) {
|
||||
|
||||
create_config_keymap();
|
||||
|
||||
if (cli_config_path) {
|
||||
snprintf(filename, sizeof(filename), "%s", cli_config_path);
|
||||
} else {
|
||||
// 获取 MANGOCONFIG 环境变量
|
||||
const char *mangoconfig = getenv("MANGOCONFIG");
|
||||
|
||||
// 如果 MANGOCONFIG 环境变量不存在或为空,则使用 HOME 环境变量
|
||||
if (!mangoconfig || mangoconfig[0] == '\0') {
|
||||
// 获取当前用户家目录
|
||||
const char *homedir = getenv("HOME");
|
||||
if (!homedir) {
|
||||
@@ -3073,6 +3012,9 @@ void parse_config(void) {
|
||||
snprintf(filename, sizeof(filename), "%s/mango/config.conf",
|
||||
SYSCONFDIR);
|
||||
}
|
||||
} else {
|
||||
// 使用 MANGOCONFIG 环境变量作为配置文件夹路径
|
||||
snprintf(filename, sizeof(filename), "%s/config.conf", mangoconfig);
|
||||
}
|
||||
|
||||
set_value_default();
|
||||
@@ -3170,12 +3112,6 @@ 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) {
|
||||
Client *c = NULL;
|
||||
|
||||
@@ -3277,7 +3213,6 @@ void reset_option(void) {
|
||||
set_env();
|
||||
run_exec();
|
||||
|
||||
reapply_cursor_style();
|
||||
reapply_border();
|
||||
reapply_keyboard();
|
||||
reapply_pointer();
|
||||
|
||||
@@ -33,27 +33,27 @@ double animation_curve_close[4] = {0.46, 1.0, 0.29, 0.99}; // 动画曲线
|
||||
double animation_curve_focus[4] = {0.46, 1.0, 0.29, 0.99}; // 动画曲线
|
||||
|
||||
/* appearance */
|
||||
uint32_t axis_bind_apply_timeout = 100; // 滚轮绑定动作的触发的时间间隔
|
||||
uint32_t focus_on_activate = 1; // 收到窗口激活请求是否自动跳转聚焦
|
||||
uint32_t new_is_master = 1; // 新窗口是否插在头部
|
||||
double default_mfact = 0.55f; // master 窗口比例
|
||||
uint32_t default_nmaster = 1; // 默认master数量
|
||||
int center_master_overspread = 0; // 中心master时是否铺满
|
||||
int center_when_single_stack = 1; // 单个stack时是否居中
|
||||
unsigned int axis_bind_apply_timeout = 100; // 滚轮绑定动作的触发的时间间隔
|
||||
unsigned int focus_on_activate = 1; // 收到窗口激活请求是否自动跳转聚焦
|
||||
unsigned int new_is_master = 1; // 新窗口是否插在头部
|
||||
double default_mfact = 0.55f; // master 窗口比例
|
||||
unsigned int default_nmaster = 1; // 默认master数量
|
||||
int center_master_overspread = 0; // 中心master时是否铺满
|
||||
int center_when_single_stack = 1; // 单个stack时是否居中
|
||||
/* logging */
|
||||
int log_level = WLR_ERROR;
|
||||
uint32_t numlockon = 0; // 是否打开右边小键盘
|
||||
uint32_t capslock = 0; // 是否启用快捷键
|
||||
unsigned int numlockon = 0; // 是否打开右边小键盘
|
||||
unsigned int capslock = 0; // 是否启用快捷键
|
||||
|
||||
uint32_t ov_tab_mode = 0; // alt tab切换模式
|
||||
uint32_t hotarea_size = 10; // 热区大小,10x10
|
||||
uint32_t enable_hotarea = 1; // 是否启用鼠标热区
|
||||
int smartgaps = 0; /* 1 means no outer gap when there is only one window */
|
||||
int sloppyfocus = 1; /* focus follows mouse */
|
||||
uint32_t gappih = 5; /* horiz inner gap between windows */
|
||||
uint32_t gappiv = 5; /* vert inner gap between windows */
|
||||
uint32_t gappoh = 10; /* horiz outer gap between windows and screen edge */
|
||||
uint32_t gappov = 10; /* vert outer gap between windows and screen edge */
|
||||
unsigned int ov_tab_mode = 0; // alt tab切换模式
|
||||
unsigned int hotarea_size = 10; // 热区大小,10x10
|
||||
unsigned int enable_hotarea = 1; // 是否启用鼠标热区
|
||||
int smartgaps = 0; /* 1 means no outer gap when there is only one window */
|
||||
int sloppyfocus = 1; /* focus follows mouse */
|
||||
unsigned int gappih = 5; /* horiz inner gap between windows */
|
||||
unsigned int gappiv = 5; /* vert inner gap between windows */
|
||||
unsigned int gappoh = 10; /* horiz outer gap between windows and screen edge */
|
||||
unsigned int gappov = 10; /* vert outer gap between windows and screen edge */
|
||||
float scratchpad_width_ratio = 0.8;
|
||||
float scratchpad_height_ratio = 0.9;
|
||||
|
||||
@@ -63,7 +63,6 @@ float scroller_default_proportion_single = 1.0;
|
||||
int scroller_ignore_proportion_single = 0;
|
||||
int scroller_focus_center = 0;
|
||||
int scroller_prefer_center = 0;
|
||||
float dual_scroller_default_split_ratio = 0.3;
|
||||
int focus_cross_monitor = 0;
|
||||
int focus_cross_tag = 0;
|
||||
int exchange_cross_monitor = 0;
|
||||
@@ -74,15 +73,15 @@ int no_radius_when_single = 0;
|
||||
int snap_distance = 30;
|
||||
int enable_floating_snap = 0;
|
||||
int drag_tile_to_tile = 0;
|
||||
uint32_t cursor_size = 24;
|
||||
uint32_t cursor_hide_timeout = 0;
|
||||
unsigned int cursor_size = 24;
|
||||
unsigned int cursor_hide_timeout = 0;
|
||||
|
||||
uint32_t swipe_min_threshold = 1;
|
||||
unsigned int swipe_min_threshold = 1;
|
||||
|
||||
int inhibit_regardless_of_visibility =
|
||||
0; /* 1 means idle inhibitors will disable idle tracking even if it's
|
||||
surface isn't visible */
|
||||
uint32_t borderpx = 4; /* border pixel of windows */
|
||||
unsigned int borderpx = 4; /* border pixel of windows */
|
||||
float rootcolor[] = COLOR(0x323232ff);
|
||||
float bordercolor[] = COLOR(0x444444ff);
|
||||
float focuscolor[] = COLOR(0xc66b25ff);
|
||||
@@ -104,7 +103,6 @@ int warpcursor = 1; /* Warp cursor to focused client */
|
||||
int xwayland_persistence = 1; /* xwayland persistence */
|
||||
int syncobj_enable = 0;
|
||||
int adaptive_sync = 0;
|
||||
int allow_lock_transparent = 0;
|
||||
double drag_refresh_interval = 30.0;
|
||||
int allow_tearing = TEARING_DISABLED;
|
||||
int allow_shortcuts_inhibit = SHORTCUTS_INHIBIT_ENABLE;
|
||||
@@ -167,7 +165,7 @@ LIBINPUT_CONFIG_SCROLL_EDGE
|
||||
LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN
|
||||
*/
|
||||
enum libinput_config_scroll_method scroll_method = LIBINPUT_CONFIG_SCROLL_2FG;
|
||||
uint32_t scroll_button = 274;
|
||||
unsigned int scroll_button = 274;
|
||||
|
||||
/* You can choose between:
|
||||
LIBINPUT_CONFIG_CLICK_METHOD_NONE
|
||||
@@ -225,7 +223,7 @@ float blur_params_saturation = 1.2;
|
||||
int shadows = 0;
|
||||
int shadow_only_floating = 1;
|
||||
int layer_shadows = 0;
|
||||
uint32_t shadows_size = 10;
|
||||
unsigned int shadows_size = 10;
|
||||
double shadows_blur = 15;
|
||||
int shadows_position_x = 0;
|
||||
int shadows_position_y = 0;
|
||||
|
||||
@@ -29,7 +29,6 @@ int switch_keyboard_layout(const Arg *arg);
|
||||
int setlayout(const Arg *arg);
|
||||
int switch_layout(const Arg *arg);
|
||||
int setmfact(const Arg *arg);
|
||||
int adjust_dual_scroller_split(const Arg *arg);
|
||||
int quit(const Arg *arg);
|
||||
int moveresize(const Arg *arg);
|
||||
int exchange_client(const Arg *arg);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
int bind_to_view(const Arg *arg) {
|
||||
|
||||
uint32_t target = arg->ui;
|
||||
unsigned int target = arg->ui;
|
||||
|
||||
if (view_current_to_back && selmon->pertag->curtag &&
|
||||
(target & TAGMASK) == (selmon->tagset[selmon->seltags])) {
|
||||
@@ -80,12 +80,8 @@ int defaultgaps(const Arg *arg) {
|
||||
|
||||
int exchange_client(const Arg *arg) {
|
||||
Client *c = selmon->sel;
|
||||
if (!c || c->isfloating)
|
||||
if (!c || c->isfloating || c->isfullscreen || c->ismaximizescreen)
|
||||
return 0;
|
||||
|
||||
if ((c->isfullscreen || c->ismaximizescreen) && !is_scroller_layout(c->mon))
|
||||
return 0;
|
||||
|
||||
exchange_two_client(c, direction_select(arg));
|
||||
return 0;
|
||||
}
|
||||
@@ -153,10 +149,10 @@ int focuslast(const Arg *arg) {
|
||||
Client *c = NULL;
|
||||
Client *tc = NULL;
|
||||
bool begin = false;
|
||||
uint32_t target = 0;
|
||||
unsigned int target = 0;
|
||||
|
||||
wl_list_for_each(c, &fstack, flink) {
|
||||
if (c->iskilling || c->isminimized || c->isunglobal ||
|
||||
if (c->iskilling || c->isminied || c->isunglobal ||
|
||||
!client_surface(c)->mapped || client_is_unmanaged(c) ||
|
||||
client_is_x11_popup(c))
|
||||
continue;
|
||||
@@ -194,7 +190,7 @@ int toggle_trackpad_enable(const Arg *arg) {
|
||||
}
|
||||
|
||||
int focusmon(const Arg *arg) {
|
||||
Client *c = NULL;
|
||||
Client *c = NULL, *old_selmon_sel = NULL;
|
||||
Monitor *m = NULL;
|
||||
|
||||
if (arg->i != UNDIR) {
|
||||
@@ -215,6 +211,7 @@ int focusmon(const Arg *arg) {
|
||||
if (!m || !m->wlr_output->enabled || m == selmon)
|
||||
return 0;
|
||||
|
||||
old_selmon_sel = selmon->sel;
|
||||
selmon = m;
|
||||
if (warpcursor) {
|
||||
warp_cursor_to_selmon(selmon);
|
||||
@@ -224,10 +221,12 @@ int focusmon(const Arg *arg) {
|
||||
selmon->sel = NULL;
|
||||
wlr_seat_pointer_notify_clear_focus(seat);
|
||||
wlr_seat_keyboard_notify_clear_focus(seat);
|
||||
focusclient(NULL, 0);
|
||||
} else
|
||||
focusclient(c, 1);
|
||||
|
||||
if (old_selmon_sel) {
|
||||
client_set_unfocused_opacity_animation(old_selmon_sel);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -327,28 +326,6 @@ int setmfact(const Arg *arg) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int adjust_dual_scroller_split(const Arg *arg) {
|
||||
float new_ratio;
|
||||
|
||||
if (!arg || !selmon)
|
||||
return 0;
|
||||
|
||||
// Check if we're in a dual-scroller layout
|
||||
if (!is_row_layout(selmon))
|
||||
return 0;
|
||||
|
||||
// Calculate new ratio: if arg->f < 1.0, treat as relative adjustment, otherwise as absolute value
|
||||
new_ratio = arg->f < 1.0 ? dual_scroller_default_split_ratio + arg->f : arg->f - 1.0;
|
||||
|
||||
// Clamp the ratio between 0.1 and 0.9
|
||||
if (new_ratio < 0.1 || new_ratio > 0.9)
|
||||
return 0;
|
||||
|
||||
dual_scroller_default_split_ratio = new_ratio;
|
||||
arrange(selmon, false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int killclient(const Arg *arg) {
|
||||
Client *c = NULL;
|
||||
c = selmon->sel;
|
||||
@@ -513,7 +490,7 @@ int restore_minimized(const Arg *arg) {
|
||||
|
||||
if (selmon && selmon->sel && selmon->sel->is_in_scratchpad &&
|
||||
selmon->sel->is_scratchpad_show) {
|
||||
selmon->sel->isminimized = 0;
|
||||
selmon->sel->isminied = 0;
|
||||
selmon->sel->is_scratchpad_show = 0;
|
||||
selmon->sel->is_in_scratchpad = 0;
|
||||
selmon->sel->isnamedscratchpad = 0;
|
||||
@@ -522,7 +499,7 @@ int restore_minimized(const Arg *arg) {
|
||||
}
|
||||
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
if (c->isminimized && !c->isnamedscratchpad) {
|
||||
if (c->isminied && !c->isnamedscratchpad) {
|
||||
c->is_scratchpad_show = 0;
|
||||
c->is_in_scratchpad = 0;
|
||||
c->isnamedscratchpad = 0;
|
||||
@@ -543,7 +520,7 @@ int setlayout(const Arg *arg) {
|
||||
for (jk = 0; jk < LENGTH(layouts); jk++) {
|
||||
if (strcmp(layouts[jk].name, arg->v) == 0) {
|
||||
selmon->pertag->ltidxs[selmon->pertag->curtag] = &layouts[jk];
|
||||
clear_fullscreen_and_maximized_state(selmon);
|
||||
|
||||
arrange(selmon, false);
|
||||
printstatus();
|
||||
return 0;
|
||||
@@ -573,7 +550,7 @@ int set_proportion(const Arg *arg) {
|
||||
return 0;
|
||||
|
||||
if (selmon->sel) {
|
||||
uint32_t max_client_width =
|
||||
unsigned int max_client_width =
|
||||
selmon->w.width - 2 * scroller_structs - gappih;
|
||||
selmon->sel->scroller_proportion = arg->f;
|
||||
selmon->sel->geom.width = max_client_width * arg->f;
|
||||
@@ -758,26 +735,14 @@ int centerwin(const Arg *arg) {
|
||||
Client *c = NULL;
|
||||
c = selmon->sel;
|
||||
|
||||
if (!c || c->isfullscreen || c->ismaximizescreen)
|
||||
if (!c || c->isfullscreen)
|
||||
return 0;
|
||||
if (!c->isfloating)
|
||||
setfloating(c, true);
|
||||
|
||||
if (c->isfloating) {
|
||||
c->float_geom = setclient_coordinate_center(c, c->geom, 0, 0);
|
||||
c->iscustomsize = 1;
|
||||
resize(c, c->float_geom, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!is_scroller_layout(selmon))
|
||||
return 0;
|
||||
|
||||
if (selmon->pertag->ltidxs[selmon->pertag->curtag]->id == SCROLLER) {
|
||||
c->geom.x = selmon->w.x + (selmon->w.width - c->geom.width) / 2;
|
||||
} else {
|
||||
c->geom.y = selmon->w.y + (selmon->w.height - c->geom.height) / 2;
|
||||
}
|
||||
|
||||
arrange(selmon, false);
|
||||
c->float_geom = setclient_coordinate_center(c, c->geom, 0, 0);
|
||||
c->iscustomsize = 1;
|
||||
resize(c, c->float_geom, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -891,9 +856,9 @@ int switch_keyboard_layout(const Arg *arg) {
|
||||
xkb_layout_index_t next = (current + 1) % num_layouts;
|
||||
|
||||
// 6. 应用新 keymap
|
||||
uint32_t depressed = keyboard->modifiers.depressed;
|
||||
uint32_t latched = keyboard->modifiers.latched;
|
||||
uint32_t locked = keyboard->modifiers.locked;
|
||||
unsigned int depressed = keyboard->modifiers.depressed;
|
||||
unsigned int latched = keyboard->modifiers.latched;
|
||||
unsigned int locked = keyboard->modifiers.locked;
|
||||
|
||||
wlr_keyboard_set_keymap(keyboard, keyboard->keymap);
|
||||
wlr_keyboard_notify_modifiers(keyboard, depressed, latched, locked, next);
|
||||
@@ -928,7 +893,7 @@ int switch_layout(const Arg *arg) {
|
||||
|
||||
int jk, ji;
|
||||
char *target_layout_name = NULL;
|
||||
uint32_t len;
|
||||
unsigned int len;
|
||||
|
||||
if (config.circle_layout_count != 0) {
|
||||
for (jk = 0; jk < config.circle_layout_count; jk++) {
|
||||
@@ -959,7 +924,7 @@ int switch_layout(const Arg *arg) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
clear_fullscreen_and_maximized_state(selmon);
|
||||
|
||||
arrange(selmon, false);
|
||||
printstatus();
|
||||
return 0;
|
||||
@@ -970,7 +935,6 @@ int switch_layout(const Arg *arg) {
|
||||
selmon->pertag->ltidxs[selmon->pertag->curtag]->name) == 0) {
|
||||
selmon->pertag->ltidxs[selmon->pertag->curtag] =
|
||||
jk == LENGTH(layouts) - 1 ? &layouts[0] : &layouts[jk + 1];
|
||||
clear_fullscreen_and_maximized_state(selmon);
|
||||
arrange(selmon, false);
|
||||
printstatus();
|
||||
return 0;
|
||||
@@ -1013,7 +977,7 @@ int switch_proportion_preset(const Arg *arg) {
|
||||
target_proportion = config.scroller_proportion_preset[0];
|
||||
}
|
||||
|
||||
uint32_t max_client_width =
|
||||
unsigned int max_client_width =
|
||||
selmon->w.width - 2 * scroller_structs - gappih;
|
||||
selmon->sel->scroller_proportion = target_proportion;
|
||||
selmon->sel->geom.width = max_client_width * target_proportion;
|
||||
@@ -1055,8 +1019,8 @@ int tagmon(const Arg *arg) {
|
||||
if (!m || !m->wlr_output->enabled)
|
||||
return 0;
|
||||
|
||||
uint32_t newtags = arg->ui ? arg->ui : arg->i2 ? c->tags : 0;
|
||||
uint32_t target;
|
||||
unsigned int newtags = arg->ui ? arg->ui : arg->i2 ? c->tags : 0;
|
||||
unsigned int target;
|
||||
|
||||
if (c->mon == m) {
|
||||
view(&(Arg){.ui = newtags}, true);
|
||||
@@ -1176,7 +1140,7 @@ int toggle_scratchpad(const Arg *arg) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (single_scratchpad && c->isnamedscratchpad && !c->isminimized) {
|
||||
if (single_scratchpad && c->isnamedscratchpad && !c->isminied) {
|
||||
set_minimized(c);
|
||||
continue;
|
||||
}
|
||||
@@ -1296,7 +1260,7 @@ int toggleoverlay(const Arg *arg) {
|
||||
}
|
||||
|
||||
int toggletag(const Arg *arg) {
|
||||
uint32_t newtags;
|
||||
unsigned int newtags;
|
||||
Client *sel = focustop(selmon);
|
||||
if (!sel)
|
||||
return 0;
|
||||
@@ -1319,8 +1283,8 @@ int toggletag(const Arg *arg) {
|
||||
}
|
||||
|
||||
int toggleview(const Arg *arg) {
|
||||
uint32_t newtagset;
|
||||
uint32_t target;
|
||||
unsigned int newtagset;
|
||||
unsigned int target;
|
||||
|
||||
target = arg->ui == 0 ? ~0 & TAGMASK : arg->ui;
|
||||
|
||||
@@ -1337,7 +1301,7 @@ int toggleview(const Arg *arg) {
|
||||
}
|
||||
|
||||
int viewtoleft(const Arg *arg) {
|
||||
uint32_t target = selmon->tagset[selmon->seltags];
|
||||
unsigned int target = selmon->tagset[selmon->seltags];
|
||||
|
||||
if (selmon->isoverview || selmon->pertag->curtag == 0) {
|
||||
return 0;
|
||||
@@ -1360,7 +1324,7 @@ int viewtoright(const Arg *arg) {
|
||||
if (selmon->isoverview || selmon->pertag->curtag == 0) {
|
||||
return 0;
|
||||
}
|
||||
uint32_t target = selmon->tagset[selmon->seltags];
|
||||
unsigned int target = selmon->tagset[selmon->seltags];
|
||||
target <<= 1;
|
||||
|
||||
if (!selmon || (target) == selmon->tagset[selmon->seltags])
|
||||
@@ -1374,8 +1338,9 @@ int viewtoright(const Arg *arg) {
|
||||
}
|
||||
|
||||
int viewtoleft_have_client(const Arg *arg) {
|
||||
uint32_t n;
|
||||
uint32_t current = get_tags_first_tag_num(selmon->tagset[selmon->seltags]);
|
||||
unsigned int n;
|
||||
unsigned int current =
|
||||
get_tags_first_tag_num(selmon->tagset[selmon->seltags]);
|
||||
bool found = false;
|
||||
|
||||
if (selmon->isoverview) {
|
||||
@@ -1398,8 +1363,9 @@ int viewtoleft_have_client(const Arg *arg) {
|
||||
}
|
||||
|
||||
int viewtoright_have_client(const Arg *arg) {
|
||||
uint32_t n;
|
||||
uint32_t current = get_tags_first_tag_num(selmon->tagset[selmon->seltags]);
|
||||
unsigned int n;
|
||||
unsigned int current =
|
||||
get_tags_first_tag_num(selmon->tagset[selmon->seltags]);
|
||||
bool found = false;
|
||||
|
||||
if (selmon->isoverview) {
|
||||
@@ -1436,7 +1402,7 @@ int tagcrossmon(const Arg *arg) {
|
||||
}
|
||||
|
||||
int comboview(const Arg *arg) {
|
||||
uint32_t newtags = arg->ui & TAGMASK;
|
||||
unsigned int newtags = arg->ui & TAGMASK;
|
||||
|
||||
if (!newtags || !selmon)
|
||||
return 0;
|
||||
@@ -1499,7 +1465,7 @@ int minimized(const Arg *arg) {
|
||||
if (selmon && selmon->isoverview)
|
||||
return 0;
|
||||
|
||||
if (selmon->sel && !selmon->sel->isminimized) {
|
||||
if (selmon->sel && !selmon->sel->isminied) {
|
||||
set_minimized(selmon->sel);
|
||||
}
|
||||
return 0;
|
||||
@@ -1514,14 +1480,14 @@ int toggleoverview(const Arg *arg) {
|
||||
}
|
||||
|
||||
selmon->isoverview ^= 1;
|
||||
uint32_t target;
|
||||
uint32_t visible_client_number = 0;
|
||||
unsigned int target;
|
||||
unsigned int visible_client_number = 0;
|
||||
|
||||
if (selmon->isoverview) {
|
||||
wl_list_for_each(c, &clients, link) if (c && c->mon == selmon &&
|
||||
!client_is_unmanaged(c) &&
|
||||
!client_is_x11_popup(c) &&
|
||||
!c->isminimized &&
|
||||
!c->isminied &&
|
||||
!c->isunglobal) {
|
||||
visible_client_number++;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
#include "dwl-ipc-unstable-v2-protocol.h"
|
||||
|
||||
static void dwl_ipc_manager_bind(struct wl_client *client, void *data,
|
||||
uint32_t version, uint32_t id);
|
||||
unsigned int version, unsigned int id);
|
||||
static void dwl_ipc_manager_destroy(struct wl_resource *resource);
|
||||
static void dwl_ipc_manager_get_output(struct wl_client *client,
|
||||
struct wl_resource *resource,
|
||||
uint32_t id, struct wl_resource *output);
|
||||
unsigned int id,
|
||||
struct wl_resource *output);
|
||||
static void dwl_ipc_manager_release(struct wl_client *client,
|
||||
struct wl_resource *resource);
|
||||
static void dwl_ipc_output_destroy(struct wl_resource *resource);
|
||||
@@ -13,14 +14,15 @@ static void dwl_ipc_output_printstatus(Monitor *monitor);
|
||||
static void dwl_ipc_output_printstatus_to(DwlIpcOutput *ipc_output);
|
||||
static void dwl_ipc_output_set_client_tags(struct wl_client *client,
|
||||
struct wl_resource *resource,
|
||||
uint32_t and_tags,
|
||||
uint32_t xor_tags);
|
||||
unsigned int and_tags,
|
||||
unsigned int xor_tags);
|
||||
static void dwl_ipc_output_set_layout(struct wl_client *client,
|
||||
struct wl_resource *resource,
|
||||
uint32_t index);
|
||||
unsigned int index);
|
||||
static void dwl_ipc_output_set_tags(struct wl_client *client,
|
||||
struct wl_resource *resource,
|
||||
uint32_t tagmask, uint32_t toggle_tagset);
|
||||
unsigned int tagmask,
|
||||
unsigned int toggle_tagset);
|
||||
static void dwl_ipc_output_quit(struct wl_client *client,
|
||||
struct wl_resource *resource);
|
||||
static void dwl_ipc_output_dispatch(struct wl_client *client,
|
||||
@@ -44,7 +46,7 @@ static struct zdwl_ipc_output_v2_interface dwl_output_implementation = {
|
||||
.set_client_tags = dwl_ipc_output_set_client_tags};
|
||||
|
||||
void dwl_ipc_manager_bind(struct wl_client *client, void *data,
|
||||
uint32_t version, uint32_t id) {
|
||||
unsigned int version, unsigned int id) {
|
||||
struct wl_resource *manager_resource =
|
||||
wl_resource_create(client, &zdwl_ipc_manager_v2_interface, version, id);
|
||||
if (!manager_resource) {
|
||||
@@ -57,7 +59,7 @@ void dwl_ipc_manager_bind(struct wl_client *client, void *data,
|
||||
|
||||
zdwl_ipc_manager_v2_send_tags(manager_resource, LENGTH(tags));
|
||||
|
||||
for (uint32_t i = 0; i < LENGTH(layouts); i++)
|
||||
for (unsigned int i = 0; i < LENGTH(layouts); i++)
|
||||
zdwl_ipc_manager_v2_send_layout(manager_resource, layouts[i].symbol);
|
||||
}
|
||||
|
||||
@@ -66,7 +68,7 @@ void dwl_ipc_manager_destroy(struct wl_resource *resource) {
|
||||
}
|
||||
|
||||
void dwl_ipc_manager_get_output(struct wl_client *client,
|
||||
struct wl_resource *resource, uint32_t id,
|
||||
struct wl_resource *resource, unsigned int id,
|
||||
struct wl_resource *output) {
|
||||
DwlIpcOutput *ipc_output;
|
||||
struct wlr_output *op = wlr_output_from_resource(output);
|
||||
@@ -99,14 +101,12 @@ static void dwl_ipc_output_destroy(struct wl_resource *resource) {
|
||||
free(ipc_output);
|
||||
}
|
||||
|
||||
// 修改IPC输出函数,接受掩码参数
|
||||
void dwl_ipc_output_printstatus(Monitor *monitor) {
|
||||
DwlIpcOutput *ipc_output;
|
||||
wl_list_for_each(ipc_output, &monitor->dwl_ipc_outputs, link)
|
||||
dwl_ipc_output_printstatus_to(ipc_output);
|
||||
}
|
||||
|
||||
// 修改主IPC输出函数,根据掩码发送相应事件
|
||||
void dwl_ipc_output_printstatus_to(DwlIpcOutput *ipc_output) {
|
||||
Monitor *monitor = ipc_output->mon;
|
||||
Client *c = NULL, *focused = NULL;
|
||||
@@ -216,11 +216,12 @@ void dwl_ipc_output_printstatus_to(DwlIpcOutput *ipc_output) {
|
||||
|
||||
void dwl_ipc_output_set_client_tags(struct wl_client *client,
|
||||
struct wl_resource *resource,
|
||||
uint32_t and_tags, uint32_t xor_tags) {
|
||||
unsigned int and_tags,
|
||||
unsigned int xor_tags) {
|
||||
DwlIpcOutput *ipc_output;
|
||||
Monitor *monitor = NULL;
|
||||
Client *selected_client = NULL;
|
||||
uint32_t newtags = 0;
|
||||
unsigned int newtags = 0;
|
||||
|
||||
ipc_output = wl_resource_get_user_data(resource);
|
||||
if (!ipc_output)
|
||||
@@ -243,7 +244,8 @@ void dwl_ipc_output_set_client_tags(struct wl_client *client,
|
||||
}
|
||||
|
||||
void dwl_ipc_output_set_layout(struct wl_client *client,
|
||||
struct wl_resource *resource, uint32_t index) {
|
||||
struct wl_resource *resource,
|
||||
unsigned int index) {
|
||||
DwlIpcOutput *ipc_output;
|
||||
Monitor *monitor = NULL;
|
||||
|
||||
@@ -256,17 +258,16 @@ void dwl_ipc_output_set_layout(struct wl_client *client,
|
||||
index = 0;
|
||||
|
||||
monitor->pertag->ltidxs[monitor->pertag->curtag] = &layouts[index];
|
||||
clear_fullscreen_and_maximized_state(monitor);
|
||||
arrange(monitor, false);
|
||||
printstatus();
|
||||
}
|
||||
|
||||
void dwl_ipc_output_set_tags(struct wl_client *client,
|
||||
struct wl_resource *resource, uint32_t tagmask,
|
||||
uint32_t toggle_tagset) {
|
||||
struct wl_resource *resource, unsigned int tagmask,
|
||||
unsigned int toggle_tagset) {
|
||||
DwlIpcOutput *ipc_output;
|
||||
Monitor *monitor = NULL;
|
||||
uint32_t newtags = tagmask & TAGMASK;
|
||||
unsigned int newtags = tagmask & TAGMASK;
|
||||
|
||||
ipc_output = wl_resource_get_user_data(resource);
|
||||
if (!ipc_output)
|
||||
|
||||
@@ -8,7 +8,7 @@ typedef struct Monitor Monitor;
|
||||
|
||||
struct workspace {
|
||||
struct wl_list link; // Link in global workspaces list
|
||||
uint32_t tag; // Numeric identifier (1-9, 0=overview)
|
||||
unsigned int tag; // Numeric identifier (1-9, 0=overview)
|
||||
Monitor *m; // Associated monitor
|
||||
struct wlr_ext_workspace_handle_v1 *ext_workspace; // Protocol object
|
||||
/* Event listeners */
|
||||
@@ -22,7 +22,7 @@ struct wlr_ext_workspace_manager_v1 *ext_manager;
|
||||
struct wl_list workspaces;
|
||||
|
||||
void goto_workspace(struct workspace *target) {
|
||||
uint32_t tag;
|
||||
unsigned int tag;
|
||||
tag = 1 << (target->tag - 1);
|
||||
if (target->tag == 0) {
|
||||
toggleoverview(&(Arg){.i = -1});
|
||||
@@ -33,7 +33,7 @@ void goto_workspace(struct workspace *target) {
|
||||
}
|
||||
|
||||
void toggle_workspace(struct workspace *target) {
|
||||
uint32_t tag;
|
||||
unsigned int tag;
|
||||
tag = 1 << (target->tag - 1);
|
||||
if (target->tag == 0) {
|
||||
toggleview(&(Arg){.i = -1});
|
||||
@@ -69,7 +69,7 @@ static void handle_ext_workspace_deactivate(struct wl_listener *listener,
|
||||
wlr_log(WLR_INFO, "ext deactivating workspace %d", workspace->tag);
|
||||
}
|
||||
|
||||
static const char *get_name_from_tag(uint32_t tag) {
|
||||
static const char *get_name_from_tag(unsigned int tag) {
|
||||
static const char *names[] = {"overview", "1", "2", "3", "4",
|
||||
"5", "6", "7", "8", "9"};
|
||||
return (tag < sizeof(names) / sizeof(names[0])) ? names[tag] : NULL;
|
||||
@@ -92,7 +92,7 @@ void cleanup_workspaces_by_monitor(Monitor *m) {
|
||||
}
|
||||
}
|
||||
|
||||
static void remove_workspace_by_tag(uint32_t tag, Monitor *m) {
|
||||
static void remove_workspace_by_tag(unsigned int tag, Monitor *m) {
|
||||
struct workspace *workspace, *tmp;
|
||||
wl_list_for_each_safe(workspace, tmp, &workspaces, link) {
|
||||
if (workspace->tag == tag && workspace->m == m) {
|
||||
@@ -127,7 +127,7 @@ static void add_workspace_by_tag(int tag, Monitor *m) {
|
||||
|
||||
void dwl_ext_workspace_printstatus(Monitor *m) {
|
||||
struct workspace *w;
|
||||
uint32_t tag_status = 0;
|
||||
unsigned int tag_status = 0;
|
||||
|
||||
wl_list_for_each(w, &workspaces, link) {
|
||||
if (w && w->m == m) {
|
||||
|
||||
@@ -4,12 +4,17 @@ static struct wlr_foreign_toplevel_manager_v1 *foreign_toplevel_manager;
|
||||
|
||||
void handle_foreign_activate_request(struct wl_listener *listener, void *data) {
|
||||
Client *c = wl_container_of(listener, c, foreign_activate_request);
|
||||
uint32_t target;
|
||||
unsigned int target;
|
||||
|
||||
if (c->swallowing)
|
||||
if (c && c->swallowing)
|
||||
return;
|
||||
|
||||
if (c->isminimized) {
|
||||
if (c && !c->isminied && c == selmon->sel) {
|
||||
set_minimized(c);
|
||||
return;
|
||||
}
|
||||
|
||||
if (c->isminied) {
|
||||
c->is_in_scratchpad = 0;
|
||||
c->isnamedscratchpad = 0;
|
||||
c->is_scratchpad_show = 0;
|
||||
@@ -22,82 +27,29 @@ void handle_foreign_activate_request(struct wl_listener *listener, void *data) {
|
||||
target = get_tags_first_tag(c->tags);
|
||||
view_in_mon(&(Arg){.ui = target}, true, c->mon, true);
|
||||
focusclient(c, 1);
|
||||
}
|
||||
|
||||
void handle_foreign_maximize_request(struct wl_listener *listener, void *data) {
|
||||
Client *c = wl_container_of(listener, c, foreign_maximize_request);
|
||||
struct wlr_foreign_toplevel_handle_v1_maximized_event *event = data;
|
||||
|
||||
if (c->swallowing)
|
||||
return;
|
||||
|
||||
if (c->ismaximizescreen && !event->maximized) {
|
||||
setmaximizescreen(c, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!c->ismaximizescreen && event->maximized) {
|
||||
setmaximizescreen(c, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void handle_foreign_minimize_request(struct wl_listener *listener, void *data) {
|
||||
Client *c = wl_container_of(listener, c, foreign_minimize_request);
|
||||
struct wlr_foreign_toplevel_handle_v1_minimized_event *event = data;
|
||||
|
||||
if (c->swallowing)
|
||||
return;
|
||||
|
||||
if (!c->isminimized && event->minimized) {
|
||||
set_minimized(c);
|
||||
return;
|
||||
}
|
||||
|
||||
if (c->isminimized && !event->minimized) {
|
||||
c->is_in_scratchpad = 0;
|
||||
c->isnamedscratchpad = 0;
|
||||
c->is_scratchpad_show = 0;
|
||||
setborder_color(c);
|
||||
show_hide_client(c);
|
||||
arrange(c->mon, true);
|
||||
return;
|
||||
}
|
||||
wlr_foreign_toplevel_handle_v1_set_activated(c->foreign_toplevel, true);
|
||||
}
|
||||
|
||||
void handle_foreign_fullscreen_request(struct wl_listener *listener,
|
||||
void *data) {
|
||||
|
||||
Client *c = wl_container_of(listener, c, foreign_fullscreen_request);
|
||||
struct wlr_foreign_toplevel_handle_v1_fullscreen_event *event = data;
|
||||
|
||||
if (c->swallowing)
|
||||
return;
|
||||
|
||||
if (c->isfullscreen && !event->fullscreen) {
|
||||
setfullscreen(c, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!c->isfullscreen && event->fullscreen) {
|
||||
setfullscreen(c, 1);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void handle_foreign_close_request(struct wl_listener *listener, void *data) {
|
||||
Client *c = wl_container_of(listener, c, foreign_close_request);
|
||||
pending_kill_client(c);
|
||||
if (c) {
|
||||
pending_kill_client(c);
|
||||
}
|
||||
}
|
||||
|
||||
void handle_foreign_destroy(struct wl_listener *listener, void *data) {
|
||||
Client *c = wl_container_of(listener, c, foreign_destroy);
|
||||
wl_list_remove(&c->foreign_activate_request.link);
|
||||
wl_list_remove(&c->foreign_minimize_request.link);
|
||||
wl_list_remove(&c->foreign_maximize_request.link);
|
||||
wl_list_remove(&c->foreign_fullscreen_request.link);
|
||||
wl_list_remove(&c->foreign_close_request.link);
|
||||
wl_list_remove(&c->foreign_destroy.link);
|
||||
if (c) {
|
||||
wl_list_remove(&c->foreign_activate_request.link);
|
||||
wl_list_remove(&c->foreign_fullscreen_request.link);
|
||||
wl_list_remove(&c->foreign_close_request.link);
|
||||
wl_list_remove(&c->foreign_destroy.link);
|
||||
}
|
||||
}
|
||||
|
||||
void remove_foreign_topleve(Client *c) {
|
||||
@@ -115,10 +67,6 @@ void add_foreign_toplevel(Client *c) {
|
||||
if (c->foreign_toplevel) {
|
||||
LISTEN(&(c->foreign_toplevel->events.request_activate),
|
||||
&c->foreign_activate_request, handle_foreign_activate_request);
|
||||
LISTEN(&(c->foreign_toplevel->events.request_minimize),
|
||||
&c->foreign_minimize_request, handle_foreign_minimize_request);
|
||||
LISTEN(&(c->foreign_toplevel->events.request_maximize),
|
||||
&c->foreign_maximize_request, handle_foreign_maximize_request);
|
||||
LISTEN(&(c->foreign_toplevel->events.request_fullscreen),
|
||||
&c->foreign_fullscreen_request,
|
||||
handle_foreign_fullscreen_request);
|
||||
|
||||
@@ -13,10 +13,7 @@ static void handle_controller_set_hint(struct wl_listener *listener,
|
||||
void *data) {
|
||||
struct tearing_controller *controller =
|
||||
wl_container_of(listener, controller, set_hint);
|
||||
Client *c = NULL;
|
||||
|
||||
toplevel_from_wlr_surface(controller->tearing_control->surface, &c, NULL);
|
||||
|
||||
Client *c = get_client_from_surface(controller->tearing_control->surface);
|
||||
if (c) {
|
||||
/*
|
||||
* tearing_control->current is actually an enum:
|
||||
|
||||
@@ -41,21 +41,10 @@ Client *get_client_by_id_or_title(const char *arg_id, const char *arg_title) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c->swallowedby) {
|
||||
appid = client_get_appid(c->swallowedby);
|
||||
title = client_get_title(c->swallowedby);
|
||||
} else {
|
||||
appid = client_get_appid(c);
|
||||
title = client_get_title(c);
|
||||
}
|
||||
|
||||
if (!appid) {
|
||||
if (!(appid = client_get_appid(c)))
|
||||
appid = broken;
|
||||
}
|
||||
|
||||
if (!title) {
|
||||
if (!(title = client_get_title(c)))
|
||||
title = broken;
|
||||
}
|
||||
|
||||
if (arg_id && strncmp(arg_id, "none", 4) == 0)
|
||||
arg_id = NULL;
|
||||
@@ -81,7 +70,7 @@ setclient_coordinate_center(Client *c, struct wlr_box geom, int offsetx,
|
||||
int len = 0;
|
||||
Monitor *m = c->mon ? c->mon : selmon;
|
||||
|
||||
uint32_t cbw = check_hit_no_border(c) ? c->bw : 0;
|
||||
unsigned int cbw = check_hit_no_border(c) ? c->bw : 0;
|
||||
|
||||
if (!c->no_force_center) {
|
||||
tempbox.x = m->w.x + (m->w.width - geom.width) / 2;
|
||||
@@ -139,9 +128,8 @@ Client *center_tiled_select(Monitor *m) {
|
||||
int dirx, diry;
|
||||
long int distance;
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
if (c && VISIBLEON(c, m) && ISSCROLLTILED(c) &&
|
||||
client_surface(c)->mapped && !c->isfloating &&
|
||||
!client_is_unmanaged(c)) {
|
||||
if (c && VISIBLEON(c, m) && ISTILED(c) && client_surface(c)->mapped &&
|
||||
!c->isfloating && !client_is_unmanaged(c)) {
|
||||
dirx = c->geom.x + c->geom.width / 2 - (m->w.x + m->w.width / 2);
|
||||
diry = c->geom.y + c->geom.height / 2 - (m->w.y + m->w.height / 2);
|
||||
distance = dirx * dirx + diry * diry;
|
||||
@@ -194,9 +182,7 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
|
||||
int sel_x = tc->geom.x;
|
||||
int sel_y = tc->geom.y;
|
||||
long long int distance = LLONG_MAX;
|
||||
long long int same_monitor_distance = LLONG_MAX;
|
||||
Client *tempFocusClients = NULL;
|
||||
Client *tempSameMonitorFocusClients = NULL;
|
||||
|
||||
switch (arg->i) {
|
||||
case UP:
|
||||
@@ -227,11 +213,6 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
|
||||
distance = tmp_distance;
|
||||
tempFocusClients = tempClients[_i];
|
||||
}
|
||||
if (tempClients[_i]->mon == tc->mon &&
|
||||
tmp_distance < same_monitor_distance) {
|
||||
same_monitor_distance = tmp_distance;
|
||||
tempSameMonitorFocusClients = tempClients[_i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -264,11 +245,6 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
|
||||
distance = tmp_distance;
|
||||
tempFocusClients = tempClients[_i];
|
||||
}
|
||||
if (tempClients[_i]->mon == tc->mon &&
|
||||
tmp_distance < same_monitor_distance) {
|
||||
same_monitor_distance = tmp_distance;
|
||||
tempSameMonitorFocusClients = tempClients[_i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -301,11 +277,6 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
|
||||
distance = tmp_distance;
|
||||
tempFocusClients = tempClients[_i];
|
||||
}
|
||||
if (tempClients[_i]->mon == tc->mon &&
|
||||
tmp_distance < same_monitor_distance) {
|
||||
same_monitor_distance = tmp_distance;
|
||||
tempSameMonitorFocusClients = tempClients[_i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -338,11 +309,6 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
|
||||
distance = tmp_distance;
|
||||
tempFocusClients = tempClients[_i];
|
||||
}
|
||||
if (tempClients[_i]->mon == tc->mon &&
|
||||
tmp_distance < same_monitor_distance) {
|
||||
same_monitor_distance = tmp_distance;
|
||||
tempSameMonitorFocusClients = tempClients[_i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -350,11 +316,7 @@ Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
|
||||
}
|
||||
|
||||
free(tempClients); // 释放内存
|
||||
if (tempSameMonitorFocusClients) {
|
||||
return tempSameMonitorFocusClients;
|
||||
} else {
|
||||
return tempFocusClients;
|
||||
}
|
||||
return tempFocusClients;
|
||||
}
|
||||
|
||||
Client *direction_select(const Arg *arg) {
|
||||
@@ -365,12 +327,11 @@ Client *direction_select(const Arg *arg) {
|
||||
return NULL;
|
||||
|
||||
if (tc && (tc->isfullscreen || tc->ismaximizescreen) &&
|
||||
(!is_scroller_layout(selmon) || tc->isfloating)) {
|
||||
!is_scroller_layout(selmon)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return find_client_by_direction(
|
||||
tc, arg, true, is_scroller_layout(selmon) && !selmon->isoverview);
|
||||
return find_client_by_direction(tc, arg, true, is_scroller_layout(selmon));
|
||||
}
|
||||
|
||||
/* We probably should change the name of this, it sounds like
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
pid_t getparentprocess(pid_t p) {
|
||||
uint32_t v = 0;
|
||||
unsigned int v = 0;
|
||||
|
||||
FILE *f;
|
||||
char buf[256];
|
||||
@@ -26,6 +26,24 @@ int isdescprocess(pid_t p, pid_t c) {
|
||||
return (int)c;
|
||||
}
|
||||
|
||||
char *get_autostart_path(char *autostart_path, unsigned int buf_size) {
|
||||
const char *mangoconfig = getenv("MANGOCONFIG");
|
||||
|
||||
if (mangoconfig && mangoconfig[0] != '\0') {
|
||||
snprintf(autostart_path, buf_size, "%s/autostart.sh", mangoconfig);
|
||||
} else {
|
||||
const char *homedir = getenv("HOME");
|
||||
if (!homedir) {
|
||||
fprintf(stderr, "Error: HOME environment variable not set.\n");
|
||||
return NULL;
|
||||
}
|
||||
snprintf(autostart_path, buf_size, "%s/.config/mango/autostart.sh",
|
||||
homedir);
|
||||
}
|
||||
|
||||
return autostart_path;
|
||||
}
|
||||
|
||||
void get_layout_abbr(char *abbr, const char *full_name) {
|
||||
// 清空输出缓冲区
|
||||
abbr[0] = '\0';
|
||||
@@ -42,10 +60,10 @@ void get_layout_abbr(char *abbr, const char *full_name) {
|
||||
const char *open = strrchr(full_name, '(');
|
||||
const char *close = strrchr(full_name, ')');
|
||||
if (open && close && close > open) {
|
||||
uint32_t len = close - open - 1;
|
||||
unsigned int len = close - open - 1;
|
||||
if (len > 0 && len <= 4) {
|
||||
// 提取并转换为小写
|
||||
for (uint32_t j = 0; j < len; j++) {
|
||||
for (unsigned int j = 0; j < len; j++) {
|
||||
abbr[j] = tolower(open[j + 1]);
|
||||
}
|
||||
abbr[len] = '\0';
|
||||
@@ -54,8 +72,8 @@ void get_layout_abbr(char *abbr, const char *full_name) {
|
||||
}
|
||||
|
||||
// 3. 提取前2-3个字母并转换为小写
|
||||
uint32_t j = 0;
|
||||
for (uint32_t i = 0; full_name[i] != '\0' && j < 3; i++) {
|
||||
unsigned int j = 0;
|
||||
for (unsigned int i = 0; full_name[i] != '\0' && j < 3; i++) {
|
||||
if (isalpha(full_name[i])) {
|
||||
abbr[j++] = tolower(full_name[i]);
|
||||
}
|
||||
@@ -97,10 +115,6 @@ void xytonode(double x, double y, struct wlr_surface **psurface, Client **pc,
|
||||
surface = wlr_scene_surface_try_from_buffer(
|
||||
wlr_scene_buffer_from_node(node))
|
||||
->surface;
|
||||
else if (node->type == WLR_SCENE_NODE_RECT) {
|
||||
surface = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
/* start from the topmost layer,
|
||||
find a sureface that can be focused by pointer,
|
||||
|
||||
@@ -39,9 +39,9 @@ bool is_row_layout(Monitor *m) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t get_tag_status(uint32_t tag, Monitor *m) {
|
||||
unsigned int get_tag_status(unsigned int tag, Monitor *m) {
|
||||
Client *c = NULL;
|
||||
uint32_t status = 0;
|
||||
unsigned int status = 0;
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
if (c->mon == m && c->tags & 1 << (tag - 1) & TAGMASK) {
|
||||
if (c->isurgent) {
|
||||
@@ -54,8 +54,8 @@ uint32_t get_tag_status(uint32_t tag, Monitor *m) {
|
||||
return status;
|
||||
}
|
||||
|
||||
uint32_t get_tags_first_tag_num(uint32_t source_tags) {
|
||||
uint32_t i, tag;
|
||||
unsigned int get_tags_first_tag_num(unsigned int source_tags) {
|
||||
unsigned int i, tag;
|
||||
tag = 0;
|
||||
|
||||
if (!source_tags) {
|
||||
@@ -76,8 +76,8 @@ uint32_t get_tags_first_tag_num(uint32_t source_tags) {
|
||||
}
|
||||
|
||||
// 获取tags中最前面的tag的tagmask
|
||||
uint32_t get_tags_first_tag(uint32_t source_tags) {
|
||||
uint32_t i, tag;
|
||||
unsigned int get_tags_first_tag(unsigned int source_tags) {
|
||||
unsigned int i, tag;
|
||||
tag = 0;
|
||||
|
||||
if (!source_tags) {
|
||||
|
||||
@@ -19,7 +19,7 @@ void set_size_per(Monitor *m, Client *c) {
|
||||
}
|
||||
|
||||
void resize_tile_master_horizontal(Client *grabc, bool isdrag, int offsetx,
|
||||
int offsety, uint32_t time, int type) {
|
||||
int offsety, unsigned int time, int type) {
|
||||
Client *tc = NULL;
|
||||
float delta_x, delta_y;
|
||||
Client *next = NULL;
|
||||
@@ -213,7 +213,7 @@ void resize_tile_master_horizontal(Client *grabc, bool isdrag, int offsetx,
|
||||
}
|
||||
|
||||
void resize_tile_master_vertical(Client *grabc, bool isdrag, int offsetx,
|
||||
int offsety, uint32_t time, int type) {
|
||||
int offsety, unsigned int time, int type) {
|
||||
Client *tc = NULL;
|
||||
float delta_x, delta_y;
|
||||
Client *next = NULL;
|
||||
@@ -370,7 +370,7 @@ void resize_tile_master_vertical(Client *grabc, bool isdrag, int offsetx,
|
||||
}
|
||||
|
||||
void resize_tile_scroller(Client *grabc, bool isdrag, int offsetx, int offsety,
|
||||
uint32_t time, bool isvertical) {
|
||||
unsigned int time, bool isvertical) {
|
||||
float delta_x, delta_y;
|
||||
float new_scroller_proportion;
|
||||
|
||||
@@ -474,7 +474,7 @@ void resize_tile_scroller(Client *grabc, bool isdrag, int offsetx, int offsety,
|
||||
}
|
||||
|
||||
void resize_tile_client(Client *grabc, bool isdrag, int offsetx, int offsety,
|
||||
uint32_t time) {
|
||||
unsigned int time) {
|
||||
|
||||
if (!grabc || grabc->isfullscreen || grabc->ismaximizescreen)
|
||||
return;
|
||||
@@ -511,22 +511,24 @@ void reset_size_per_mon(Monitor *m, int tile_cilent_num,
|
||||
int stack_num) {
|
||||
Client *c = NULL;
|
||||
int i = 0;
|
||||
uint32_t stack_index = 0;
|
||||
uint32_t nmasters = m->pertag->nmasters[m->pertag->curtag];
|
||||
unsigned int stack_index = 0;
|
||||
unsigned int nmasters = m->pertag->nmasters[m->pertag->curtag];
|
||||
|
||||
if (m->pertag->ltidxs[m->pertag->curtag]->id != CENTER_TILE) {
|
||||
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
if (VISIBLEON(c, m) && ISTILED(c)) {
|
||||
if (total_master_inner_percent > 0.0 && i < nmasters) {
|
||||
|
||||
if (total_master_inner_percent <= 0.0)
|
||||
return;
|
||||
if (i < m->pertag->nmasters[m->pertag->curtag]) {
|
||||
c->ismaster = true;
|
||||
c->stack_innder_per = stack_num ? 1.0f / stack_num : 1.0f;
|
||||
c->master_inner_per =
|
||||
c->master_inner_per / total_master_inner_percent;
|
||||
} else {
|
||||
c->ismaster = false;
|
||||
c->master_inner_per =
|
||||
master_num > 0 ? 1.0f / master_num : 1.0f;
|
||||
c->master_inner_per = 1.0f / master_num;
|
||||
c->stack_innder_per =
|
||||
total_stack_hight_percent
|
||||
? c->stack_innder_per / total_stack_hight_percent
|
||||
@@ -538,7 +540,10 @@ void reset_size_per_mon(Monitor *m, int tile_cilent_num,
|
||||
} else {
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
if (VISIBLEON(c, m) && ISTILED(c)) {
|
||||
if (total_master_inner_percent > 0.0 && i < nmasters) {
|
||||
|
||||
if (total_master_inner_percent <= 0.0)
|
||||
return;
|
||||
if (i < m->pertag->nmasters[m->pertag->curtag]) {
|
||||
c->ismaster = true;
|
||||
if ((stack_index % 2) ^ (tile_cilent_num % 2 == 0)) {
|
||||
c->stack_innder_per =
|
||||
@@ -555,8 +560,7 @@ void reset_size_per_mon(Monitor *m, int tile_cilent_num,
|
||||
stack_index = i - nmasters;
|
||||
|
||||
c->ismaster = false;
|
||||
c->master_inner_per =
|
||||
master_num > 0 ? 1.0f / master_num : 1.0f;
|
||||
c->master_inner_per = 1.0f / master_num;
|
||||
if ((stack_index % 2) ^ (tile_cilent_num % 2 == 0)) {
|
||||
c->stack_innder_per =
|
||||
total_right_stack_hight_percent
|
||||
@@ -635,7 +639,7 @@ arrange(Monitor *m, bool want_animation) {
|
||||
if (VISIBLEON(c, m)) {
|
||||
if (ISTILED(c)) {
|
||||
|
||||
if (i < nmasters) {
|
||||
if (i < m->pertag->nmasters[m->pertag->curtag]) {
|
||||
master_num++;
|
||||
total_master_inner_percent += c->master_inner_per;
|
||||
} else {
|
||||
@@ -684,6 +688,4 @@ arrange(Monitor *m, bool want_animation) {
|
||||
motionnotify(0, NULL, 0, 0, 0, 0);
|
||||
checkidleinhibitor(NULL);
|
||||
}
|
||||
|
||||
printstatus();
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// 网格布局窗口大小和位置计算
|
||||
void grid(Monitor *m) {
|
||||
uint32_t i, n;
|
||||
uint32_t cx, cy, cw, ch;
|
||||
uint32_t dx;
|
||||
uint32_t cols, rows, overcols;
|
||||
unsigned int i, n;
|
||||
unsigned int cx, cy, cw, ch;
|
||||
unsigned int dx;
|
||||
unsigned int cols, rows, overcols;
|
||||
Client *c = NULL;
|
||||
n = 0;
|
||||
int target_gappo = enablegaps ? m->isoverview ? overviewgappo : gappoh : 0;
|
||||
@@ -23,6 +23,10 @@ void grid(Monitor *m) {
|
||||
if (c->mon != m)
|
||||
continue;
|
||||
|
||||
c->bw = m->visible_tiling_clients == 1 && no_border_when_single &&
|
||||
smartgaps
|
||||
? 0
|
||||
: borderpx;
|
||||
if (VISIBLEON(c, m) && !c->isunglobal &&
|
||||
((m->isoverview && !client_is_x11_popup(c)) || ISTILED(c))) {
|
||||
cw = (m->w.width - 2 * target_gappo) * single_width_ratio;
|
||||
@@ -45,6 +49,10 @@ void grid(Monitor *m) {
|
||||
if (c->mon != m)
|
||||
continue;
|
||||
|
||||
c->bw = m->visible_tiling_clients == 1 && no_border_when_single &&
|
||||
smartgaps
|
||||
? 0
|
||||
: borderpx;
|
||||
if (VISIBLEON(c, m) && !c->isunglobal &&
|
||||
((m->isoverview && !client_is_x11_popup(c)) || ISTILED(c))) {
|
||||
if (i == 0) {
|
||||
@@ -91,7 +99,10 @@ void grid(Monitor *m) {
|
||||
|
||||
if (c->mon != m)
|
||||
continue;
|
||||
|
||||
c->bw =
|
||||
m->visible_tiling_clients == 1 && no_border_when_single && smartgaps
|
||||
? 0
|
||||
: borderpx;
|
||||
if (VISIBLEON(c, m) && !c->isunglobal &&
|
||||
((m->isoverview && !client_is_x11_popup(c)) || ISTILED(c))) {
|
||||
cx = m->w.x + (i % cols) * (cw + target_gappi);
|
||||
@@ -110,15 +121,15 @@ void grid(Monitor *m) {
|
||||
}
|
||||
|
||||
void deck(Monitor *m) {
|
||||
uint32_t mw, my;
|
||||
unsigned int mw, my;
|
||||
int i, n = 0;
|
||||
Client *c = NULL;
|
||||
Client *fc = NULL;
|
||||
float mfact;
|
||||
|
||||
uint32_t cur_gappih = enablegaps ? m->gappih : 0;
|
||||
uint32_t cur_gappoh = enablegaps ? m->gappoh : 0;
|
||||
uint32_t cur_gappov = enablegaps ? m->gappov : 0;
|
||||
unsigned int cur_gappih = enablegaps ? m->gappih : 0;
|
||||
unsigned int cur_gappoh = enablegaps ? m->gappoh : 0;
|
||||
unsigned int cur_gappov = enablegaps ? m->gappov : 0;
|
||||
|
||||
cur_gappih = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappih;
|
||||
cur_gappoh = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappoh;
|
||||
@@ -181,9 +192,9 @@ void deck(Monitor *m) {
|
||||
void horizontal_scroll_adjust_fullandmax(Client *c,
|
||||
struct wlr_box *target_geom) {
|
||||
Monitor *m = c->mon;
|
||||
uint32_t cur_gappih = enablegaps ? m->gappih : 0;
|
||||
uint32_t cur_gappoh = enablegaps ? m->gappoh : 0;
|
||||
uint32_t cur_gappov = enablegaps ? m->gappov : 0;
|
||||
unsigned int cur_gappih = enablegaps ? m->gappih : 0;
|
||||
unsigned int cur_gappoh = enablegaps ? m->gappoh : 0;
|
||||
unsigned int cur_gappov = enablegaps ? m->gappov : 0;
|
||||
|
||||
cur_gappih =
|
||||
smartgaps && m->visible_scroll_tiling_clients == 1 ? 0 : cur_gappih;
|
||||
@@ -212,7 +223,7 @@ void horizontal_scroll_adjust_fullandmax(Client *c,
|
||||
|
||||
// 滚动布局
|
||||
void scroller(Monitor *m) {
|
||||
uint32_t i, n, j;
|
||||
unsigned int i, n, j;
|
||||
float single_proportion = 1.0;
|
||||
|
||||
Client *c = NULL, *root_client = NULL;
|
||||
@@ -220,9 +231,9 @@ void scroller(Monitor *m) {
|
||||
struct wlr_box target_geom;
|
||||
int focus_client_index = 0;
|
||||
bool need_scroller = false;
|
||||
uint32_t cur_gappih = enablegaps ? m->gappih : 0;
|
||||
uint32_t cur_gappoh = enablegaps ? m->gappoh : 0;
|
||||
uint32_t cur_gappov = enablegaps ? m->gappov : 0;
|
||||
unsigned int cur_gappih = enablegaps ? m->gappih : 0;
|
||||
unsigned int cur_gappoh = enablegaps ? m->gappoh : 0;
|
||||
unsigned int cur_gappov = enablegaps ? m->gappov : 0;
|
||||
|
||||
cur_gappih =
|
||||
smartgaps && m->visible_scroll_tiling_clients == 1 ? 0 : cur_gappih;
|
||||
@@ -231,7 +242,8 @@ void scroller(Monitor *m) {
|
||||
cur_gappov =
|
||||
smartgaps && m->visible_scroll_tiling_clients == 1 ? 0 : cur_gappov;
|
||||
|
||||
uint32_t max_client_width = m->w.width - 2 * scroller_structs - cur_gappih;
|
||||
unsigned int max_client_width =
|
||||
m->w.width - 2 * scroller_structs - cur_gappih;
|
||||
|
||||
n = m->visible_scroll_tiling_clients;
|
||||
|
||||
@@ -272,7 +284,7 @@ void scroller(Monitor *m) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m->sel && !client_is_unmanaged(m->sel) && ISSCROLLTILED(m->sel)) {
|
||||
if (m->sel && !client_is_unmanaged(m->sel) && !m->sel->isfloating) {
|
||||
root_client = m->sel;
|
||||
} else if (m->prevsel && ISSCROLLTILED(m->prevsel) &&
|
||||
VISIBLEON(m->prevsel, m) && !client_is_unmanaged(m->prevsel)) {
|
||||
@@ -289,7 +301,8 @@ void scroller(Monitor *m) {
|
||||
for (i = 0; i < n; i++) {
|
||||
c = tempClients[i];
|
||||
if (root_client == c) {
|
||||
if (c->geom.x >= m->w.x + scroller_structs &&
|
||||
if (!c->is_pending_open_animation &&
|
||||
c->geom.x >= m->w.x + scroller_structs &&
|
||||
c->geom.x + c->geom.width <=
|
||||
m->w.x + m->w.width - scroller_structs) {
|
||||
need_scroller = false;
|
||||
@@ -442,8 +455,8 @@ void dual_scroller(Monitor *m) {
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate row heights using configurable split ratio
|
||||
unsigned int top_row_height = (unsigned int)((m->w.height - 2 * cur_gappov - cur_gappiv) * dual_scroller_default_split_ratio);
|
||||
// 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;
|
||||
@@ -572,7 +585,7 @@ void dual_scroller(Monitor *m) {
|
||||
}
|
||||
|
||||
void center_tile(Monitor *m) {
|
||||
uint32_t 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 *fc = NULL;
|
||||
double mfact = 0;
|
||||
@@ -581,8 +594,6 @@ void center_tile(Monitor *m) {
|
||||
|
||||
n = m->visible_tiling_clients;
|
||||
master_num = m->pertag->nmasters[m->pertag->curtag];
|
||||
master_num = n > master_num ? master_num : n;
|
||||
|
||||
stack_num = n - master_num;
|
||||
|
||||
if (n == 0)
|
||||
@@ -595,10 +606,10 @@ void center_tile(Monitor *m) {
|
||||
}
|
||||
|
||||
// 间隙参数处理
|
||||
uint32_t cur_gappiv = enablegaps ? m->gappiv : 0; // 内部垂直间隙
|
||||
uint32_t cur_gappih = enablegaps ? m->gappih : 0; // 内部水平间隙
|
||||
uint32_t cur_gappov = enablegaps ? m->gappov : 0; // 外部垂直间隙
|
||||
uint32_t cur_gappoh = enablegaps ? m->gappoh : 0; // 外部水平间隙
|
||||
unsigned int cur_gappiv = enablegaps ? m->gappiv : 0; // 内部垂直间隙
|
||||
unsigned int cur_gappih = enablegaps ? m->gappih : 0; // 内部水平间隙
|
||||
unsigned int cur_gappov = enablegaps ? m->gappov : 0; // 外部垂直间隙
|
||||
unsigned int cur_gappoh = enablegaps ? m->gappoh : 0; // 外部水平间隙
|
||||
|
||||
// 智能间隙处理
|
||||
cur_gappiv = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappiv;
|
||||
@@ -606,7 +617,7 @@ void center_tile(Monitor *m) {
|
||||
cur_gappov = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappov;
|
||||
cur_gappoh = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappoh;
|
||||
|
||||
uint32_t nmasters = m->pertag->nmasters[m->pertag->curtag];
|
||||
unsigned int nmasters = m->pertag->nmasters[m->pertag->curtag];
|
||||
mfact = fc->master_mfact_per > 0.0f ? fc->master_mfact_per
|
||||
: m->pertag->mfacts[m->pertag->curtag];
|
||||
|
||||
@@ -619,19 +630,6 @@ void center_tile(Monitor *m) {
|
||||
// 判断是否需要主区域铺满
|
||||
int should_overspread = center_master_overspread && (n <= nmasters);
|
||||
|
||||
uint32_t master_surplus_height =
|
||||
(m->w.height - 2 * cur_gappov - cur_gappiv * ie * (master_num - 1));
|
||||
float master_surplus_ratio = 1.0;
|
||||
|
||||
uint32_t slave_left_surplus_height =
|
||||
(m->w.height - 2 * cur_gappov - cur_gappiv * ie * (stack_num / 2 - 1));
|
||||
float slave_left_surplus_ratio = 1.0;
|
||||
|
||||
uint32_t slave_right_surplus_height =
|
||||
(m->w.height - 2 * cur_gappov -
|
||||
cur_gappiv * ie * ((stack_num + 1) / 2 - 1));
|
||||
float slave_right_surplus_ratio = 1.0;
|
||||
|
||||
if (n > nmasters || !should_overspread) {
|
||||
// 计算主区域宽度(居中模式)
|
||||
mw = nmasters ? (m->w.width - 2 * cur_gappoh - cur_gappih * ie) * mfact
|
||||
@@ -676,11 +674,9 @@ void center_tile(Monitor *m) {
|
||||
// 主区域窗口
|
||||
r = MIN(n, nmasters) - i;
|
||||
if (c->master_inner_per > 0.0f) {
|
||||
h = master_surplus_height * c->master_inner_per /
|
||||
master_surplus_ratio;
|
||||
master_surplus_height = master_surplus_height - h;
|
||||
master_surplus_ratio =
|
||||
master_surplus_ratio - c->master_inner_per;
|
||||
h = (m->w.height - 2 * cur_gappov -
|
||||
cur_gappiv * ie * (master_num - 1)) *
|
||||
c->master_inner_per;
|
||||
c->master_mfact_per = mfact;
|
||||
} else {
|
||||
h = (m->w.height - my - cur_gappov -
|
||||
@@ -700,7 +696,7 @@ void center_tile(Monitor *m) {
|
||||
my += c->geom.height + cur_gappiv * ie;
|
||||
} else {
|
||||
// 堆叠区域窗口
|
||||
uint32_t stack_index = i - nmasters;
|
||||
unsigned int stack_index = i - nmasters;
|
||||
|
||||
if (n - nmasters == 1) {
|
||||
// 单个堆叠窗口
|
||||
@@ -742,12 +738,9 @@ void center_tile(Monitor *m) {
|
||||
if ((stack_index % 2) ^ (n % 2 == 0)) {
|
||||
// 右侧堆叠窗口
|
||||
if (c->stack_innder_per > 0.0f) {
|
||||
h = slave_right_surplus_height * c->stack_innder_per /
|
||||
slave_right_surplus_ratio;
|
||||
slave_right_surplus_height =
|
||||
slave_right_surplus_height - h;
|
||||
slave_right_surplus_ratio =
|
||||
slave_right_surplus_ratio - c->stack_innder_per;
|
||||
h = (m->w.height - 2 * cur_gappov -
|
||||
cur_gappiv * ie * ((stack_num + 1) / 2 - 1)) *
|
||||
c->stack_innder_per;
|
||||
c->master_mfact_per = mfact;
|
||||
} else {
|
||||
h = (m->w.height - ety - cur_gappov -
|
||||
@@ -771,12 +764,9 @@ void center_tile(Monitor *m) {
|
||||
} else {
|
||||
// 左侧堆叠窗口
|
||||
if (c->stack_innder_per > 0.0f) {
|
||||
h = slave_left_surplus_height * c->stack_innder_per /
|
||||
slave_left_surplus_ratio;
|
||||
slave_left_surplus_height =
|
||||
slave_left_surplus_height - h;
|
||||
slave_left_surplus_ratio =
|
||||
slave_left_surplus_ratio - c->stack_innder_per;
|
||||
h = (m->w.height - 2 * cur_gappov -
|
||||
cur_gappiv * ie * (stack_num / 2 - 1)) *
|
||||
c->stack_innder_per;
|
||||
c->master_mfact_per = mfact;
|
||||
} else {
|
||||
h = (m->w.height - oty - cur_gappov -
|
||||
@@ -804,7 +794,7 @@ void center_tile(Monitor *m) {
|
||||
}
|
||||
|
||||
void tile(Monitor *m) {
|
||||
uint32_t i, n = 0, h, r, ie = enablegaps, mw, my, ty;
|
||||
unsigned int i, n = 0, h, r, ie = enablegaps, mw, my, ty;
|
||||
Client *c = NULL;
|
||||
Client *fc = NULL;
|
||||
double mfact = 0;
|
||||
@@ -813,16 +803,15 @@ void tile(Monitor *m) {
|
||||
|
||||
n = m->visible_tiling_clients;
|
||||
master_num = m->pertag->nmasters[m->pertag->curtag];
|
||||
master_num = n > master_num ? master_num : n;
|
||||
stack_num = n - master_num;
|
||||
|
||||
if (n == 0)
|
||||
return;
|
||||
|
||||
uint32_t cur_gappiv = enablegaps ? m->gappiv : 0;
|
||||
uint32_t cur_gappih = enablegaps ? m->gappih : 0;
|
||||
uint32_t cur_gappov = enablegaps ? m->gappov : 0;
|
||||
uint32_t cur_gappoh = enablegaps ? m->gappoh : 0;
|
||||
unsigned int cur_gappiv = enablegaps ? m->gappiv : 0;
|
||||
unsigned int cur_gappih = enablegaps ? m->gappih : 0;
|
||||
unsigned int cur_gappov = enablegaps ? m->gappov : 0;
|
||||
unsigned int cur_gappoh = enablegaps ? m->gappoh : 0;
|
||||
|
||||
cur_gappiv = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappiv;
|
||||
cur_gappih = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappih;
|
||||
@@ -846,26 +835,15 @@ void tile(Monitor *m) {
|
||||
mw = m->w.width - 2 * cur_gappoh + cur_gappih * ie;
|
||||
i = 0;
|
||||
my = ty = cur_gappov;
|
||||
|
||||
uint32_t master_surplus_height =
|
||||
(m->w.height - 2 * cur_gappov - cur_gappiv * ie * (master_num - 1));
|
||||
float master_surplus_ratio = 1.0;
|
||||
|
||||
uint32_t slave_surplus_height =
|
||||
(m->w.height - 2 * cur_gappov - cur_gappiv * ie * (stack_num - 1));
|
||||
float slave_surplus_ratio = 1.0;
|
||||
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
if (!VISIBLEON(c, m) || !ISTILED(c))
|
||||
continue;
|
||||
if (i < m->pertag->nmasters[m->pertag->curtag]) {
|
||||
r = MIN(n, m->pertag->nmasters[m->pertag->curtag]) - i;
|
||||
if (c->master_inner_per > 0.0f) {
|
||||
h = master_surplus_height * c->master_inner_per /
|
||||
master_surplus_ratio;
|
||||
master_surplus_height = master_surplus_height - h;
|
||||
master_surplus_ratio =
|
||||
master_surplus_ratio - c->master_inner_per;
|
||||
h = (m->w.height - 2 * cur_gappov -
|
||||
cur_gappiv * ie * (master_num - 1)) *
|
||||
c->master_inner_per;
|
||||
c->master_mfact_per = mfact;
|
||||
} else {
|
||||
h = (m->w.height - my - cur_gappov -
|
||||
@@ -885,10 +863,9 @@ void tile(Monitor *m) {
|
||||
} else {
|
||||
r = n - i;
|
||||
if (c->stack_innder_per > 0.0f) {
|
||||
h = slave_surplus_height * c->stack_innder_per /
|
||||
slave_surplus_ratio;
|
||||
slave_surplus_height = slave_surplus_height - h;
|
||||
slave_surplus_ratio = slave_surplus_ratio - c->stack_innder_per;
|
||||
h = (m->w.height - 2 * cur_gappov -
|
||||
cur_gappiv * ie * (stack_num - 1)) *
|
||||
c->stack_innder_per;
|
||||
c->master_mfact_per = mfact;
|
||||
} else {
|
||||
h = (m->w.height - ty - cur_gappov -
|
||||
@@ -914,7 +891,7 @@ void tile(Monitor *m) {
|
||||
}
|
||||
|
||||
void right_tile(Monitor *m) {
|
||||
uint32_t i, n = 0, h, r, ie = enablegaps, mw, my, ty;
|
||||
unsigned int i, n = 0, h, r, ie = enablegaps, mw, my, ty;
|
||||
Client *c = NULL;
|
||||
Client *fc = NULL;
|
||||
double mfact = 0;
|
||||
@@ -923,16 +900,15 @@ void right_tile(Monitor *m) {
|
||||
|
||||
n = m->visible_tiling_clients;
|
||||
master_num = m->pertag->nmasters[m->pertag->curtag];
|
||||
master_num = n > master_num ? master_num : n;
|
||||
stack_num = n - master_num;
|
||||
|
||||
if (n == 0)
|
||||
return;
|
||||
|
||||
uint32_t cur_gappiv = enablegaps ? m->gappiv : 0;
|
||||
uint32_t cur_gappih = enablegaps ? m->gappih : 0;
|
||||
uint32_t cur_gappov = enablegaps ? m->gappov : 0;
|
||||
uint32_t cur_gappoh = enablegaps ? m->gappoh : 0;
|
||||
unsigned int cur_gappiv = enablegaps ? m->gappiv : 0;
|
||||
unsigned int cur_gappih = enablegaps ? m->gappih : 0;
|
||||
unsigned int cur_gappov = enablegaps ? m->gappov : 0;
|
||||
unsigned int cur_gappoh = enablegaps ? m->gappoh : 0;
|
||||
|
||||
cur_gappiv = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappiv;
|
||||
cur_gappih = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappih;
|
||||
@@ -956,26 +932,15 @@ void right_tile(Monitor *m) {
|
||||
mw = m->w.width - 2 * cur_gappoh + cur_gappih * ie;
|
||||
i = 0;
|
||||
my = ty = cur_gappov;
|
||||
|
||||
uint32_t master_surplus_height =
|
||||
(m->w.height - 2 * cur_gappov - cur_gappiv * ie * (master_num - 1));
|
||||
float master_surplus_ratio = 1.0;
|
||||
|
||||
uint32_t slave_surplus_height =
|
||||
(m->w.height - 2 * cur_gappov - cur_gappiv * ie * (stack_num - 1));
|
||||
float slave_surplus_ratio = 1.0;
|
||||
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
if (!VISIBLEON(c, m) || !ISTILED(c))
|
||||
continue;
|
||||
if (i < m->pertag->nmasters[m->pertag->curtag]) {
|
||||
r = MIN(n, m->pertag->nmasters[m->pertag->curtag]) - i;
|
||||
if (c->master_inner_per > 0.0f) {
|
||||
h = master_surplus_height * c->master_inner_per /
|
||||
master_surplus_ratio;
|
||||
master_surplus_height = master_surplus_height - h;
|
||||
master_surplus_ratio =
|
||||
master_surplus_ratio - c->master_inner_per;
|
||||
h = (m->w.height - 2 * cur_gappov -
|
||||
cur_gappiv * ie * (master_num - 1)) *
|
||||
c->master_inner_per;
|
||||
c->master_mfact_per = mfact;
|
||||
} else {
|
||||
h = (m->w.height - my - cur_gappov -
|
||||
@@ -996,10 +961,9 @@ void right_tile(Monitor *m) {
|
||||
} else {
|
||||
r = n - i;
|
||||
if (c->stack_innder_per > 0.0f) {
|
||||
h = slave_surplus_height * c->stack_innder_per /
|
||||
slave_surplus_ratio;
|
||||
slave_surplus_height = slave_surplus_height - h;
|
||||
slave_surplus_ratio = slave_surplus_ratio - c->stack_innder_per;
|
||||
h = (m->w.height - 2 * cur_gappov -
|
||||
cur_gappiv * ie * (stack_num - 1)) *
|
||||
c->stack_innder_per;
|
||||
c->master_mfact_per = mfact;
|
||||
} else {
|
||||
h = (m->w.height - ty - cur_gappov -
|
||||
@@ -1029,8 +993,8 @@ monocle(Monitor *m) {
|
||||
Client *c = NULL;
|
||||
struct wlr_box geom;
|
||||
|
||||
uint32_t cur_gappov = enablegaps ? m->gappov : 0;
|
||||
uint32_t cur_gappoh = enablegaps ? m->gappoh : 0;
|
||||
unsigned int cur_gappov = enablegaps ? m->gappov : 0;
|
||||
unsigned int cur_gappoh = enablegaps ? m->gappoh : 0;
|
||||
|
||||
cur_gappoh = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappoh;
|
||||
cur_gappov = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappov;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
void vertical_tile(Monitor *m) {
|
||||
uint32_t i, n = 0, w, r, ie = enablegaps, mh, mx, tx;
|
||||
unsigned int i, n = 0, w, r, ie = enablegaps, mh, mx, tx;
|
||||
Client *c = NULL;
|
||||
Client *fc = NULL;
|
||||
double mfact = 0;
|
||||
@@ -8,16 +8,15 @@ void vertical_tile(Monitor *m) {
|
||||
|
||||
n = m->visible_tiling_clients;
|
||||
master_num = m->pertag->nmasters[m->pertag->curtag];
|
||||
master_num = n > master_num ? master_num : n;
|
||||
stack_num = n - master_num;
|
||||
|
||||
if (n == 0)
|
||||
return;
|
||||
|
||||
uint32_t cur_gapih = enablegaps ? m->gappih : 0;
|
||||
uint32_t cur_gapiv = enablegaps ? m->gappiv : 0;
|
||||
uint32_t cur_gapoh = enablegaps ? m->gappoh : 0;
|
||||
uint32_t cur_gapov = enablegaps ? m->gappov : 0;
|
||||
unsigned int cur_gapih = enablegaps ? m->gappih : 0;
|
||||
unsigned int cur_gapiv = enablegaps ? m->gappiv : 0;
|
||||
unsigned int cur_gapoh = enablegaps ? m->gappoh : 0;
|
||||
unsigned int cur_gapov = enablegaps ? m->gappov : 0;
|
||||
|
||||
cur_gapih = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gapih;
|
||||
cur_gapiv = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gapiv;
|
||||
@@ -41,26 +40,15 @@ void vertical_tile(Monitor *m) {
|
||||
|
||||
i = 0;
|
||||
mx = tx = cur_gapih;
|
||||
|
||||
uint32_t master_surplus_width =
|
||||
(m->w.width - 2 * cur_gapih - cur_gapih * ie * (master_num - 1));
|
||||
float master_surplus_ratio = 1.0;
|
||||
|
||||
uint32_t slave_surplus_width =
|
||||
(m->w.width - 2 * cur_gapih - cur_gapih * ie * (stack_num - 1));
|
||||
float slave_surplus_ratio = 1.0;
|
||||
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
if (!VISIBLEON(c, m) || !ISTILED(c))
|
||||
continue;
|
||||
if (i < m->pertag->nmasters[m->pertag->curtag]) {
|
||||
r = MIN(n, m->pertag->nmasters[m->pertag->curtag]) - i;
|
||||
if (c->master_inner_per > 0.0f) {
|
||||
w = master_surplus_width * c->master_inner_per /
|
||||
master_surplus_ratio;
|
||||
master_surplus_width = master_surplus_width - w;
|
||||
master_surplus_ratio =
|
||||
master_surplus_ratio - c->master_inner_per;
|
||||
w = (m->w.width - 2 * cur_gapih -
|
||||
cur_gapih * ie * (master_num - 1)) *
|
||||
c->master_inner_per;
|
||||
c->master_mfact_per = mfact;
|
||||
} else {
|
||||
w = (m->w.width - mx - cur_gapih - cur_gapih * ie * (r - 1)) /
|
||||
@@ -79,10 +67,9 @@ void vertical_tile(Monitor *m) {
|
||||
} else {
|
||||
r = n - i;
|
||||
if (c->stack_innder_per > 0.0f) {
|
||||
w = slave_surplus_width * c->stack_innder_per /
|
||||
slave_surplus_ratio;
|
||||
slave_surplus_width = slave_surplus_width - w;
|
||||
slave_surplus_ratio = slave_surplus_ratio - c->stack_innder_per;
|
||||
w = (m->w.width - 2 * cur_gapih -
|
||||
cur_gapih * ie * (stack_num - 1)) *
|
||||
c->stack_innder_per;
|
||||
c->master_mfact_per = mfact;
|
||||
} else {
|
||||
w = (m->w.width - tx - cur_gapih - cur_gapih * ie * (r - 1)) /
|
||||
@@ -105,15 +92,15 @@ void vertical_tile(Monitor *m) {
|
||||
}
|
||||
|
||||
void vertical_deck(Monitor *m) {
|
||||
uint32_t mh, mx;
|
||||
unsigned int mh, mx;
|
||||
int i, n = 0;
|
||||
Client *c = NULL;
|
||||
Client *fc = NULL;
|
||||
float mfact;
|
||||
|
||||
uint32_t cur_gappiv = enablegaps ? m->gappiv : 0;
|
||||
uint32_t cur_gappoh = enablegaps ? m->gappoh : 0;
|
||||
uint32_t cur_gappov = enablegaps ? m->gappov : 0;
|
||||
unsigned int cur_gappiv = enablegaps ? m->gappiv : 0;
|
||||
unsigned int cur_gappoh = enablegaps ? m->gappoh : 0;
|
||||
unsigned int cur_gappov = enablegaps ? m->gappov : 0;
|
||||
|
||||
cur_gappiv = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappiv;
|
||||
cur_gappoh = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappoh;
|
||||
@@ -170,9 +157,9 @@ void vertical_deck(Monitor *m) {
|
||||
|
||||
void vertical_scroll_adjust_fullandmax(Client *c, struct wlr_box *target_geom) {
|
||||
Monitor *m = c->mon;
|
||||
uint32_t cur_gappiv = enablegaps ? m->gappiv : 0;
|
||||
uint32_t cur_gappov = enablegaps ? m->gappov : 0;
|
||||
uint32_t cur_gappoh = enablegaps ? m->gappoh : 0;
|
||||
unsigned int cur_gappiv = enablegaps ? m->gappiv : 0;
|
||||
unsigned int cur_gappov = enablegaps ? m->gappov : 0;
|
||||
unsigned int cur_gappoh = enablegaps ? m->gappoh : 0;
|
||||
|
||||
cur_gappiv =
|
||||
smartgaps && m->visible_scroll_tiling_clients == 1 ? 0 : cur_gappiv;
|
||||
@@ -201,7 +188,7 @@ void vertical_scroll_adjust_fullandmax(Client *c, struct wlr_box *target_geom) {
|
||||
|
||||
// 竖屏滚动布局
|
||||
void vertical_scroller(Monitor *m) {
|
||||
uint32_t i, n, j;
|
||||
unsigned int i, n, j;
|
||||
float single_proportion = 1.0;
|
||||
|
||||
Client *c = NULL, *root_client = NULL;
|
||||
@@ -209,9 +196,9 @@ void vertical_scroller(Monitor *m) {
|
||||
struct wlr_box target_geom;
|
||||
int focus_client_index = 0;
|
||||
bool need_scroller = false;
|
||||
uint32_t cur_gappiv = enablegaps ? m->gappiv : 0;
|
||||
uint32_t cur_gappov = enablegaps ? m->gappov : 0;
|
||||
uint32_t cur_gappoh = enablegaps ? m->gappoh : 0;
|
||||
unsigned int cur_gappiv = enablegaps ? m->gappiv : 0;
|
||||
unsigned int cur_gappov = enablegaps ? m->gappov : 0;
|
||||
unsigned int cur_gappoh = enablegaps ? m->gappoh : 0;
|
||||
|
||||
cur_gappiv =
|
||||
smartgaps && m->visible_scroll_tiling_clients == 1 ? 0 : cur_gappiv;
|
||||
@@ -220,7 +207,7 @@ void vertical_scroller(Monitor *m) {
|
||||
cur_gappoh =
|
||||
smartgaps && m->visible_scroll_tiling_clients == 1 ? 0 : cur_gappoh;
|
||||
|
||||
uint32_t max_client_height =
|
||||
unsigned int max_client_height =
|
||||
m->w.height - 2 * scroller_structs - cur_gappiv;
|
||||
|
||||
n = m->visible_scroll_tiling_clients;
|
||||
@@ -259,7 +246,7 @@ void vertical_scroller(Monitor *m) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m->sel && !client_is_unmanaged(m->sel) && ISSCROLLTILED(m->sel)) {
|
||||
if (m->sel && !client_is_unmanaged(m->sel) && !m->sel->isfloating) {
|
||||
root_client = m->sel;
|
||||
} else if (m->prevsel && ISSCROLLTILED(m->prevsel) &&
|
||||
VISIBLEON(m->prevsel, m) && !client_is_unmanaged(m->prevsel)) {
|
||||
@@ -276,7 +263,8 @@ void vertical_scroller(Monitor *m) {
|
||||
for (i = 0; i < n; i++) {
|
||||
c = tempClients[i];
|
||||
if (root_client == c) {
|
||||
if (c->geom.y >= m->w.y + scroller_structs &&
|
||||
if (!c->is_pending_open_animation &&
|
||||
c->geom.y >= m->w.y + scroller_structs &&
|
||||
c->geom.y + c->geom.height <=
|
||||
m->w.y + m->w.height - scroller_structs) {
|
||||
need_scroller = false;
|
||||
@@ -354,10 +342,10 @@ void vertical_scroller(Monitor *m) {
|
||||
}
|
||||
|
||||
void vertical_grid(Monitor *m) {
|
||||
uint32_t i, n;
|
||||
uint32_t cx, cy, cw, ch;
|
||||
uint32_t dy;
|
||||
uint32_t rows, cols, overrows;
|
||||
unsigned int i, n;
|
||||
unsigned int cx, cy, cw, ch;
|
||||
unsigned int dy;
|
||||
unsigned int rows, cols, overrows;
|
||||
Client *c = NULL;
|
||||
int target_gappo = enablegaps ? m->isoverview ? overviewgappo : gappov : 0;
|
||||
int target_gappi = enablegaps ? m->isoverview ? overviewgappi : gappiv : 0;
|
||||
@@ -376,6 +364,10 @@ void vertical_grid(Monitor *m) {
|
||||
if (c->mon != m)
|
||||
continue;
|
||||
|
||||
c->bw = m->visible_tiling_clients == 1 && no_border_when_single &&
|
||||
smartgaps
|
||||
? 0
|
||||
: borderpx;
|
||||
if (VISIBLEON(c, m) && !c->isunglobal &&
|
||||
((m->isoverview && !client_is_x11_popup(c)) || ISTILED(c))) {
|
||||
ch = (m->w.height - 2 * target_gappo) * single_height_ratio;
|
||||
@@ -399,6 +391,10 @@ void vertical_grid(Monitor *m) {
|
||||
if (c->mon != m)
|
||||
continue;
|
||||
|
||||
c->bw = m->visible_tiling_clients == 1 && no_border_when_single &&
|
||||
smartgaps
|
||||
? 0
|
||||
: borderpx;
|
||||
if (VISIBLEON(c, m) && !c->isunglobal &&
|
||||
((m->isoverview && !client_is_x11_popup(c)) || ISTILED(c))) {
|
||||
if (i == 0) {
|
||||
@@ -441,6 +437,10 @@ void vertical_grid(Monitor *m) {
|
||||
if (c->mon != m)
|
||||
continue;
|
||||
|
||||
c->bw =
|
||||
m->visible_tiling_clients == 1 && no_border_when_single && smartgaps
|
||||
? 0
|
||||
: borderpx;
|
||||
if (VISIBLEON(c, m) && !c->isunglobal &&
|
||||
((m->isoverview && !client_is_x11_popup(c)) || ISTILED(c))) {
|
||||
cx = m->w.x + (i / rows) * (cw + target_gappi);
|
||||
|
||||
468
src/mango.c
468
src/mango.c
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user