mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -05:00
crtc-xrandr: Respect configured RANDR panning
A user may have configured an output to be panning, e.g. using xrandr --output <output> --mode <mode> --panning <size>. Respect this by making the logical monitor use the panning size, instead of the mode. This makes e.g. makes the background cover the whole panning size, and panels etc will cover the whole top of the panned area, instead of just the top left part covering the monitor if having panned to (0, 0). No support is added to configuring panning, i.e. a panned monitor configuration cannot be stored in monitors.xml. https://gitlab.gnome.org/GNOME/mutter/merge_requests/1085
This commit is contained in:
parent
6885c37784
commit
0462208d4e
@ -234,20 +234,23 @@ meta_create_xrandr_crtc (MetaGpuXrandr *gpu_xrandr,
|
||||
RRCrtc crtc_id,
|
||||
XRRScreenResources *resources)
|
||||
{
|
||||
MetaGpu *gpu = META_GPU (gpu_xrandr);
|
||||
MetaBackend *backend = meta_gpu_get_backend (gpu);
|
||||
MetaMonitorManager *monitor_manager =
|
||||
meta_backend_get_monitor_manager (backend);
|
||||
MetaMonitorManagerXrandr *monitor_manager_xrandr =
|
||||
META_MONITOR_MANAGER_XRANDR (monitor_manager);
|
||||
Display *xdisplay =
|
||||
meta_monitor_manager_xrandr_get_xdisplay (monitor_manager_xrandr);
|
||||
MetaCrtc *crtc;
|
||||
MetaCrtcXrandr *crtc_xrandr;
|
||||
XRRPanning *panning;
|
||||
unsigned int i;
|
||||
GList *modes;
|
||||
|
||||
crtc = g_object_new (META_TYPE_CRTC, NULL);
|
||||
|
||||
crtc_xrandr = g_new0 (MetaCrtcXrandr, 1);
|
||||
crtc_xrandr->rect = (MetaRectangle) {
|
||||
.x = xrandr_crtc->x,
|
||||
.y = xrandr_crtc->y,
|
||||
.width = xrandr_crtc->width,
|
||||
.height = xrandr_crtc->height,
|
||||
};
|
||||
crtc_xrandr->transform =
|
||||
meta_monitor_transform_from_xrandr (xrandr_crtc->rotation);
|
||||
|
||||
@ -255,6 +258,27 @@ meta_create_xrandr_crtc (MetaGpuXrandr *gpu_xrandr,
|
||||
crtc->driver_notify = (GDestroyNotify) meta_crtc_destroy_notify;
|
||||
crtc->gpu = META_GPU (gpu_xrandr);
|
||||
crtc->crtc_id = crtc_id;
|
||||
|
||||
panning = XRRGetPanning (xdisplay, resources, crtc_id);
|
||||
if (panning && panning->width > 0 && panning->height > 0)
|
||||
{
|
||||
crtc_xrandr->rect = (MetaRectangle) {
|
||||
.x = panning->left,
|
||||
.y = panning->top,
|
||||
.width = panning->width,
|
||||
.height = panning->height,
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
crtc_xrandr->rect = (MetaRectangle) {
|
||||
.x = xrandr_crtc->x,
|
||||
.y = xrandr_crtc->y,
|
||||
.width = xrandr_crtc->width,
|
||||
.height = xrandr_crtc->height,
|
||||
};
|
||||
}
|
||||
|
||||
crtc->is_dirty = FALSE;
|
||||
crtc->all_transforms =
|
||||
meta_monitor_transform_from_xrandr_all (xrandr_crtc->rotations);
|
||||
|
Loading…
Reference in New Issue
Block a user