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 30, 2024
2 parents acef336 + 3d3f360 commit 404652d
Show file tree
Hide file tree
Showing 12 changed files with 124 additions and 78 deletions.
3 changes: 2 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ Checks: >
-readability-magic-numbers,
-readability-identifier-length,
-bugprone-easily-swappable-parameters
AnalyzeTemporaryDtors: false
FormatStyle: file
CheckOptions:
- key: readability-magic-numbers.IgnoredIntegerValues
Expand All @@ -29,3 +28,5 @@ CheckOptions:
value: true
- key: bugprone-signed-char-misuse.CharTypdefsToIgnore
value: int8_t
- key: bugprone-suspicious-string-compare.WarnOnLogicalNotComparison
value: true
16 changes: 14 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
# v12-rc3 (2024-Aug-30)

## Bug fixes

* `transparent-clipping` has no effect (#1317)
* `unredir` in window rules not being parsed correctly
* Changing window opacity with `picom-trans` does not take effect immediately (#1315)

## Documentation

* Document behavior change around rounded corners and fullscreen windows (#1323)

# v12-rc2 (2024-Aug-17)

## Bug fixes

* Setting corner-radius to 0 cause all windows to not render: #1311
* Setting corner-radius to 0 cause all windows to not render (#1311)
* Setting corner-radius causes windows to have a 1-pixel transparent border
* Window shaders no longer work: #1312
* Window shaders no longer work (#1312)

# v12-rc1 (2024-Aug-12)

Expand Down
40 changes: 27 additions & 13 deletions man/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,32 @@ mans = ['picom.1', 'picom-inspect.1', 'picom-trans.1']
if get_option('with_docs')
a2x = find_program('asciidoctor')
foreach m : mans
custom_target(m, output: [m], input: [m+'.adoc'],
command: [a2x, '-a',
'picom-version='+version,
'--backend', 'manpage', '@INPUT@', '-D',
meson.current_build_dir()],
install: true,
install_dir: join_paths(get_option('mandir'), 'man1'))
custom_target(m+'.html', output: [m+'.html'], input: [m+'.adoc'],
command: [a2x, '-a',
'picom-version='+version,
'--backend', 'html', '@INPUT@', '-D',
meson.current_build_dir()],
install_dir: get_option('datadir') / 'doc' / 'picom')
custom_target(
m,
output: [m],
input: [m + '.adoc'],
command: [
a2x,
'-a', 'picom-version=v' + meson.project_version(),
'--backend', 'manpage',
'@INPUT@',
'-D', meson.current_build_dir(),
],
install: true,
install_dir: join_paths(get_option('mandir'), 'man1'),
)
custom_target(
m + '.html',
output: [m + '.html'],
input: [m + '.adoc'],
command: [
a2x,
'-a', 'picom-version=v' + meson.project_version(),
'--backend', 'html',
'@INPUT@',
'-D', meson.current_build_dir(),
],
install_dir: get_option('datadir') / 'doc' / 'picom',
)
endforeach
endif
12 changes: 10 additions & 2 deletions man/picom.1.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,9 @@ Following is a list of all the options that are superseded by window rules:

<<shadow-ignore-shaped>>, <<inactive-opacity>>, <<active-opacity>>, <<inactive-opacity-override>>, <<inactive-dim>>, <<mark-wmwin-focused>>, <<mark-ovredir-focused>>, <<invert-color-include>>, <<shadow-exclude>>, <<fade-exclude>>, <<focus-exclude>>, <<rounded-corners-exclude>>, <<blur-background-exclude>>, <<opacity-rule>>, <<corner-radius-rules>>, <<window-shader-fg-rule>>, <<clip-shadow-above>>. As well as the xref:wintypes[*wintypes*] configuration file option.

If window rules option is used, none of the above options will have any effect. And warning messages will be issued.
If window rules option is used, none of the above options will have any effect. And warning messages will be issued. When the window rules option is used, the compositor will also behave somewhat differently in certain cases. One such case is that fullscreen windows will no longer have their rounded corners disabled by default.

If you are currently using some of these options and want to switch to window rules, see the xref:_migrating_old_rules[*Migrating old rules*] section for how to convert them.
If you are currently using some of these options and want to switch to window rules, or if you want to keep the existing behavior, see the xref:_migrating_old_rules[*Migrating old rules*] section for how to convert them.

=== Syntax

Expand Down Expand Up @@ -362,6 +362,14 @@ Most of the rule options should 1:1 map to the new window rules. Here is a list

*Active window*:: This includes option <<focus-exclude>>. This option was only used to influence what windows are considered active, to apply inactive opacity and dimming. Since with window rules you no longer need the compositor to help you decide what is active and what is not (see above), this option is no longer needed.

*Rounded corners and fullscreen windows*:: Rounded corners are no longer automatically disabled for fullscreen windows. If you want to disable rounded corners for fullscreen windows, you can use the following rule:
+
----
rules = (
{ match = "fullscreen"; corner-radius = 0; },
)
----

FORMAT OF CONDITIONS
--------------------
Some options accept a condition string to match certain windows. A condition string is formed by one or more conditions, joined by logical operators.
Expand Down
26 changes: 20 additions & 6 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,33 @@ project('picom', 'c', version: '11',

cc = meson.get_compiler('c')

# use project version by default
version = 'v'+meson.project_version()

# use git describe if that's available
git = find_program('git', required: false)
if git.found()
gitv = run_command('git', 'rev-parse', '--short=5', 'HEAD', check: false)
gitv = run_command('git', 'rev-parse', '--short=7', 'HEAD', check: false)
if gitv.returncode() == 0
version = 'vgit-'+gitv.stdout().strip()
commit_hash_short = gitv.stdout().strip()
endif
git_upstream = run_command('git', 'rev-parse', '--abbrev-ref', '--symbolic-full-name', '@{upstream}', check: false)
if git_upstream.returncode() == 0
remote = git_upstream.stdout().strip().split('/')[0]
else
remote = 'origin'
endif
git_repository = run_command('git', 'remote', 'get-url', remote, check: false)
if git_repository.returncode() == 0
repository = git_repository.stdout().strip()
endif
endif

add_global_arguments('-DPICOM_VERSION="'+version+'"', language: 'c')
add_global_arguments('-DPICOM_VERSION="v'+meson.project_version()+'"', language: 'c')
if is_variable('repository')
add_global_arguments('-DPICOM_FULL_VERSION="v'+meson.project_version()+' ('+repository+' revision '+commit_hash_short+')"', language: 'c')
elif is_variable('commit_hash_short')
add_global_arguments('-DPICOM_FULL_VERSION="v'+meson.project_version()+' (revision '+commit_hash_short+')"', language: 'c')
else
add_global_arguments('-DPICOM_FULL_VERSION="v'+meson.project_version()+'"', language: 'c')
endif

if get_option('buildtype') == 'release'
add_global_arguments('-DNDEBUG', language: 'c')
Expand Down
15 changes: 7 additions & 8 deletions src/c2.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "atom.h"
#include "common.h"
#include "compiler.h"
#include "config.h"
#include "log.h"
#include "test.h"
#include "utils/str.h"
Expand Down Expand Up @@ -645,10 +644,10 @@ c2_parse_group(const char *pattern, int offset, c2_condition_node_ptr *presult,
}

next_expected = true;
if (!mstrncmp("&&", pattern + offset)) {
if (mstrncmp("&&", pattern + offset) == 0) {
ops[elei] = C2_B_OAND;
++offset;
} else if (!mstrncmp("||", pattern + offset)) {
} else if (mstrncmp("||", pattern + offset) == 0) {
ops[elei] = C2_B_OOR;
++offset;
} else {
Expand Down Expand Up @@ -812,7 +811,7 @@ static int c2_parse_target(const char *pattern, int offset, c2_condition_node_pt
// Check for predefined targets
static const int npredefs = (int)(sizeof(C2_PREDEFS) / sizeof(C2_PREDEFS[0]));
for (int i = 0; i < npredefs; ++i) {
if (!strcmp(C2_PREDEFS[i].name, pleaf->tgt)) {
if (strcmp(C2_PREDEFS[i].name, pleaf->tgt) == 0) {
pleaf->predef = i;
break;
}
Expand Down Expand Up @@ -1662,19 +1661,19 @@ static bool c2_string_op(const c2_condition_node_leaf *leaf, const char *target)
}
if (leaf->match_ignorecase) {
switch (leaf->match) {
case C2_L_MEXACT: return !strcasecmp(target, leaf->ptnstr);
case C2_L_MEXACT: return strcasecmp(target, leaf->ptnstr) == 0;
case C2_L_MCONTAINS: return strcasestr(target, leaf->ptnstr);
case C2_L_MSTART:
return !strncasecmp(target, leaf->ptnstr, strlen(leaf->ptnstr));
return strncasecmp(target, leaf->ptnstr, strlen(leaf->ptnstr)) == 0;
case C2_L_MWILDCARD: return !fnmatch(leaf->ptnstr, target, FNM_CASEFOLD);
default: unreachable();
}
} else {
switch (leaf->match) {
case C2_L_MEXACT: return !strcmp(target, leaf->ptnstr);
case C2_L_MEXACT: return strcmp(target, leaf->ptnstr) == 0;
case C2_L_MCONTAINS: return strstr(target, leaf->ptnstr);
case C2_L_MSTART:
return !strncmp(target, leaf->ptnstr, strlen(leaf->ptnstr));
return strncmp(target, leaf->ptnstr, strlen(leaf->ptnstr)) == 0;
case C2_L_MWILDCARD: return !fnmatch(leaf->ptnstr, target, 0);
default: unreachable();
}
Expand Down
6 changes: 3 additions & 3 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -499,18 +499,18 @@ bool parse_config(options_t *, const char *config_file);
*/
static inline attr_pure int parse_backend(const char *str) {
for (int i = 0; BACKEND_STRS[i]; ++i) {
if (!strcasecmp(str, BACKEND_STRS[i])) {
if (strcasecmp(str, BACKEND_STRS[i]) == 0) {
return i;
}
}
// Keep compatibility with an old revision containing a spelling mistake...
if (!strcasecmp(str, "xr_glx_hybird")) {
if (strcasecmp(str, "xr_glx_hybird") == 0) {
log_warn("backend xr_glx_hybird should be xr_glx_hybrid, the misspelt "
"version will be removed soon.");
return BKEND_XR_GLX_HYBRID;
}
// cju wants to use dashes
if (!strcasecmp(str, "xr-glx-hybrid")) {
if (strcasecmp(str, "xr-glx-hybrid") == 0) {
log_warn("backend xr-glx-hybrid should be xr_glx_hybrid, the alternative "
"version will be removed soon.");
return BKEND_XR_GLX_HYBRID;
Expand Down
21 changes: 11 additions & 10 deletions src/config_libconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ static enum window_unredir_option parse_unredir_option(config_setting_t *setting
return WINDOW_UNREDIR_INVALID;
}
if (strcmp(sval, "yes") == 0 || strcmp(sval, "true") == 0 ||
strcmp(sval, "default") == 0 || strcmp(sval, "when-possible-else-terminate")) {
strcmp(sval, "default") == 0 || strcmp(sval, "when-possible-else-terminate") == 0) {
return WINDOW_UNREDIR_WHEN_POSSIBLE_ELSE_TERMINATE;
}
if (strcmp(sval, "preferred") == 0 || strcmp(sval, "when-possible") == 0) {
Expand Down Expand Up @@ -729,6 +729,16 @@ bool parse_config_libconfig(options_t *opt, const char *config_file) {
}
config_set_auto_convert(&cfg, 1);

// --log-level
if (config_lookup_string(&cfg, "log-level", &sval)) {
opt->log_level = string_to_log_level(sval);
if (opt->log_level == LOG_LEVEL_INVALID) {
log_warn("Invalid log level, defaults to WARN");
} else {
log_set_level_tls(opt->log_level);
}
}

// Get options from the configuration file. We don't do range checking
// right now. It will be done later

Expand Down Expand Up @@ -935,15 +945,6 @@ bool parse_config_libconfig(options_t *opt, const char *config_file) {
goto out;
}
}
// --log-level
if (config_lookup_string(&cfg, "log-level", &sval)) {
opt->log_level = string_to_log_level(sval);
if (opt->log_level == LOG_LEVEL_INVALID) {
log_warn("Invalid log level, defaults to WARN");
} else {
log_set_level_tls(opt->log_level);
}
}
// --log-file
if (config_lookup_string(&cfg, "log-file", &sval)) {
if (*sval != '/') {
Expand Down
Loading

0 comments on commit 404652d

Please sign in to comment.