Split Monitor detection/creation
This commit is contained in:
		| @@ -48,9 +48,17 @@ impl Monitor { | ||||
|                         crtc: output_info.crtc(), | ||||
|                         config_timestamp, | ||||
|                     }); | ||||
|                     let reply = conn.wait_for_reply(cookie)?; | ||||
|                     let crtc_info = conn.wait_for_reply(cookie)?; | ||||
|                     monitors.push(Monitor::new(conn, &screen, *output, &crtc_info)?); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  | ||||
|                     let (blanker_window, unlock_window) = create_windows(conn, &screen, &reply)?; | ||||
|         Ok(monitors) | ||||
|     } | ||||
|  | ||||
|     pub fn new(conn: &xcb::Connection, screen: &x::Screen, output: randr::Output, crtc_info: &randr::GetCrtcInfoReply) -> xcb::Result<Monitor> { | ||||
|         let (blanker_window, unlock_window) = create_windows(conn, &screen, &crtc_info)?; | ||||
|         let blank_cursor = create_blank_cursor(conn, &screen)?; | ||||
|  | ||||
|         let black_gc: x::Gcontext = conn.generate_id(); | ||||
| @@ -63,29 +71,24 @@ impl Monitor { | ||||
|             ], | ||||
|         })?; | ||||
|  | ||||
|                     let backlight_control = find_backlight_control(conn, *output); | ||||
|         let backlight_control = find_backlight_control(conn, output); | ||||
|         if let Err(err) = &backlight_control { | ||||
|             warn!("Failed to find backlight control: {}", err); | ||||
|         } | ||||
|  | ||||
|                     monitors.push(Monitor { | ||||
|         Ok(Monitor { | ||||
|             root: screen.root(), | ||||
|             black_gc, | ||||
|                         output: *output, | ||||
|             output, | ||||
|             blanker_window, | ||||
|             unlock_window, | ||||
|             blank_cursor, | ||||
|                         x: reply.x(), | ||||
|                         y: reply.y(), | ||||
|                         width: reply.width(), | ||||
|                         height: reply.height(), | ||||
|             x: crtc_info.x(), | ||||
|             y: crtc_info.y(), | ||||
|             width: crtc_info.width(), | ||||
|             height: crtc_info.height(), | ||||
|             backlight_control: backlight_control.ok().flatten(), | ||||
|                     }); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         Ok(monitors) | ||||
|         }) | ||||
|     } | ||||
|  | ||||
|     pub fn release(self, conn: &xcb::Connection) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user