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 2, 2024
2 parents ee5e13e + 8fda937 commit e695a77
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 24 deletions.
38 changes: 27 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,21 @@ jobs:
- attach_workspace:
at: /tmp/workspace
- run:
name: unit test
command: ninja -vC build test
- run:
name: test config file parsing
command: xvfb-run -s "-screen 0 640x480x24" build/src/picom --config tests/configs/parsing_test.conf --no-vsync --diagnostics
- run:
name: test config file parsing in a different locale
command: LC_NUMERIC=de_DE.UTF-8 xvfb-run -s "-screen 0 640x480x24" build/src/picom --config tests/configs/parsing_test.conf --no-vsync --diagnostics
- run:
name: run testsuite
command: tests/run_tests.sh build/src/picom
name: Tests
command: |
ulimit -c unlimited
printf "\n::: Unit tests :::\n"
ninja -vC build test
printf "\n::: test config file parsing :::\n"
xvfb-run -a -s "-screen 0 640x480x24" build/src/picom --config tests/configs/parsing_test.conf --no-vsync --diagnostics
printf "\n::: test config file parsing in a different locale :::\n"
LC_NUMERIC=de_DE.UTF-8 xvfb-run -a -s "-screen 0 640x480x24" build/src/picom --config tests/configs/parsing_test.conf --no-vsync --diagnostics
printf "\n::: run testsuite :::\n"
tests/run_tests.sh build/src/picom
- run:
name: generate coverage reports
command: cd build; find -name '*.gcno' -exec gcov -pb {} +
Expand All @@ -70,6 +74,18 @@ jobs:
- run:
name: upload coverage reports
command: bash ./codecov.sh -X gcov
- run:
name: collect coredumps
when: on_fail
command: |
. $HOME/.cargo/env
mkdir /tmp/artifacts
for c in tests/core.*; do
coredump-copy $c /tmp/coredumps/`basename $c`
done
tar Jcf /tmp/artifacts/coredumps.tar.xz /tmp/coredumps
- store_artifacts:
path: /tmp/artifacts

minimal:
executor: e
Expand Down
11 changes: 11 additions & 0 deletions src/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,12 @@ update_ewmh_active_win(struct x_connection * /*c*/, struct x_async_request_base
free(req_base);

ps->pending_focus_check = false;

if (reply_or_error == NULL) {
// Connection shutdown
return;
}

if (reply_or_error->response_type == 0) {
log_error("Failed to get _NET_ACTIVE_WINDOW: %s",
x_strerror(((xcb_generic_error_t *)reply_or_error)));
Expand Down Expand Up @@ -250,6 +256,11 @@ static void recheck_focus(struct x_connection * /*c*/, struct x_async_request_ba

ps->pending_focus_check = false;

if (reply_or_error == NULL) {
// Connection shutdown
return;
}

// Determine the currently focused window so we can apply appropriate
// opacity on it
if (reply_or_error->response_type == 0) {
Expand Down
5 changes: 5 additions & 0 deletions src/picom.c
Original file line number Diff line number Diff line change
Expand Up @@ -1503,6 +1503,11 @@ static void handle_new_window_attributes_reply(struct x_connection * /*c*/,
auto new_window = wm_find(ps->wm, wid);
free(req);

if (reply_or_error == NULL) {
// Shutting down
return;
}

if (reply_or_error->response_type == 0) {
log_debug("Failed to get window attributes for newly created window "
"%#010x",
Expand Down
18 changes: 12 additions & 6 deletions src/wm/win.c
Original file line number Diff line number Diff line change
Expand Up @@ -2174,15 +2174,16 @@ int win_find_monitor(const struct x_monitors *monitors, const struct win *mw) {
auto e = pixman_region32_extents(&monitors->regions[i]);
if (e->x1 <= mw->g.x && e->y1 <= mw->g.y &&
e->x2 >= mw->g.x + mw->widthb && e->y2 >= mw->g.y + mw->heightb) {
log_debug("Window %#010x (%s), %dx%d+%dx%d, is entirely on the "
"monitor %d (%dx%d+%dx%d)",
win_id(mw), mw->name, mw->g.x, mw->g.y, mw->widthb,
mw->heightb, i, e->x1, e->y1, e->x2 - e->x1, e->y2 - e->y1);
log_verbose("Window %#010x (%s), %dx%d+%dx%d, is entirely on the "
"monitor %d (%dx%d+%dx%d)",
win_id(mw), mw->name, mw->g.x, mw->g.y, mw->widthb,
mw->heightb, i, e->x1, e->y1, e->x2 - e->x1,
e->y2 - e->y1);
return i;
}
}
log_debug("Window %#010x (%s), %dx%d+%dx%d, is not entirely on any monitor",
win_id(mw), mw->name, mw->g.x, mw->g.y, mw->widthb, mw->heightb);
log_verbose("Window %#010x (%s), %dx%d+%dx%d, is not entirely on any monitor",
win_id(mw), mw->name, mw->g.x, mw->g.y, mw->widthb, mw->heightb);
return ret;
}

Expand Down Expand Up @@ -2232,6 +2233,11 @@ static void win_handle_get_geometry_reply(struct x_connection * /*c*/,
auto ps = req->ps;
free(req);

if (reply_or_error == NULL) {
// Shutting down
return;
}

if (reply_or_error->response_type == 0) {
log_debug("Failed to get geometry of window %#010x: %s", wid,
x_strerror((xcb_generic_error_t *)reply_or_error));
Expand Down
5 changes: 5 additions & 0 deletions src/x.c
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,11 @@ static void x_handle_update_monitors_reply(struct x_connection * /*c*/,
auto m = ((struct x_update_monitors_request *)req_base)->monitors;
free(req_base);

if (reply_or_error == NULL) {
// Shutting down
return;
}

if (reply_or_error->response_type == 0) {
log_warn("Failed to get monitor information using RandR: %s",
x_strerror((xcb_generic_error_t *)reply_or_error));
Expand Down
8 changes: 2 additions & 6 deletions subprojects/test.h/test.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,8 @@ static inline void __attribute__((constructor(102))) run_tests(void) {

#define TEST_CASE(name) static void __attribute__((unused)) __test_h_##name(void)

#define TEST_EQUAL(a, b) \
(void)(a); \
(void)(b)
#define TEST_NOTEQUAL(a, b) \
(void)(a); \
(void)(b)
#define TEST_EQUAL(a, b) (void)((a) == (b))
#define TEST_NOTEQUAL(a, b) (void)((a) != (b))
#define TEST_TRUE(a) (void)(a)
#define TEST_STREQUAL(a, b) \
(void)(a); \
Expand Down
2 changes: 1 addition & 1 deletion tests/run_one_test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -xe
if [ -z $DISPLAY ]; then
exec xvfb-run -s "+extension composite" -a $0 $1 $2 $3
Expand Down

0 comments on commit e695a77

Please sign in to comment.