screenoverlay 0.6.0__py3-none-any.whl → 0.6.2__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
  """
@@ -78,7 +79,7 @@ class NativeBlurOverlay:
78
79
 
79
80
  while True:
80
81
  overlay.show() # Show overlay (instant)
81
- time.sleep(2)
82
+ time.sleep(2)
82
83
  overlay.hide() # Hide overlay (instant)
83
84
  overlay.update() # Keep overlay responsive (call regularly!)
84
85
 
@@ -103,26 +104,34 @@ class NativeBlurOverlay:
103
104
  self.start()
104
105
 
105
106
  if not self._is_visible:
107
+ print(f"\n🔴 SHOWING overlay windows...")
106
108
  for win in self.windows:
107
109
  try:
108
110
  win.deiconify()
111
+ win.attributes('-topmost', True) # Re-enable topmost when showing
109
112
  win.lift()
110
113
  except Exception as e:
111
114
  print(f"Warning: Failed to show window: {e}")
112
115
  self._is_visible = True
116
+ print(f"✅ OVERLAY IS NOW VISIBLE\n")
113
117
 
114
118
  def hide(self):
115
- """Hide the overlay (instant, <1ms)"""
119
+ """Hide the overlay using withdraw() (lightweight, fast, no resource leaks)"""
116
120
  if self.root is None:
117
121
  return # Not started yet
118
122
 
119
123
  if self._is_visible:
124
+ # LIGHTWEIGHT HIDE - just withdraw windows (don't destroy/recreate)
125
+ print(f"🫥 WITHDRAWING overlay windows (lightweight hide)...")
120
126
  for win in self.windows:
121
127
  try:
128
+ win.attributes('-topmost', False) # Remove topmost before hiding
122
129
  win.withdraw()
123
130
  except Exception as e:
124
- print(f"Warning: Failed to hide window: {e}")
131
+ print(f"Warning: Failed to withdraw window: {e}")
132
+
125
133
  self._is_visible = False
134
+ print(f"✅ OVERLAY HIDDEN (windows withdrawn)\n")
126
135
 
127
136
  def update(self):
128
137
  """
@@ -143,6 +152,31 @@ class NativeBlurOverlay:
143
152
  """
144
153
  if self.root is not None:
145
154
  try:
155
+ import time
156
+ current_time = time.time()
157
+
158
+ # Throttle: only update every 100ms (10 FPS) to reduce CPU load
159
+ # This prevents excessive event processing while keeping UI responsive
160
+ if current_time - self._last_update_time < 0.1:
161
+ return # Skip this update
162
+
163
+ self._last_update_time = current_time
164
+
165
+ # Defensive check: verify window state matches _is_visible flag
166
+ for win in self.windows:
167
+ try:
168
+ actual_state = win.winfo_viewable()
169
+ if actual_state and not self._is_visible:
170
+ print(f"⚠️ BUG DETECTED: Window is visible but _is_visible=False! Force hiding...")
171
+ win.attributes('-topmost', False)
172
+ win.withdraw()
173
+ elif not actual_state and self._is_visible:
174
+ print(f"⚠️ BUG DETECTED: Window is hidden but _is_visible=True! Syncing flag...")
175
+ self._is_visible = False
176
+ except Exception as e:
177
+ pass # Ignore errors in defensive check
178
+
179
+ # Process Tkinter events
146
180
  self.root.update()
147
181
  except Exception as e:
148
182
  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.2
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=Z9E0nf5fwG0Q1RqS6kOYRRNYYPCGGnzPTDFL4OVVF8I,17236
3
+ screenoverlay-0.6.2.dist-info/licenses/LICENSE,sha256=QlEjK4tuMjNEYVlvzaIhxfsCeU8hcGZyuT85cm1YChE,1084
4
+ screenoverlay-0.6.2.dist-info/METADATA,sha256=BsjE4qiC5JVokN3XaRPFaglF8h35PRVzdTzv_EzCLO8,17132
5
+ screenoverlay-0.6.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
6
+ screenoverlay-0.6.2.dist-info/top_level.txt,sha256=kfPL07o_kJ-mlb14Ps2zp_tIYnD8GfsSXlbDxDF6Eic,14
7
+ screenoverlay-0.6.2.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,,