private Display GetDisplay(wl_output *handle) { Display display = null; for (var i = 0; i < _displays.Count; i++) { if (_displays[i].Handle == (IntPtr)handle) { display = _displays[i]; break; } } return(display); }
private void OutputModeCallback(void *data, wl_output *output, wl_output_mode modeEnum, int width, int height, int refresh) { var display = GetDisplay(output); if (display == null) { throw new OpenWindowException("Got an Output Geometry event for unknown output."); } if (modeEnum.HasFlag(wl_output_mode.Current)) { display.Bounds = display.Bounds.WithSize(width, height); } // TODO expose refresh rate of the output? Probably quite nice to have, but should check other platforms for support. // TODO supported display modes of the output - should this exist in a pure windowing lib? Seems like this is graphics territory. }
private void OutputGeometryCallback(void *data, wl_output *output, int x, int y, int physicalWidth, int physicalHeight, wl_output_subpixel subpixelEnum, byte *make, byte *model, wl_output_transform transformEnum) { var display = GetDisplay(output); if (display == null) { throw new OpenWindowException("Got an Output Geometry event for unknown output."); } // TODO check this is in the right coordinate space (unscaled or scaled) display.Bounds = display.Bounds.WithPosition(x, y); // TODO document how this name is assigned display.Name = Util.Utf8ToString(make) + " - " + Util.Utf8ToString(model); LogDebug($"Registered output with name {display.Name}."); }
private void OutputDoneCallback(void *data, wl_output *output) { // we don't really need to handle this explicitly }
private void OutputScaleCallback(void *data, wl_output *output, int factor) { // TODO high dpi stuff }