move Set_mouse_position() to sdlscreen.c / win32screen.c / etc.
This commit is contained in:
parent
d5645dec26
commit
206c67e77c
@ -1855,15 +1855,6 @@ void Adjust_mouse_sensitivity(word fullscreen)
|
||||
(void)fullscreen;
|
||||
}
|
||||
|
||||
void Set_mouse_position(void)
|
||||
{
|
||||
#if defined(USE_SDL)
|
||||
SDL_WarpMouse(Mouse_X*Pixel_width, Mouse_Y*Pixel_height);
|
||||
#elif defined(USE_SDL2)
|
||||
//SDL_WarpMouseInWindow(Window_SDL, Mouse_X*Pixel_width, Mouse_Y*Pixel_height);
|
||||
#endif
|
||||
}
|
||||
|
||||
static int Color_cycling(void)
|
||||
{
|
||||
static byte offset[16];
|
||||
|
||||
@ -49,8 +49,6 @@ int Has_shortcut(word function);
|
||||
/// Adjust mouse sensitivity (and actual mouse input mode)
|
||||
void Adjust_mouse_sensitivity(word fullscreen);
|
||||
|
||||
void Set_mouse_position(void);
|
||||
|
||||
int Move_cursor_with_constraints(void);
|
||||
|
||||
///
|
||||
|
||||
@ -83,4 +83,7 @@ int GFX2_Get_X11_Display_Window(Display * * display, Window * window);
|
||||
/// Set application icon(s)
|
||||
void Define_icon(void);
|
||||
|
||||
/// set (system) mouse cursor position
|
||||
void Set_mouse_position(void);
|
||||
|
||||
#endif // SCREEN_H_INCLUDED
|
||||
|
||||
@ -778,3 +778,12 @@ void Define_icon(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Set_mouse_position(void)
|
||||
{
|
||||
#if defined(USE_SDL)
|
||||
SDL_WarpMouse(Mouse_X*Pixel_width, Mouse_Y*Pixel_height);
|
||||
#elif defined(USE_SDL2)
|
||||
SDL_WarpMouseInWindow(NULL, Mouse_X*Pixel_width, Mouse_Y*Pixel_height);
|
||||
#endif
|
||||
}
|
||||
@ -609,3 +609,17 @@ void Define_icon(void)
|
||||
// Do nothing because the icon is set in the window class
|
||||
// see Init_Win32()
|
||||
}
|
||||
|
||||
void Set_mouse_position(void)
|
||||
{
|
||||
POINT pt;
|
||||
pt.x = Mouse_X * Pixel_width;
|
||||
pt.y = Mouse_Y * Pixel_height;
|
||||
if (!ClientToScreen(Win32_hwnd, &pt))
|
||||
GFX2_Log(GFX2_WARNING, "ClientToScreen(%08x, %p) failed\n", Win32_hwnd, &pt);
|
||||
else
|
||||
{
|
||||
if (!SetCursorPos(pt.x, pt.y))
|
||||
GFX2_Log(GFX2_WARNING, "SetCursorPos(%ld, %ld) failed\n", pt.x, pt.y);
|
||||
}
|
||||
}
|
||||
@ -330,3 +330,8 @@ void Define_icon(void)
|
||||
snprintf(icon_path, sizeof(icon_path), "%s%s", Data_directory, "gfx2.png"); // 48x48
|
||||
icon = Load_surface(icon_path, NULL);
|
||||
}
|
||||
|
||||
void Set_mouse_position(void)
|
||||
{
|
||||
/// @todo implement screen capture and set position for x11.
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user