Slight cleanup of error handling based on improvement to pure-x11.

This commit is contained in:
Vidar Hokstad 2024-01-26 07:08:55 +00:00
parent 7dcd5daaf2
commit 739da5fdf9
3 changed files with 50 additions and 50 deletions

View file

@ -2,4 +2,5 @@
source "https://rubygems.org" source "https://rubygems.org"
gem "pure-x11" gem "pure-x11", ">=0.0.9"

View file

@ -57,5 +57,9 @@ loop do
end end
p ev p ev
begin
d.(ev.class, ev) d.(ev.class, ev)
rescue X11::Error => e
pp e
end
end end

9
wm.rb
View file

@ -115,7 +115,7 @@ class WindowManager
w = @windows[wid] # To avoid infinite recursion, this *must not* use #window w = @windows[wid] # To avoid infinite recursion, this *must not* use #window
return w if w return w if w
w = Window.new(self, wid) w = Window.new(self, wid)
begin
# FIXME: At least some of these ought to "adopted" but set as # FIXME: At least some of these ought to "adopted" but set as
# floating/non-layout so they stay on a single desktop. # floating/non-layout so they stay on a single desktop.
# #
@ -140,7 +140,7 @@ class WindowManager
return w if attr.override_redirect return w if attr.override_redirect
w.mapped = attr.map_state != 0 w.mapped = attr.map_state != 0
geom = w.get_geometry geom = w.get_geometry
return w if geom.is_a?(X11::Form::Error) || geom.width < 2 || geom.height < 2 return w if geom.width < 2 || geom.height < 2
@windows[wid] = w @windows[wid] = w
wms = w.get_property(:_NET_WM_STATE, :atom)&.value wms = w.get_property(:_NET_WM_STATE, :atom)&.value
@ -160,11 +160,6 @@ class WindowManager
X11::Form::EnterWindowMask | X11::Form::EnterWindowMask |
X11::Form::LeaveWindowMask X11::Form::LeaveWindowMask
) )
rescue Exception => e
p [:ZZZZZZZZZZZZZZZZZZZZZZZZZADOPT_FAILED, e]
# Failure here most likely reflects a window that has "disappeared".
# We should handle that better, but for now this is fine
end
update_client_list update_client_list
return w return w
end end