From a918317f09a5eb052500d724fce33ef671491c06 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 22 Oct 2023 22:12:40 +0300 Subject: [PATCH 48/48] sdl3: Change SDL_GetMouseState() parameters to floats See osdn #48892 Signed-off-by: Marko Lindqvist --- client/gui-sdl3/gui_mouse.c | 4 ++-- client/gui-sdl3/mapctrl.c | 2 +- client/gui-sdl3/widget_scrollbar.c | 26 +++++++++++++------------- client/gui-sdl3/widget_window.c | 8 ++++---- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/client/gui-sdl3/gui_mouse.c b/client/gui-sdl3/gui_mouse.c index 620f191ac5..a8fabb4f44 100644 --- a/client/gui-sdl3/gui_mouse.c +++ b/client/gui-sdl3/gui_mouse.c @@ -95,8 +95,8 @@ static SDL_Cursor *SurfaceToCursor(SDL_Surface *image, int hx, int hy) **************************************************************************/ void draw_mouse_cursor(void) { - int cursor_x = 0; - int cursor_y = 0; + float cursor_x = 0; + float cursor_y = 0; static SDL_Rect area = {0, 0, 0, 0}; if (GUI_SDL_OPTION(use_color_cursors)) { diff --git a/client/gui-sdl3/mapctrl.c b/client/gui-sdl3/mapctrl.c index b59b5c6ece..ae10572f0b 100644 --- a/client/gui-sdl3/mapctrl.c +++ b/client/gui-sdl3/mapctrl.c @@ -2924,7 +2924,7 @@ void set_turn_done_button_state(bool state) **************************************************************************/ void create_line_at_mouse_pos(void) { - int pos_x, pos_y; + float pos_x, pos_y; SDL_GetMouseState(&pos_x, &pos_y); update_line(pos_x, pos_y); diff --git a/client/gui-sdl3/widget_scrollbar.c b/client/gui-sdl3/widget_scrollbar.c index 97b64d1552..35e61dcd55 100644 --- a/client/gui-sdl3/widget_scrollbar.c +++ b/client/gui-sdl3/widget_scrollbar.c @@ -32,7 +32,7 @@ #include "widget.h" #include "widget_p.h" -struct UP_DOWN { +struct up_down { struct widget *begin; struct widget *end; struct widget *begin_widget_list; @@ -40,9 +40,9 @@ struct UP_DOWN { struct scroll_bar *vscroll; float old_y; int step; - int prev_x; - int prev_y; - int offset; /* number of pixels the mouse is away from the slider origin */ + float prev_x; + float prev_y; + int offset; /* Number of pixels the mouse is away from the slider origin */ }; #define widget_add_next(new_widget, add_dock) \ @@ -863,14 +863,14 @@ static struct widget *vertical_scroll_widget_list(struct widget *active_widget_l **************************************************************************/ static void inside_scroll_down_loop(void *data) { - struct UP_DOWN *down = (struct UP_DOWN *)data; + struct up_down *down = (struct up_down *)data; if (down->end != down->begin_widget_list) { if (down->vscroll->pscroll_bar && down->vscroll->pscroll_bar->size.y <= - down->vscroll->max - down->vscroll->pscroll_bar->size.h) { + down->vscroll->max - down->vscroll->pscroll_bar->size.h) { - /* draw bcgd */ + /* Draw bcgd */ widget_undraw(down->vscroll->pscroll_bar); widget_mark_dirty(down->vscroll->pscroll_bar); @@ -910,14 +910,14 @@ static void inside_scroll_down_loop(void *data) **************************************************************************/ static void inside_scroll_up_loop(void *data) { - struct UP_DOWN *up = (struct UP_DOWN *)data; + struct up_down *up = (struct up_down *)data; if (up && up->begin != up->end_widget_list) { if (up->vscroll->pscroll_bar && (up->vscroll->pscroll_bar->size.y >= up->vscroll->min)) { - /* draw bcgd */ + /* Draw bcgd */ widget_undraw(up->vscroll->pscroll_bar); widget_mark_dirty(up->vscroll->pscroll_bar); @@ -953,7 +953,7 @@ static void inside_scroll_up_loop(void *data) static Uint16 scroll_mouse_motion_handler(SDL_MouseMotionEvent *motion_event, void *data) { - struct UP_DOWN *motion = (struct UP_DOWN *)data; + struct up_down *motion = (struct up_down *)data; int yrel; int y; int normalized_y; @@ -1052,7 +1052,7 @@ static struct widget *down_scroll_widget_list(struct scroll_bar *vscroll, struct widget *begin_widget_list, struct widget *end_widget_list) { - struct UP_DOWN down; + struct up_down down; struct widget *begin = begin_active_widget_list; int step = vscroll->active * vscroll->step - 1; @@ -1081,7 +1081,7 @@ static struct widget *up_scroll_widget_list(struct scroll_bar *vscroll, struct widget *begin_widget_list, struct widget *end_widget_list) { - struct UP_DOWN up; + struct up_down up; up.step = get_step(vscroll); up.begin = begin_active_widget_list; @@ -1103,7 +1103,7 @@ static struct widget *vertic_scroll_widget_list(struct scroll_bar *vscroll, struct widget *begin_widget_list, struct widget *end_widget_list) { - struct UP_DOWN motion; + struct up_down motion; motion.step = get_step(vscroll); motion.begin = begin_active_widget_list; diff --git a/client/gui-sdl3/widget_window.c b/client/gui-sdl3/widget_window.c index a9329eb940..49880dbffa 100644 --- a/client/gui-sdl3/widget_window.c +++ b/client/gui-sdl3/widget_window.c @@ -35,8 +35,8 @@ struct move { bool moved; struct widget *pwindow; - int prev_x; - int prev_y; + float prev_x; + float prev_y; }; static int (*baseclass_redraw)(struct widget *pwidget); @@ -134,7 +134,7 @@ static void window_set_position(struct widget *pwindow, int x, int y) **************************************************************************/ static void window_select(struct widget *pwindow) { - /* nothing */ + /* Nothing */ } /**********************************************************************//** @@ -142,7 +142,7 @@ static void window_select(struct widget *pwindow) **************************************************************************/ static void window_unselect(struct widget *pwindow) { - /* nothing */ + /* Nothing */ } /**********************************************************************//** -- 2.42.0