Import Debian version 1.29

steamos-compositor (1.29) brewmaster; urgency=medium

  * Tweaking focus and display logic in steamcompmgr to avoid event storms on newer
    X servers. It looks like Damage semantics changed on Xserver 1.16 and we were
    getting unexpected events after XDamageSubtract().
This commit is contained in:
Pierre-Loup A. Griffais 2015-07-03 19:36:36 -07:00
parent a7deb61fc5
commit 34f963a59a
2 changed files with 39 additions and 21 deletions

8
debian/changelog vendored
View file

@ -1,3 +1,11 @@
steamos-compositor (1.29) brewmaster; urgency=medium
* Tweaking focus and display logic in steamcompmgr to avoid event storms on newer
X servers. It looks like Damage semantics changed on Xserver 1.16 and we were
getting unexpected events after XDamageSubtract().
-- Pierre-Loup A. Griffais <pgriffais@valvesoftware.com> Fri, 03 Jul 2015 19:36:36 -0700
steamos-compositor (1.28) brewmaster; urgency=medium steamos-compositor (1.28) brewmaster; urgency=medium
* Add set_hd_mode.sh helper script, run at start of session; helps get out * Add set_hd_mode.sh helper script, run at start of session; helps get out

View file

@ -164,6 +164,10 @@ Bool hideCursorForScale;
Bool hideCursorForMovement; Bool hideCursorForMovement;
unsigned int lastCursorMovedTime; unsigned int lastCursorMovedTime;
Bool focusDirty = False;
unsigned long damageSequence = 0;
#define CURSOR_HIDE_TIME 3000 #define CURSOR_HIDE_TIME 3000
Bool gotXError = False; Bool gotXError = False;
@ -1181,12 +1185,13 @@ determine_and_apply_focus (Display *dpy)
setup_pointer_barriers(dpy); setup_pointer_barriers(dpy);
if (gameFocused || !gamesRunningCount) if (gameFocused || !gamesRunningCount && list[0].id != focus->id)
{ {
XRaiseWindow(dpy, focus->id); XRaiseWindow(dpy, focus->id);
XSetInputFocus(dpy, focus->id, RevertToNone, CurrentTime);
} }
XSetInputFocus(dpy, focus->id, RevertToNone, CurrentTime);
if (!focus->nudged) if (!focus->nudged)
{ {
XMoveWindow(dpy, focus->id, 1, 1); XMoveWindow(dpy, focus->id, 1, 1);
@ -1338,7 +1343,7 @@ map_win (Display *dpy, Window id, unsigned long sequence)
w->validContents = False; w->validContents = False;
determine_and_apply_focus(dpy); focusDirty = True;
} }
static void static void
@ -1372,7 +1377,7 @@ unmap_win (Display *dpy, Window id, Bool fade)
return; return;
w->a.map_state = IsUnmapped; w->a.map_state = IsUnmapped;
determine_and_apply_focus(dpy); focusDirty = True;
finish_unmap_win (dpy, w); finish_unmap_win (dpy, w);
} }
@ -1443,7 +1448,7 @@ add_win (Display *dpy, Window id, Window prev, unsigned long sequence)
if (new->a.map_state == IsViewable) if (new->a.map_state == IsViewable)
map_win (dpy, id, sequence); map_win (dpy, id, sequence);
determine_and_apply_focus (dpy); focusDirty = True;
} }
static void static void
@ -1473,9 +1478,9 @@ restack_win (Display *dpy, win *w, Window new_above)
} }
w->next = *prev; w->next = *prev;
*prev = w; *prev = w;
focusDirty = True;
} }
determine_and_apply_focus(dpy);
} }
static void static void
@ -1510,7 +1515,7 @@ configure_win (Display *dpy, XConfigureEvent *ce)
w->a.override_redirect = ce->override_redirect; w->a.override_redirect = ce->override_redirect;
restack_win (dpy, w, ce->above); restack_win (dpy, w, ce->above);
determine_and_apply_focus (dpy); focusDirty = True;
} }
static void static void
@ -1561,7 +1566,7 @@ destroy_win (Display *dpy, Window id, Bool gone, Bool fade)
currentOverlayWindow = None; currentOverlayWindow = None;
if (currentNotificationWindow == id && gone) if (currentNotificationWindow == id && gone)
currentNotificationWindow = None; currentNotificationWindow = None;
determine_and_apply_focus(dpy); focusDirty = True;
finish_destroy_win (dpy, id, gone); finish_destroy_win (dpy, id, gone);
} }
@ -1583,14 +1588,14 @@ damage_win (Display *dpy, XDamageNotifyEvent *de)
// First damage event we get, compute focus; we only want to focus damaged // First damage event we get, compute focus; we only want to focus damaged
// windows to have meaningful frames. // windows to have meaningful frames.
if (w->gameID && w->damage_sequence == 0) if (w->gameID && w->damage_sequence == 0)
determine_and_apply_focus(dpy); focusDirty = True;
w->damage_sequence = de->serial; w->damage_sequence = damageSequence++;
// If we just passed the focused window, we might be eliglible to take over // If we just passed the focused window, we might be eliglible to take over
if (focus && focus != w && w->gameID && if (focus && focus != w && w->gameID &&
w->damage_sequence > focus->damage_sequence) w->damage_sequence > focus->damage_sequence)
determine_and_apply_focus(dpy); focusDirty = True;
w->damaged = 1; w->damaged = 1;
@ -1981,6 +1986,8 @@ main (int argc, char **argv)
for (;;) for (;;)
{ {
focusDirty = False;
do { do {
XNextEvent (dpy, &ev); XNextEvent (dpy, &ev);
if ((ev.type & 0x7f) != KeymapNotify) if ((ev.type & 0x7f) != KeymapNotify)
@ -2040,7 +2047,7 @@ main (int argc, char **argv)
if (w) if (w)
{ {
get_size_hints(dpy, w); get_size_hints(dpy, w);
determine_and_apply_focus(dpy); focusDirty = True;
} }
} }
} }
@ -2085,7 +2092,7 @@ main (int argc, char **argv)
if (w) if (w)
{ {
w->isSteam = get_prop(dpy, w->id, steamAtom, 0); w->isSteam = get_prop(dpy, w->id, steamAtom, 0);
determine_and_apply_focus(dpy); focusDirty = True;
} }
} }
if (ev.xproperty.atom == gameAtom) if (ev.xproperty.atom == gameAtom)
@ -2094,7 +2101,7 @@ main (int argc, char **argv)
if (w) if (w)
{ {
w->gameID = get_prop(dpy, w->id, gameAtom, 0); w->gameID = get_prop(dpy, w->id, gameAtom, 0);
determine_and_apply_focus(dpy); focusDirty = True;
} }
} }
if (ev.xproperty.atom == overlayAtom) if (ev.xproperty.atom == overlayAtom)
@ -2103,7 +2110,7 @@ main (int argc, char **argv)
if (w) if (w)
{ {
w->isOverlay = get_prop(dpy, w->id, overlayAtom, 0); w->isOverlay = get_prop(dpy, w->id, overlayAtom, 0);
determine_and_apply_focus(dpy); focusDirty = True;
// Overlay windows need a RGBA pixmap, so destroy the old one there // Overlay windows need a RGBA pixmap, so destroy the old one there
// It'll be reallocated as RGBA in ensure_win_resources() // It'll be reallocated as RGBA in ensure_win_resources()
@ -2119,14 +2126,14 @@ main (int argc, char **argv)
if (w) if (w)
{ {
get_size_hints(dpy, w); get_size_hints(dpy, w);
determine_and_apply_focus(dpy); focusDirty = True;
} }
} }
if (ev.xproperty.atom == gamesRunningAtom) if (ev.xproperty.atom == gamesRunningAtom)
{ {
gamesRunningCount = get_prop(dpy, root, gamesRunningAtom, 0); gamesRunningCount = get_prop(dpy, root, gamesRunningAtom, 0);
determine_and_apply_focus(dpy); focusDirty = True;
} }
if (ev.xproperty.atom == screenScaleAtom) if (ev.xproperty.atom == screenScaleAtom)
{ {
@ -2137,7 +2144,7 @@ main (int argc, char **argv)
if (w = find_win(dpy, currentFocusWindow)) if (w = find_win(dpy, currentFocusWindow))
w->damaged = 1; w->damaged = 1;
determine_and_apply_focus(dpy); focusDirty = True;
} }
break; break;
case ClientMessage: case ClientMessage:
@ -2149,7 +2156,7 @@ main (int argc, char **argv)
{ {
w->isFullscreen = ev.xclient.data.l[0]; w->isFullscreen = ev.xclient.data.l[0];
determine_and_apply_focus(dpy); focusDirty = True;
} }
} }
break; break;
@ -2208,6 +2215,9 @@ main (int argc, char **argv)
break; break;
} }
} while (QLength (dpy)); } while (QLength (dpy));
if (focusDirty == True)
determine_and_apply_focus(dpy);
if (doRender) if (doRender)
{ {