mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 08:00:42 -05:00
x11/xrandr: Use xcb to set properties on outputs
It seems that fglrx sometimes gives us absolute junk when requesting the outputs, and if we don't trap errors, we'll just crash when trying to configure a junk output. Use xcb so errors simply get ignored.
This commit is contained in:
parent
aea71fbd01
commit
8da5761ffc
@ -917,11 +917,12 @@ output_set_presentation_xrandr (MetaMonitorManagerXrandr *manager_xrandr,
|
|||||||
int value = presentation;
|
int value = presentation;
|
||||||
|
|
||||||
atom = XInternAtom (manager_xrandr->xdisplay, "_MUTTER_PRESENTATION_OUTPUT", False);
|
atom = XInternAtom (manager_xrandr->xdisplay, "_MUTTER_PRESENTATION_OUTPUT", False);
|
||||||
XRRChangeOutputProperty (manager_xrandr->xdisplay,
|
|
||||||
(XID)output->winsys_id,
|
xcb_randr_change_output_property (XGetXCBConnection (manager_xrandr->xdisplay),
|
||||||
atom,
|
(XID)output->winsys_id,
|
||||||
XA_CARDINAL, 32, PropModeReplace,
|
atom, XCB_ATOM_CARDINAL, 32,
|
||||||
(unsigned char*) &value, 1);
|
XCB_PROP_MODE_REPLACE,
|
||||||
|
1, &value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -936,11 +937,12 @@ output_set_underscanning_xrandr (MetaMonitorManagerXrandr *manager_xrandr,
|
|||||||
|
|
||||||
value = underscanning ? "on" : "off";
|
value = underscanning ? "on" : "off";
|
||||||
valueatom = XInternAtom (manager_xrandr->xdisplay, value, False);
|
valueatom = XInternAtom (manager_xrandr->xdisplay, value, False);
|
||||||
XRRChangeOutputProperty (manager_xrandr->xdisplay,
|
|
||||||
(XID)output->winsys_id,
|
xcb_randr_change_output_property (XGetXCBConnection (manager_xrandr->xdisplay),
|
||||||
prop,
|
(XID)output->winsys_id,
|
||||||
XA_ATOM, 32, PropModeReplace,
|
prop, XCB_ATOM_ATOM, 32,
|
||||||
(unsigned char*) &valueatom, 1);
|
XCB_PROP_MODE_REPLACE,
|
||||||
|
1, &valueatom);
|
||||||
|
|
||||||
/* Configure the border at the same time. Currently, we use a
|
/* Configure the border at the same time. Currently, we use a
|
||||||
* 5% of the width/height of the mode. In the future, we should
|
* 5% of the width/height of the mode. In the future, we should
|
||||||
@ -951,19 +953,21 @@ output_set_underscanning_xrandr (MetaMonitorManagerXrandr *manager_xrandr,
|
|||||||
|
|
||||||
prop = XInternAtom (manager_xrandr->xdisplay, "underscan hborder", False);
|
prop = XInternAtom (manager_xrandr->xdisplay, "underscan hborder", False);
|
||||||
border_value = output->crtc->current_mode->width * 0.05;
|
border_value = output->crtc->current_mode->width * 0.05;
|
||||||
XRRChangeOutputProperty (manager_xrandr->xdisplay,
|
|
||||||
(XID)output->winsys_id,
|
xcb_randr_change_output_property (XGetXCBConnection (manager_xrandr->xdisplay),
|
||||||
prop,
|
(XID)output->winsys_id,
|
||||||
XA_INTEGER, 32, PropModeReplace,
|
prop, XCB_ATOM_INTEGER, 32,
|
||||||
(unsigned char *) &border_value, 1);
|
XCB_PROP_MODE_REPLACE,
|
||||||
|
1, &border_value);
|
||||||
|
|
||||||
prop = XInternAtom (manager_xrandr->xdisplay, "underscan vborder", False);
|
prop = XInternAtom (manager_xrandr->xdisplay, "underscan vborder", False);
|
||||||
border_value = output->crtc->current_mode->height * 0.05;
|
border_value = output->crtc->current_mode->height * 0.05;
|
||||||
XRRChangeOutputProperty (manager_xrandr->xdisplay,
|
|
||||||
(XID)output->winsys_id,
|
xcb_randr_change_output_property (XGetXCBConnection (manager_xrandr->xdisplay),
|
||||||
prop,
|
(XID)output->winsys_id,
|
||||||
XA_INTEGER, 32, PropModeReplace,
|
prop, XCB_ATOM_INTEGER, 32,
|
||||||
(unsigned char *) &border_value, 1);
|
XCB_PROP_MODE_REPLACE,
|
||||||
|
1, &border_value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1199,11 +1203,12 @@ meta_monitor_manager_xrandr_change_backlight (MetaMonitorManager *manager,
|
|||||||
hw_value = round ((double)value / 100.0 * output->backlight_max + output->backlight_min);
|
hw_value = round ((double)value / 100.0 * output->backlight_max + output->backlight_min);
|
||||||
|
|
||||||
atom = XInternAtom (manager_xrandr->xdisplay, "Backlight", False);
|
atom = XInternAtom (manager_xrandr->xdisplay, "Backlight", False);
|
||||||
XRRChangeOutputProperty (manager_xrandr->xdisplay,
|
|
||||||
(XID)output->winsys_id,
|
xcb_randr_change_output_property (XGetXCBConnection (manager_xrandr->xdisplay),
|
||||||
atom,
|
(XID)output->winsys_id,
|
||||||
XA_INTEGER, 32, PropModeReplace,
|
atom, XCB_ATOM_INTEGER, 32,
|
||||||
(unsigned char *) &hw_value, 1);
|
XCB_PROP_MODE_REPLACE,
|
||||||
|
1, &hw_value);
|
||||||
|
|
||||||
/* We're not selecting for property notifies, so update the value immediately */
|
/* We're not selecting for property notifies, so update the value immediately */
|
||||||
output->backlight = normalize_backlight (output, hw_value);
|
output->backlight = normalize_backlight (output, hw_value);
|
||||||
|
Loading…
Reference in New Issue
Block a user