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 Jun 11, 2024
2 parents 85819e7 + 7befeff commit a312328
Show file tree
Hide file tree
Showing 11 changed files with 81 additions and 67 deletions.
1 change: 0 additions & 1 deletion .builds/freebsd.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
image: freebsd/latest
packages:
- libev
- libXext
- libxcb
- meson
- pkgconf
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
languages: ${{ matrix.language }}

# Install dependencies
- run: sudo apt update && sudo apt install libdbus-1-dev libegl-dev libev-dev libgl-dev libpcre2-dev libpixman-1-dev libx11-xcb-dev libxcb1-dev libxcb-composite0-dev libxcb-damage0-dev libxcb-glx0-dev libxcb-image0-dev libxcb-present-dev libxcb-randr0-dev libxcb-render0-dev libxcb-render-util0-dev libxcb-shape0-dev libxcb-util-dev libxcb-xfixes0-dev libxext-dev meson ninja-build uthash-dev
- run: sudo apt update && sudo apt install libdbus-1-dev libegl-dev libev-dev libgl-dev libpcre2-dev libpixman-1-dev libx11-xcb-dev libxcb1-dev libxcb-composite0-dev libxcb-damage0-dev libxcb-glx0-dev libxcb-image0-dev libxcb-present-dev libxcb-randr0-dev libxcb-render0-dev libxcb-render-util0-dev libxcb-shape0-dev libxcb-util-dev libxcb-xfixes0-dev meson ninja-build uthash-dev
if: ${{ matrix.language == 'cpp' }}

# Autobuild
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ doxygen/
*.orig
/tests/log
/tests/testcases/__pycache__/
*.profraw

# Subproject files
subprojects/libconfig
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
* picom now uses some OpenGL 4.3 features.
* picom now optionally depends on `rtkit` at runtime to give itself realtime scheduling priority.
* `libconfig` is now a mandatory dependency, with a minimal supported version of 1.7.
* picom doesn't depend on `xcb-dpms` anymore.
* `xcb-dpms` is not needed anymore.
* `libXext` is not needed anymore.

