diff --git a/pupil_src/launchables/eye.py b/pupil_src/launchables/eye.py index f8eca4d569..b0bc9384c2 100644 --- a/pupil_src/launchables/eye.py +++ b/pupil_src/launchables/eye.py @@ -433,8 +433,7 @@ def toggle_general_settings(collapsed): general_settings.collapsed = collapsed # Initialize glfw - with GLFWErrorReporting.glfw_init(): - glfw.init() + glfw.init() glfw.window_hint(glfw.SCALE_TO_MONITOR, glfw.TRUE) if hide_ui: glfw.window_hint(glfw.VISIBLE, 0) # hide window diff --git a/pupil_src/launchables/player.py b/pupil_src/launchables/player.py index 42d0fece01..afdcaceedd 100644 --- a/pupil_src/launchables/player.py +++ b/pupil_src/launchables/player.py @@ -372,8 +372,7 @@ def get_dt(): window_name = f"Pupil Player: {meta_info.recording_name} - {rec_dir}" - with GLFWErrorReporting.glfw_init(): - glfw.init() + glfw.init() glfw.window_hint(glfw.SCALE_TO_MONITOR, glfw.TRUE) main_window = glfw.create_window(width, height, window_name, None, None) window_position_manager = gl_utils.WindowPositionManager() @@ -859,8 +858,7 @@ def on_drop(window, paths): session_settings.clear() w, h = session_settings.get("window_size", (1280, 720)) - with GLFWErrorReporting.glfw_init(): - glfw.init() + glfw.init() glfw.window_hint(glfw.SCALE_TO_MONITOR, glfw.TRUE) glfw.window_hint(glfw.RESIZABLE, 0) window = glfw.create_window(w, h, "Pupil Player", None, None) diff --git a/pupil_src/launchables/world.py b/pupil_src/launchables/world.py index b664d8fadb..78e9784402 100644 --- a/pupil_src/launchables/world.py +++ b/pupil_src/launchables/world.py @@ -526,8 +526,7 @@ def handle_notifications(noti): ) # window and gl setup - with GLFWErrorReporting.glfw_init(): - glfw.init() + glfw.init() glfw.window_hint(glfw.SCALE_TO_MONITOR, glfw.TRUE) if hide_ui: glfw.window_hint(glfw.VISIBLE, 0) # hide window diff --git a/pupil_src/shared_modules/gl_utils/utils.py b/pupil_src/shared_modules/gl_utils/utils.py index e42ad359aa..faa85fbf73 100644 --- a/pupil_src/shared_modules/gl_utils/utils.py +++ b/pupil_src/shared_modules/gl_utils/utils.py @@ -335,17 +335,6 @@ def get_window_title_bar_rect(window) -> _Rectangle: class GLFWErrorReporting: - @classmethod - @contextlib.contextmanager - def glfw_init(cls): - ignore = [ - # GLFWError: (65544) b'Cocoa: Failed to find service port for display' - # This happens on macOS Big Sur running on Apple Silicone hardware - 65544, - ] - with cls.error_code_handling(ignore=tuple(ignore)): - yield - @classmethod @contextlib.contextmanager def error_code_handling( @@ -383,7 +372,15 @@ def set_default(cls): @staticmethod def __default_error_reporting() -> _GLFWErrorReportingDict: - return {None: "raise"} + ignore = [ + # GLFWError: (65544) b'Cocoa: Failed to find service port for display' + # This happens on macOS Big Sur running on Apple Silicone hardware + 65544, + ] + return { + None: "raise", + **{code: "log" for code in ignore}, + } GLFWErrorReporting.set_default() diff --git a/pupil_src/shared_modules/head_pose_tracker/ui/gl_window.py b/pupil_src/shared_modules/head_pose_tracker/ui/gl_window.py index 42aff44a7d..9b37b30304 100644 --- a/pupil_src/shared_modules/head_pose_tracker/ui/gl_window.py +++ b/pupil_src/shared_modules/head_pose_tracker/ui/gl_window.py @@ -65,8 +65,7 @@ def _init_trackball(): return trackball def _glfw_init(self): - with GLFWErrorReporting.glfw_init(): - glfw.init() + glfw.init() glfw.window_hint(glfw.SCALE_TO_MONITOR, glfw.TRUE) window = glfw.create_window( 640, diff --git a/pupil_src/shared_modules/service_ui.py b/pupil_src/shared_modules/service_ui.py index fc52b42023..45097c1413 100644 --- a/pupil_src/shared_modules/service_ui.py +++ b/pupil_src/shared_modules/service_ui.py @@ -54,8 +54,7 @@ def __init__( self.texture = np.zeros((1, 1, 3), dtype=np.uint8) + 128 - with GLFWErrorReporting.glfw_init(): - glfw.init() + glfw.init() glfw.window_hint(glfw.SCALE_TO_MONITOR, glfw.TRUE) if g_pool.hide_ui: glfw.window_hint(glfw.VISIBLE, 0) # hide window diff --git a/pupil_src/shared_modules/visualizer.py b/pupil_src/shared_modules/visualizer.py index 076ee40e26..0e6d0a9b31 100644 --- a/pupil_src/shared_modules/visualizer.py +++ b/pupil_src/shared_modules/visualizer.py @@ -204,8 +204,7 @@ def open_window(self): # get glfw started if self.run_independently: - with GLFWErrorReporting.glfw_init(): - glfw.init() + glfw.init() glfw.window_hint(glfw.SCALE_TO_MONITOR, glfw.TRUE) self.window = glfw.create_window( self.window_size[0], self.window_size[1], self.name, None, None