Fixed bug
Browse files
+13 −2 src/window_manager.rs
| @@ -498,6 +498,19 @@ impl WindowManager { | ||
| 498 | 498 | fn handle_event(&mut self, event: Event) -> Result<Option<bool>> { |
| 499 | 499 | match event { |
| 500 | 500 | Event::MapRequest(event) => { |
| 501 | + let attrs = match self.connection.get_window_attributes(event.window)?.reply() { | |
| 502 | + Ok(attrs) => attrs, | |
| 503 | + Err(_) => return Ok(None), | |
| 504 | + }; | |
| 505 | + | |
| 506 | + if attrs.override_redirect { | |
| 507 | + return Ok(None); | |
| 508 | + } | |
| 509 | + | |
| 510 | + if self.windows.contains(&event.window) { | |
| 511 | + return Ok(None); | |
| 512 | + } | |
| 513 | + | |
| 501 | 514 | self.connection.map_window(event.window)?; |
| 502 | 515 | self.connection.change_window_attributes( |
| 503 | 516 | event.window, |
| @@ -506,9 +519,7 @@ impl WindowManager { | ||
| 506 | 519 | |
| 507 | 520 | self.windows.push(event.window); |
| 508 | 521 | self.window_tags.insert(event.window, self.selected_tags); |
| 509 | - | |
| 510 | 522 | self.set_wm_state(event.window, 1)?; |
| 511 | - | |
| 512 | 523 | let _ = self.save_client_tag(event.window, self.selected_tags); |
| 513 | 524 | |
| 514 | 525 | self.apply_layout()?; |