literally 9 lines and got mouse hover support. daily driving time.
Browse files
+13 −0 src/window_manager.rs
| @@ -449,6 +449,11 @@ impl WindowManager { | |||
| 449 | match event { | 449 | match event { |
| 450 | Event::MapRequest(event) => { | 450 | Event::MapRequest(event) => { |
| 451 | self.connection.map_window(event.window)?; | 451 | self.connection.map_window(event.window)?; |
| 452 | + self.connection.change_window_attributes( | ||
| 453 | + event.window, | ||
| 454 | + &ChangeWindowAttributesAux::new().event_mask(EventMask::ENTER_WINDOW), | ||
| 455 | + )?; | ||
| 456 | + | ||
| 452 | self.windows.push(event.window); | 457 | self.windows.push(event.window); |
| 453 | self.window_tags.insert(event.window, self.selected_tags); | 458 | self.window_tags.insert(event.window, self.selected_tags); |
| 454 | 459 | ||
| @@ -468,6 +473,14 @@ impl WindowManager { | |||
| 468 | self.remove_window(event.window)?; | 473 | self.remove_window(event.window)?; |
| 469 | } | 474 | } |
| 470 | } | 475 | } |
| 476 | + Event::EnterNotify(event) => { | ||
| 477 | + if event.mode != x11rb::protocol::xproto::NotifyMode::NORMAL { | ||
| 478 | + return Ok(None); | ||
| 479 | + } | ||
| 480 | + if self.windows.contains(&event.event) { | ||
| 481 | + self.set_focus(Some(event.event))?; | ||
| 482 | + } | ||
| 483 | + } | ||
| 471 | Event::KeyPress(event) => { | 484 | Event::KeyPress(event) => { |
| 472 | let (action, arg) = keyboard::handle_key_press(event)?; | 485 | let (action, arg) = keyboard::handle_key_press(event)?; |
| 473 | 486 | ||