Skip to content

Commit

Permalink
Merge branch 'yshui:next' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
pijulius committed Aug 6, 2024
2 parents 4644815 + 890dc78 commit 585d86b
Show file tree
Hide file tree
Showing 30 changed files with 2,959 additions and 503 deletions.
7 changes: 7 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ jobs:
steps:
- build:
build-config: -Dwith_docs=true -Db_coverage=true
- run:
name: build animgen
command: ninja -vC build tools/animgen
- persist_to_workspace:
root: .
paths:
Expand All @@ -54,6 +57,10 @@ jobs:
command: |
ulimit -c unlimited
printf "\n::: test animgen :::\n"
build/tools/animgen data/animation_presets.conf >/dev/null 2>error.log
[ -s error.log ] && cat error.log && exit 1
printf "\n::: Unit tests :::\n"
ninja -vC build test
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ target
!/tests/testcases/*.py

# Misc files
.vscode
*.conf
!/tests/configs/*.conf
!/data/*.conf
perf.data
perf.data.old
core.*
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
* Type and format specifiers are no longer used in rules. These specifiers are what you put after the colon (':') in rules, e.g. the `:32c` in `"_GTK_FRAME_EXTENTS@:32c"`. Now this information is ignored and the property is matched regardless of format or type.
* `backend` is now a required option. picom will not start if one is not specified explicitly.
* New predefined target for conditions: `group_focused`. This target indicate whether the focused window is in the same window group as the window being matched.
* Meaning of `window_type` in conditions changed slightly, now it supports windows with multiple types. (However the behavior of `wintypes` remains unchanged.)

## Deprecated features

Expand Down
165 changes: 165 additions & 0 deletions data/animation_presets.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
disappear = {
opacity = {
duration = "placeholder0";
start = "window-raw-opacity-before";
end = "window-raw-opacity";
};
blur-opacity = "opacity";
shadow-opacity = "opacity";
offset-x = "(1 - scale-x) / 2 * window-width";
offset-y = "(1 - scale-y) / 2 * window-height";
scale-x = {
curve = "cubic-bezier(0.21, 0.02, 0.76, 0.36)";
duration = "placeholder0";
start = 1;
end = "placeholder1";
};
scale-y = "scale-x";
shadow-scale-x = "scale-x";
shadow-scale-y = "scale-y";
shadow-offset-x = "offset-x";
shadow-offset-y = "offset-y";

# See comments in tools/animgen.c for syntax
*knobs = {
scale = 0.95;
duration = 0.2;
};
*placeholders = ((0, "duration"),(1, "scale"));
};

appear = {
opacity = {
duration = "placeholder0";
start = "window-raw-opacity-before";
end = "window-raw-opacity";
};
blur-opacity = "opacity";
shadow-opacity = "opacity";
offset-x = "(1 - scale-x) / 2 * window-width";
offset-y = "(1 - scale-y) / 2 * window-height";
scale-x = {
curve = "cubic-bezier(0.24, 0.64, 0.79, 0.98)";
duration = "placeholder0";
start = "placeholder1";
end = 1;
};
scale-y = "scale-x";
shadow-scale-x = "scale-x";
shadow-scale-y = "scale-y";
shadow-offset-x = "offset-x";
shadow-offset-y = "offset-y";
*knobs = {
scale = 0.95;
duration = 0.2;
};
*placeholders = ((0, "duration"),(1, "scale"));
};

slide-out = {
v-timing = {
curve = "cubic-bezier(0.21, 0.02, 0.76, 0.36)";
start = 0;
duration = "placeholder0";
end = "window-width * placeholder1 + window-height * placeholder2";
};
offset-x = "v-timing * placeholder3";
offset-y = "v-timing * (1 - placeholder3)";
shadow-offset-x = "offset-x";
shadow-offset-y = "offset-y";
crop-x = "window-x";
crop-y = "window-y";
crop-width = "window-width";
crop-height = "window-height";
opacity = 1;
blur-opacity = "opacity";
shadow-opacity = "opacity";
*knobs = {
duration = 0.2;
direction = (2, ["up", "down", "left", "right"]);
};
*placeholders = (
(0, "duration"),
(1, "direction", [0, 0, -1, 1]),
(2, "direction", [-1, 1, 0, 0]),
(3, "direction", [0, 0, 1, 1]),
);
};

slide-in = {
v-timing = {
curve = "cubic-bezier(0.24, 0.64, 0.79, 0.98)";
start = "window-width * placeholder1 + window-height * placeholder2";
duration = "placeholder0";
end = 0;
};
offset-x = "v-timing * placeholder3";
offset-y = "v-timing * (1 - placeholder3)";
shadow-offset-x = "offset-x";
shadow-offset-y = "offset-y";
crop-x = "window-x";
crop-y = "window-y";
crop-width = "window-width";
crop-height = "window-height";
*knobs = {
duration = 0.2;
direction = (2, ["up", "down", "left", "right"]);
};
*placeholders = (
(0, "duration"),
(1, "direction", [0, 0, -1, 1]),
(2, "direction", [-1, 1, 0, 0]),
(3, "direction", [0, 0, 1, 1]),
);
};

fly-out = {
v-timing = {
curve = "cubic-bezier(0.05, 0, 0.69, -0.05)";
duration = "placeholder0";
start = 0;
end = "(window-height + window-y) * placeholder2 + (window-width + window-x) * placeholder1";
};
offset-x = "v-timing * placeholder3";
offset-y = "v-timing * (1 - placeholder3)";
shadow-offset-x = "offset-x";
shadow-offset-y = "offset-y";
opacity = 1;
shadow-opacity = 1;
blur-opacity = 1;
*knobs = {
duration = 0.2;
direction = (0, ["up", "down", "left", "right"]);
};
*placeholders = (
(0, "duration"),
(1, "direction", [0, 0, -1, 1]),
(2, "direction", [-1, 1, 0, 0]),
(3, "direction", [0, 0, 1, 1]),
);
};
fly-in = {
v-timing = {
curve = "cubic-bezier(0.17, 0.67, 0.68, 1.03)";
end = 0;
duration = "placeholder0";
start = "- window-height - window-y";
};
offset-x = "v-timing * placeholder3";
offset-y = "v-timing * (1 - placeholder3)";
shadow-offset-x = "offset-x";
shadow-offset-y = "offset-y";
opacity = 1;
shadow-opacity = 1;
blur-opacity = 1;
*knobs = {
duration = 0.2;
direction = (0, ["up", "down", "left", "right"]);
};
*placeholders = (
(0, "duration"),
(1, "direction", [0, 0, -1, 1]),
(2, "direction", [-1, 1, 0, 0]),
(3, "direction", [0, 0, 1, 1]),
);
}
8 changes: 6 additions & 2 deletions man/picom.1.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ Supported predefined targets are: :::
Whether the window bounding shape only has rounded corners, and is otherwise rectangular. This implies <<c2-bounding-shaped>>. Requires <<detect-rounded-corners>>. This has no relation to <<corner-radius>>.
`window_type`::::
Window type, as defined by _pass:[_]NET_WM_WINDOW_TYPE_. Name only, e.g. _normal_ means _pass:[_]NET_WM_WINDOW_TYPE_NORMAL_.
Window type, as defined by _pass:[_]NET_WM_WINDOW_TYPE_. Name only, e.g. _normal_ means _pass:[_]NET_WM_WINDOW_TYPE_NORMAL_. Because a window can have multiple types, testing for equality succeeds if any of the window's types match.
`name`::::
Name of the window. This is either _pass:[_]NET_WM_NAME_ or _pass:[_]WM_NAME_.
Expand Down Expand Up @@ -538,7 +538,7 @@ When `@include` directive is used in the config file, picom will first search fo
picom uses general libconfig configuration file format. A sample configuration file is available as `picom.sample.conf` in the source tree. Most of command line switches can be used as options in configuration file as well. For example, *--vsync* option documented above can be set in the configuration file using `vsync = `. Command line options will always overwrite the settings in the configuration file.
Window-type-specific settings allow you to set window-specific options based on the window type. These settings are exposed only in configuration file. Using this is discouraged, see the xref:_window_rules[*WINDOW RULES*] section for the recommended way to set window-specific options. The format of this option is as follows:
Window-type-specific settings allow you to set window-specific options based on the window type. These settings are exposed only in configuration file. The format of this option is as follows:
[#wintypes]
------------
Expand All @@ -548,6 +548,10 @@ wintypes:
};
------------
WARNING: Using this is highly discouraged, see the xref:_window_rules[*WINDOW RULES*] section for the recommended way to set window-specific options.
IMPORTANT: According to the window manager specification, a window can have multiple types. But due to the limitation of how _wintypes_ was implemented, if a window has multiple types, then for the purpose of applying `wintypes` options, one of the window types will be chosen at random. Again, you are recommended to use xref:_window_rules[*WINDOW RULES*] instead.
_WINDOW_TYPE_ is one of the 15 window types defined in EWMH standard: "unknown", "desktop", "dock", "toolbar", "menu", "utility", "splash", "dialog", "normal", "dropdown_menu", "popup_menu", "tooltip", "notification", "combo", and "dnd".
Following per window-type options are available: ::
Expand Down
1 change: 1 addition & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ test_h_dep = subproject('test.h').get_variable('test_h_dep')

subdir('src')
subdir('man')
subdir('tools')

install_data('bin/picom-trans', install_dir: get_option('bindir'))
install_data('picom.desktop', install_dir: 'share/applications')
Expand Down
14 changes: 11 additions & 3 deletions src/c2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1712,14 +1712,22 @@ c2_match_once_leaf_string(struct atom *atoms, const struct win *w, const c2_l_t
// A predefined target
const char *predef_target = NULL;
if (leaf->predef != C2_L_PUNDEFINED) {
if (leaf->predef == C2_L_PWINDOWTYPE) {
for (unsigned i = 0; i < NUM_WINTYPES; i++) {
if (w->window_types & (1 << i) &&
c2_string_op(leaf, WINTYPES[i].name)) {
return true;
}
}
return false;
}

switch (leaf->predef) {
case C2_L_PWINDOWTYPE:
predef_target = WINTYPES[w->window_type].name;
break;
case C2_L_PNAME: predef_target = w->name; break;
case C2_L_PCLASSG: predef_target = w->class_general; break;
case C2_L_PCLASSI: predef_target = w->class_instance; break;
case C2_L_PROLE: predef_target = w->role; break;
case C2_L_PWINDOWTYPE:
default: unreachable();
}
if (!predef_target) {
Expand Down
20 changes: 20 additions & 0 deletions src/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@
# define __has_include(x) 0
#endif

#ifndef __has_builtin
# define __has_builtin(x) 0
#endif

#if !defined(__STDC_NO_THREADS__) && __has_include(<threads.h>)
# include <threads.h>
#elif __STDC_VERSION__ >= 201112L
Expand All @@ -137,3 +141,19 @@ typedef unsigned int uint;
static inline int attr_const popcntul(unsigned long a) {
return __builtin_popcountl(a);
}

/// Get the index of the lowest bit set in a number. The result is undefined if
/// `a` is 0.
static inline int attr_const index_of_lowest_one(unsigned a) {
#if __has_builtin(__builtin_ctz)
return __builtin_ctz(a);
#else
auto lowbit = (a & -a);
int r = (lowbit & 0xAAAAAAAA) != 0;
r |= ((lowbit & 0xCCCCCCCC) != 0) << 1;
r |= ((lowbit & 0xF0F0F0F0) != 0) << 2;
r |= ((lowbit & 0xFF00FF00) != 0) << 3;
r |= ((lowbit & 0xFFFF0000) != 0) << 4;
return r;
#endif
}
Loading

0 comments on commit 585d86b

Please sign in to comment.