fikovnik / ShiftIt

Managing windows size and position in OSX
5.54k stars 360 forks source link

Fix #247 (crash when X11WindowDriver failed to get window properties) #291

Open elipsitz opened 5 years ago

elipsitz commented 5 years ago

X11WindowDriver uses XGetWindowPropertyRef to get a reference to the properties of the active window. If this fails, however, the outer function findFocusedWindow does not return "NO" to indicate failure, because the result of the inner block is ignored. This change makes sure findFocusedWindow returns "NO" if the inner block returns "NO".

Reproduce/test by using a GTK window, like sylpheed as suggested in the window, or this ginput/matplotlib Python script:

import matplotlib.pyplot as plt
plt.title("test ginput")
x = plt.ginput(n=0, timeout=-1)

Trying to use ShiftIt on the window still won't work, but ShiftIt will no longer crash.

Fixes #247 .