gardesk/gardisplay / 32c0e1e

Browse files

add demo RandR outputs with multiple resolution/refresh options

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
32c0e1efaeacc236f28a1d1b5b7838c208527a47
Parents
e6c0176
Tree
252af1d

1 changed file

StatusFile+-
M gardisplay/src/app.rs 70 7
gardisplay/src/app.rsmodified
@@ -10,7 +10,7 @@ use gartk_x11::{
1010
 use x11rb::protocol::xproto::ConnectionExt;
1111
 
1212
 use crate::config::{Config, MonitorConfig, Profile};
13
-use crate::randr::{OutputInfo, RandrManager};
13
+use crate::randr::{ModeInfo, OutputInfo, RandrManager};
1414
 use crate::ui::{
1515
     Button, DisplayPanel, DisplayPanelResult, Dropdown, DropdownAction, EventResult, MonitorView,
1616
     TextInput,
@@ -122,7 +122,7 @@ impl App {
122122
 
123123
         // Create RandR manager (only in non-demo mode)
124124
         let (randr, randr_outputs) = if demo {
125
-            (None, Vec::new())
125
+            (None, Self::demo_outputs())
126126
         } else {
127127
             match RandrManager::new(conn.clone()) {
128128
                 Ok(r) => {
@@ -249,25 +249,88 @@ impl App {
249249
         vec![
250250
             gartk_x11::Monitor {
251251
                 name: "eDP-1".to_string(),
252
-                rect: Rect::new(0, 0, 2560, 1600),
252
+                rect: Rect::new(0, 0, 2880, 1800),
253253
                 primary: true,
254
-                width_mm: 290,
255
-                height_mm: 180,
254
+                width_mm: 301,
255
+                height_mm: 188,
256256
             },
257257
             gartk_x11::Monitor {
258258
                 name: "HDMI-1".to_string(),
259
-                rect: Rect::new(2560, 0, 1920, 1080),
259
+                rect: Rect::new(2880, 0, 1920, 1080),
260260
                 primary: false,
261261
                 width_mm: 530,
262262
                 height_mm: 300,
263263
             },
264264
             gartk_x11::Monitor {
265265
                 name: "DP-1".to_string(),
266
-                rect: Rect::new(2560, 1080, 1920, 1080),
266
+                rect: Rect::new(2880, 1080, 2560, 1440),
267267
                 primary: false,
268
+                width_mm: 597,
269
+                height_mm: 336,
270
+            },
271
+        ]
272
+    }
273
+
274
+    /// Create demo RandR outputs with available modes for UI testing.
275
+    fn demo_outputs() -> Vec<OutputInfo> {
276
+        vec![
277
+            OutputInfo {
278
+                name: "eDP-1".to_string(),
279
+                output: 0,
280
+                crtc: Some(0),
281
+                connected: true,
282
+                modes: vec![
283
+                    ModeInfo { id: 1, width: 2880, height: 1800, refresh: 60.0 },
284
+                    ModeInfo { id: 2, width: 2560, height: 1600, refresh: 60.0 },
285
+                    ModeInfo { id: 3, width: 1920, height: 1200, refresh: 60.0 },
286
+                    ModeInfo { id: 4, width: 1920, height: 1080, refresh: 60.0 },
287
+                    ModeInfo { id: 5, width: 1680, height: 1050, refresh: 60.0 },
288
+                    ModeInfo { id: 6, width: 1440, height: 900, refresh: 60.0 },
289
+                    ModeInfo { id: 7, width: 1280, height: 800, refresh: 60.0 },
290
+                ],
291
+                current_mode: Some(ModeInfo { id: 1, width: 2880, height: 1800, refresh: 60.0 }),
292
+                position: Some((0, 0)),
293
+                width_mm: 301,
294
+                height_mm: 188,
295
+            },
296
+            OutputInfo {
297
+                name: "HDMI-1".to_string(),
298
+                output: 1,
299
+                crtc: Some(1),
300
+                connected: true,
301
+                modes: vec![
302
+                    ModeInfo { id: 10, width: 3840, height: 2160, refresh: 60.0 },
303
+                    ModeInfo { id: 11, width: 3840, height: 2160, refresh: 30.0 },
304
+                    ModeInfo { id: 12, width: 2560, height: 1440, refresh: 60.0 },
305
+                    ModeInfo { id: 13, width: 1920, height: 1080, refresh: 120.0 },
306
+                    ModeInfo { id: 14, width: 1920, height: 1080, refresh: 60.0 },
307
+                    ModeInfo { id: 15, width: 1920, height: 1080, refresh: 30.0 },
308
+                    ModeInfo { id: 16, width: 1280, height: 720, refresh: 60.0 },
309
+                ],
310
+                current_mode: Some(ModeInfo { id: 14, width: 1920, height: 1080, refresh: 60.0 }),
311
+                position: Some((2880, 0)),
268312
                 width_mm: 530,
269313
                 height_mm: 300,
270314
             },
315
+            OutputInfo {
316
+                name: "DP-1".to_string(),
317
+                output: 2,
318
+                crtc: Some(2),
319
+                connected: true,
320
+                modes: vec![
321
+                    ModeInfo { id: 20, width: 2560, height: 1440, refresh: 144.0 },
322
+                    ModeInfo { id: 21, width: 2560, height: 1440, refresh: 120.0 },
323
+                    ModeInfo { id: 22, width: 2560, height: 1440, refresh: 60.0 },
324
+                    ModeInfo { id: 23, width: 1920, height: 1080, refresh: 144.0 },
325
+                    ModeInfo { id: 24, width: 1920, height: 1080, refresh: 120.0 },
326
+                    ModeInfo { id: 25, width: 1920, height: 1080, refresh: 60.0 },
327
+                    ModeInfo { id: 26, width: 1280, height: 720, refresh: 60.0 },
328
+                ],
329
+                current_mode: Some(ModeInfo { id: 22, width: 2560, height: 1440, refresh: 60.0 }),
330
+                position: Some((2880, 1080)),
331
+                width_mm: 597,
332
+                height_mm: 336,
333
+            },
271334
         ]
272335
     }
273336