# v11.2 (2024-Feb-13)

Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ Assuming you already have all the usual building tools installed (e.g. gcc, pyth

* libx11
* libx11-xcb
* libXext
* xproto
* xcb
* xcb-util
Expand All @@ -58,13 +57,13 @@ Assuming you already have all the usual building tools installed (e.g. gcc, pyth
On Debian based distributions (e.g. Ubuntu), the needed packages are

```
libconfig-dev libdbus-1-dev libegl-dev libev-dev libgl-dev libepoxy-dev libpcre2-dev libpixman-1-dev libx11-xcb-dev libxcb1-dev libxcb-composite0-dev libxcb-damage0-dev libxcb-glx0-dev libxcb-image0-dev libxcb-present-dev libxcb-randr0-dev libxcb-render0-dev libxcb-render-util0-dev libxcb-shape0-dev libxcb-util-dev libxcb-xfixes0-dev libxext-dev meson ninja-build uthash-dev
libconfig-dev libdbus-1-dev libegl-dev libev-dev libgl-dev libepoxy-dev libpcre2-dev libpixman-1-dev libx11-xcb-dev libxcb1-dev libxcb-composite0-dev libxcb-damage0-dev libxcb-glx0-dev libxcb-image0-dev libxcb-present-dev libxcb-randr0-dev libxcb-render0-dev libxcb-render-util0-dev libxcb-shape0-dev libxcb-util-dev libxcb-xfixes0-dev meson ninja-build uthash-dev
```

On Fedora, the needed packages are

```
dbus-devel gcc git libconfig-devel libdrm-devel libev-devel libX11-devel libX11-xcb libXext-devel libxcb-devel libGL-devel libEGL-devel libepoxy-devel meson pcre2-devel pixman-devel uthash-devel xcb-util-image-devel xcb-util-renderutil-devel xorg-x11-proto-devel xcb-util-devel
dbus-devel gcc git libconfig-devel libdrm-devel libev-devel libX11-devel libX11-xcb libxcb-devel libGL-devel libEGL-devel libepoxy-devel meson pcre2-devel pixman-devel uthash-devel xcb-util-image-devel xcb-util-renderutil-devel xorg-x11-proto-devel xcb-util-devel
```

To build the documents, you need `asciidoc`
Expand Down
9 changes: 9 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ if get_option('sanitize')
endif
endif

if get_option('llvm_coverage')
if cc.get_id() != 'clang'
error('option \'llvm_coverage\' requires clang')
endif
coverage_flags = ['-fprofile-instr-generate', '-fcoverage-mapping']
add_global_arguments(coverage_flags, language: 'c')
add_global_link_arguments(coverage_flags, language: 'c')
endif

if get_option('modularize')
if not cc.has_argument('-fmodules')
error('option \'modularize\' requires clang')
Expand Down
7 changes: 5 additions & 2 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ option('compton', type: 'boolean', value: true, description: 'Install backwards

option('with_docs', type: 'boolean', value: false, description: 'Build documentation and man pages')

option('modularize', type: 'boolean', value: false, description: 'Build with clang\'s module system')

option('unittest', type: 'boolean', value: false, description: 'Enable unittests in the code')

# Experimental options

option('modularize', type: 'boolean', value: false, description: 'Build with clang\'s module system (experimental)')
option('llvm_coverage', type: 'boolean', value: false, description: 'Use LLVM source-based code coverage, instead of --coverage. Do not use with b_coverage.')
90 changes: 48 additions & 42 deletions src/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "picom.h"
#include "region.h"
#include "utils/dynarr.h"
#include "utils/misc.h"
#include "wm/defs.h"
#include "wm/wm.h"
#include "x.h"
Expand Down Expand Up @@ -90,18 +89,18 @@ static inline const char *ev_window_name(session_t *ps, xcb_window_t wid) {

static inline xcb_window_t attr_pure ev_window(session_t *ps, xcb_generic_event_t *ev) {
switch (ev->response_type) {
case FocusIn:
case FocusOut: return ((xcb_focus_in_event_t *)ev)->event;
case CreateNotify: return ((xcb_create_notify_event_t *)ev)->window;
case ConfigureNotify: return ((xcb_configure_notify_event_t *)ev)->window;
case DestroyNotify: return ((xcb_destroy_notify_event_t *)ev)->window;
case MapNotify: return ((xcb_map_notify_event_t *)ev)->window;
case UnmapNotify: return ((xcb_unmap_notify_event_t *)ev)->window;
case ReparentNotify: return ((xcb_reparent_notify_event_t *)ev)->window;
case CirculateNotify: return ((xcb_circulate_notify_event_t *)ev)->window;
case Expose: return ((xcb_expose_event_t *)ev)->window;
case PropertyNotify: return ((xcb_property_notify_event_t *)ev)->window;
case ClientMessage: return ((xcb_client_message_event_t *)ev)->window;
case XCB_FOCUS_IN:
case XCB_FOCUS_OUT: return ((xcb_focus_in_event_t *)ev)->event;
case XCB_CREATE_NOTIFY: return ((xcb_create_notify_event_t *)ev)->window;
case XCB_CONFIGURE_NOTIFY: return ((xcb_configure_notify_event_t *)ev)->window;
case XCB_DESTROY_NOTIFY: return ((xcb_destroy_notify_event_t *)ev)->window;
case XCB_MAP_NOTIFY: return ((xcb_map_notify_event_t *)ev)->window;
case XCB_UNMAP_NOTIFY: return ((xcb_unmap_notify_event_t *)ev)->window;
case XCB_REPARENT_NOTIFY: return ((xcb_reparent_notify_event_t *)ev)->window;
case XCB_CIRCULATE_NOTIFY: return ((xcb_circulate_notify_event_t *)ev)->window;
case XCB_EXPOSE: return ((xcb_expose_event_t *)ev)->window;
case XCB_PROPERTY_NOTIFY: return ((xcb_property_notify_event_t *)ev)->window;
case XCB_CLIENT_MESSAGE: return ((xcb_client_message_event_t *)ev)->window;
default:
if (ps->damage_event + XCB_DAMAGE_NOTIFY == ev->response_type) {
return ((xcb_damage_notify_event_t *)ev)->drawable;
Expand All @@ -116,38 +115,38 @@ static inline xcb_window_t attr_pure ev_window(session_t *ps, xcb_generic_event_
}

#define CASESTRRET(s) \
case s: return #s;
case XCB_##s: return #s;

static inline const char *ev_name(session_t *ps, xcb_generic_event_t *ev) {
static char buf[128];
switch (XCB_EVENT_RESPONSE_TYPE(ev)) {
CASESTRRET(FocusIn);
CASESTRRET(FocusOut);
CASESTRRET(CreateNotify);
CASESTRRET(ConfigureNotify);
CASESTRRET(DestroyNotify);
CASESTRRET(MapNotify);
CASESTRRET(UnmapNotify);
CASESTRRET(ReparentNotify);
CASESTRRET(CirculateNotify);
CASESTRRET(Expose);
CASESTRRET(PropertyNotify);
CASESTRRET(ClientMessage);
CASESTRRET(FOCUS_IN);
CASESTRRET(FOCUS_OUT);
CASESTRRET(CREATE_NOTIFY);
CASESTRRET(CONFIGURE_NOTIFY);
CASESTRRET(DESTROY_NOTIFY);
CASESTRRET(MAP_NOTIFY);
CASESTRRET(UNMAP_NOTIFY);
CASESTRRET(REPARENT_NOTIFY);
CASESTRRET(CIRCULATE_NOTIFY);
CASESTRRET(EXPOSE);
CASESTRRET(PROPERTY_NOTIFY);
CASESTRRET(CLIENT_MESSAGE);
}

if (ps->damage_event + XCB_DAMAGE_NOTIFY == ev->response_type) {
return "Damage";
return "DAMAGE_NOTIFY";
}

if (ps->shape_exists && ev->response_type == ps->shape_event) {
return "ShapeNotify";
return "SHAPE_NOTIFY";
}

if (ps->xsync_exists) {
int o = ev->response_type - ps->xsync_event;
switch (o) {
CASESTRRET(XSyncCounterNotify);
CASESTRRET(XSyncAlarmNotify);
CASESTRRET(SYNC_COUNTER_NOTIFY);
CASESTRRET(SYNC_ALARM_NOTIFY);
}
}

Expand All @@ -157,26 +156,33 @@ static inline const char *ev_name(session_t *ps, xcb_generic_event_t *ev) {
}

static inline const char *attr_pure ev_focus_mode_name(xcb_focus_in_event_t *ev) {
#undef CASESTRRET
#define CASESTRRET(s) \
case XCB_NOTIFY_MODE_##s: return #s

switch (ev->mode) {
CASESTRRET(NotifyNormal);
CASESTRRET(NotifyWhileGrabbed);
CASESTRRET(NotifyGrab);
CASESTRRET(NotifyUngrab);
CASESTRRET(NORMAL);
CASESTRRET(WHILE_GRABBED);
CASESTRRET(GRAB);
CASESTRRET(UNGRAB);
}

return "Unknown";
}

static inline const char *attr_pure ev_focus_detail_name(xcb_focus_in_event_t *ev) {
#undef CASESTRRET
#define CASESTRRET(s) \
case XCB_NOTIFY_DETAIL_##s: return #s
switch (ev->detail) {
CASESTRRET(NotifyAncestor);
CASESTRRET(NotifyVirtual);
CASESTRRET(NotifyInferior);
CASESTRRET(NotifyNonlinear);
CASESTRRET(NotifyNonlinearVirtual);
CASESTRRET(NotifyPointer);
CASESTRRET(NotifyPointerRoot);
CASESTRRET(NotifyDetailNone);
CASESTRRET(ANCESTOR);
CASESTRRET(VIRTUAL);
CASESTRRET(INFERIOR);
CASESTRRET(NONLINEAR);
CASESTRRET(NONLINEAR_VIRTUAL);
CASESTRRET(POINTER);
CASESTRRET(POINTER_ROOT);
CASESTRRET(NONE);
}

return "Unknown";
Expand Down
2 changes: 1 addition & 1 deletion src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ required_xcb_packages = [
# Some XCB packages are here because their versioning differs (see check below).
required_packages = [
'pixman-1', 'x11', 'x11-xcb', 'xcb-image', 'xcb-renderutil', 'xcb-util',
'xext', 'threads',
'threads',
]

foreach i : required_packages
Expand Down
10 changes: 10 additions & 0 deletions src/utils/list.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,16 @@ static inline bool list_is_empty(const struct list_node *head) {
return head->prev == head;
}

/// Splice a list of nodes from `from` to into the beginning of list `to`.
static inline void list_splice(struct list_node *from, struct list_node *to) {
if (list_is_empty(from)) {
return;
}
__list_link(from->prev, to->next);
__list_link(to, from->next);
list_init_head(from);
}

/// Return true if `to_check` is the first node in list headed by `head`
static inline bool
list_node_is_first(const struct list_node *head, const struct list_node *to_check) {
Expand Down
18 changes: 2 additions & 16 deletions src/wm/win.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include "picom.h"
#include "region.h"
#include "render.h"
#include "utils/list.h"
#include "utils/misc.h"
#include "x.h"

Expand Down Expand Up @@ -80,11 +79,6 @@ static void win_update_prop_shadow_raw(struct x_connection *c, struct atom *atom
struct managed_win *w);
static bool
win_update_prop_shadow(struct x_connection *c, struct atom *atoms, struct managed_win *w);
/**
* Update window EWMH fullscreen state.
*/
bool win_update_prop_fullscreen(struct x_connection *c, const struct atom *atoms,
struct managed_win *w);
/**
* Update leader of a window.
*/
Expand Down Expand Up @@ -901,14 +895,6 @@ void unmap_win_finish(session_t *ps, struct managed_win *w) {
assert(w->running_animation == NULL);
}

struct window_transition_data {
struct managed_win *w;
session_t *ps;
// TODO(yshui) switch to only pass backend_data after the legacy backend removal
// struct backend_base *backend_data;
uint64_t refcount;
};

/**
* Determine whether a window is to be dimmed.
*/
Expand Down Expand Up @@ -2269,8 +2255,8 @@ bool win_process_animation_and_state_change(struct session *ps, struct managed_w
if (w->running_animation == NULL) {
return false;
}
log_debug("Advance animation for %#010x (%s) %f seconds", w->base.id,
w->name, delta_t);
log_verbose("Advance animation for %#010x (%s) %f seconds", w->base.id,
w->name, delta_t);
if (!script_instance_is_finished(w->running_animation)) {
w->running_animation->elapsed += delta_t;
auto result =
Expand Down

0 comments on commit a312328

Please sign in to comment.