summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/c_fl_gl_window.cpp6
-rw-r--r--src/c_fl_gl_window.h6
-rw-r--r--src/fltk-widgets-groups-windows-opengl.adb50
-rw-r--r--src/fltk-widgets-groups-windows-opengl.ads44
4 files changed, 46 insertions, 60 deletions
diff --git a/src/c_fl_gl_window.cpp b/src/c_fl_gl_window.cpp
index 16af87d..9b1766d 100644
--- a/src/c_fl_gl_window.cpp
+++ b/src/c_fl_gl_window.cpp
@@ -109,15 +109,15 @@ float fl_gl_window_pixels_per_unit(GLWINDOW w) {
-int fl_gl_window_get_mode(GLWINDOW w) {
+unsigned int fl_gl_window_get_mode(GLWINDOW w) {
return reinterpret_cast<Fl_Gl_Window*>(w)->mode();
}
-void fl_gl_window_set_mode(GLWINDOW w, int a) {
+void fl_gl_window_set_mode(GLWINDOW w, unsigned int a) {
reinterpret_cast<Fl_Gl_Window*>(w)->mode(a);
}
-int fl_gl_window_static_can_do(int m) {
+int fl_gl_window_static_can_do(unsigned int m) {
return Fl_Gl_Window::can_do(m);
}
diff --git a/src/c_fl_gl_window.h b/src/c_fl_gl_window.h
index 134cb9c..155c2ef 100644
--- a/src/c_fl_gl_window.h
+++ b/src/c_fl_gl_window.h
@@ -37,9 +37,9 @@ extern "C" int fl_gl_window_pixel_w(GLWINDOW w);
extern "C" float fl_gl_window_pixels_per_unit(GLWINDOW w);
-extern "C" int fl_gl_window_get_mode(GLWINDOW w);
-extern "C" void fl_gl_window_set_mode(GLWINDOW w, int a);
-extern "C" int fl_gl_window_static_can_do(int m);
+extern "C" unsigned int fl_gl_window_get_mode(GLWINDOW w);
+extern "C" void fl_gl_window_set_mode(GLWINDOW w, unsigned int a);
+extern "C" int fl_gl_window_static_can_do(unsigned int m);
extern "C" int fl_gl_window_can_do(GLWINDOW w);
extern "C" int fl_gl_window_can_do_overlay(GLWINDOW w);
diff --git a/src/fltk-widgets-groups-windows-opengl.adb b/src/fltk-widgets-groups-windows-opengl.adb
index 2d0ff45..c877497 100644
--- a/src/fltk-widgets-groups-windows-opengl.adb
+++ b/src/fltk-widgets-groups-windows-opengl.adb
@@ -97,18 +97,18 @@ package body FLTK.Widgets.Groups.Windows.OpenGL is
function fl_gl_window_get_mode
(S : in System.Address)
- return Interfaces.C.int;
+ return Mode_Mask;
pragma Import (C, fl_gl_window_get_mode, "fl_gl_window_get_mode");
pragma Inline (fl_gl_window_get_mode);
procedure fl_gl_window_set_mode
(S : in System.Address;
- M : in Interfaces.C.int);
+ M : in Mode_Mask);
pragma Import (C, fl_gl_window_set_mode, "fl_gl_window_set_mode");
pragma Inline (fl_gl_window_set_mode);
function fl_gl_window_static_can_do
- (M : in Interfaces.C.int)
+ (M : in Mode_Mask)
return Interfaces.C.int;
pragma Import (C, fl_gl_window_static_can_do, "fl_gl_window_static_can_do");
pragma Inline (fl_gl_window_static_can_do);
@@ -347,23 +347,9 @@ package body FLTK.Widgets.Groups.Windows.OpenGL is
function Get_Mode
(This : in GL_Window)
- return Mode_Mask
- is
- Raw : Interfaces.C.unsigned := Interfaces.C.unsigned
- (fl_gl_window_get_mode (This.Void_Ptr));
+ return Mode_Mask is
begin
- return
- (Index => (Raw and 1) /= 0,
- Double => (Raw and 2) /= 0,
- Accum => (Raw and 4) /= 0,
- Alpha => (Raw and 8) /= 0,
- Depth => (Raw and 16) /= 0,
- Stencil => (Raw and 32) /= 0,
- RGB8 => (Raw and 64) /= 0,
- Multisample => (Raw and 128) /= 0,
- Stereo => (Raw and 256) /= 0,
- Fake_Single => (Raw and 512) /= 0,
- OpenGL3 => (Raw and 1024) /= 0);
+ return fl_gl_window_get_mode (This.Void_Ptr);
end Get_Mode;
@@ -371,18 +357,7 @@ package body FLTK.Widgets.Groups.Windows.OpenGL is
(This : in out GL_Window;
Mask : in Mode_Mask) is
begin
- fl_gl_window_set_mode (This.Void_Ptr,
- Boolean'Pos (Mask.Index) * 1 +
- Boolean'Pos (Mask.Double) * 2 +
- Boolean'Pos (Mask.Accum) * 4 +
- Boolean'Pos (Mask.Alpha) * 8 +
- Boolean'Pos (Mask.Depth) * 16 +
- Boolean'Pos (Mask.Stencil) * 32 +
- Boolean'Pos (Mask.RGB8) * 64 +
- Boolean'Pos (Mask.Multisample) * 128 +
- Boolean'Pos (Mask.Stereo) * 256 +
- Boolean'Pos (Mask.Fake_Single) * 512 +
- Boolean'Pos (Mask.OpenGL3) * 1024);
+ fl_gl_window_set_mode (This.Void_Ptr, Mask);
end Set_Mode;
@@ -390,18 +365,7 @@ package body FLTK.Widgets.Groups.Windows.OpenGL is
(Mask : in Mode_Mask)
return Boolean is
begin
- return fl_gl_window_static_can_do
- (Boolean'Pos (Mask.Index) * 1 +
- Boolean'Pos (Mask.Double) * 2 +
- Boolean'Pos (Mask.Accum) * 4 +
- Boolean'Pos (Mask.Alpha) * 8 +
- Boolean'Pos (Mask.Depth) * 16 +
- Boolean'Pos (Mask.Stencil) * 32 +
- Boolean'Pos (Mask.RGB8) * 64 +
- Boolean'Pos (Mask.Multisample) * 128 +
- Boolean'Pos (Mask.Stereo) * 256 +
- Boolean'Pos (Mask.Fake_Single) * 512 +
- Boolean'Pos (Mask.OpenGL3) * 1024) /= 0;
+ return fl_gl_window_static_can_do (Mask) /= 0;
end Can_Do;
diff --git a/src/fltk-widgets-groups-windows-opengl.ads b/src/fltk-widgets-groups-windows-opengl.ads
index 81d01c4..8d76884 100644
--- a/src/fltk-widgets-groups-windows-opengl.ads
+++ b/src/fltk-widgets-groups-windows-opengl.ads
@@ -21,18 +21,20 @@ package FLTK.Widgets.Groups.Windows.OpenGL is
type GL_Window_Reference (Data : not null access GL_Window'Class) is
limited null record with Implicit_Dereference => Data;
+ -- RGB mode is achieved by Index being set to False
+ -- Single buffer mode is achieved by Double being set to False
type Mode_Mask is record
- Index : Boolean;
- Double : Boolean;
- Accum : Boolean;
- Alpha : Boolean;
- Depth : Boolean;
- Stencil : Boolean;
- RGB8 : Boolean;
- Multisample : Boolean;
- Stereo : Boolean;
- Fake_Single : Boolean;
- OpenGL3 : Boolean;
+ Index : Boolean := False;
+ Double : Boolean := False;
+ Accum : Boolean := False;
+ Alpha : Boolean := False;
+ Depth : Boolean := False;
+ Stencil : Boolean := False;
+ RGB8 : Boolean := False;
+ Multisample : Boolean := False;
+ Stereo : Boolean := False;
+ Fake_Single : Boolean := False;
+ OpenGL3 : Boolean := False;
end record;
@@ -193,6 +195,23 @@ private
(This : in out GL_Window);
+ for Mode_Mask use record
+ Index at 0 range 0 .. 0;
+ Double at 0 range 1 .. 1;
+ Accum at 0 range 2 .. 2;
+ Alpha at 0 range 3 .. 3;
+ Depth at 0 range 4 .. 4;
+ Stencil at 0 range 5 .. 5;
+ RGB8 at 0 range 6 .. 6;
+ Multisample at 0 range 7 .. 7;
+ Stereo at 0 range 8 .. 8;
+ Fake_Single at 0 range 9 .. 9;
+ OpenGL3 at 0 range 10 .. Interfaces.C.unsigned'Size - 1;
+ end record;
+
+ for Mode_Mask'Size use Interfaces.C.unsigned'Size;
+
+ pragma Convention (C_Pass_By_Copy, Mode_Mask);
pragma Inline (Show);
@@ -206,6 +225,9 @@ private
pragma Inline (Pixels_Per_Unit);
+ pragma Inline (Get_Mode);
+ pragma Inline (Set_Mode);
+ pragma Inline (Can_Do);
pragma Inline (Can_Do_Overlay);