Merge pull request #780 from jansegre/impl-clone-builders

Make `WindowBuilder` and `HeadlessRendererBuilder` derive `Clone`.
This commit is contained in:
tomaka 2016-05-23 08:48:09 +02:00
commit e796a2e018
11 changed files with 14 additions and 12 deletions

View file

@ -65,9 +65,9 @@ impl MonitorId {
} }
} }
#[derive(Default)] #[derive(Clone, Default)]
pub struct PlatformSpecificWindowBuilderAttributes; pub struct PlatformSpecificWindowBuilderAttributes;
#[derive(Default)] #[derive(Clone, Default)]
pub struct PlatformSpecificHeadlessBuilderAttributes; pub struct PlatformSpecificHeadlessBuilderAttributes;
pub struct PollEventsIterator<'a> { pub struct PollEventsIterator<'a> {

View file

@ -13,7 +13,7 @@ use cocoa::appkit::*;
use PixelFormat; use PixelFormat;
use api::cocoa::helpers; use api::cocoa::helpers;
#[derive(Default)] #[derive(Clone, Default)]
pub struct PlatformSpecificHeadlessBuilderAttributes; pub struct PlatformSpecificHeadlessBuilderAttributes;
pub struct HeadlessContext { pub struct HeadlessContext {

View file

@ -181,7 +181,7 @@ impl Drop for WindowDelegate {
} }
} }
#[derive(Default)] #[derive(Clone, Default)]
pub struct PlatformSpecificWindowBuilderAttributes { pub struct PlatformSpecificWindowBuilderAttributes {
pub activation_policy: ActivationPolicy, pub activation_policy: ActivationPolicy,
} }

View file

@ -177,7 +177,7 @@ impl MonitorId {
} }
} }
#[derive(Default)] #[derive(Clone, Default)]
pub struct PlatformSpecificWindowBuilderAttributes; pub struct PlatformSpecificWindowBuilderAttributes;
impl Window { impl Window {

View file

@ -11,6 +11,7 @@ use Robustness;
use platform; use platform;
/// Object that allows you to build headless contexts. /// Object that allows you to build headless contexts.
#[derive(Clone)]
pub struct HeadlessRendererBuilder<'a> { pub struct HeadlessRendererBuilder<'a> {
/// The dimensions to use. /// The dimensions to use.
pub dimensions: (u32, u32), pub dimensions: (u32, u32),

View file

@ -106,6 +106,7 @@ pub struct Window {
} }
/// Object that allows you to build windows. /// Object that allows you to build windows.
#[derive(Clone)]
pub struct WindowBuilder<'a> { pub struct WindowBuilder<'a> {
/// The attributes to use to create the window. /// The attributes to use to create the window.
pub window: WindowAttributes, pub window: WindowAttributes,

View file

@ -58,7 +58,7 @@ impl GlContext for HeadlessContext {
unsafe impl Send for HeadlessContext {} unsafe impl Send for HeadlessContext {}
unsafe impl Sync for HeadlessContext {} unsafe impl Sync for HeadlessContext {}
#[derive(Default)] #[derive(Clone, Default)]
pub struct PlatformSpecificWindowBuilderAttributes; pub struct PlatformSpecificWindowBuilderAttributes;
#[derive(Default)] #[derive(Clone, Default)]
pub struct PlatformSpecificHeadlessBuilderAttributes; pub struct PlatformSpecificHeadlessBuilderAttributes;

View file

@ -8,7 +8,7 @@ use ContextError;
pub use api::ios::*; pub use api::ios::*;
#[derive(Default)] #[derive(Clone, Default)]
pub struct PlatformSpecificHeadlessBuilderAttributes; pub struct PlatformSpecificHeadlessBuilderAttributes;
pub struct HeadlessContext(i32); pub struct HeadlessContext(i32);

View file

@ -22,7 +22,7 @@ use api::x11::XConnection;
use api::x11::XError; use api::x11::XError;
use api::x11::XNotSupported; use api::x11::XNotSupported;
#[derive(Default)] #[derive(Clone, Default)]
pub struct PlatformSpecificWindowBuilderAttributes; pub struct PlatformSpecificWindowBuilderAttributes;
enum Backend { enum Backend {

View file

@ -15,7 +15,7 @@ pub use self::api_dispatch::{WaitEventsIterator, PollEventsIterator};
pub use self::api_dispatch::PlatformSpecificWindowBuilderAttributes; pub use self::api_dispatch::PlatformSpecificWindowBuilderAttributes;
mod api_dispatch; mod api_dispatch;
#[derive(Default)] #[derive(Clone, Default)]
pub struct PlatformSpecificHeadlessBuilderAttributes; pub struct PlatformSpecificHeadlessBuilderAttributes;
pub struct HeadlessContext(OsMesaContext); pub struct HeadlessContext(OsMesaContext);

View file

@ -51,9 +51,9 @@ lazy_static! {
}; };
} }
#[derive(Default)] #[derive(Clone, Default)]
pub struct PlatformSpecificWindowBuilderAttributes; pub struct PlatformSpecificWindowBuilderAttributes;
#[derive(Default)] #[derive(Clone, Default)]
pub struct PlatformSpecificHeadlessBuilderAttributes; pub struct PlatformSpecificHeadlessBuilderAttributes;
/// The Win32 implementation of the main `Window` object. /// The Win32 implementation of the main `Window` object.