Skip to content

Commit

Permalink
Code format fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pijulius committed Jun 5, 2024
1 parent 400e517 commit 9df22a4
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 25 deletions.
9 changes: 6 additions & 3 deletions src/config_libconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -688,11 +688,14 @@ bool parse_config_libconfig(options_t *opt, const char *config_file) {
// -e (frame_opacity)
config_lookup_float(&cfg, "frame-opacity", &opt->frame_opacity);
// --frame-opacity-for-same-colors
lcfg_lookup_bool(&cfg, "frame-opacity-for-same-colors", &opt->frame_opacity_for_same_colors);
lcfg_lookup_bool(&cfg, "frame-opacity-for-same-colors",
&opt->frame_opacity_for_same_colors);
// --frame-opacity-for-same-colors-tolerance
config_lookup_float(&cfg, "frame-opacity-for-same-colors-tolerance", &opt->frame_opacity_for_same_colors_tolerance);
config_lookup_float(&cfg, "frame-opacity-for-same-colors-tolerance",
&opt->frame_opacity_for_same_colors_tolerance);
// --frame-opacity-for-same-colors-multiplier
config_lookup_int(&cfg, "frame-opacity-for-same-colors-multiplier", &opt->frame_opacity_for_same_colors_multiplier);
config_lookup_int(&cfg, "frame-opacity-for-same-colors-multiplier",
&opt->frame_opacity_for_same_colors_multiplier);
// -c (shadow_enable)
lcfg_lookup_bool(&cfg, "shadow", &opt->shadow_enable);
// -m (menu_opacity)
Expand Down
8 changes: 5 additions & 3 deletions src/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -586,11 +586,13 @@ static inline void ev_property_notify(session_t *ps, xcb_property_notify_event_t
if (ps->c.screen_info->root == ev->window) {
// If desktop number property changes
if (ev->atom == ps->atoms->a_NET_CURRENT_DESKTOP) {
auto prop = x_get_prop(&ps->c, ps->c.screen_info->root, ps->atoms->a_NET_CURRENT_DESKTOP,
1L, XCB_ATOM_CARDINAL, 32);
auto prop = x_get_prop(&ps->c, ps->c.screen_info->root,
ps->atoms->a_NET_CURRENT_DESKTOP, 1L,
XCB_ATOM_CARDINAL, 32);

if (prop.nitems) {
ps->root_desktop_switch_direction = ((int)*prop.c32) - ps->root_desktop_num;
ps->root_desktop_switch_direction =
((int)*prop.c32) - ps->root_desktop_num;
ps->root_desktop_num = (int)*prop.c32;
}
}
Expand Down
12 changes: 7 additions & 5 deletions src/picom.c
Original file line number Diff line number Diff line change
Expand Up @@ -867,8 +867,10 @@ static bool paint_preprocess(session_t *ps, bool *animation, struct managed_win
if (win_has_frame(w)) {
w->frame_opacity = ps->o.frame_opacity;
w->frame_opacity_for_same_colors = ps->o.frame_opacity_for_same_colors;
w->frame_opacity_for_same_colors_tolerance = ps->o.frame_opacity_for_same_colors_tolerance;
w->frame_opacity_for_same_colors_multiplier = ps->o.frame_opacity_for_same_colors_multiplier;
w->frame_opacity_for_same_colors_tolerance =
ps->o.frame_opacity_for_same_colors_tolerance;
w->frame_opacity_for_same_colors_multiplier =
ps->o.frame_opacity_for_same_colors_multiplier;
} else {
w->frame_opacity = 1.0;
}
Expand Down Expand Up @@ -2321,10 +2323,10 @@ static session_t *session_init(int argc, char **argv, Display *dpy,
goto err;
}

// Initiate current workspace num so we correctly animate if picom
// Initiate current workspace num so we correctly animate if picom
// started/restarted on different desktop number than 0
auto prop = x_get_prop(&ps->c, ps->c.screen_info->root, ps->atoms->a_NET_CURRENT_DESKTOP,
1L, XCB_ATOM_CARDINAL, 32);
auto prop = x_get_prop(&ps->c, ps->c.screen_info->root,
ps->atoms->a_NET_CURRENT_DESKTOP, 1L, XCB_ATOM_CARDINAL, 32);

ps->root_desktop_switch_direction = 0;
if (prop.nitems) {
Expand Down
6 changes: 4 additions & 2 deletions src/renderer/command_builder.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ commands_for_window_body(struct layer *layer, struct backend_command *cmd,
.frame_opacity = w->frame_opacity,
.frame_opacity_for_same_colors = w->frame_opacity_for_same_colors,
.frame_opacity_for_same_colors_tolerance = w->frame_opacity_for_same_colors_tolerance,
.frame_opacity_for_same_colors_multiplier = w->frame_opacity_for_same_colors_multiplier,
.frame_opacity_for_same_colors_multiplier =
w->frame_opacity_for_same_colors_multiplier,
.dim = dim,
.scale = layer->scale,
.effective_size = layer->window.size,
Expand Down Expand Up @@ -380,7 +381,8 @@ void command_builder_build(struct command_builder *cb, struct layout *layout, bo
if (layer->win->shadow) {
ncmds += 1;
}
if (layer->win->frame_opacity < 1 && layer->win->frame_opacity > 0 && !layer->win->frame_opacity_for_same_colors) {
if (layer->win->frame_opacity < 1 && layer->win->frame_opacity > 0 &&
!layer->win->frame_opacity_for_same_colors) {
// Needs to draw the frame separately
ncmds += 1;
}
Expand Down
22 changes: 10 additions & 12 deletions src/wm/win.c
Original file line number Diff line number Diff line change
Expand Up @@ -2323,12 +2323,11 @@ bool win_process_animation_and_state_change(struct session *ps, struct managed_w
: ANIMATION_TRIGGER_SHOW;

if (ps->root_desktop_switch_direction != 0) {
trigger =
(ps->root_desktop_switch_direction < 0 &&
ps->root_desktop_switch_direction >= -1) ||
ps->root_desktop_switch_direction > 1 ?
ANIMATION_TRIGGER_WORKSPACE_IN_INVERSE :
ANIMATION_TRIGGER_WORKSPACE_IN;
trigger = (ps->root_desktop_switch_direction < 0 &&
ps->root_desktop_switch_direction >= -1) ||
ps->root_desktop_switch_direction > 1
? ANIMATION_TRIGGER_WORKSPACE_IN_INVERSE
: ANIMATION_TRIGGER_WORKSPACE_IN;
}
break;
case WSTATE_PAIR(WSTATE_UNMAPPED, WSTATE_DESTROYED):
Expand All @@ -2349,12 +2348,11 @@ bool win_process_animation_and_state_change(struct session *ps, struct managed_w
trigger = ANIMATION_TRIGGER_HIDE;

if (ps->root_desktop_switch_direction != 0) {
trigger =
(ps->root_desktop_switch_direction < 0 &&
ps->root_desktop_switch_direction >= -1) ||
ps->root_desktop_switch_direction > 1 ?
ANIMATION_TRIGGER_WORKSPACE_OUT_INVERSE :
ANIMATION_TRIGGER_WORKSPACE_OUT;
trigger = (ps->root_desktop_switch_direction < 0 &&
ps->root_desktop_switch_direction >= -1) ||
ps->root_desktop_switch_direction > 1
? ANIMATION_TRIGGER_WORKSPACE_OUT_INVERSE
: ANIMATION_TRIGGER_WORKSPACE_OUT;
}
break;
default:
Expand Down

0 comments on commit 9df22a4

Please sign in to comment.