code review 219560044: taowm: move offscreenXY away from the int16 underflow d... (issue 219560044 by nigeltao@golang.org)

1 view
Skip to first unread message

nige...@golang.org

unread,
Apr 5, 2015, 7:25:47 AM4/5/15
to nige...@golang.org, ta...@googlegroups.com, re...@codereview-hr.appspotmail.com
Reviewers: nigeltao,

Message:
Hello nige...@golang.org (cc: ta...@googlegroups.com),

I'd like you to review this change to
https://code.google.com/p/taowm/


Description:
taowm: move offscreenXY away from the int16 underflow discontinuity.

This works around a session-crasher occasionally seen when using the
GIMP's
"Perspective" tool.

Please review this at https://codereview.appspot.com/219560044/

Affected files (+9, -2 lines):
M taowm/geom.go


Index: taowm/geom.go
===================================================================
--- a/taowm/geom.go
+++ b/taowm/geom.go
@@ -29,8 +29,15 @@
listWorkspaces
)

-// offscreenXY is the most negative X/Y co-ordinate.
-const offscreenXY = -1 << 15
+// offscreenXY is a very negative X/Y co-ordinate. The most negative value
is
+// -1<<15, but using that value is dangerously close to the int16 underflow
+// discontinuity. For example, using -1<<15 can cause the X server to
close the
+// connection, exiting the window manager and thus the session, when using
the
+// GIMP's "Perspective" tool that creates an unusual window to show the
+// perspective grid. It's not entirely obvious why mapping and configuring
that
+// window leads to a connection close, but empirically, moving offscreenXY
away
+// from that int16 underflow discontinuity prevents that from happening.
+const offscreenXY = -1<<15 + 1<<13 // = -32768 + 8192 = -24576 =
int16(uint16(0xa000))

func contains(r xp.Rectangle, x, y int16) bool {
return r.X <= x && x <= r.X+int16(r.Width) &&


nige...@golang.org

unread,
Apr 5, 2015, 7:25:51 AM4/5/15
to nige...@golang.org, ta...@googlegroups.com, re...@codereview-hr.appspotmail.com

nige...@golang.org

unread,
Apr 5, 2015, 7:27:24 AM4/5/15
to nige...@golang.org, ta...@googlegroups.com, re...@codereview-hr.appspotmail.com
*** Submitted as
https://code.google.com/p/taowm/source/detail?r=9a591316f3ea ***

taowm: move offscreenXY away from the int16 underflow discontinuity.

This works around a session-crasher occasionally seen when using the
GIMP's
"Perspective" tool.

TBR=nigeltao
R=nigeltao
CC=taowm
https://codereview.appspot.com/219560044


https://codereview.appspot.com/219560044/
Reply all
Reply to author
Forward
0 new messages