Skip to content

Commit

Permalink
core: drop xcb-dpms
Browse files Browse the repository at this point in the history
it's not used anymore.
  • Loading branch information
absolutelynothelix committed May 29, 2024
1 parent c3883b8 commit 8b89ffd
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 43 deletions.
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-dpms0-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 libxext-dev meson ninja-build uthash-dev
if: ${{ matrix.language == 'cpp' }}

# Autobuild
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ Assuming you already have all the usual building tools installed (e.g. gcc, pyth
* xcb
* xcb-util
* xcb-damage
* xcb-dpms
* xcb-xfixes
* xcb-shape
* xcb-renderutil
Expand All @@ -49,7 +48,7 @@ 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-dpms0-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 libxext-dev meson ninja-build uthash-dev
```

On Fedora, the needed packages are
Expand Down
4 changes: 0 additions & 4 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,6 @@ typedef struct session {
xcb_sync_fence_t sync_fence;
/// Whether we are rendering the first frame after screen is redirected
bool first_frame;
/// Whether screen has been turned off
bool screen_is_off;
/// When last MSC event happened, in useconds.
uint64_t last_msc_instant;
/// The last MSC number
Expand Down Expand Up @@ -332,8 +330,6 @@ typedef struct session {
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.
Expand Down
4 changes: 2 additions & 2 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ picom_inc = include_directories(['.', '../include'])
cflags = []

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

# Some XCB packages are here because their versioning differs (see check below).
Expand Down
8 changes: 0 additions & 8 deletions src/picom.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include <unistd.h>
#include <xcb/composite.h>
#include <xcb/damage.h>
#include <xcb/dpms.h>
#include <xcb/glx.h>
#include <xcb/present.h>
#include <xcb/randr.h>
Expand Down Expand Up @@ -2109,7 +2108,6 @@ static session_t *session_init(int argc, char **argv, Display *dpy,
xcb_prefetch_extension_data(ps->c.c, &xcb_present_id);
xcb_prefetch_extension_data(ps->c.c, &xcb_sync_id);
xcb_prefetch_extension_data(ps->c.c, &xcb_glx_id);
xcb_prefetch_extension_data(ps->c.c, &xcb_dpms_id);

ext_info = xcb_get_extension_data(ps->c.c, &xcb_render_id);
if (!ext_info || !ext_info->present) {
Expand Down Expand Up @@ -2179,12 +2177,6 @@ static session_t *session_init(int argc, char **argv, Display *dpy,
ps->glx_event = ext_info->first_event;
}

ext_info = xcb_get_extension_data(ps->c.c, &xcb_dpms_id);
ps->dpms_exists = ext_info && ext_info->present;
if (!ps->dpms_exists) {
log_warn("No DPMS extension");
}

// Parse configuration file
if (!parse_config(&ps->o, config_file)) {
return NULL;
Expand Down
21 changes: 0 additions & 21 deletions src/x.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include <pixman.h>
#include <xcb/composite.h>
#include <xcb/damage.h>
#include <xcb/dpms.h>
#include <xcb/glx.h>
#include <xcb/present.h>
#include <xcb/randr.h>
Expand Down Expand Up @@ -782,26 +781,6 @@ void x_request_vblank_event(struct x_connection *c, xcb_window_t window, uint64_
set_cant_fail_cookie(c, cookie);
}

static inline bool dpms_screen_is_off(xcb_dpms_info_reply_t *info) {
// state is a bool indicating whether dpms is enabled
return info->state && (info->power_level != XCB_DPMS_DPMS_MODE_ON);
}

bool x_check_dpms_status(struct x_connection *c, bool *screen_is_off) {
auto r = xcb_dpms_info_reply(c->c, xcb_dpms_info(c->c), NULL);
if (!r) {
log_error("Failed to query DPMS status.");
return false;
}
auto now_screen_is_off = dpms_screen_is_off(r);
if (*screen_is_off != now_screen_is_off) {
log_debug("Screen is now %s", now_screen_is_off ? "off" : "on");
*screen_is_off = now_screen_is_off;
}
free(r);
return true;
}

/**
* Convert a struct conv to a X picture convolution filter, normalizing the kernel
* in the process. Allow the caller to specify the element at the center of the kernel,
Expand Down
5 changes: 0 additions & 5 deletions src/x.h
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,3 @@ uint32_t attr_deprecated xcb_generate_id(xcb_connection_t *c);

/// Ask X server to send us a notification for the next end of vblank.
void x_request_vblank_event(struct x_connection *c, xcb_window_t window, uint64_t msc);

/// Update screen_is_off to reflect the current DPMS state.
///
/// Returns true if the DPMS state was successfully queried, false otherwise.
bool x_check_dpms_status(struct x_connection *c, bool *screen_is_off);

0 comments on commit 8b89ffd

Please sign in to comment.