gardesk/garshot / 827a0ab

Browse files

annotate: fix initial toolbar visibility and handle expose events

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
827a0ab0894545ff88ec1997804cd9ee2051e16d
Parents
320efcd
Tree
1e433f7

1 changed file

StatusFile+-
M garshot/src/annotate/overlay.rs 14 1
garshot/src/annotate/overlay.rsmodified
@@ -195,8 +195,13 @@ impl AnnotationOverlay {
195
         // Map window (gar will manage it as a floating dialog)
195
         // Map window (gar will manage it as a floating dialog)
196
         self.window.map()?;
196
         self.window.map()?;
197
 
197
 
198
-        // Focus window for keyboard input (no grab - allows WM keybinds to work)
198
+        // Flush and sync to ensure window is mapped before we try to draw
199
+        self.conn.inner().flush()?;
200
+        self.conn.inner().sync()?;
201
+
202
+        // Focus and raise window for keyboard input (no grab - allows WM keybinds to work)
199
         self.window.focus()?;
203
         self.window.focus()?;
204
+        self.window.raise()?;
200
 
205
 
201
         // Set initial cursor
206
         // Set initial cursor
202
         self.update_cursor()?;
207
         self.update_cursor()?;
@@ -204,6 +209,9 @@ impl AnnotationOverlay {
204
         // Initial draw
209
         // Initial draw
205
         self.redraw()?;
210
         self.redraw()?;
206
 
211
 
212
+        // Flush to ensure initial draw is visible
213
+        self.conn.inner().flush()?;
214
+
207
         // Event loop
215
         // Event loop
208
         loop {
216
         loop {
209
             // Wait for first event
217
             // Wait for first event
@@ -501,6 +509,11 @@ impl AnnotationOverlay {
501
                 }
509
                 }
502
             }
510
             }
503
 
511
 
512
+            // Handle expose events (window needs redraw)
513
+            InputEvent::Expose => {
514
+                return Ok(true);
515
+            }
516
+
504
             _ => {}
517
             _ => {}
505
         }
518
         }
506
 
519