(
state: &mut OpState,
args: CreateWindowArgs,
_: ()
)
| 60 | } |
| 61 | |
| 62 | pub fn op_create_window( |
| 63 | state: &mut OpState, |
| 64 | args: CreateWindowArgs, |
| 65 | _: () |
| 66 | ) -> Result<(u32, ResourceId), AnyError> { |
| 67 | let ev = EVENT_LOOP.lock().unwrap(); |
| 68 | let ev = ev.as_ref().unwrap().lock().unwrap(); |
| 69 | |
| 70 | let mut attribs = WindowAttributes::default(); |
| 71 | |
| 72 | if let Some(title) = args.title { |
| 73 | attribs.title = title; |
| 74 | } |
| 75 | |
| 76 | if let Some(resizable) = args.resizable { |
| 77 | attribs.resizable = resizable; |
| 78 | } |
| 79 | |
| 80 | if let Some(decorations) = args.decorations { |
| 81 | attribs.decorations = decorations; |
| 82 | } |
| 83 | |
| 84 | if let Some(maximized) = args.maximized { |
| 85 | attribs.maximized = maximized; |
| 86 | } |
| 87 | |
| 88 | if let Some(visible) = args.visible { |
| 89 | attribs.visible = visible; |
| 90 | } |
| 91 | |
| 92 | if let Some(transparent) = args.transparent { |
| 93 | attribs.transparent = transparent; |
| 94 | } |
| 95 | |
| 96 | if let Some(always_on_top) = args.always_on_top { |
| 97 | attribs.always_on_top = always_on_top; |
| 98 | } |
| 99 | |
| 100 | if args.width.is_some() || args.height.is_some() { |
| 101 | let width = args.width.unwrap_or(800); |
| 102 | let height = args.height.unwrap_or(600); |
| 103 | let size = PhysicalSize::new(width, height); |
| 104 | attribs.inner_size = Some(Size::Physical(size)); |
| 105 | } |
| 106 | |
| 107 | if args.min_width.is_some() || args.min_height.is_some() { |
| 108 | let min_width = args.min_width.unwrap_or(0); |
| 109 | let min_height = args.min_height.unwrap_or(0); |
| 110 | let size = PhysicalSize::new(min_width, min_height); |
| 111 | attribs.min_inner_size = Some(Size::Physical(size)); |
| 112 | } |
| 113 | |
| 114 | if args.max_width.is_some() || args.max_height.is_some() { |
| 115 | let max_width = args.max_width.unwrap_or(0); |
| 116 | let max_height = args.max_height.unwrap_or(0); |
| 117 | let size = PhysicalSize::new(max_width, max_height); |
| 118 | attribs.max_inner_size = Some(Size::Physical(size)); |
| 119 | } |
nothing calls this directly
no test coverage detected