From 8df3e30abd06ce8d51e6b1ad696aabf97ea9f178 Mon Sep 17 00:00:00 2001 From: Kostadin Damyanov Date: Thu, 11 Jun 2015 22:57:41 +0300 Subject: Haiku: create a GL context and initialize the audio and physics servers --- platform/haiku/haiku_direct_window.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 platform/haiku/haiku_direct_window.h (limited to 'platform/haiku/haiku_direct_window.h') diff --git a/platform/haiku/haiku_direct_window.h b/platform/haiku/haiku_direct_window.h new file mode 100644 index 0000000000..450ea64296 --- /dev/null +++ b/platform/haiku/haiku_direct_window.h @@ -0,0 +1,27 @@ +#ifndef HAIKU_DIRECT_WINDOW_H +#define HAIKU_DIRECT_WINDOW_H + +#include // needed for image_id +#include + +#include "haiku_gl_view.h" + +#define REDRAW_MSG 'rdrw' + +class HaikuDirectWindow : public BDirectWindow +{ +public: + HaikuDirectWindow(BRect p_frame); + ~HaikuDirectWindow(); + + void SetHaikuGLView(HaikuGLView* p_view); + void InitMessageRunner(); + virtual bool QuitRequested(); + virtual void DirectConnected(direct_buffer_info *info); + +private: + HaikuGLView* view; + BMessageRunner* update_runner; +}; + +#endif -- cgit v1.2.3 From 1505d65ac9ec9f44195e961f0089343aabe3de79 Mon Sep 17 00:00:00 2001 From: Kostadin Damyanov Date: Tue, 16 Jun 2015 21:52:24 +0300 Subject: Haiku: handle mouse movement and click events --- platform/haiku/haiku_direct_window.h | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'platform/haiku/haiku_direct_window.h') diff --git a/platform/haiku/haiku_direct_window.h b/platform/haiku/haiku_direct_window.h index 450ea64296..19ea987e76 100644 --- a/platform/haiku/haiku_direct_window.h +++ b/platform/haiku/haiku_direct_window.h @@ -4,24 +4,38 @@ #include // needed for image_id #include +#include "os/input.h" #include "haiku_gl_view.h" #define REDRAW_MSG 'rdrw' class HaikuDirectWindow : public BDirectWindow { +private: + unsigned int event_id; + Point2i last_mouse_pos; + bool last_mouse_pos_valid; + uint32 last_buttons_state; + + InputDefault* input; + HaikuGLView* view; + BMessageRunner* update_runner; + + void DispatchMouseButton(BMessage* message); + void DispatchMouseMoved(BMessage* message); + public: HaikuDirectWindow(BRect p_frame); ~HaikuDirectWindow(); void SetHaikuGLView(HaikuGLView* p_view); - void InitMessageRunner(); + void StartMessageRunner(); + void StopMessageRunner(); + void SetInput(InputDefault* p_input); virtual bool QuitRequested(); - virtual void DirectConnected(direct_buffer_info *info); - -private: - HaikuGLView* view; - BMessageRunner* update_runner; + virtual void DirectConnected(direct_buffer_info* info); + virtual void MessageReceived(BMessage* message); + virtual void DispatchMessage(BMessage* message, BHandler* handler); }; #endif -- cgit v1.2.3 From 2102d35e9c18a0cede87e7e45d375153702b3ea5 Mon Sep 17 00:00:00 2001 From: Kostadin Damyanov Date: Wed, 17 Jun 2015 22:27:45 +0300 Subject: Haiku: read the status of the key modifiers and mouse buttons --- platform/haiku/haiku_direct_window.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'platform/haiku/haiku_direct_window.h') diff --git a/platform/haiku/haiku_direct_window.h b/platform/haiku/haiku_direct_window.h index 19ea987e76..bb0ef43da0 100644 --- a/platform/haiku/haiku_direct_window.h +++ b/platform/haiku/haiku_direct_window.h @@ -23,6 +23,8 @@ private: void DispatchMouseButton(BMessage* message); void DispatchMouseMoved(BMessage* message); + inline InputModifierState GetKeyModifierState(uint32 p_state); + inline unsigned int GetMouseButtonState(uint32 p_state); public: HaikuDirectWindow(BRect p_frame); -- cgit v1.2.3 From f10eb8ffa1a7f6bee9b5228ea1204fd93844e4cc Mon Sep 17 00:00:00 2001 From: Kostadin Damyanov Date: Thu, 18 Jun 2015 22:41:33 +0300 Subject: Haiku: implement get_mouse_pos() and get_mouse_button_state() --- platform/haiku/haiku_direct_window.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'platform/haiku/haiku_direct_window.h') diff --git a/platform/haiku/haiku_direct_window.h b/platform/haiku/haiku_direct_window.h index bb0ef43da0..be4dcd9e94 100644 --- a/platform/haiku/haiku_direct_window.h +++ b/platform/haiku/haiku_direct_window.h @@ -13,9 +13,10 @@ class HaikuDirectWindow : public BDirectWindow { private: unsigned int event_id; - Point2i last_mouse_pos; + Point2i last_mouse_position; bool last_mouse_pos_valid; uint32 last_buttons_state; + int last_button_mask; InputDefault* input; HaikuGLView* view; @@ -24,7 +25,7 @@ private: void DispatchMouseButton(BMessage* message); void DispatchMouseMoved(BMessage* message); inline InputModifierState GetKeyModifierState(uint32 p_state); - inline unsigned int GetMouseButtonState(uint32 p_state); + inline int GetMouseButtonState(uint32 p_state); public: HaikuDirectWindow(BRect p_frame); @@ -38,6 +39,9 @@ public: virtual void DirectConnected(direct_buffer_info* info); virtual void MessageReceived(BMessage* message); virtual void DispatchMessage(BMessage* message, BHandler* handler); + + inline Point2i GetLastMousePosition() { return last_mouse_position; }; + inline int GetLastButtonMask() { return last_button_mask; }; }; #endif -- cgit v1.2.3 From 93ac4ace0a0d84fdd7003fcaa02296d55ad5b2ad Mon Sep 17 00:00:00 2001 From: Kostadin Damyanov Date: Sat, 20 Jun 2015 01:59:32 +0300 Subject: Haiku: handle the quit request message --- platform/haiku/haiku_direct_window.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'platform/haiku/haiku_direct_window.h') diff --git a/platform/haiku/haiku_direct_window.h b/platform/haiku/haiku_direct_window.h index be4dcd9e94..c985cdc5d6 100644 --- a/platform/haiku/haiku_direct_window.h +++ b/platform/haiku/haiku_direct_window.h @@ -18,6 +18,7 @@ private: uint32 last_buttons_state; int last_button_mask; + MainLoop* main_loop; InputDefault* input; HaikuGLView* view; BMessageRunner* update_runner; @@ -35,6 +36,7 @@ public: void StartMessageRunner(); void StopMessageRunner(); void SetInput(InputDefault* p_input); + void SetMainLoop(MainLoop* p_main_loop); virtual bool QuitRequested(); virtual void DirectConnected(direct_buffer_info* info); virtual void MessageReceived(BMessage* message); -- cgit v1.2.3 From 174df9a276b26eb6594e3387f71e3fe8c1706253 Mon Sep 17 00:00:00 2001 From: Kostadin Damyanov Date: Sun, 21 Jun 2015 22:18:27 +0300 Subject: Haiku: add support for mouse wheel --- platform/haiku/haiku_direct_window.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'platform/haiku/haiku_direct_window.h') diff --git a/platform/haiku/haiku_direct_window.h b/platform/haiku/haiku_direct_window.h index c985cdc5d6..5355ab4dd4 100644 --- a/platform/haiku/haiku_direct_window.h +++ b/platform/haiku/haiku_direct_window.h @@ -16,6 +16,7 @@ private: Point2i last_mouse_position; bool last_mouse_pos_valid; uint32 last_buttons_state; + uint32 last_key_modifier_state; int last_button_mask; MainLoop* main_loop; @@ -25,6 +26,7 @@ private: void DispatchMouseButton(BMessage* message); void DispatchMouseMoved(BMessage* message); + void DispatchMouseWheelChanged(BMessage* message); inline InputModifierState GetKeyModifierState(uint32 p_state); inline int GetMouseButtonState(uint32 p_state); -- cgit v1.2.3 From 77e78cdb200b08a079b9d4047ea99227874ff3e1 Mon Sep 17 00:00:00 2001 From: Kostadin Damyanov Date: Thu, 2 Jul 2015 18:41:32 +0300 Subject: Haiku: gl context locking --- platform/haiku/haiku_direct_window.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'platform/haiku/haiku_direct_window.h') diff --git a/platform/haiku/haiku_direct_window.h b/platform/haiku/haiku_direct_window.h index 5355ab4dd4..3667eb24d1 100644 --- a/platform/haiku/haiku_direct_window.h +++ b/platform/haiku/haiku_direct_window.h @@ -5,9 +5,12 @@ #include #include "os/input.h" +#include "core/os/os.h" #include "haiku_gl_view.h" #define REDRAW_MSG 'rdrw' +#define LOCKGL_MSG 'glck' +#define UNLOCKGL_MSG 'ulck' class HaikuDirectWindow : public BDirectWindow { @@ -18,15 +21,17 @@ private: uint32 last_buttons_state; uint32 last_key_modifier_state; int last_button_mask; + OS::VideoMode* current_video_mode; MainLoop* main_loop; InputDefault* input; HaikuGLView* view; BMessageRunner* update_runner; - void DispatchMouseButton(BMessage* message); - void DispatchMouseMoved(BMessage* message); - void DispatchMouseWheelChanged(BMessage* message); + void HandleMouseButton(BMessage* message); + void HandleMouseMoved(BMessage* message); + void HandleMouseWheelChanged(BMessage* message); + void HandleWindowResized(BMessage* message); inline InputModifierState GetKeyModifierState(uint32 p_state); inline int GetMouseButtonState(uint32 p_state); @@ -39,6 +44,7 @@ public: void StopMessageRunner(); void SetInput(InputDefault* p_input); void SetMainLoop(MainLoop* p_main_loop); + inline void SetVideoMode(OS::VideoMode* video_mode) { current_video_mode = video_mode; }; virtual bool QuitRequested(); virtual void DirectConnected(direct_buffer_info* info); virtual void MessageReceived(BMessage* message); -- cgit v1.2.3 From 07e76a3f2ce85c996ddddce8e4e5180c7b948490 Mon Sep 17 00:00:00 2001 From: Kostadin Damyanov Date: Sun, 12 Jul 2015 00:52:47 +0300 Subject: Haiku: add keyboard support --- platform/haiku/haiku_direct_window.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'platform/haiku/haiku_direct_window.h') diff --git a/platform/haiku/haiku_direct_window.h b/platform/haiku/haiku_direct_window.h index 3667eb24d1..7b1fd851fa 100644 --- a/platform/haiku/haiku_direct_window.h +++ b/platform/haiku/haiku_direct_window.h @@ -32,6 +32,8 @@ private: void HandleMouseMoved(BMessage* message); void HandleMouseWheelChanged(BMessage* message); void HandleWindowResized(BMessage* message); + void HandleKeyboardEvent(BMessage* message); + void HandleKeyboardModifierEvent(BMessage* message); inline InputModifierState GetKeyModifierState(uint32 p_state); inline int GetMouseButtonState(uint32 p_state); -- cgit v1.2.3 From c925fbce2da5925009d5f78183e017f9252af35f Mon Sep 17 00:00:00 2001 From: Kostadin Damyanov Date: Sat, 17 Oct 2015 15:41:01 +0300 Subject: Haiku: fix build --- platform/haiku/haiku_direct_window.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'platform/haiku/haiku_direct_window.h') diff --git a/platform/haiku/haiku_direct_window.h b/platform/haiku/haiku_direct_window.h index 7b1fd851fa..f0398df505 100644 --- a/platform/haiku/haiku_direct_window.h +++ b/platform/haiku/haiku_direct_window.h @@ -4,15 +4,16 @@ #include // needed for image_id #include -#include "os/input.h" #include "core/os/os.h" +#include "main/input_default.h" + #include "haiku_gl_view.h" #define REDRAW_MSG 'rdrw' #define LOCKGL_MSG 'glck' #define UNLOCKGL_MSG 'ulck' -class HaikuDirectWindow : public BDirectWindow +class HaikuDirectWindow : public BDirectWindow { private: unsigned int event_id; -- cgit v1.2.3