screenoverlay 0.6.0__py3-none-any.whl → 0.6.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
screenoverlay/overlay.py CHANGED
@@ -63,6 +63,7 @@ class NativeBlurOverlay:
63
63
  self.root = None
64
64
  self.windows = [] # List to hold multiple windows for multi-monitor
65
65
  self._is_visible = False
66
+ self._last_update_time = 0 # Throttle update() calls
66
67
 
67
68
  def start(self):
68
69
  """
@@ -98,6 +99,10 @@ class NativeBlurOverlay:
98
99
 
99
100
  def show(self):
100
101
  """Show the overlay (instant, <1ms)"""
102
+ import traceback
103
+ print(f"\n🔴 OVERLAY.SHOW() CALLED! Stack trace:")
104
+ traceback.print_stack()
105
+
101
106
  if self.root is None:
102
107
  # Auto-start if not started yet
103
108
  self.start()
@@ -106,23 +111,61 @@ class NativeBlurOverlay:
106
111
  for win in self.windows:
107
112
  try:
108
113
  win.deiconify()
114
+ win.attributes('-topmost', True) # Re-enable topmost when showing
109
115
  win.lift()
110
116
  except Exception as e:
111
117
  print(f"Warning: Failed to show window: {e}")
112
118
  self._is_visible = True
119
+ print(f"✅ OVERLAY IS NOW VISIBLE\n")
113
120
 
114
121
  def hide(self):
115
- """Hide the overlay (instant, <1ms)"""
122
+ """Hide the overlay by DESTROYING and RECREATING it (prevents ghost windows/CPU leaks)"""
123
+ import traceback
124
+ print(f"\n⚪ OVERLAY.HIDE() CALLED! Stack trace:")
125
+ traceback.print_stack()
126
+
116
127
  if self.root is None:
117
128
  return # Not started yet
118
129
 
119
130
  if self._is_visible:
120
- for win in self.windows:
121
- try:
122
- win.withdraw()
123
- except Exception as e:
124
- print(f"Warning: Failed to hide window: {e}")
131
+ # COMPLETE DESTRUCTION - no lingering windows or events!
132
+ print(f"🗑️ DESTROYING overlay completely...")
133
+ try:
134
+ # Just destroy root - it will destroy all child windows automatically
135
+ if self.root:
136
+ try:
137
+ self.root.destroy()
138
+ except Exception as e:
139
+ print(f"Warning: destroy() failed: {e} (might already be destroyed)")
140
+ except Exception as e:
141
+ print(f"Warning: Failed to destroy overlay: {e}")
142
+
143
+ self.root = None
144
+ self.windows = []
125
145
  self._is_visible = False
146
+ print(f"✅ OVERLAY DESTROYED\n")
147
+
148
+ # SAFETY CHECK: Verify system is clean before recreating
149
+ print(f"🔍 SAFETY CHECK: Verifying clean state...")
150
+ if self.root is not None:
151
+ print(f"⚠️ WARNING: self.root is not None after destroy! Force clearing...")
152
+ self.root = None
153
+ if len(self.windows) > 0:
154
+ print(f"⚠️ WARNING: self.windows has {len(self.windows)} entries after destroy! Force clearing...")
155
+ self.windows = []
156
+ if self._is_visible:
157
+ print(f"⚠️ WARNING: _is_visible is True after destroy! Force clearing...")
158
+ self._is_visible = False
159
+
160
+ # Small delay to let Tkinter/macOS fully cleanup
161
+ import time
162
+ time.sleep(0.01) # 10ms delay for cleanup
163
+ print(f"✅ SYSTEM CLEAN\n")
164
+
165
+ # RECREATE FRESH for next show()
166
+ print(f"♻️ RECREATING fresh overlay...")
167
+ self.start()
168
+ print(f"✅ FRESH OVERLAY READY (hidden)\n")
126
169
 
127
170
  def update(self):
128
171
  """
@@ -143,6 +186,31 @@ class NativeBlurOverlay:
143
186
  """
144
187
  if self.root is not None:
145
188
  try:
189
+ import time
190
+ current_time = time.time()
191
+
192
+ # Throttle: only update every 100ms (10 FPS) to reduce CPU load
193
+ # This prevents excessive event processing while keeping UI responsive
194
+ if current_time - self._last_update_time < 0.1:
195
+ return # Skip this update
196
+
197
+ self._last_update_time = current_time
198
+
199
+ # Defensive check: verify window state matches _is_visible flag
200
+ for win in self.windows:
201
+ try:
202
+ actual_state = win.winfo_viewable()
203
+ if actual_state and not self._is_visible:
204
+ print(f"⚠️ BUG DETECTED: Window is visible but _is_visible=False! Force hiding...")
205
+ win.attributes('-topmost', False)
206
+ win.withdraw()
207
+ elif not actual_state and self._is_visible:
208
+ print(f"⚠️ BUG DETECTED: Window is hidden but _is_visible=True! Syncing flag...")
209
+ self._is_visible = False
210
+ except Exception as e:
211
+ pass # Ignore errors in defensive check
212
+
213
+ # Process Tkinter events
146
214
  self.root.update()
147
215
  except Exception as e:
148
216
  print(f"Warning: Update failed: {e}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: screenoverlay
3
- Version: 0.6.0
3
+ Version: 0.6.1
4
4
  Summary: Cross-platform screen overlay with blur, black, white, and custom modes
5
5
  Home-page: https://github.com/pekay-ai/screenoverlay
6
6
  Author: Pekay
@@ -0,0 +1,7 @@
1
+ screenoverlay/__init__.py,sha256=t0XbgQ-zncGYdl9TANsZd3bK45dK2ghg0cndEA5rLKM,256
2
+ screenoverlay/overlay.py,sha256=4djOTQ2Qc4g9xdglVVqsG1NjC_s1mHHGEvQXVN2479Y,18685
3
+ screenoverlay-0.6.1.dist-info/licenses/LICENSE,sha256=QlEjK4tuMjNEYVlvzaIhxfsCeU8hcGZyuT85cm1YChE,1084
4
+ screenoverlay-0.6.1.dist-info/METADATA,sha256=uMyDKyrYqNwfYei0LkjCwMF193bVILoRV8ozaiMcfRE,17132
5
+ screenoverlay-0.6.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
6
+ screenoverlay-0.6.1.dist-info/top_level.txt,sha256=kfPL07o_kJ-mlb14Ps2zp_tIYnD8GfsSXlbDxDF6Eic,14
7
+ screenoverlay-0.6.1.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- screenoverlay/__init__.py,sha256=t0XbgQ-zncGYdl9TANsZd3bK45dK2ghg0cndEA5rLKM,256
2
- screenoverlay/overlay.py,sha256=3kVHpaHSE3-0ZA7WRpcS3WFsUIlMbLJUMGhcm2KdY3Y,15273
3
- screenoverlay-0.6.0.dist-info/licenses/LICENSE,sha256=QlEjK4tuMjNEYVlvzaIhxfsCeU8hcGZyuT85cm1YChE,1084
4
- screenoverlay-0.6.0.dist-info/METADATA,sha256=Ku92qyrE7X3SPi9j2yeZdbG1TlJccrgf43qkTbG21SE,17132
5
- screenoverlay-0.6.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
6
- screenoverlay-0.6.0.dist-info/top_level.txt,sha256=kfPL07o_kJ-mlb14Ps2zp_tIYnD8GfsSXlbDxDF6Eic,14
7
- screenoverlay-0.6.0.dist-info/RECORD,,