Skip to content

Commit

Permalink
SDL: Move mouse movement to base
Browse files Browse the repository at this point in the history
  • Loading branch information
vasi committed Apr 24, 2013
1 parent d0648a7 commit 14e6e65
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions BasiliskII/src/SDL/video_sdl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -606,14 +606,14 @@ class driver_base {
virtual void update_palette(void);
virtual void suspend(void) {}
virtual void resume(void) {}
virtual void toggle_mouse_grab(void) {}
virtual void mouse_moved(int x, int y) { ADBMouseMoved(x, y); }
void toggle_mouse_grab(void);
void mouse_moved(int x, int y) { ADBMouseMoved(x, y); }

void disable_mouse_accel(void);
void restore_mouse_accel(void);

virtual void grab_mouse(void) {}
virtual void ungrab_mouse(void) {}
void grab_mouse(void);
void ungrab_mouse(void);

public:
SDL_monitor_desc &monitor; // Associated video monitor
Expand All @@ -632,11 +632,6 @@ class driver_window : public driver_base {
public:
driver_window(SDL_monitor_desc &monitor);
virtual void init();

void toggle_mouse_grab(void);

void grab_mouse(void);
void ungrab_mouse(void);
};

class driver_fullscreen : public driver_base {
Expand Down Expand Up @@ -817,7 +812,7 @@ void driver_window::init()
}

// Toggle mouse grab
void driver_window::toggle_mouse_grab(void)
void driver_base::toggle_mouse_grab(void)
{
if (mouse_grabbed)
ungrab_mouse();
Expand All @@ -826,7 +821,7 @@ void driver_window::toggle_mouse_grab(void)
}

// Grab mouse, switch to relative mouse mode
void driver_window::grab_mouse(void)
void driver_base::grab_mouse(void)
{
if (!mouse_grabbed) {
SDL_GrabMode new_mode = set_grab_mode(SDL_GRAB_ON);
Expand All @@ -839,7 +834,7 @@ void driver_window::grab_mouse(void)
}

// Ungrab mouse, switch to absolute mouse mode
void driver_window::ungrab_mouse(void)
void driver_base::ungrab_mouse(void)
{
if (mouse_grabbed) {
SDL_GrabMode new_mode = set_grab_mode(SDL_GRAB_OFF);
Expand Down

0 comments on commit 14e6e65

Please sign in to comment.