From e08c6a0752772745f35f7afcf6c2b1c927b91cc0 Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Mon, 4 May 2009 19:24:47 -0500 Subject: randr: bug #21554 - re-probe outputs when coming back from laptop unsuspend Make xf86 RANDR wrap the EnterVT call chain, so it can re-probe the outputs when a laptop comes back from suspend/unsuspend (actually, any time that we enter our VT again). The X server should then send RR* events to clients, so they can cope with a monitor that was unplugged while the laptop was suspended. Signed-off-by: Federico Mena Quintero --- hw/xfree86/modes/xf86RandR12.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c index 1e3b70c09..0de21e253 100644 --- a/hw/xfree86/modes/xf86RandR12.c +++ b/hw/xfree86/modes/xf86RandR12.c @@ -55,6 +55,13 @@ typedef struct _xf86RandR12Info { int pointerY; Rotation rotation; /* current mode */ Rotation supported_rotations; /* driver supported */ + + /* Used to wrap EnterVT so we can re-probe the outputs when a laptop unsuspends + * (actually, any time that we switch back into our VT). + * + * See https://bugs.freedesktop.org/show_bug.cgi?id=21554 + */ + xf86EnterVTProc *orig_EnterVT; } XF86RandRInfoRec, *XF86RandRInfoPtr; #ifdef RANDR_12_INTERFACE @@ -1745,11 +1752,26 @@ xf86RandR12ChangeGamma(int scrnIndex, Gamma gamma) return Success; } +static Bool +xf86RandR12EnterVT (int screen_index, int flags) +{ + ScreenPtr pScreen = screenInfo.screens[screen_index]; + XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); + + if (randrp->orig_EnterVT) { + if (!randrp->orig_EnterVT (screen_index, flags)) + return FALSE; + } + + return RRGetInfo (pScreen, TRUE); /* force a re-probe of outputs and notify clients about changes */ +} + static Bool xf86RandR12Init12 (ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; rrScrPrivPtr rp = rrGetScrPriv(pScreen); + XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); rp->rrGetInfo = xf86RandR12GetInfo12; rp->rrScreenSetSize = xf86RandR12ScreenSetSize; @@ -1767,6 +1789,10 @@ xf86RandR12Init12 (ScreenPtr pScreen) rp->rrSetConfig = NULL; pScrn->PointerMoved = xf86RandR12PointerMoved; pScrn->ChangeGamma = xf86RandR12ChangeGamma; + + randrp->orig_EnterVT = pScrn->EnterVT; + pScrn->EnterVT = xf86RandR12EnterVT; + if (!xf86RandR12CreateObjects12 (pScreen)) return FALSE; -- cgit v1.2.3