remove references to SDL_GetModState();
changed word Key_modifiers(SDLMod mod); to word Get_Key_modifiers(void);
This commit is contained in:
parent
7f1a747d1e
commit
bf29a6837c
@ -3,7 +3,7 @@ $(OBJDIR)/brush.o: brush.c global.h struct.h const.h graph.h misc.h errors.h \
|
|||||||
windows.h screen.h brush.h tiles.h
|
windows.h screen.h brush.h tiles.h
|
||||||
$(OBJDIR)/brush_ops.o: brush_ops.c brush.h struct.h const.h buttons.h loadsave.h \
|
$(OBJDIR)/brush_ops.o: brush_ops.c brush.h struct.h const.h buttons.h loadsave.h \
|
||||||
gfx2surface.h engine.h global.h graph.h misc.h operatio.h pages.h \
|
gfx2surface.h engine.h global.h graph.h misc.h operatio.h pages.h \
|
||||||
screen.h windows.h
|
screen.h windows.h keyboard.h
|
||||||
$(OBJDIR)/buttons.o: buttons.c const.h struct.h global.h misc.h graph.h engine.h \
|
$(OBJDIR)/buttons.o: buttons.c const.h struct.h global.h misc.h graph.h engine.h \
|
||||||
readline.h filesel.h loadsave.h gfx2surface.h init.h buttons.h \
|
readline.h filesel.h loadsave.h gfx2surface.h init.h buttons.h \
|
||||||
operatio.h pages.h palette.h errors.h readini.h saveini.h shade.h io.h \
|
operatio.h pages.h palette.h errors.h readini.h saveini.h shade.h io.h \
|
||||||
@ -42,7 +42,7 @@ $(OBJDIR)/init.o: init.c buttons.h struct.h const.h loadsave.h gfx2surface.h \
|
|||||||
$(OBJDIR)/input.o: input.c global.h struct.h const.h keyboard.h screen.h windows.h \
|
$(OBJDIR)/input.o: input.c global.h struct.h const.h keyboard.h screen.h windows.h \
|
||||||
errors.h misc.h buttons.h loadsave.h gfx2surface.h input.h keycodes.h
|
errors.h misc.h buttons.h loadsave.h gfx2surface.h input.h keycodes.h
|
||||||
$(OBJDIR)/io.o: io.c struct.h const.h io.h realpath.h unicode.h global.h
|
$(OBJDIR)/io.o: io.c struct.h const.h io.h realpath.h unicode.h global.h
|
||||||
$(OBJDIR)/keyboard.o: keyboard.c global.h struct.h const.h keyboard.h
|
$(OBJDIR)/keyboard.o: keyboard.c global.h struct.h const.h keyboard.h keycodes.h
|
||||||
$(OBJDIR)/layers.o: layers.c const.h struct.h global.h windows.h engine.h pages.h \
|
$(OBJDIR)/layers.o: layers.c const.h struct.h global.h windows.h engine.h pages.h \
|
||||||
screen.h input.h keycodes.h help.h misc.h readline.h graph.h
|
screen.h input.h keycodes.h help.h misc.h readline.h graph.h
|
||||||
$(OBJDIR)/libraw2crtc.o: libraw2crtc.c const.h global.h struct.h loadsave.h \
|
$(OBJDIR)/libraw2crtc.o: libraw2crtc.c const.h global.h struct.h loadsave.h \
|
||||||
@ -70,7 +70,7 @@ $(OBJDIR)/op_c.o: op_c.c op_c.h struct.h const.h colorred.h errors.h global.h \
|
|||||||
engine.h windows.h
|
engine.h windows.h
|
||||||
$(OBJDIR)/operatio.o: operatio.c const.h struct.h global.h misc.h engine.h graph.h \
|
$(OBJDIR)/operatio.o: operatio.c const.h struct.h global.h misc.h engine.h graph.h \
|
||||||
operatio.h buttons.h loadsave.h gfx2surface.h pages.h errors.h screen.h \
|
operatio.h buttons.h loadsave.h gfx2surface.h pages.h errors.h screen.h \
|
||||||
brush.h windows.h input.h keycodes.h special.h tiles.h
|
brush.h windows.h input.h keycodes.h special.h tiles.h keyboard.h
|
||||||
$(OBJDIR)/pages.o: pages.c global.h struct.h const.h pages.h errors.h loadsave.h \
|
$(OBJDIR)/pages.o: pages.c global.h struct.h const.h pages.h errors.h loadsave.h \
|
||||||
gfx2surface.h misc.h windows.h tiles.h graph.h
|
gfx2surface.h misc.h windows.h tiles.h graph.h
|
||||||
$(OBJDIR)/palette.o: palette.c const.h struct.h global.h misc.h engine.h readline.h \
|
$(OBJDIR)/palette.o: palette.c const.h struct.h global.h misc.h engine.h readline.h \
|
||||||
@ -119,6 +119,7 @@ $(OBJDIR)/transform.o: transform.c global.h struct.h const.h transform.h engine.
|
|||||||
loadsave.h gfx2surface.h pages.h tiles.h
|
loadsave.h gfx2surface.h pages.h tiles.h
|
||||||
$(OBJDIR)/unicode.o: unicode.c unicode.h struct.h const.h
|
$(OBJDIR)/unicode.o: unicode.c unicode.h struct.h const.h
|
||||||
$(OBJDIR)/version.o: version.c
|
$(OBJDIR)/version.o: version.c
|
||||||
|
$(OBJDIR)/win32screen.o: win32screen.c screen.h struct.h const.h global.h
|
||||||
$(OBJDIR)/windows.o: windows.c windows.h struct.h const.h engine.h errors.h \
|
$(OBJDIR)/windows.o: windows.c windows.h struct.h const.h engine.h errors.h \
|
||||||
global.h graph.h input.h keycodes.h misc.h op_c.h colorred.h readline.h \
|
global.h graph.h input.h keycodes.h misc.h op_c.h colorred.h readline.h \
|
||||||
screen.h palette.h unicode.h
|
screen.h palette.h unicode.h keyboard.h
|
||||||
|
|||||||
@ -37,6 +37,7 @@
|
|||||||
#include "pages.h"
|
#include "pages.h"
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
|
#include "keyboard.h"
|
||||||
|
|
||||||
#if defined(__VBCC__) || defined(__GP2X__) || defined(__WIZ__) || defined(__CAANOO__)
|
#if defined(__VBCC__) || defined(__GP2X__) || defined(__WIZ__) || defined(__CAANOO__)
|
||||||
#define M_PI 3.141592653589793238462643
|
#define M_PI 3.141592653589793238462643
|
||||||
@ -961,11 +962,8 @@ void Rotate_brush_1_5(void)
|
|||||||
// On corrige les coordonnées de la ligne si la touche shift est appuyée...
|
// On corrige les coordonnées de la ligne si la touche shift est appuyée...
|
||||||
cursor_x = Paintbrush_X;
|
cursor_x = Paintbrush_X;
|
||||||
cursor_y = Paintbrush_Y;
|
cursor_y = Paintbrush_Y;
|
||||||
#if defined(USE_SDL) || defined(USE_SDL2)
|
if(Get_Key_modifiers() & MOD_SHIFT)
|
||||||
if(SDL_GetModState() & KMOD_SHIFT)
|
|
||||||
Clamp_coordinates_regular_angle(Brush_rotation_center_X,Brush_rotation_center_Y,&cursor_x,&cursor_y);
|
Clamp_coordinates_regular_angle(Brush_rotation_center_X,Brush_rotation_center_Y,&cursor_x,&cursor_y);
|
||||||
// TODO : portable
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if ( (cursor_x!=old_x) || (cursor_y!=old_y) || (prev_state!=2) )
|
if ( (cursor_x!=old_x) || (cursor_y!=old_y) || (prev_state!=2) )
|
||||||
{
|
{
|
||||||
@ -1035,11 +1033,8 @@ void Rotate_brush_0_5(void)
|
|||||||
// On corrige les coordonnées de la ligne si la touche shift est appuyée...
|
// On corrige les coordonnées de la ligne si la touche shift est appuyée...
|
||||||
cursor_x = Paintbrush_X;
|
cursor_x = Paintbrush_X;
|
||||||
cursor_y = Paintbrush_Y;
|
cursor_y = Paintbrush_Y;
|
||||||
#if defined(USE_SDL) || defined(USE_SDL2)
|
if(Get_Key_modifiers() & MOD_SHIFT)
|
||||||
if(SDL_GetModState() & KMOD_SHIFT)
|
|
||||||
Clamp_coordinates_regular_angle(Brush_rotation_center_X,Brush_rotation_center_Y,&cursor_x,&cursor_y);
|
Clamp_coordinates_regular_angle(Brush_rotation_center_X,Brush_rotation_center_Y,&cursor_x,&cursor_y);
|
||||||
// TODO
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if ((cursor_x!=old_x) || (cursor_y!=old_y) || (prev_state!=3))
|
if ((cursor_x!=old_x) || (cursor_y!=old_y) || (prev_state!=3))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -344,7 +344,7 @@ int Handle_mouse_click(SDL_MouseButtonEvent event)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_BUTTON_MIDDLE:
|
case SDL_BUTTON_MIDDLE:
|
||||||
Key = KEY_MOUSEMIDDLE|Key_modifiers(SDL_GetModState());
|
Key = KEY_MOUSEMIDDLE|Get_Key_modifiers();
|
||||||
// TODO: repeat system maybe?
|
// TODO: repeat system maybe?
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -352,11 +352,11 @@ int Handle_mouse_click(SDL_MouseButtonEvent event)
|
|||||||
// Look for SDL_MOUSEWHEEL events.
|
// Look for SDL_MOUSEWHEEL events.
|
||||||
#if defined(USE_SDL)
|
#if defined(USE_SDL)
|
||||||
case SDL_BUTTON_WHEELUP:
|
case SDL_BUTTON_WHEELUP:
|
||||||
Key = KEY_MOUSEWHEELUP|Key_modifiers(SDL_GetModState());
|
Key = KEY_MOUSEWHEELUP|Get_Key_modifiers();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case SDL_BUTTON_WHEELDOWN:
|
case SDL_BUTTON_WHEELDOWN:
|
||||||
Key = KEY_MOUSEWHEELDOWN|Key_modifiers(SDL_GetModState());
|
Key = KEY_MOUSEWHEELDOWN|Get_Key_modifiers();
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -703,7 +703,7 @@ int Handle_joystick_press(SDL_JoyButtonEvent event)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Key = (KEY_JOYBUTTON+event.button)|Key_modifiers(SDL_GetModState());
|
Key = (KEY_JOYBUTTON+event.button)|Get_Key_modifiers();
|
||||||
// TODO: systeme de répétition
|
// TODO: systeme de répétition
|
||||||
|
|
||||||
return Move_cursor_with_constraints();
|
return Move_cursor_with_constraints();
|
||||||
|
|||||||
@ -330,9 +330,10 @@ word Key_for_scancode(word scancode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Convertit des modificateurs de touches SDL en modificateurs GrafX2
|
// Convertit des modificateurs de touches SDL en modificateurs GrafX2
|
||||||
word Key_modifiers(SDLMod mod)
|
word Get_Key_modifiers(void)
|
||||||
{
|
{
|
||||||
word modifiers=0;
|
word modifiers=0;
|
||||||
|
SDLMod mod = SDL_GetModState();
|
||||||
|
|
||||||
if (mod & KMOD_CTRL )
|
if (mod & KMOD_CTRL )
|
||||||
modifiers|=MOD_CTRL;
|
modifiers|=MOD_CTRL;
|
||||||
@ -371,7 +372,7 @@ word Keysym_to_keycode(SDL_keysym keysym)
|
|||||||
// Normally I should test keysym.mod here, but on windows the implementation
|
// Normally I should test keysym.mod here, but on windows the implementation
|
||||||
// is buggy: if you release a modifier key, the following keys (when they repeat)
|
// is buggy: if you release a modifier key, the following keys (when they repeat)
|
||||||
// still name the original modifiers.
|
// still name the original modifiers.
|
||||||
mod=Key_modifiers(SDL_GetModState());
|
mod = Get_Key_modifiers();
|
||||||
|
|
||||||
// SDL_GetModState() seems to get the right up-to-date info.
|
// SDL_GetModState() seems to get the right up-to-date info.
|
||||||
key_code |= mod;
|
key_code |= mod;
|
||||||
@ -768,7 +769,7 @@ word Key_for_scancode(word scancode)
|
|||||||
{
|
{
|
||||||
return scancode;
|
return scancode;
|
||||||
}
|
}
|
||||||
word Key_modifiers(SDL_Keymod mod)
|
word Get_Key_modifiers(void)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -79,13 +79,7 @@ word Key_for_scancode(word scancode);
|
|||||||
const char * Key_name(word key);
|
const char * Key_name(word key);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Gets the modifiers in our format from the SDL_Mod information.
|
Gets the Key modifiers in our format
|
||||||
Returns a combination of ::MOD_SHIFT, ::MOD_ALT, ::MOD_CTRL
|
Returns a combination of ::MOD_SHIFT, ::MOD_ALT, ::MOD_CTRL
|
||||||
@param mod SDL modifiers state
|
|
||||||
*/
|
*/
|
||||||
#if defined(USE_SDL)
|
word Get_Key_modifiers(void);
|
||||||
word Key_modifiers(SDLMod mod);
|
|
||||||
#elif defined(USE_SDL2)
|
|
||||||
word Key_modifiers(SDL_Keymod mod);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|||||||
@ -39,6 +39,7 @@
|
|||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "special.h"
|
#include "special.h"
|
||||||
#include "tiles.h"
|
#include "tiles.h"
|
||||||
|
#include "keyboard.h"
|
||||||
|
|
||||||
// PI is NOT part of math.h according to C standards...
|
// PI is NOT part of math.h according to C standards...
|
||||||
#if defined(__GP2X__) || defined(__VBCC__)
|
#if defined(__GP2X__) || defined(__VBCC__)
|
||||||
@ -520,10 +521,8 @@ void Line_12_5(void)
|
|||||||
cursor_y = Paintbrush_Y;
|
cursor_y = Paintbrush_Y;
|
||||||
|
|
||||||
// On corrige les coordonnées de la ligne si la touche shift est appuyée...
|
// On corrige les coordonnées de la ligne si la touche shift est appuyée...
|
||||||
#if defined(USE_SDL) || defined(USE_SDL2)
|
if(Get_Key_modifiers() & MOD_SHIFT)
|
||||||
if(SDL_GetModState() & KMOD_SHIFT)
|
|
||||||
Clamp_coordinates_regular_angle(start_x,start_y,&cursor_x,&cursor_y);
|
Clamp_coordinates_regular_angle(start_x,start_y,&cursor_x,&cursor_y);
|
||||||
#endif
|
|
||||||
|
|
||||||
// On vient de bouger
|
// On vient de bouger
|
||||||
if ((cursor_x!=end_x) || (cursor_y!=end_y))
|
if ((cursor_x!=end_x) || (cursor_y!=end_y))
|
||||||
@ -3808,10 +3807,8 @@ void Grad_rectangle_12_9(void)
|
|||||||
cursor_x = Paintbrush_X;
|
cursor_x = Paintbrush_X;
|
||||||
cursor_y = Paintbrush_Y;
|
cursor_y = Paintbrush_Y;
|
||||||
// On corrige les coordonnées de la ligne si la touche shift est appuyée...
|
// On corrige les coordonnées de la ligne si la touche shift est appuyée...
|
||||||
#if defined(USE_SDL) || defined(USE_SDL2)
|
if(Get_Key_modifiers() & MOD_SHIFT)
|
||||||
if(SDL_GetModState() & KMOD_SHIFT)
|
|
||||||
Clamp_coordinates_regular_angle(start_x,start_y,&cursor_x,&cursor_y);
|
Clamp_coordinates_regular_angle(start_x,start_y,&cursor_x,&cursor_y);
|
||||||
#endif
|
|
||||||
|
|
||||||
if ((cursor_x!=end_x) || (cursor_y!=end_y))
|
if ((cursor_x!=end_x) || (cursor_y!=end_y))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -50,6 +50,7 @@
|
|||||||
#include "palette.h"
|
#include "palette.h"
|
||||||
#include "unicode.h"
|
#include "unicode.h"
|
||||||
#include "keycodes.h"
|
#include "keycodes.h"
|
||||||
|
#include "keyboard.h"
|
||||||
|
|
||||||
T_Toolbar_button Buttons_Pool[NB_BUTTONS];
|
T_Toolbar_button Buttons_Pool[NB_BUTTONS];
|
||||||
T_Menu_Bar Menu_bars[MENUBAR_COUNT] =
|
T_Menu_Bar Menu_bars[MENUBAR_COUNT] =
|
||||||
@ -1854,7 +1855,7 @@ void Compute_paintbrush_coordinates(void)
|
|||||||
// Operations that implement it
|
// Operations that implement it
|
||||||
#if defined(USE_SDL) || defined(USE_SDL2)
|
#if defined(USE_SDL) || defined(USE_SDL2)
|
||||||
default:
|
default:
|
||||||
if (Snap_axis==0 && (SDL_GetModState() & KMOD_SHIFT))
|
if (Snap_axis==0 && (Get_Key_modifiers() & MOD_SHIFT))
|
||||||
{
|
{
|
||||||
// Start "Snap axis" mode
|
// Start "Snap axis" mode
|
||||||
Snap_axis=1;
|
Snap_axis=1;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user