mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-06 13:30:01 -05:00
pipewire: module-x11-bell: simplify x11_connect()
Since no cleanup needs to be in `x11_cleanup()`, the `error` label may be removed and the error codes can be returned directly.
This commit is contained in:
parent
d558e87b51
commit
afda4c81e7
1 changed files with 5 additions and 10 deletions
|
|
@ -156,13 +156,12 @@ static void display_io(void *data, int fd, uint32_t mask)
|
||||||
|
|
||||||
static int x11_connect(struct impl *impl, const char *name)
|
static int x11_connect(struct impl *impl, const char *name)
|
||||||
{
|
{
|
||||||
int res, major, minor;
|
int major, minor;
|
||||||
unsigned int auto_ctrls, auto_values;
|
unsigned int auto_ctrls, auto_values;
|
||||||
|
|
||||||
if (!(impl->display = XOpenDisplay(name))) {
|
if (!(impl->display = XOpenDisplay(name))) {
|
||||||
pw_log_error("XOpenDisplay() failed");
|
pw_log_error("XOpenDisplay() failed");
|
||||||
res = -EIO;
|
return -EIO;
|
||||||
goto error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl->source = pw_loop_add_io(impl->loop,
|
impl->source = pw_loop_add_io(impl->loop,
|
||||||
|
|
@ -176,8 +175,7 @@ static int x11_connect(struct impl *impl, const char *name)
|
||||||
|
|
||||||
if (!XkbLibraryVersion(&major, &minor)) {
|
if (!XkbLibraryVersion(&major, &minor)) {
|
||||||
pw_log_error("XkbLibraryVersion() failed");
|
pw_log_error("XkbLibraryVersion() failed");
|
||||||
res = -EIO;
|
return -EIO;
|
||||||
goto error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
major = XkbMajorVersion;
|
major = XkbMajorVersion;
|
||||||
|
|
@ -185,9 +183,8 @@ static int x11_connect(struct impl *impl, const char *name)
|
||||||
|
|
||||||
if (!XkbQueryExtension(impl->display, NULL, &impl->xkb_event_base,
|
if (!XkbQueryExtension(impl->display, NULL, &impl->xkb_event_base,
|
||||||
NULL, &major, &minor)) {
|
NULL, &major, &minor)) {
|
||||||
res = -EIO;
|
|
||||||
pw_log_error("XkbQueryExtension() failed");
|
pw_log_error("XkbQueryExtension() failed");
|
||||||
goto error;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
XkbSelectEvents(impl->display, XkbUseCoreKbd, XkbBellNotifyMask, XkbBellNotifyMask);
|
XkbSelectEvents(impl->display, XkbUseCoreKbd, XkbBellNotifyMask, XkbBellNotifyMask);
|
||||||
|
|
@ -195,9 +192,7 @@ static int x11_connect(struct impl *impl, const char *name)
|
||||||
XkbSetAutoResetControls(impl->display, XkbAudibleBellMask, &auto_ctrls, &auto_values);
|
XkbSetAutoResetControls(impl->display, XkbAudibleBellMask, &auto_ctrls, &auto_values);
|
||||||
XkbChangeEnabledControls(impl->display, XkbUseCoreKbd, XkbAudibleBellMask, 0);
|
XkbChangeEnabledControls(impl->display, XkbUseCoreKbd, XkbAudibleBellMask, 0);
|
||||||
|
|
||||||
res = 0;
|
return 0;
|
||||||
error:
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void module_destroy(void *data)
|
static void module_destroy(void *data)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue