Compare commits
18 Commits
feature/du
...
7ed12cf921
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7ed12cf921 | ||
|
|
64d8764f58 | ||
|
|
d0a51f4785 | ||
|
|
7552e77781 | ||
|
|
c206693257 | ||
|
|
11dfab478a | ||
|
|
3cfcaa21c0 | ||
|
|
276560840b | ||
|
|
ee789613ff | ||
|
|
8ac331aa64 | ||
|
|
e59b9c10b5 | ||
|
|
9fecdb6c3a | ||
|
|
c51cf7d6cc | ||
|
|
a42939f0c2 | ||
|
|
fbdf7fdb34 | ||
|
|
16dc4fa9cd | ||
|
|
9b97d11c83 | ||
|
|
58790c0e53 |
@@ -101,7 +101,7 @@ emerge --ask --verbose gui-wm/mangowc
|
||||
## Other
|
||||
|
||||
```bash
|
||||
git clone -b 0.19.1 https://gitlab.freedesktop.org/wlroots/wlroots.git
|
||||
git clone -b 0.19.2 https://gitlab.freedesktop.org/wlroots/wlroots.git
|
||||
cd wlroots
|
||||
meson build -Dprefix=/usr
|
||||
sudo ninja -C build install
|
||||
@@ -119,7 +119,7 @@ sudo ninja -C build install
|
||||
|
||||
## Suggested Tools
|
||||
|
||||
### integrated component
|
||||
### Hybrid component
|
||||
- [dms-shell](https://github.com/AvengeMedia/DankMaterialShell)
|
||||
|
||||
### Independent component
|
||||
|
||||
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 ++ [];
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -255,8 +259,12 @@ void client_draw_shadow(Client *c) {
|
||||
return;
|
||||
|
||||
if (!shadows || (!c->isfloating && shadow_only_floating)) {
|
||||
wlr_scene_shadow_set_size(c->shadow, 0, 0);
|
||||
if (c->shadow->node.enabled)
|
||||
wlr_scene_node_set_enabled(&c->shadow->node, false);
|
||||
return;
|
||||
} else {
|
||||
if (c->scene_surface->node.enabled && !c->shadow->node.enabled)
|
||||
wlr_scene_node_set_enabled(&c->shadow->node, true);
|
||||
}
|
||||
|
||||
bool hit_no_border = check_hit_no_border(c);
|
||||
@@ -345,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;
|
||||
@@ -529,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});
|
||||
@@ -566,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) {
|
||||
@@ -987,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;
|
||||
}
|
||||
// 如果不是工作区切换时划出去的窗口,就让动画的结束位置,就是上面的真实位置和大小
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -356,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;
|
||||
|
||||
@@ -69,6 +69,7 @@ typedef struct {
|
||||
int isunglobal;
|
||||
int isglobal;
|
||||
int isoverlay;
|
||||
int allow_shortcuts_inhibit;
|
||||
int ignore_maximize;
|
||||
int ignore_minimize;
|
||||
int isnosizehint;
|
||||
@@ -77,6 +78,7 @@ typedef struct {
|
||||
int offsety;
|
||||
int width;
|
||||
int height;
|
||||
int nofocus;
|
||||
int nofadein;
|
||||
int nofadeout;
|
||||
int no_force_center;
|
||||
@@ -193,6 +195,7 @@ typedef struct {
|
||||
int scroller_structs;
|
||||
float scroller_default_proportion;
|
||||
float scroller_default_proportion_single;
|
||||
int scroller_ignore_proportion_single;
|
||||
int scroller_focus_center;
|
||||
int scroller_prefer_center;
|
||||
int edge_scroller_pointer_focus;
|
||||
@@ -334,6 +337,7 @@ typedef struct {
|
||||
int syncobj_enable;
|
||||
int adaptive_sync;
|
||||
int allow_tearing;
|
||||
int allow_shortcuts_inhibit;
|
||||
|
||||
struct xkb_rule_names xkb_rules;
|
||||
|
||||
@@ -886,9 +890,6 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value,
|
||||
} else if (strcmp(func_name, "set_proportion") == 0) {
|
||||
func = set_proportion;
|
||||
(*arg).f = atof(arg_value);
|
||||
} else if (strcmp(func_name, "increase_proportion") == 0) {
|
||||
func = increase_proportion;
|
||||
(*arg).f = atof(arg_value);
|
||||
} else if (strcmp(func_name, "switch_proportion_preset") == 0) {
|
||||
func = switch_proportion_preset;
|
||||
} else if (strcmp(func_name, "viewtoleft") == 0) {
|
||||
@@ -1210,6 +1211,8 @@ void parse_option(Config *config, char *key, char *value) {
|
||||
config->scroller_default_proportion = atof(value);
|
||||
} else if (strcmp(key, "scroller_default_proportion_single") == 0) {
|
||||
config->scroller_default_proportion_single = atof(value);
|
||||
} else if (strcmp(key, "scroller_ignore_proportion_single") == 0) {
|
||||
config->scroller_ignore_proportion_single = atoi(value);
|
||||
} else if (strcmp(key, "scroller_focus_center") == 0) {
|
||||
config->scroller_focus_center = atoi(value);
|
||||
} else if (strcmp(key, "scroller_prefer_center") == 0) {
|
||||
@@ -1270,6 +1273,8 @@ void parse_option(Config *config, char *key, char *value) {
|
||||
config->adaptive_sync = atoi(value);
|
||||
} else if (strcmp(key, "allow_tearing") == 0) {
|
||||
config->allow_tearing = atoi(value);
|
||||
} else if (strcmp(key, "allow_shortcuts_inhibit") == 0) {
|
||||
config->allow_shortcuts_inhibit = 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) {
|
||||
@@ -1707,6 +1712,7 @@ void parse_option(Config *config, char *key, char *value) {
|
||||
rule->isunglobal = -1;
|
||||
rule->isglobal = -1;
|
||||
rule->isoverlay = -1;
|
||||
rule->allow_shortcuts_inhibit = -1;
|
||||
rule->ignore_maximize = -1;
|
||||
rule->ignore_minimize = -1;
|
||||
rule->isnosizehint = -1;
|
||||
@@ -1716,6 +1722,7 @@ void parse_option(Config *config, char *key, char *value) {
|
||||
rule->force_tearing = -1;
|
||||
rule->noswallow = -1;
|
||||
rule->noblur = -1;
|
||||
rule->nofocus = -1;
|
||||
rule->nofadein = -1;
|
||||
rule->nofadeout = -1;
|
||||
rule->no_force_center = -1;
|
||||
@@ -1770,6 +1777,8 @@ void parse_option(Config *config, char *key, char *value) {
|
||||
rule->offsetx = atoi(val);
|
||||
} else if (strcmp(key, "offsety") == 0) {
|
||||
rule->offsety = atoi(val);
|
||||
} else if (strcmp(key, "nofocus") == 0) {
|
||||
rule->nofocus = atoi(val);
|
||||
} else if (strcmp(key, "nofadein") == 0) {
|
||||
rule->nofadein = atoi(val);
|
||||
} else if (strcmp(key, "nofadeout") == 0) {
|
||||
@@ -1802,6 +1811,8 @@ void parse_option(Config *config, char *key, char *value) {
|
||||
rule->focused_opacity = atof(val);
|
||||
} else if (strcmp(key, "isoverlay") == 0) {
|
||||
rule->isoverlay = atoi(val);
|
||||
} else if (strcmp(key, "allow_shortcuts_inhibit") == 0) {
|
||||
rule->allow_shortcuts_inhibit = atoi(val);
|
||||
} else if (strcmp(key, "ignore_maximize") == 0) {
|
||||
rule->ignore_maximize = atoi(val);
|
||||
} else if (strcmp(key, "ignore_minimize") == 0) {
|
||||
@@ -2665,6 +2676,8 @@ void override_config(void) {
|
||||
CLAMP_FLOAT(config.scroller_default_proportion, 0.1f, 1.0f);
|
||||
scroller_default_proportion_single =
|
||||
CLAMP_FLOAT(config.scroller_default_proportion_single, 0.1f, 1.0f);
|
||||
scroller_ignore_proportion_single =
|
||||
CLAMP_INT(config.scroller_ignore_proportion_single, 0, 1);
|
||||
scroller_focus_center = CLAMP_INT(config.scroller_focus_center, 0, 1);
|
||||
scroller_prefer_center = CLAMP_INT(config.scroller_prefer_center, 0, 1);
|
||||
edge_scroller_pointer_focus =
|
||||
@@ -2690,6 +2703,7 @@ void override_config(void) {
|
||||
syncobj_enable = CLAMP_INT(config.syncobj_enable, 0, 1);
|
||||
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);
|
||||
axis_bind_apply_timeout =
|
||||
CLAMP_INT(config.axis_bind_apply_timeout, 0, 1000);
|
||||
focus_on_activate = CLAMP_INT(config.focus_on_activate, 0, 1);
|
||||
@@ -2852,6 +2866,8 @@ void set_value_default() {
|
||||
config.scroller_default_proportion = scroller_default_proportion;
|
||||
config.scroller_default_proportion_single =
|
||||
scroller_default_proportion_single;
|
||||
config.scroller_ignore_proportion_single =
|
||||
scroller_ignore_proportion_single;
|
||||
config.scroller_focus_center = scroller_focus_center;
|
||||
config.scroller_prefer_center = scroller_prefer_center;
|
||||
config.edge_scroller_pointer_focus = edge_scroller_pointer_focus;
|
||||
@@ -2865,6 +2881,7 @@ void set_value_default() {
|
||||
config.syncobj_enable = syncobj_enable;
|
||||
config.adaptive_sync = adaptive_sync;
|
||||
config.allow_tearing = allow_tearing;
|
||||
config.allow_shortcuts_inhibit = allow_shortcuts_inhibit;
|
||||
config.no_border_when_single = no_border_when_single;
|
||||
config.no_radius_when_single = no_radius_when_single;
|
||||
config.snap_distance = snap_distance;
|
||||
|
||||
@@ -60,6 +60,7 @@ float scratchpad_height_ratio = 0.9;
|
||||
int scroller_structs = 20;
|
||||
float scroller_default_proportion = 0.9;
|
||||
float scroller_default_proportion_single = 1.0;
|
||||
int scroller_ignore_proportion_single = 0;
|
||||
int scroller_focus_center = 0;
|
||||
int scroller_prefer_center = 0;
|
||||
int focus_cross_monitor = 0;
|
||||
@@ -104,6 +105,7 @@ int syncobj_enable = 0;
|
||||
int adaptive_sync = 0;
|
||||
double drag_refresh_interval = 30.0;
|
||||
int allow_tearing = TEARING_DISABLED;
|
||||
int allow_shortcuts_inhibit = SHORTCUTS_INHIBIT_ENABLE;
|
||||
|
||||
/* keyboard */
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ int toggle_scratchpad(const Arg *arg);
|
||||
int focusdir(const Arg *arg);
|
||||
int toggleoverview(const Arg *arg);
|
||||
int set_proportion(const Arg *arg);
|
||||
int increase_proportion(const Arg *arg);
|
||||
int switch_proportion_preset(const Arg *arg);
|
||||
int zoom(const Arg *arg);
|
||||
int tagsilent(const Arg *arg);
|
||||
|
||||
@@ -281,18 +281,6 @@ int incovgaps(const Arg *arg) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int increase_proportion(const Arg *arg) {
|
||||
if (selmon->sel) {
|
||||
unsigned int max_client_width =
|
||||
selmon->w.width - 2 * scroller_structs - gappih;
|
||||
selmon->sel->scroller_proportion =
|
||||
MIN(MAX(arg->f + selmon->sel->scroller_proportion, 0.1), 1.0);
|
||||
selmon->sel->geom.width = max_client_width * arg->f;
|
||||
arrange(selmon, false);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int setmfact(const Arg *arg) {
|
||||
float f;
|
||||
Client *c = NULL;
|
||||
@@ -530,6 +518,14 @@ int setkeymode(const Arg *arg) {
|
||||
}
|
||||
|
||||
int set_proportion(const Arg *arg) {
|
||||
|
||||
if (selmon->isoverview || !is_scroller_layout(selmon))
|
||||
return 0;
|
||||
|
||||
if (selmon->visible_tiling_clients == 1 &&
|
||||
!scroller_ignore_proportion_single)
|
||||
return 0;
|
||||
|
||||
if (selmon->sel) {
|
||||
unsigned int max_client_width =
|
||||
selmon->w.width - 2 * scroller_structs - gappih;
|
||||
@@ -931,6 +927,13 @@ int switch_proportion_preset(const Arg *arg) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (selmon->isoverview || !is_scroller_layout(selmon))
|
||||
return 0;
|
||||
|
||||
if (selmon->visible_tiling_clients == 1 &&
|
||||
!scroller_ignore_proportion_single)
|
||||
return 0;
|
||||
|
||||
if (selmon->sel) {
|
||||
|
||||
for (int i = 0; i < config.scroller_proportion_preset_count; i++) {
|
||||
|
||||
@@ -47,6 +47,11 @@ static void handle_ext_workspace_activate(struct wl_listener *listener,
|
||||
void *data) {
|
||||
struct workspace *workspace =
|
||||
wl_container_of(listener, workspace, activate);
|
||||
|
||||
if (workspace->m->isoverview) {
|
||||
return;
|
||||
}
|
||||
|
||||
goto_workspace(workspace);
|
||||
wlr_log(WLR_INFO, "ext activating workspace %d", workspace->tag);
|
||||
}
|
||||
@@ -55,6 +60,11 @@ static void handle_ext_workspace_deactivate(struct wl_listener *listener,
|
||||
void *data) {
|
||||
struct workspace *workspace =
|
||||
wl_container_of(listener, workspace, deactivate);
|
||||
|
||||
if (workspace->m->isoverview) {
|
||||
return;
|
||||
}
|
||||
|
||||
toggle_workspace(workspace);
|
||||
wlr_log(WLR_INFO, "ext deactivating workspace %d", workspace->tag);
|
||||
}
|
||||
|
||||
@@ -374,6 +374,10 @@ void resize_tile_scroller(Client *grabc, bool isdrag, int offsetx, int offsety,
|
||||
float delta_x, delta_y;
|
||||
float new_scroller_proportion;
|
||||
|
||||
if (grabc && grabc->mon->visible_tiling_clients == 1 &&
|
||||
!scroller_ignore_proportion_single)
|
||||
return;
|
||||
|
||||
if (!start_drag_window && isdrag) {
|
||||
drag_begin_cursorx = cursor->x;
|
||||
drag_begin_cursory = cursor->y;
|
||||
@@ -475,6 +479,9 @@ void resize_tile_client(Client *grabc, bool isdrag, int offsetx, int offsety,
|
||||
if (!grabc || grabc->isfullscreen || grabc->ismaximizescreen)
|
||||
return;
|
||||
|
||||
if (grabc->mon->isoverview)
|
||||
return;
|
||||
|
||||
const Layout *current_layout =
|
||||
grabc->mon->pertag->ltidxs[grabc->mon->pertag->curtag];
|
||||
if (current_layout->id == TILE || current_layout->id == DECK ||
|
||||
|
||||
@@ -231,7 +231,7 @@ void scroller(Monitor *m) {
|
||||
}
|
||||
}
|
||||
|
||||
if (n == 1) {
|
||||
if (n == 1 && !scroller_ignore_proportion_single) {
|
||||
c = tempClients[0];
|
||||
target_geom.height = m->w.height - 2 * cur_gappov;
|
||||
target_geom.width =
|
||||
@@ -274,6 +274,10 @@ void scroller(Monitor *m) {
|
||||
}
|
||||
}
|
||||
|
||||
if (n == 1 && scroller_ignore_proportion_single) {
|
||||
need_scroller = true;
|
||||
}
|
||||
|
||||
if (start_drag_window)
|
||||
need_scroller = false;
|
||||
|
||||
|
||||
@@ -192,7 +192,7 @@ void vertical_scroller(Monitor *m) {
|
||||
}
|
||||
}
|
||||
|
||||
if (n == 1) {
|
||||
if (n == 1 && !scroller_ignore_proportion_single) {
|
||||
c = tempClients[0];
|
||||
target_geom.width = m->w.width - 2 * cur_gappoh;
|
||||
target_geom.height =
|
||||
@@ -235,6 +235,13 @@ void vertical_scroller(Monitor *m) {
|
||||
}
|
||||
}
|
||||
|
||||
if (n == 1 && scroller_ignore_proportion_single) {
|
||||
need_scroller = true;
|
||||
}
|
||||
|
||||
if (start_drag_window)
|
||||
need_scroller = false;
|
||||
|
||||
target_geom.width = m->w.width - 2 * cur_gappoh;
|
||||
target_geom.height = max_client_height * c->scroller_proportion;
|
||||
target_geom.x = m->w.x + (m->w.width - target_geom.width) / 2;
|
||||
|
||||
178
src/mango.c
178
src/mango.c
@@ -48,6 +48,7 @@
|
||||
#include <wlr/types/wlr_input_device.h>
|
||||
#include <wlr/types/wlr_keyboard.h>
|
||||
#include <wlr/types/wlr_keyboard_group.h>
|
||||
#include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h>
|
||||
#include <wlr/types/wlr_layer_shell_v1.h>
|
||||
#include <wlr/types/wlr_linux_dmabuf_v1.h>
|
||||
#include <wlr/types/wlr_linux_drm_syncobj_v1.h>
|
||||
@@ -172,6 +173,11 @@ enum tearing_mode {
|
||||
TEARING_FULLSCREEN_ONLY,
|
||||
};
|
||||
|
||||
enum seat_config_shortcuts_inhibit {
|
||||
SHORTCUTS_INHIBIT_DISABLE,
|
||||
SHORTCUTS_INHIBIT_ENABLE,
|
||||
};
|
||||
|
||||
typedef struct Pertag Pertag;
|
||||
typedef struct Monitor Monitor;
|
||||
typedef struct Client Client;
|
||||
@@ -276,6 +282,7 @@ struct Client {
|
||||
struct wlr_scene_tree *scene;
|
||||
struct wlr_scene_rect *border; /* top, bottom, left, right */
|
||||
struct wlr_scene_shadow *shadow;
|
||||
struct wlr_scene_blur *blur;
|
||||
struct wlr_scene_tree *scene_surface;
|
||||
struct wl_list link;
|
||||
struct wl_list flink;
|
||||
@@ -352,6 +359,7 @@ struct Client {
|
||||
bool drag_to_tile;
|
||||
bool scratchpad_switching_mon;
|
||||
bool fake_no_border;
|
||||
int nofocus;
|
||||
int nofadein;
|
||||
int nofadeout;
|
||||
int no_force_center;
|
||||
@@ -368,6 +376,7 @@ struct Client {
|
||||
bool isleftstack;
|
||||
int tearing_hint;
|
||||
int force_tearing;
|
||||
int allow_shortcuts_inhibit;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
@@ -397,6 +406,12 @@ typedef struct {
|
||||
struct wl_listener destroy;
|
||||
} KeyboardGroup;
|
||||
|
||||
typedef struct {
|
||||
struct wlr_keyboard_shortcuts_inhibitor_v1 *inhibitor;
|
||||
struct wl_listener destroy;
|
||||
struct wl_list link;
|
||||
} KeyboardShortcutsInhibitor;
|
||||
|
||||
typedef struct {
|
||||
/* Must keep these three elements in this order */
|
||||
unsigned int type; /* LayerShell */
|
||||
@@ -405,6 +420,7 @@ typedef struct {
|
||||
struct wlr_scene_tree *scene;
|
||||
struct wlr_scene_tree *popups;
|
||||
struct wlr_scene_shadow *shadow;
|
||||
struct wlr_scene_blur *blur;
|
||||
struct wlr_scene_layer_surface_v1 *scene_layer;
|
||||
struct wl_list link;
|
||||
struct wl_list fadeout_link;
|
||||
@@ -621,7 +637,9 @@ static void urgent(struct wl_listener *listener, void *data);
|
||||
static void view(const Arg *arg, bool want_animation);
|
||||
|
||||
static void handlesig(int signo);
|
||||
|
||||
static void
|
||||
handle_keyboard_shortcuts_inhibit_new_inhibitor(struct wl_listener *listener,
|
||||
void *data);
|
||||
static void virtualkeyboard(struct wl_listener *listener, void *data);
|
||||
static void virtualpointer(struct wl_listener *listener, void *data);
|
||||
static void warp_cursor(const Client *c);
|
||||
@@ -749,6 +767,8 @@ static struct wlr_idle_inhibit_manager_v1 *idle_inhibit_mgr;
|
||||
static struct wlr_layer_shell_v1 *layer_shell;
|
||||
static struct wlr_output_manager_v1 *output_mgr;
|
||||
static struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard_mgr;
|
||||
static struct wlr_keyboard_shortcuts_inhibit_manager_v1
|
||||
*keyboard_shortcuts_inhibit;
|
||||
static struct wlr_virtual_pointer_manager_v1 *virtual_pointer_mgr;
|
||||
static struct wlr_output_power_manager_v1 *power_mgr;
|
||||
static struct wlr_pointer_gestures_v1 *pointer_gestures;
|
||||
@@ -772,6 +792,7 @@ static struct wlr_pointer_constraint_v1 *active_constraint;
|
||||
static struct wlr_seat *seat;
|
||||
static KeyboardGroup *kb_group;
|
||||
static struct wl_list inputdevices;
|
||||
static struct wl_list keyboard_shortcut_inhibitors;
|
||||
static unsigned int cursor_mode;
|
||||
static Client *grabc;
|
||||
static int grabcx, grabcy; /* client-relative */
|
||||
@@ -858,6 +879,8 @@ static struct wl_listener request_start_drag = {.notify = requeststartdrag};
|
||||
static struct wl_listener start_drag = {.notify = startdrag};
|
||||
static struct wl_listener new_session_lock = {.notify = locksession};
|
||||
static struct wl_listener drm_lease_request = {.notify = requestdrmlease};
|
||||
static struct wl_listener keyboard_shortcuts_inhibit_new_inhibitor = {
|
||||
.notify = handle_keyboard_shortcuts_inhibit_new_inhibitor};
|
||||
|
||||
#ifdef XWAYLAND
|
||||
static void activatex11(struct wl_listener *listener, void *data);
|
||||
@@ -1130,6 +1153,7 @@ static void apply_rule_properties(Client *c, const ConfigWinRule *r) {
|
||||
APPLY_INT_PROP(c, r, force_maximize);
|
||||
APPLY_INT_PROP(c, r, force_tearing);
|
||||
APPLY_INT_PROP(c, r, noswallow);
|
||||
APPLY_INT_PROP(c, r, nofocus);
|
||||
APPLY_INT_PROP(c, r, nofadein);
|
||||
APPLY_INT_PROP(c, r, nofadeout);
|
||||
APPLY_INT_PROP(c, r, no_force_center);
|
||||
@@ -1148,6 +1172,7 @@ static void apply_rule_properties(Client *c, const ConfigWinRule *r) {
|
||||
APPLY_INT_PROP(c, r, isnosizehint);
|
||||
APPLY_INT_PROP(c, r, isunglobal);
|
||||
APPLY_INT_PROP(c, r, noblur);
|
||||
APPLY_INT_PROP(c, r, allow_shortcuts_inhibit);
|
||||
|
||||
APPLY_FLOAT_PROP(c, r, scroller_proportion);
|
||||
APPLY_FLOAT_PROP(c, r, focused_opacity);
|
||||
@@ -1243,11 +1268,16 @@ void applyrules(Client *c) {
|
||||
const char *appid, *title;
|
||||
unsigned int i, newtags = 0;
|
||||
const ConfigWinRule *r;
|
||||
Monitor *mon = selmon, *m = NULL;
|
||||
Monitor *m = NULL;
|
||||
Client *fc = NULL;
|
||||
bool hit_rule_pos = false;
|
||||
Client *parent = NULL;
|
||||
|
||||
c->isfloating = client_is_float_type(c);
|
||||
parent = client_get_parent(c);
|
||||
|
||||
Monitor *mon = parent && parent->mon ? parent->mon : selmon;
|
||||
|
||||
c->isfloating = client_is_float_type(c) || parent;
|
||||
if (!(appid = client_get_appid(c)))
|
||||
appid = broken;
|
||||
if (!(title = client_get_title(c)))
|
||||
@@ -1264,8 +1294,12 @@ void applyrules(Client *c) {
|
||||
// set general properties
|
||||
apply_rule_properties(c, r);
|
||||
|
||||
// set tags
|
||||
newtags |= (r->tags > 0) ? r->tags : 0;
|
||||
// // set tags
|
||||
if (r->tags > 0) {
|
||||
newtags |= r->tags;
|
||||
} else if (parent) {
|
||||
newtags = parent->tags;
|
||||
}
|
||||
|
||||
// set monitor of client
|
||||
wl_list_for_each(m, &mons, link) {
|
||||
@@ -1334,8 +1368,9 @@ void applyrules(Client *c) {
|
||||
|
||||
int fullscreen_state_backup = c->isfullscreen || client_wants_fullscreen(c);
|
||||
setmon(c, mon, newtags,
|
||||
!c->isopensilent && (!c->istagsilent || !newtags ||
|
||||
newtags & mon->tagset[mon->seltags]));
|
||||
!c->isopensilent && !client_should_ignore_focus(c) &&
|
||||
(!c->istagsilent || !newtags ||
|
||||
newtags & mon->tagset[mon->seltags]));
|
||||
|
||||
if (c->mon &&
|
||||
!(c->mon == selmon && c->tags & c->mon->tagset[c->mon->seltags]) &&
|
||||
@@ -1964,8 +1999,11 @@ void cleanuplisteners(void) {
|
||||
wl_list_remove(&request_start_drag.link);
|
||||
wl_list_remove(&start_drag.link);
|
||||
wl_list_remove(&new_session_lock.link);
|
||||
wl_list_remove(&drm_lease_request.link);
|
||||
wl_list_remove(&tearing_new_object.link);
|
||||
wl_list_remove(&keyboard_shortcuts_inhibit_new_inhibitor.link);
|
||||
if (drm_lease_manager) {
|
||||
wl_list_remove(&drm_lease_request.link);
|
||||
}
|
||||
#ifdef XWAYLAND
|
||||
wl_list_remove(&new_xwayland_surface.link);
|
||||
wl_list_remove(&xwayland_ready.link);
|
||||
@@ -2081,12 +2119,16 @@ static void iter_layer_scene_buffers(struct wlr_scene_buffer *buffer, int sx,
|
||||
return;
|
||||
}
|
||||
|
||||
wlr_scene_buffer_set_backdrop_blur(buffer, true);
|
||||
wlr_scene_buffer_set_backdrop_blur_ignore_transparent(buffer, true);
|
||||
LayerSurface *l = (LayerSurface *)user_data;
|
||||
|
||||
wlr_scene_node_set_enabled(&l->blur->node, true);
|
||||
wlr_scene_blur_set_transparency_mask_source(l->blur, buffer);
|
||||
wlr_scene_blur_set_size(l->blur, l->geom.width, l->geom.height);
|
||||
|
||||
if (blur_optimized) {
|
||||
wlr_scene_buffer_set_backdrop_blur_optimized(buffer, true);
|
||||
wlr_scene_blur_set_should_only_blur_bottom_layer(l->blur, true);
|
||||
} else {
|
||||
wlr_scene_buffer_set_backdrop_blur_optimized(buffer, false);
|
||||
wlr_scene_blur_set_should_only_blur_bottom_layer(l->blur, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2131,13 +2173,17 @@ void maplayersurfacenotify(struct wl_listener *listener, void *data) {
|
||||
}
|
||||
|
||||
// 初始化阴影
|
||||
if (layer_surface->current.exclusive_zone == 0 &&
|
||||
layer_surface->current.layer != ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM &&
|
||||
if (layer_surface->current.layer != ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM &&
|
||||
layer_surface->current.layer != ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND) {
|
||||
l->shadow = wlr_scene_shadow_create(l->scene, 0, 0, border_radius,
|
||||
shadows_blur, shadowscolor);
|
||||
wlr_scene_node_lower_to_bottom(&l->shadow->node);
|
||||
wlr_scene_node_set_enabled(&l->shadow->node, true);
|
||||
if (layer_surface->current.exclusive_zone == 0) {
|
||||
l->shadow = wlr_scene_shadow_create(l->scene, 0, 0, border_radius,
|
||||
shadows_blur, shadowscolor);
|
||||
wlr_scene_node_lower_to_bottom(&l->shadow->node);
|
||||
wlr_scene_node_set_enabled(&l->shadow->node, true);
|
||||
}
|
||||
|
||||
l->blur = wlr_scene_blur_create(l->scene, 0, 0);
|
||||
wlr_scene_node_lower_to_bottom(&l->blur->node);
|
||||
}
|
||||
|
||||
// 初始化动画
|
||||
@@ -2194,7 +2240,8 @@ void commitlayersurfacenotify(struct wl_listener *listener, void *data) {
|
||||
if (!l->noblur &&
|
||||
layer_surface->current.layer != ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM &&
|
||||
layer_surface->current.layer !=
|
||||
ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND) {
|
||||
ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND &&
|
||||
l->blur) {
|
||||
|
||||
wlr_scene_node_for_each_buffer(&l->scene->node,
|
||||
iter_layer_scene_buffers, l);
|
||||
@@ -3082,6 +3129,9 @@ void focusclient(Client *c, int lift) {
|
||||
if (c && client_should_ignore_focus(c) && client_is_x11_popup(c))
|
||||
return;
|
||||
|
||||
if (c && c->nofocus)
|
||||
return;
|
||||
|
||||
/* Raise client in stacking order if requested */
|
||||
if (c && lift)
|
||||
wlr_scene_node_raise_to_top(&c->scene->node); // 将视图提升到顶层
|
||||
@@ -3249,6 +3299,17 @@ int keyrepeat(void *data) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool is_keyboard_shortcut_inhibitor(struct wlr_surface *surface) {
|
||||
KeyboardShortcutsInhibitor *kbsinhibitor;
|
||||
|
||||
wl_list_for_each(kbsinhibitor, &keyboard_shortcut_inhibitors, link) {
|
||||
if (kbsinhibitor->inhibitor->surface == surface) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int // 17
|
||||
keybinding(unsigned int state, bool locked, unsigned int mods, xkb_keysym_t sym,
|
||||
unsigned int keycode) {
|
||||
@@ -3267,6 +3328,10 @@ keybinding(unsigned int state, bool locked, unsigned int mods, xkb_keysym_t sym,
|
||||
keycode == 62 || keycode == 108 || keycode == 105 || keycode == 134)
|
||||
return false;
|
||||
|
||||
if (is_keyboard_shortcut_inhibitor(seat->keyboard_state.focused_surface)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (ji = 0; ji < config.key_bindings_count; ji++) {
|
||||
if (config.key_bindings_count < 1)
|
||||
break;
|
||||
@@ -3521,15 +3586,15 @@ static void iter_xdg_scene_buffers(struct wlr_scene_buffer *buffer, int sx,
|
||||
return;
|
||||
|
||||
if (blur && c && !c->noblur) {
|
||||
wlr_scene_buffer_set_backdrop_blur(buffer, true);
|
||||
wlr_scene_buffer_set_backdrop_blur_ignore_transparent(buffer, false);
|
||||
wlr_scene_node_set_enabled(&c->blur->node, true);
|
||||
// wlr_scene_blur_set_transparency_mask_source(c->blur, buffer);
|
||||
if (blur_optimized) {
|
||||
wlr_scene_buffer_set_backdrop_blur_optimized(buffer, true);
|
||||
wlr_scene_blur_set_should_only_blur_bottom_layer(c->blur, true);
|
||||
} else {
|
||||
wlr_scene_buffer_set_backdrop_blur_optimized(buffer, false);
|
||||
wlr_scene_blur_set_should_only_blur_bottom_layer(c->blur, false);
|
||||
}
|
||||
} else {
|
||||
wlr_scene_buffer_set_backdrop_blur(buffer, false);
|
||||
wlr_scene_node_set_enabled(&c->blur->node, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3558,6 +3623,7 @@ void init_client_properties(Client *c) {
|
||||
c->fake_no_border = false;
|
||||
c->focused_opacity = focused_opacity;
|
||||
c->unfocused_opacity = unfocused_opacity;
|
||||
c->nofocus = 0;
|
||||
c->nofadein = 0;
|
||||
c->nofadeout = 0;
|
||||
c->no_force_center = 0;
|
||||
@@ -3573,12 +3639,12 @@ void init_client_properties(Client *c) {
|
||||
c->allow_csd = 0;
|
||||
c->force_maximize = 0;
|
||||
c->force_tearing = 0;
|
||||
c->allow_shortcuts_inhibit = SHORTCUTS_INHIBIT_ENABLE;
|
||||
}
|
||||
|
||||
void // old fix to 0.5
|
||||
mapnotify(struct wl_listener *listener, void *data) {
|
||||
/* Called when the surface is mapped, or ready to display on-screen. */
|
||||
Client *p = NULL;
|
||||
Client *at_client = NULL;
|
||||
Client *c = wl_container_of(listener, c, map);
|
||||
/* Create scene tree for this client and its border */
|
||||
@@ -3642,6 +3708,9 @@ mapnotify(struct wl_listener *listener, void *data) {
|
||||
c->shadow = wlr_scene_shadow_create(c->scene, 0, 0, border_radius,
|
||||
shadows_blur, shadowscolor);
|
||||
|
||||
c->blur = wlr_scene_blur_create(c->scene_surface, 0, 0);
|
||||
wlr_scene_node_lower_to_bottom(&c->blur->node);
|
||||
|
||||
wlr_scene_node_lower_to_bottom(&c->shadow->node);
|
||||
wlr_scene_node_set_enabled(&c->shadow->node, true);
|
||||
|
||||
@@ -3670,16 +3739,7 @@ mapnotify(struct wl_listener *listener, void *data) {
|
||||
wl_list_insert(clients.prev, &c->link); // 尾部入栈
|
||||
wl_list_insert(&fstack, &c->flink);
|
||||
|
||||
/* Set initial monitor, tags, floating status, and focus:
|
||||
* we always consider floating, clients that have parent and thus
|
||||
* we set the same tags and monitor than its parent, if not
|
||||
* try to apply rules for them */
|
||||
if ((p = client_get_parent(c))) {
|
||||
c->isfloating = 1;
|
||||
setmon(c, p->mon, p->tags, true);
|
||||
} else {
|
||||
applyrules(c);
|
||||
}
|
||||
applyrules(c);
|
||||
|
||||
client_set_tiled(c, WLR_EDGE_TOP | WLR_EDGE_BOTTOM | WLR_EDGE_LEFT |
|
||||
WLR_EDGE_RIGHT);
|
||||
@@ -4995,6 +5055,7 @@ void setup(void) {
|
||||
* to let us know when new input devices are available on the backend.
|
||||
*/
|
||||
wl_list_init(&inputdevices);
|
||||
wl_list_init(&keyboard_shortcut_inhibitors);
|
||||
wl_signal_add(&backend->events.new_input, &new_input_device);
|
||||
virtual_keyboard_mgr = wlr_virtual_keyboard_manager_v1_create(dpy);
|
||||
wl_signal_add(&virtual_keyboard_mgr->events.new_virtual_keyboard,
|
||||
@@ -5024,6 +5085,10 @@ void setup(void) {
|
||||
kb_group = createkeyboardgroup();
|
||||
wl_list_init(&kb_group->destroy.link);
|
||||
|
||||
keyboard_shortcuts_inhibit = wlr_keyboard_shortcuts_inhibit_v1_create(dpy);
|
||||
wl_signal_add(&keyboard_shortcuts_inhibit->events.new_inhibitor,
|
||||
&keyboard_shortcuts_inhibit_new_inhibitor);
|
||||
|
||||
output_mgr = wlr_output_manager_v1_create(dpy);
|
||||
wl_signal_add(&output_mgr->events.apply, &output_mgr_apply);
|
||||
wl_signal_add(&output_mgr->events.test, &output_mgr_test);
|
||||
@@ -5551,6 +5616,49 @@ void view(const Arg *arg, bool want_animation) {
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
handle_keyboard_shortcuts_inhibitor_destroy(struct wl_listener *listener,
|
||||
void *data) {
|
||||
KeyboardShortcutsInhibitor *inhibitor =
|
||||
wl_container_of(listener, inhibitor, destroy);
|
||||
|
||||
wlr_log(WLR_DEBUG, "Removing keyboard shortcuts inhibitor");
|
||||
|
||||
wl_list_remove(&inhibitor->link);
|
||||
wl_list_remove(&inhibitor->destroy.link);
|
||||
free(inhibitor);
|
||||
}
|
||||
|
||||
void handle_keyboard_shortcuts_inhibit_new_inhibitor(
|
||||
struct wl_listener *listener, void *data) {
|
||||
|
||||
struct wlr_keyboard_shortcuts_inhibitor_v1 *inhibitor = data;
|
||||
|
||||
if (allow_shortcuts_inhibit == SHORTCUTS_INHIBIT_DISABLE) {
|
||||
return;
|
||||
}
|
||||
|
||||
// per-view, seat-agnostic config via criteria
|
||||
Client *c = get_client_from_surface(inhibitor->surface);
|
||||
if (c && !c->allow_shortcuts_inhibit) {
|
||||
return;
|
||||
}
|
||||
|
||||
wlr_log(WLR_DEBUG, "Adding keyboard shortcuts inhibitor");
|
||||
|
||||
KeyboardShortcutsInhibitor *kbsinhibitor =
|
||||
calloc(1, sizeof(KeyboardShortcutsInhibitor));
|
||||
|
||||
kbsinhibitor->inhibitor = inhibitor;
|
||||
|
||||
kbsinhibitor->destroy.notify = handle_keyboard_shortcuts_inhibitor_destroy;
|
||||
wl_signal_add(&inhibitor->events.destroy, &kbsinhibitor->destroy);
|
||||
|
||||
wl_list_insert(&keyboard_shortcut_inhibitors, &kbsinhibitor->link);
|
||||
|
||||
wlr_keyboard_shortcuts_inhibitor_v1_activate(inhibitor);
|
||||
}
|
||||
|
||||
void virtualkeyboard(struct wl_listener *listener, void *data) {
|
||||
struct wlr_virtual_keyboard_v1 *kb = data;
|
||||
/* virtual keyboards shouldn't share keyboard group */
|
||||
|
||||
Reference in New Issue
Block a user