mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2025-11-07 13:29:59 -05:00
format code
This commit is contained in:
parent
ec2e5d5019
commit
f3ab9d87a5
1 changed files with 70 additions and 68 deletions
68
src/maomao.c
68
src/maomao.c
|
|
@ -232,7 +232,8 @@ struct Client {
|
|||
bool dirty;
|
||||
uint32_t configure_serial;
|
||||
struct wlr_foreign_toplevel_handle_v1 *foreign_toplevel;
|
||||
int isfloating, isurgent, isfullscreen, isfakefullscreen, need_float_size_reduce, isminied, isoverlay;
|
||||
int isfloating, isurgent, isfullscreen, isfakefullscreen,
|
||||
need_float_size_reduce, isminied, isoverlay;
|
||||
int ismaxmizescreen;
|
||||
int overview_backup_bw;
|
||||
int fullscreen_backup_x, fullscreen_backup_y, fullscreen_backup_w,
|
||||
|
|
@ -605,18 +606,19 @@ static struct wlr_box setclient_coordinate_center(struct wlr_box geom,
|
|||
static unsigned int get_tags_first_tag(unsigned int tags);
|
||||
|
||||
static void client_commit(Client *c);
|
||||
static void apply_border(Client *c, struct wlr_box clip_box, int offsetx, int offsety);
|
||||
static void apply_border(Client *c, struct wlr_box clip_box, int offsetx,
|
||||
int offsety);
|
||||
static void client_set_opacity(Client *c, double opacity);
|
||||
static void init_baked_points(void);
|
||||
static void scene_buffer_apply_opacity(struct wlr_scene_buffer *buffer, int sx, int sy,
|
||||
void *data);
|
||||
static void scene_buffer_apply_opacity(struct wlr_scene_buffer *buffer, int sx,
|
||||
int sy, void *data);
|
||||
|
||||
static Client *direction_select(const Arg *arg);
|
||||
static void view_in_mon(const Arg *arg, bool want_animation, Monitor *m);
|
||||
|
||||
static void buffer_set_effect(Client *c, animationScale scale_data);
|
||||
static void snap_scene_buffer_apply_effect(struct wlr_scene_buffer *buffer, int sx,
|
||||
int sy, void *data);
|
||||
static void snap_scene_buffer_apply_effect(struct wlr_scene_buffer *buffer,
|
||||
int sx, int sy, void *data);
|
||||
static void client_set_pending_state(Client *c);
|
||||
static void set_rect_size(struct wlr_scene_rect *rect, int width, int height);
|
||||
|
||||
|
|
@ -1249,11 +1251,11 @@ void toggleoverlay(const Arg *arg) {
|
|||
selmon->sel->isoverlay ^= 1;
|
||||
|
||||
if (selmon->sel->isoverlay) {
|
||||
wlr_scene_node_reparent(&selmon->sel->scene->node,
|
||||
layers[LyrOverlay]);
|
||||
wlr_scene_node_reparent(&selmon->sel->scene->node, layers[LyrOverlay]);
|
||||
wlr_scene_node_raise_to_top(&selmon->sel->scene->node);
|
||||
} else {
|
||||
wlr_scene_node_reparent(&selmon->sel->scene->node,
|
||||
wlr_scene_node_reparent(
|
||||
&selmon->sel->scene->node,
|
||||
layers[selmon->sel->isfloating ? LyrFloat : LyrTile]);
|
||||
}
|
||||
setborder_color(selmon->sel);
|
||||
|
|
@ -1789,12 +1791,10 @@ arrange(Monitor *m, bool want_animation) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if (c->mon == m && c->ismaxmizescreen
|
||||
&& !c->animation.tagouted && !c->animation.tagouting && VISIBLEON(c, m)) {
|
||||
if (c->mon == m && c->ismaxmizescreen && !c->animation.tagouted &&
|
||||
!c->animation.tagouting && VISIBLEON(c, m)) {
|
||||
reset_maxmizescreen_size(c);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 给全屏窗口设置背景为黑色
|
||||
|
|
@ -1854,8 +1854,10 @@ Client *center_select(Monitor *m) {
|
|||
|
||||
void apply_window_snap(Client *c) {
|
||||
int snap_up = 99999, snap_down = 99999, snap_left = 99999, snap_right = 99999;
|
||||
int snap_up_temp = 0 ,snap_down_temp = 0, snap_left_temp = 0, snap_right_temp = 0;
|
||||
int snap_up_screen = 0, snap_down_screen = 0, snap_left_screen = 0, snap_right_screen = 0;
|
||||
int snap_up_temp = 0, snap_down_temp = 0, snap_left_temp = 0,
|
||||
snap_right_temp = 0;
|
||||
int snap_up_screen = 0, snap_down_screen = 0, snap_left_screen = 0,
|
||||
snap_right_screen = 0;
|
||||
Client *tc;
|
||||
if (!c || !c->mon || !client_surface(c)->mapped || c->iskilling)
|
||||
return;
|
||||
|
|
@ -1863,13 +1865,15 @@ void apply_window_snap(Client *c) {
|
|||
if (!c->isfloating || !enable_floating_snap)
|
||||
return;
|
||||
|
||||
// 第一次遍历,计算客户端数量
|
||||
wl_list_for_each(tc, &clients, link) {
|
||||
if (tc && tc->isfloating && !tc->iskilling && client_surface(tc)->mapped && VISIBLEON(tc, c->mon)) {
|
||||
if (tc && tc->isfloating && !tc->iskilling && client_surface(tc)->mapped &&
|
||||
VISIBLEON(tc, c->mon)) {
|
||||
|
||||
snap_left_temp = c->geom.x - tc->geom.x - tc->geom.width;
|
||||
snap_right_temp = tc->geom.x - c->geom.x - c->geom.width;
|
||||
snap_up_temp = c->geom.y - tc->geom.y - tc->geom.height;
|
||||
snap_down_temp = tc->geom.y - c->geom.y - c->geom.height;
|
||||
|
||||
if (snap_left_temp < snap_left && snap_left_temp >= 0) {
|
||||
snap_left = snap_left_temp;
|
||||
}
|
||||
|
|
@ -1888,7 +1892,8 @@ void apply_window_snap(Client *c) {
|
|||
snap_left_screen = c->geom.x - c->mon->m.x;
|
||||
snap_right_screen = c->mon->m.x + c->mon->m.width - c->geom.x - c->geom.width;
|
||||
snap_up_screen = c->geom.y - c->mon->m.y;
|
||||
snap_down_screen = c->mon->m.y + c->mon->m.height - c->geom.y - c->geom.height;
|
||||
snap_down_screen =
|
||||
c->mon->m.y + c->mon->m.height - c->geom.y - c->geom.height;
|
||||
|
||||
if (snap_up_screen > 0 && snap_up_screen < snap_up)
|
||||
snap_up = snap_up_screen;
|
||||
|
|
@ -1916,7 +1921,6 @@ void apply_window_snap(Client *c) {
|
|||
}
|
||||
|
||||
resize(c, c->geom, 1);
|
||||
|
||||
}
|
||||
|
||||
Client *find_client_by_direction(Client *tc, const Arg *arg, bool findfloating,
|
||||
|
|
@ -4567,15 +4571,18 @@ void scene_buffer_apply_effect(struct wlr_scene_buffer *buffer, int sx, int sy,
|
|||
void *data) {
|
||||
animationScale *scale_data = (animationScale *)data;
|
||||
|
||||
if (scale_data->should_scale && scale_data->height_scale < 1 && scale_data->width_scale < 1) {
|
||||
if (scale_data->should_scale && scale_data->height_scale < 1 &&
|
||||
scale_data->width_scale < 1) {
|
||||
scale_data->should_scale = false;
|
||||
}
|
||||
|
||||
if (scale_data->should_scale && scale_data->height_scale == 1 && scale_data->width_scale < 1) {
|
||||
if (scale_data->should_scale && scale_data->height_scale == 1 &&
|
||||
scale_data->width_scale < 1) {
|
||||
scale_data->should_scale = false;
|
||||
}
|
||||
|
||||
if (scale_data->should_scale && scale_data->height_scale < 1 && scale_data->width_scale == 1) {
|
||||
if (scale_data->should_scale && scale_data->height_scale < 1 &&
|
||||
scale_data->width_scale == 1) {
|
||||
scale_data->should_scale = false;
|
||||
}
|
||||
|
||||
|
|
@ -4614,7 +4621,6 @@ void scene_buffer_apply_effect(struct wlr_scene_buffer *buffer, int sx, int sy,
|
|||
}
|
||||
}
|
||||
// TODO: blur set, opacity set
|
||||
|
||||
}
|
||||
|
||||
void snap_scene_buffer_apply_effect(struct wlr_scene_buffer *buffer, int sx,
|
||||
|
|
@ -4630,7 +4636,8 @@ void buffer_set_effect(Client *c, animationScale data) {
|
|||
data.should_scale = false;
|
||||
}
|
||||
|
||||
if(client_is_x11(c) && c->current.height >= c->animation.current.height && c->current.width >= c->animation.current.width) {
|
||||
if (client_is_x11(c) && c->current.height >= c->animation.current.height &&
|
||||
c->current.width >= c->animation.current.width) {
|
||||
data.should_scale = false;
|
||||
}
|
||||
|
||||
|
|
@ -4909,8 +4916,8 @@ void resize(Client *c, struct wlr_box geo, int interact) {
|
|||
client_set_opacity(c, 1);
|
||||
}
|
||||
|
||||
if (c->animation.action == OPEN && !c->animation.tagining
|
||||
&& !c->animation.tagouting && wlr_box_equal(&c->geom, &c->current)) {
|
||||
if (c->animation.action == OPEN && !c->animation.tagining &&
|
||||
!c->animation.tagouting && wlr_box_equal(&c->geom, &c->current)) {
|
||||
c->animation.action = c->animation.action;
|
||||
} else if (c->animation.tagouting) {
|
||||
c->animation.duration = animation_duration_tag;
|
||||
|
|
@ -5124,7 +5131,6 @@ void reset_maxmizescreen_size(Client *c) {
|
|||
resize(c, c->geom, 0);
|
||||
}
|
||||
|
||||
|
||||
void setmaxmizescreen(Client *c, int maxmizescreen) {
|
||||
struct wlr_box maxmizescreen_box;
|
||||
if (!c || !c->mon || !client_surface(c)->mapped || c->iskilling)
|
||||
|
|
@ -5164,9 +5170,7 @@ void setmaxmizescreen(Client *c, int maxmizescreen) {
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
setfakefullscreen(Client *c, int fakefullscreen)
|
||||
{
|
||||
void setfakefullscreen(Client *c, int fakefullscreen) {
|
||||
c->isfakefullscreen = fakefullscreen;
|
||||
if (!c->mon)
|
||||
return;
|
||||
|
|
@ -6442,9 +6446,7 @@ void togglefloating(const Arg *arg) {
|
|||
setborder_color(sel);
|
||||
}
|
||||
|
||||
void
|
||||
togglefakefullscreen(const Arg *arg)
|
||||
{
|
||||
void togglefakefullscreen(const Arg *arg) {
|
||||
Client *sel = focustop(selmon);
|
||||
if (sel)
|
||||
setfakefullscreen(sel, !sel->isfakefullscreen);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue