Skip to content

Commit

Permalink
core: dependencies cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
absolutelynothelix committed Apr 23, 2023
1 parent 05ef18d commit 1982232
Show file tree
Hide file tree
Showing 14 changed files with 237 additions and 271 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
languages: ${{ matrix.language }}

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

# Autobuild
Expand Down
42 changes: 21 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,43 +17,43 @@ See [Releases](https://github.com/yshui/picom/releases)

Assuming you already have all the usual building tools installed (e.g. gcc, python, meson, ninja, etc.), you still need:

* libconfig (optional, use the `-Dconfig_file=false` meson configure flag to disable)
* libdbus (optional, use the `-Ddbus=false` meson configure flag to disable)
* libev
* libgl, libegl (optional, use the `-Dopengl=false` meson configure flag to disable)
* libpcre2 (optional, use the `-Dregex=false` meson configure flag to disable)
* libx11
* libx11-xcb
* libXext
* xproto
* libxext
* pixman
* uthash
* xcb
* xcb-composite
* xcb-damage
* xcb-dpms
* xcb-xfixes
* xcb-shape
* xcb-renderutil
* xcb-render
* xcb-randr
* xcb-composite
* xcb-glx
* xcb-image
* xcb-present
* xcb-glx
* pixman
* libdbus (optional, disable with the `-Ddbus=false` meson configure flag)
* libconfig (optional, disable with the `-Dconfig_file=false` meson configure flag)
* libGL, libEGL (optional, disable with the `-Dopengl=false` meson configure flag)
* libpcre2 (optional, disable with the `-Dregex=false` meson configure flag)
* libev
* uthash
* xcb-randr
* xcb-render
* xcb-renderutil
* xcb-shape
* xcb-xfixes
* xproto

On Debian based distributions (e.g. Ubuntu), the needed packages are
On Debian-based distributions (e.g. Ubuntu) the needed packages are:

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

On Fedora, the needed packages are
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 meson pcre2-devel pixman-devel uthash-devel xcb-util-image-devel xcb-util-renderutil-devel xorg-x11-proto-devel
dbus-devel gcc git libconfig-devel libdrm-devel libegl-devel libev-devel libgl-devel libx11-devel libx11-xcb libxcb-devel libxext-devel meson pcre2-devel pixman-devel uthash-devel xcb-util-image-devel xcb-util-renderutil-devel xorg-x11-proto-devel
```

To build the documents, you need `asciidoc`
To build the documentation you need asciidoc.

### To build

Expand Down
4 changes: 2 additions & 2 deletions src/backend/backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ void paint_all_new(session_t *ps, struct managed_win *t, bool ignore_damage) {
return handle_device_reset(ps);
}
if (ps->o.xrender_sync_fence) {
if (ps->xsync_exists && !x_fence_sync(ps->c, ps->sync_fence)) {
if (ps->has_sync && !x_fence_sync(ps->c, ps->sync_fence)) {
log_error("x_fence_sync failed, xrender-sync-fence will be "
"disabled from now on.");
xcb_sync_destroy_fence(ps->c, ps->sync_fence);
ps->sync_fence = XCB_NONE;
ps->o.xrender_sync_fence = false;
ps->xsync_exists = false;
ps->has_sync = false;
}
}
// All painting will be limited to the damage, if _some_ of
Expand Down
2 changes: 1 addition & 1 deletion src/backend/gl/glx.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ static backend_t *glx_init(session_t *ps) {
XVisualInfo *pvis = NULL;

// Check for GLX extension
if (!ps->glx_exists) {
if (!ps->has_glx) {
log_error("No GLX extension.");
goto end;
}
Expand Down
2 changes: 1 addition & 1 deletion src/backend/xrender/xrender.c
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ static backend_t *backend_xrender_init(session_t *ps) {
}

xd->vsync = ps->o.vsync;
if (ps->present_exists) {
if (ps->has_present) {
auto eid = x_new_id(ps->c);
auto e =
xcb_request_check(ps->c, xcb_present_select_input_checked(
Expand Down
76 changes: 29 additions & 47 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -327,59 +327,41 @@ typedef struct session {
int drm_fd;
#endif

// === X extension related ===
/// Event base number for X Fixes extension.
int xfixes_event;
/// Error base number for X Fixes extension.
int xfixes_error;
/// Event base number for X Damage extension.
// === X extensions related ===
/// Event base number of the X Damage extension.
int damage_event;
/// Error base number for X Damage extension.
/// Error base number of the X Damage extension.
int damage_error;
/// Event base number for X Render extension.
int render_event;
/// Error base number for X Render extension.
int render_error;
/// Event base number for X Composite extension.
int composite_event;
/// Error base number for X Composite extension.
int composite_error;
/// Major opcode for X Composite extension.
int composite_opcode;
/// Whether X DPMS extension exists
bool dpms_exists;
/// Whether X Shape extension exists.
bool shape_exists;
/// Event base number for X Shape extension.
int shape_event;
/// Error base number for X Shape extension.
int shape_error;
/// Whether X RandR extension exists.
bool randr_exists;
/// Event base number for X RandR extension.
int randr_event;
/// Error base number for X RandR extension.
int randr_error;
/// Whether X Present extension exists.
bool present_exists;
/// Whether X GLX extension exists.
bool glx_exists;
/// Event base number for X GLX extension.
int glx_event;
/// Error base number for X GLX extension.
/// If the X GLX extension available.
bool has_glx;
/// Error base number of the X GLX extension.
int glx_error;
/// If the X Present extension available.
bool has_present;
/// If the X RandR extension available.
bool has_randr;
/// Event base number of the X RandR extension.
int randr_event;
/// Number of X RandR monitors.
int randr_nmonitors;
/// X RandR monitor regions.
/// X RandR monitors regions.
region_t *randr_monitor_regs;
/// Whether X Sync extension exists.
bool xsync_exists;
/// Event base number for X Sync extension.
int xsync_event;
/// Error base number for X Sync extension.
int xsync_error;
/// Whether X Render convolution filter exists.
bool xrfilter_convolution_exists;
/// Error base number of the X Render extension.
int render_error;
/// If the X Shape extension available.
bool has_shape;
/// Event base number of the X Shape extension.
int shape_event;
/// If the X Sync extension available.
bool has_sync;
/// Event base number of the X Sync extension.
int sync_event;
/// Error base number of the X Sync extension.
int sync_error;
/// Error base number of the X Fixes extension.
int fixes_error;
/// If the X Render extension's convolution filter available.
bool has_convolution_xrfilter;

// === Atoms ===
struct atom *atoms;
Expand Down
6 changes: 3 additions & 3 deletions src/diagnostic.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ void print_diagnostics(session_t *ps, const char *config_file, bool compositor_r
printf("**Version:** " PICOM_VERSION "\n");
// printf("**CFLAGS:** %s\n", "??");
printf("\n### Extensions:\n\n");
printf("* Shape: %s\n", ps->shape_exists ? "Yes" : "No");
printf("* RandR: %s\n", ps->randr_exists ? "Yes" : "No");
printf("* Present: %s\n", ps->present_exists ? "Present" : "Not Present");
printf("* Shape: %s\n", ps->has_shape ? "Yes" : "No");
printf("* RandR: %s\n", ps->has_randr ? "Yes" : "No");
printf("* Present: %s\n", ps->has_present ? "Yes" : "No");
printf("\n### Misc:\n\n");
printf("* Use Overlay: %s\n", ps->overlay != XCB_NONE ? "Yes" : "No");
if (ps->overlay == XCB_NONE) {
Expand Down
12 changes: 6 additions & 6 deletions src/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ static inline xcb_window_t attr_pure ev_window(session_t *ps, xcb_generic_event_
return ((xcb_damage_notify_event_t *)ev)->drawable;
}

if (ps->shape_exists && ev->response_type == ps->shape_event) {
if (ps->has_shape && ev->response_type == ps->shape_event) {
return ((xcb_shape_notify_event_t *)ev)->affected_window;
}

Expand Down Expand Up @@ -125,12 +125,12 @@ static inline const char *ev_name(session_t *ps, xcb_generic_event_t *ev) {
return "Damage";
}

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

if (ps->xsync_exists) {
int o = ev->response_type - ps->xsync_event;
if (ps->has_sync) {
int o = ev->response_type - ps->sync_event;
switch (o) {
CASESTRRET(XSyncCounterNotify);
CASESTRRET(XSyncAlarmNotify);
Expand Down Expand Up @@ -735,11 +735,11 @@ void ev_handle(session_t *ps, xcb_generic_event_t *ev) {
break;
case 0: ev_xcb_error(ps, (xcb_generic_error_t *)ev); break;
default:
if (ps->shape_exists && ev->response_type == ps->shape_event) {
if (ps->has_shape && ev->response_type == ps->shape_event) {
ev_shape_notify(ps, (xcb_shape_notify_event_t *)ev);
break;
}
if (ps->randr_exists &&
if (ps->has_randr &&
ev->response_type == (ps->randr_event + XCB_RANDR_SCREEN_CHANGE_NOTIFY)) {
set_root_flags(ps, ROOT_FLAGS_SCREEN_CHANGE);
break;
Expand Down
8 changes: 5 additions & 3 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ picom_inc = include_directories('.')
cflags = []

required_xcb_packages = [
'xcb-render', 'xcb-damage', 'xcb-randr', 'xcb-sync', 'xcb-composite',
'xcb-shape', 'xcb-xfixes', 'xcb-present', 'xcb-glx', 'xcb-dpms', 'xcb'
'xcb', 'xcb-composite', 'xcb-damage', 'xcb-dpms', 'xcb-glx', 'xcb-present',
'xcb-randr', 'xcb-render', 'xcb-shape', 'xcb-sync', 'xcb-xfixes'
]

# xcb-image and xcb-renderutil are here because their versioning doesn't match
# other xcb packages versioning (checked below)
required_packages = [
'x11', 'x11-xcb', 'xcb-renderutil', 'xcb-image', 'xext', 'pixman-1'
'pixman-1', 'x11', 'x11-xcb', 'xcb-image', 'xcb-renderutil', 'xext'
]

foreach i : required_packages
Expand Down
2 changes: 1 addition & 1 deletion src/opengl.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ bool glx_init(session_t *ps, bool need_render) {
XVisualInfo *pvis = NULL;

// Check for GLX extension
if (!ps->glx_exists) {
if (!ps->has_glx) {
log_error("No GLX extension.");
goto glx_init_end;
}
Expand Down
Loading

0 comments on commit 1982232

Please sign in to comment.