pub struct Display(/* private fields */);
Expand description
A handle to the platform-specific display backend.
On X11, for instance, it wraps a connection to the X server.
Implementations§
Source§impl<'dpy> Display
impl<'dpy> Display
Sourcepub fn open() -> Result<Self, Error>
pub fn open() -> Result<Self, Error>
Attempts to get one handle to the platform-specific display backend.
You should need only one.
Sourcepub fn open_x11_display_name(name: Option<&CStr>) -> Result<Self, Error>
pub fn open_x11_display_name(name: Option<&CStr>) -> Result<Self, Error>
X11-only specialization of open()
where you can specify
the name given to XOpenDisplay()
.
Sourcepub fn create_window(
&'dpy self,
settings: &Settings,
) -> Result<Window<'dpy>, Error>
pub fn create_window( &'dpy self, settings: &Settings, ) -> Result<Window<'dpy>, Error>
Attempts to create a Window
with the given settings.
Sourcepub fn create_window_and_show(
&'dpy self,
settings: &Settings,
) -> Result<Window<'dpy>, Error>
pub fn create_window_and_show( &'dpy self, settings: &Settings, ) -> Result<Window<'dpy>, Error>
Same as create_window()
, but immediately shows the window afterwards
if it succeeds.
Sourcepub fn create_gl_context(
&'dpy self,
settings: &GLContextSettings<'_>,
) -> Result<GLContext<'dpy>, Error>
pub fn create_gl_context( &'dpy self, settings: &GLContextSettings<'_>, ) -> Result<GLContext<'dpy>, Error>
Attempts to create a backend-specific OpenGL context.
Sourcepub fn create_software_gl_context(
&'dpy self,
settings: &GLContextSettings<'_>,
) -> Result<GLContext<'dpy>, Error>
pub fn create_software_gl_context( &'dpy self, settings: &GLContextSettings<'_>, ) -> Result<GLContext<'dpy>, Error>
Sames as create_gl_context()
, but attempts to get a
context that is not hardware-accelerated (on some platforms, this
might try to load the Mesa driver).
The use case for this is simple apps that don’t specifically need a
lot of perf, and would rather prefer saving battery power.
This won’t attempt to fall back to the default implementation - in other words, this will succeed only if it is certain that there is a software implementation available AND a context could be created out of it.
Sourcepub fn create_gl_context_from_lib<P: AsRef<Path>>(
&'dpy self,
_settings: &GLContextSettings<'_>,
_path: P,
) -> Result<GLContext<'dpy>, Error>
pub fn create_gl_context_from_lib<P: AsRef<Path>>( &'dpy self, _settings: &GLContextSettings<'_>, _path: P, ) -> Result<GLContext<'dpy>, Error>
Attempts to create an OpenGL context from a dynamically-loaded library.