Skip to content

Commit 17a2ad2

Browse files
committed
use inheritance for default_options
1 parent 61dc55b commit 17a2ad2

2 files changed

Lines changed: 18 additions & 11 deletions

File tree

lib/PDL/Graphics/TriD/GL.pm

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ Allowed 3d window types, case insensitive, are:
829829

830830
sub new {
831831
my($class,$options,$window_obj) = @_;
832-
my $opt = PDL::Options->new(default_options());
832+
my $opt = PDL::Options->new($class->default_options);
833833
$opt->incremental(1);
834834
$opt->options($options) if(defined $options);
835835
my $p = $opt->options;
@@ -842,16 +842,13 @@ default options for object oriented methods
842842
843843
=cut
844844

845-
sub default_options{
846-
{ 'x' => 0,
847-
'y' => 0,
848-
'width' => 500,
849-
'height'=> 500,
850-
'parent'=> 0,
851-
'mask' => eval '&OpenGL::StructureNotifyMask',
852-
'steal' => 0,
853-
'attributes' => eval '[ &OpenGL::GLX_DOUBLEBUFFER, &OpenGL::GLX_RGBA ]',
854-
}
845+
sub default_options {
846+
{
847+
x => 0,
848+
y => 0,
849+
width => 500,
850+
height => 500,
851+
}
855852
}
856853

857854
=head2 swap_buffers

lib/PDL/Graphics/TriD/GL/GLX.pm

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@ sub new {
3131
$self;
3232
}
3333

34+
sub default_options {
35+
my ($class) = @_;
36+
+{ %{ $class->SUPER::default_options },
37+
parent => 0,
38+
mask => StructureNotifyMask,
39+
steal => 0,
40+
attributes => [ GLX_DOUBLEBUFFER, GLX_RGBA ],
41+
};
42+
}
43+
3444
sub event_pending {
3545
my ($self) = @_;
3646
OpenGL::XPending($self->{Display});

0 commit comments

Comments
 (0)