diff --git a/divers.c b/divers.c index ddff1e20..ef6631e5 100644 --- a/divers.c +++ b/divers.c @@ -94,6 +94,7 @@ void Set_color(byte Couleur, byte Rouge, byte Vert, byte Bleu) SDL_SetPalette(Ecran_SDL, SDL_LOGPAL, &comp, Couleur, 1); } +/* void Attendre_fin_de_click(void) { SDL_Event event; @@ -115,6 +116,17 @@ void Attendre_fin_de_click(void) Mouse_K=0; INPUT_Nouveau_Mouse_K=0; } +*/ + +void Attendre_fin_de_click(void) +{ + // On désactive tous les raccourcis clavier + Desactiver_clavier=1; + + // On force la souris à se mettre à 0 + Mouse_K=0; + INPUT_Nouveau_Mouse_K=0; +} void Effacer_image_courante_Stencil(byte Couleur, byte * Pochoir) //Effacer l'image courante avec une certaine couleur en mode Stencil diff --git a/global.h b/global.h index 73f1730b..157d90b4 100644 --- a/global.h +++ b/global.h @@ -136,6 +136,9 @@ GFX2_GLOBAL Uint8* Etat_Du_Clavier; // Scancode de la touche en cours et etat d #define MOD_SHIFT 0x1000 #define MOD_CTRL 0x2000 #define MOD_ALT 0x4000 + +GFX2_GLOBAL byte Desactiver_clavier; + GFX2_GLOBAL byte Quit_demande; // !=0 lorsque l'utilisateur demande la fermeture de fenêtre. GFX2_GLOBAL byte Mouse_Facteur_de_correction_X; diff --git a/input.c b/input.c index 71af5d4b..ac0b92ae 100644 --- a/input.c +++ b/input.c @@ -199,6 +199,7 @@ int Handle_Mouse_Release(SDL_MouseButtonEvent event) INPUT_Nouveau_Mouse_K &= ~2; break; } + if(INPUT_Nouveau_Mouse_K==0) Desactiver_clavier=0; return Move_cursor_with_constraints(); } @@ -269,6 +270,8 @@ int Handle_Key_Press(SDL_KeyboardEvent event) } else Touche = 0; } + + if (Desactiver_clavier) Touche=0; // Utilisé uniquement dans Attendre fin de clic return 0; } @@ -294,11 +297,13 @@ int Relache_controle(int CodeTouche, int Modifieur) if(CodeTouche == (Config_Touche[SPECIAL_CLICK_LEFT]&0x0FFF) || (Config_Touche[SPECIAL_CLICK_LEFT]&Modifieur)) { INPUT_Nouveau_Mouse_K &= ~1; + if(INPUT_Nouveau_Mouse_K==0) Desactiver_clavier=0; return Move_cursor_with_constraints(); } if(CodeTouche == (Config_Touche[SPECIAL_CLICK_RIGHT]&0x0FFF) || (Config_Touche[SPECIAL_CLICK_RIGHT]&Modifieur)) { INPUT_Nouveau_Mouse_K &= ~2; + if(INPUT_Nouveau_Mouse_K==0) Desactiver_clavier=0; return Move_cursor_with_constraints(); }