summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/sdl/window.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/osd/sdl/window.h')
-rw-r--r--src/osd/sdl/window.h73
1 files changed, 51 insertions, 22 deletions
diff --git a/src/osd/sdl/window.h b/src/osd/sdl/window.h
index 77477176b51..49fe452192f 100644
--- a/src/osd/sdl/window.h
+++ b/src/osd/sdl/window.h
@@ -14,22 +14,20 @@
#include "modules/osdwindow.h"
#include "osdsync.h"
+#include <SDL2/SDL.h>
+
+#include <chrono>
#include <cstdint>
#include <memory>
+#include <vector>
//============================================================
// TYPE DEFINITIONS
//============================================================
-struct SDL_Window;
-
class render_target;
-// forward of SDL_DisplayMode not possible (typedef struct) - define wrapper
-
-class SDL_DM_Wrapper;
-
typedef uintptr_t HashT;
#define OSDWORK_CALLBACK(name) void *name(void *param, int threadid)
@@ -65,26 +63,34 @@ public:
int xy_to_render_target(int x, int y, int *xt, int *yt);
-private:
- // window handle and info
- int m_startmaximized;
+ void mouse_entered(unsigned device);
+ void mouse_left(unsigned device);
+ void mouse_down(unsigned device, int x, int y, unsigned button);
+ void mouse_up(unsigned device, int x, int y, unsigned button);
+ void mouse_moved(unsigned device, int x, int y);
+ void mouse_wheel(unsigned device, int y);
+ void finger_down(SDL_FingerID finger, unsigned device, int x, int y);
+ void finger_up(SDL_FingerID finger, unsigned device, int x, int y);
+ void finger_moved(SDL_FingerID finger, unsigned device, int x, int y);
- // dimensions
- osd_dim m_minimum_dim;
- osd_dim m_windowed_dim;
+private:
+ struct sdl_pointer_info : public pointer_info
+ {
+ static constexpr bool compare(sdl_pointer_info const &info, SDL_FingerID finger) { return info.finger < finger; }
- // rendering info
- osd_event m_rendered_event;
+ sdl_pointer_info(sdl_pointer_info const &) = default;
+ sdl_pointer_info(sdl_pointer_info &&) = default;
+ sdl_pointer_info &operator=(sdl_pointer_info const &) = default;
+ sdl_pointer_info &operator=(sdl_pointer_info &&) = default;
- // Original display_mode
- std::unique_ptr<SDL_DM_Wrapper> m_original_mode;
+ sdl_pointer_info(SDL_FingerID, unsigned i, unsigned d);
- int m_extra_flags;
+ SDL_FingerID finger;
+ };
// returns 0 on success, else 1
int complete_create();
-private:
int wnd_extra_width();
int wnd_extra_height();
osd_rect constrain_to_aspect_ratio(const osd_rect &rect, int adjustment);
@@ -94,12 +100,35 @@ private:
osd_dim pick_best_mode();
void set_fullscreen(int afullscreen) { m_fullscreen = afullscreen; }
- // monitor info
- bool m_mouse_captured;
- bool m_mouse_hidden;
-
void measure_fps(int update);
+ std::vector<sdl_pointer_info>::iterator map_pointer(SDL_FingerID finger, unsigned device);
+
+ // window handle and info
+ int m_startmaximized;
+
+ // dimensions
+ osd_dim m_minimum_dim;
+ osd_dim m_windowed_dim;
+
+ // rendering info
+ osd_event m_rendered_event;
+
+ // Original display_mode
+ SDL_DisplayMode m_original_mode;
+
+ int m_extra_flags;
+
+ // monitor info
+ bool m_mouse_captured;
+ bool m_mouse_hidden;
+
+ // info on currently active pointers - 64 pointers ought to be enough for anyone
+ uint64_t m_pointer_mask;
+ unsigned m_next_pointer;
+ bool m_mouse_inside;
+ std::vector<pointer_dev_info> m_ptrdev_info;
+ std::vector<sdl_pointer_info> m_active_pointers;
};
#endif // MAME_OSD_SDL_WINDOW_H