Fix issue 161 (Linux: The window "resists" resizing)
Fix issue 159 (Mouse sensitivy in fullscreen mode) by implementing user-defined mouse sensitivity in Settings screen, only affects fullscreen mode. Fix: When changing pixel size, sometimes there were some remaining "dirty lines" at the right edge of screen/window. git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@819 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
a3dbf3d4ac
commit
bb2794ed2b
21
buttons.c
21
buttons.c
@ -672,12 +672,12 @@ void Settings_display_config(T_Config * conf)
|
|||||||
|
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
|
|
||||||
// slider = Jauge de sensibilité Y
|
// slider = sensitivity slider for Y
|
||||||
slider->Position=conf->Mouse_sensitivity_index_y-1;
|
slider->Position=conf->Mouse_sensitivity_index_y-1;
|
||||||
Window_draw_slider(slider);
|
Window_draw_slider(slider);
|
||||||
|
|
||||||
slider=slider->Next;
|
slider=slider->Next;
|
||||||
// slider = Jauge de sensibilité X
|
// slider = sensitivity slider for X
|
||||||
slider->Position=conf->Mouse_sensitivity_index_x-1;
|
slider->Position=conf->Mouse_sensitivity_index_x-1;
|
||||||
Window_draw_slider(slider);
|
Window_draw_slider(slider);
|
||||||
|
|
||||||
@ -745,8 +745,6 @@ void Settings_load_config(T_Config * conf)
|
|||||||
|
|
||||||
void Button_Settings(void)
|
void Button_Settings(void)
|
||||||
{
|
{
|
||||||
int x_sensitivity;
|
|
||||||
int y_sensitivity;
|
|
||||||
short clicked_button;
|
short clicked_button;
|
||||||
T_Config Config_choisie;
|
T_Config Config_choisie;
|
||||||
char str[3];
|
char str[3];
|
||||||
@ -822,8 +820,8 @@ void Button_Settings(void)
|
|||||||
Window_set_normal_button(250,163, 51,14,"Close" ,0,1,KEY_ESC); // 19
|
Window_set_normal_button(250,163, 51,14,"Close" ,0,1,KEY_ESC); // 19
|
||||||
|
|
||||||
// Jauges de sensibilité de la souris (X puis Y)
|
// Jauges de sensibilité de la souris (X puis Y)
|
||||||
Window_set_scroller_button(265,99,56,255,1,0); // 20
|
Window_set_scroller_button(265,99,56,4,1,0); // 20
|
||||||
Window_set_scroller_button(279,99,56,255,1,0); // 21
|
Window_set_scroller_button(279,99,56,4,1,0); // 21
|
||||||
|
|
||||||
// Zone de saisie du nb de pages de Undo
|
// Zone de saisie du nb de pages de Undo
|
||||||
Window_set_input_button(140,50,2); // 22
|
Window_set_input_button(140,50,2); // 22
|
||||||
@ -942,16 +940,7 @@ void Button_Settings(void)
|
|||||||
|
|
||||||
Config=Config_choisie;
|
Config=Config_choisie;
|
||||||
|
|
||||||
// Prise en compte de la nouvelle config
|
// Font selection
|
||||||
// Gestion de la sensibilité
|
|
||||||
x_sensitivity=(Config.Mouse_sensitivity_index_x/Menu_factor_X);
|
|
||||||
y_sensitivity=(Config.Mouse_sensitivity_index_y/Menu_factor_Y);
|
|
||||||
x_sensitivity>>=Mouse_fix_factor_X;
|
|
||||||
y_sensitivity>>=Mouse_fix_factor_Y;
|
|
||||||
|
|
||||||
Mouse_sensitivity(x_sensitivity?x_sensitivity:1,
|
|
||||||
y_sensitivity?y_sensitivity:1);
|
|
||||||
// Gestion des fontes
|
|
||||||
if (Config.Font)
|
if (Config.Font)
|
||||||
Menu_font=GFX_fun_font;
|
Menu_font=GFX_fun_font;
|
||||||
else
|
else
|
||||||
|
|||||||
35
gfx2def.ini
35
gfx2def.ini
@ -25,36 +25,15 @@
|
|||||||
[MOUSE] # [SOURIS]
|
[MOUSE] # [SOURIS]
|
||||||
|
|
||||||
; The sensitivity of the mouse can | La sensibilité de la souris peut
|
; The sensitivity of the mouse can | La sensibilité de la souris peut
|
||||||
; take values from 1 to 64. The | prendre des valeurs de 1 à 64. Plus
|
; take values from 1 to 4. The | prendre des valeurs de 1 à 4. Plus
|
||||||
; smaller values, the faster. | les valeurs sont petites, plus c'est
|
; smaller values, the faster. | les valeurs sont petites, plus c'est
|
||||||
; | rapide.
|
; This only takes effect in | rapide. Ce paramétrage n'est utilisé
|
||||||
X_sensitivity = 1 ; (default 3)
|
; fullscreen modes. | que dans les modes "plein écran".
|
||||||
Y_sensitivity = 1 ; (default 3)
|
; |
|
||||||
|
X_sensitivity = 1 ; (default 1)
|
||||||
|
Y_sensitivity = 1 ; (default 1)
|
||||||
|
|
||||||
; Due to the fact that those stupid | A cause du fait que ces imbéciles de
|
; Unused setting, only kept for compatibility.
|
||||||
; mouse drivers' makers don't care | programmeurs de gestionnaires de
|
|
||||||
; if the mouse moves by steps of 2, | souris se fichent que votre souris se
|
|
||||||
; 4 or even 8 pixels, we have to | deplace par pas de 2, 4 ou même 8
|
|
||||||
; stretch the virtual area of the | pixels, nous devons élargir la zone
|
|
||||||
; mouse and divide coordinates to | virtuelle de la souris et diviser les
|
|
||||||
; get a one-pixel step motion. | coordonnées pour obtenir un pas de 1.
|
|
||||||
; (Warning: the mouse movement can | (Attention: le déplacement de la
|
|
||||||
; be correct in some video modes | souris peut être correct dans certains
|
|
||||||
; but not in others... But all the | modes vidéos mais pas dans d'autres...
|
|
||||||
; "Modes X" should behave the same | Mais tout les Modes X devraient se
|
|
||||||
; way, so you won't have to test | comporter de la même manière, donc
|
|
||||||
; them all). | vous n'aurez pas à tous les tester.
|
|
||||||
; A correction factor of 0 means | Un facteur de correction de 0 signifie
|
|
||||||
; that you are very lucky because | que vous avez de la chace car votre
|
|
||||||
; your driver doesn't need any | driver n'a pas besoin de correction.
|
|
||||||
; correction. If you set the | Si vous définissez le facteur de
|
|
||||||
; correction factor to 1, it means | correction à 1, cela signifie que
|
|
||||||
; that your mouse moves by steps of | votre souris se déplace par pas de 2
|
|
||||||
; 2 pixels; 2 for 4; 3 for 8, etc...| pixels; 2 pour 4; 3 pour 8, etc...
|
|
||||||
; If you want to use GrafX2 in a | Si vous désirez lancer GrafX2 dans une
|
|
||||||
; Win95 window, you should turn | fenêtre Windows95, vous devriez passer
|
|
||||||
; these values to 0 (and increase X | ces valeurs à 0 (et augmenter les sen-
|
|
||||||
; and Y sensitivities above). | sibilités X et Y définies plus haut).
|
|
||||||
X_correction_factor = 0 ; (default 0)
|
X_correction_factor = 0 ; (default 0)
|
||||||
Y_correction_factor = 0 ; (default 0)
|
Y_correction_factor = 0 ; (default 0)
|
||||||
|
|
||||||
|
|||||||
13
graph.c
13
graph.c
@ -45,6 +45,7 @@
|
|||||||
#include "pxtall2.h"
|
#include "pxtall2.h"
|
||||||
#include "pxquad.h"
|
#include "pxquad.h"
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
|
#include "input.h"
|
||||||
|
|
||||||
// Generic pixel-drawing function.
|
// Generic pixel-drawing function.
|
||||||
Func_pixel Pixel_figure;
|
Func_pixel Pixel_figure;
|
||||||
@ -186,8 +187,6 @@ void Transform_point(short x, short y, float cos_a, float sin_a,
|
|||||||
|
|
||||||
int Init_mode_video(int width, int height, int fullscreen, int pix_ratio)
|
int Init_mode_video(int width, int height, int fullscreen, int pix_ratio)
|
||||||
{
|
{
|
||||||
int x_sensitivity;
|
|
||||||
int y_sensitivity;
|
|
||||||
int index;
|
int index;
|
||||||
int factor;
|
int factor;
|
||||||
int pix_width;
|
int pix_width;
|
||||||
@ -277,7 +276,7 @@ int Init_mode_video(int width, int height, int fullscreen, int pix_ratio)
|
|||||||
{
|
{
|
||||||
Set_mode_SDL(&width, &height,fullscreen);
|
Set_mode_SDL(&width, &height,fullscreen);
|
||||||
}
|
}
|
||||||
Clear_border(MC_Black);
|
|
||||||
if (screen_changed || pixels_changed)
|
if (screen_changed || pixels_changed)
|
||||||
{
|
{
|
||||||
Pixel_ratio=pix_ratio;
|
Pixel_ratio=pix_ratio;
|
||||||
@ -467,6 +466,8 @@ int Init_mode_video(int width, int height, int fullscreen, int pix_ratio)
|
|||||||
Screen_width = width/Pixel_width;
|
Screen_width = width/Pixel_width;
|
||||||
Screen_height = height/Pixel_height;
|
Screen_height = height/Pixel_height;
|
||||||
|
|
||||||
|
Clear_border(MC_Black); // Requires up-to-date Screen_* and Pixel_*
|
||||||
|
|
||||||
// Taille des menus
|
// Taille des menus
|
||||||
if (Screen_width/320 > Screen_height/200)
|
if (Screen_width/320 > Screen_height/200)
|
||||||
factor=Screen_height/200;
|
factor=Screen_height/200;
|
||||||
@ -521,11 +522,7 @@ int Init_mode_video(int width, int height, int fullscreen, int pix_ratio)
|
|||||||
Menu_Y -= MENU_HEIGHT * Menu_factor_Y;
|
Menu_Y -= MENU_HEIGHT * Menu_factor_Y;
|
||||||
Menu_status_Y = Screen_height-(Menu_factor_Y<<3);
|
Menu_status_Y = Screen_height-(Menu_factor_Y<<3);
|
||||||
|
|
||||||
x_sensitivity = Config.Mouse_sensitivity_index_x;
|
Adjust_mouse_sensitivity(fullscreen);
|
||||||
y_sensitivity = Config.Mouse_sensitivity_index_y;
|
|
||||||
x_sensitivity>>=Mouse_fix_factor_X;
|
|
||||||
y_sensitivity>>=Mouse_fix_factor_Y;
|
|
||||||
Mouse_sensitivity(x_sensitivity?x_sensitivity:1,y_sensitivity?y_sensitivity:1);
|
|
||||||
|
|
||||||
Mouse_X=absolute_mouse_x/Pixel_width;
|
Mouse_X=absolute_mouse_x/Pixel_width;
|
||||||
if (Mouse_X>=Screen_width)
|
if (Mouse_X>=Screen_width)
|
||||||
|
|||||||
70
input.c
70
input.c
@ -48,6 +48,12 @@ word Input_new_mouse_X;
|
|||||||
word Input_new_mouse_Y;
|
word Input_new_mouse_Y;
|
||||||
byte Input_new_mouse_K;
|
byte Input_new_mouse_K;
|
||||||
|
|
||||||
|
byte Mouse_mode = 0; ///< Mouse mode = 0:normal, 1:emulated with custom sensitivity.
|
||||||
|
short Mouse_virtual_x_position;
|
||||||
|
short Mouse_virtual_y_position;
|
||||||
|
short Mouse_virtual_width;
|
||||||
|
short Mouse_virtual_height;
|
||||||
|
|
||||||
// TODO: move to config
|
// TODO: move to config
|
||||||
short Joybutton_shift=-1; // Button number that serves as a "shift" modifier
|
short Joybutton_shift=-1; // Button number that serves as a "shift" modifier
|
||||||
short Joybutton_control=-1; // Button number that serves as a "ctrl" modifier
|
short Joybutton_control=-1; // Button number that serves as a "ctrl" modifier
|
||||||
@ -135,13 +141,6 @@ int Move_cursor_with_constraints()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (bl)
|
|
||||||
{
|
|
||||||
SDL_WarpMouse(
|
|
||||||
Input_new_mouse_X*Pixel_width,
|
|
||||||
Input_new_mouse_Y*Pixel_height
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if ((Input_new_mouse_X != Mouse_X) ||
|
if ((Input_new_mouse_X != Mouse_X) ||
|
||||||
(Input_new_mouse_Y != Mouse_Y) ||
|
(Input_new_mouse_Y != Mouse_Y) ||
|
||||||
(Input_new_mouse_K != Mouse_K))
|
(Input_new_mouse_K != Mouse_K))
|
||||||
@ -149,8 +148,13 @@ int Move_cursor_with_constraints()
|
|||||||
if ((Input_new_mouse_K != Mouse_K))
|
if ((Input_new_mouse_K != Mouse_K))
|
||||||
feedback=1;
|
feedback=1;
|
||||||
Hide_cursor(); // On efface le curseur AVANT de le déplacer...
|
Hide_cursor(); // On efface le curseur AVANT de le déplacer...
|
||||||
|
if (Input_new_mouse_X != Mouse_X || Input_new_mouse_Y != Mouse_Y)
|
||||||
|
{
|
||||||
Mouse_X=Input_new_mouse_X;
|
Mouse_X=Input_new_mouse_X;
|
||||||
Mouse_Y=Input_new_mouse_Y;
|
Mouse_Y=Input_new_mouse_Y;
|
||||||
|
if (bl)
|
||||||
|
Set_mouse_position();
|
||||||
|
}
|
||||||
Mouse_K=Input_new_mouse_K;
|
Mouse_K=Input_new_mouse_K;
|
||||||
Compute_paintbrush_coordinates();
|
Compute_paintbrush_coordinates();
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
@ -180,8 +184,30 @@ void Handle_window_exit(__attribute__((unused)) SDL_QuitEvent event)
|
|||||||
|
|
||||||
int Handle_mouse_move(SDL_MouseMotionEvent event)
|
int Handle_mouse_move(SDL_MouseMotionEvent event)
|
||||||
{
|
{
|
||||||
|
if (Mouse_mode == 0)
|
||||||
|
{
|
||||||
Input_new_mouse_X = event.x/Pixel_width;
|
Input_new_mouse_X = event.x/Pixel_width;
|
||||||
Input_new_mouse_Y = event.y/Pixel_height;
|
Input_new_mouse_Y = event.y/Pixel_height;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Mouse_virtual_x_position += event.xrel * 12 / Config.Mouse_sensitivity_index_x;
|
||||||
|
// Clip
|
||||||
|
if (Mouse_virtual_x_position > Mouse_virtual_width)
|
||||||
|
Mouse_virtual_x_position = Mouse_virtual_width;
|
||||||
|
else if (Mouse_virtual_x_position < 0)
|
||||||
|
Mouse_virtual_x_position = 0;
|
||||||
|
|
||||||
|
Mouse_virtual_y_position += event.yrel * 12 / Config.Mouse_sensitivity_index_y;
|
||||||
|
// Clip
|
||||||
|
if (Mouse_virtual_y_position > Mouse_virtual_height)
|
||||||
|
Mouse_virtual_y_position = Mouse_virtual_height;
|
||||||
|
else if (Mouse_virtual_y_position < 0)
|
||||||
|
Mouse_virtual_y_position = 0;
|
||||||
|
|
||||||
|
Input_new_mouse_X = Mouse_virtual_x_position / 12 / Pixel_width;
|
||||||
|
Input_new_mouse_Y = Mouse_virtual_y_position / 12 / Pixel_height;
|
||||||
|
}
|
||||||
|
|
||||||
return Move_cursor_with_constraints();
|
return Move_cursor_with_constraints();
|
||||||
}
|
}
|
||||||
@ -715,3 +741,33 @@ int Get_input(void)
|
|||||||
|
|
||||||
return user_feedback_required;
|
return user_feedback_required;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Adjust_mouse_sensitivity(word fullscreen)
|
||||||
|
{
|
||||||
|
if (fullscreen == 0)
|
||||||
|
{
|
||||||
|
Mouse_mode = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Mouse_mode = 1;
|
||||||
|
Mouse_virtual_x_position = 12*Mouse_X*Pixel_width;
|
||||||
|
Mouse_virtual_y_position = 12*Mouse_Y*Pixel_height;
|
||||||
|
Mouse_virtual_width = 12*(Screen_width-1)*Pixel_width;
|
||||||
|
Mouse_virtual_height = 12*(Screen_height-1)*Pixel_height;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Set_mouse_position(void)
|
||||||
|
{
|
||||||
|
if (Mouse_mode == 0)
|
||||||
|
{
|
||||||
|
SDL_WarpMouse(
|
||||||
|
Mouse_X*Pixel_width,
|
||||||
|
Mouse_Y*Pixel_height
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Mouse_virtual_x_position = 12*Mouse_X*Pixel_width;
|
||||||
|
Mouse_virtual_y_position = 12*Mouse_Y*Pixel_height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
5
input.h
5
input.h
@ -35,3 +35,8 @@ int Get_input(void);
|
|||||||
|
|
||||||
/// Returns true if the keycode has been set as a keyboard shortcut for the function.
|
/// Returns true if the keycode has been set as a keyboard shortcut for the function.
|
||||||
int Is_shortcut(word Key, word function);
|
int Is_shortcut(word Key, word function);
|
||||||
|
|
||||||
|
/// Adjust mouse sensitivity (and actual mouse input mode)
|
||||||
|
void Adjust_mouse_sensitivity(word fullscreen);
|
||||||
|
|
||||||
|
void Set_mouse_position(void);
|
||||||
|
|||||||
13
misc.c
13
misc.c
@ -157,11 +157,6 @@ void Hide_current_image(byte color)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mouse_sensitivity(__attribute__((unused)) word x,__attribute__((unused)) word y)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Init_chrono(dword delay)
|
void Init_chrono(dword delay)
|
||||||
// Démarrer le chrono
|
// Démarrer le chrono
|
||||||
{
|
{
|
||||||
@ -343,14 +338,6 @@ byte Effect_sieve(word x,word y)
|
|||||||
return Sieve[x % Sieve_width][y % Sieve_height];
|
return Sieve[x % Sieve_width][y % Sieve_height];
|
||||||
}
|
}
|
||||||
|
|
||||||
void Set_mouse_position(void)
|
|
||||||
{
|
|
||||||
SDL_WarpMouse(
|
|
||||||
Mouse_X*Pixel_width,
|
|
||||||
Mouse_Y*Pixel_height
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Replace_colors_within_limits(byte * replace_table)
|
void Replace_colors_within_limits(byte * replace_table)
|
||||||
{
|
{
|
||||||
int line;
|
int line;
|
||||||
|
|||||||
2
misc.h
2
misc.h
@ -24,9 +24,7 @@
|
|||||||
void Copy_image_to_brush(short start_x,short start_y,short Brush_width,short Brush_height,word image_width);
|
void Copy_image_to_brush(short start_x,short start_y,short Brush_width,short Brush_height,word image_width);
|
||||||
void Remap_general_lowlevel(byte * conversion_table,byte * buffer,short width,short height,short buffer_width);
|
void Remap_general_lowlevel(byte * conversion_table,byte * buffer,short width,short height,short buffer_width);
|
||||||
void Scroll_picture(short x_offset,short y_offset);
|
void Scroll_picture(short x_offset,short y_offset);
|
||||||
void Set_mouse_position(void);
|
|
||||||
void Wait_end_of_click(void);
|
void Wait_end_of_click(void);
|
||||||
void Mouse_sensitivity(word x,word y);
|
|
||||||
void Set_color(byte color, byte red, byte green, byte blue);
|
void Set_color(byte color, byte red, byte green, byte blue);
|
||||||
void Set_palette(T_Palette palette);
|
void Set_palette(T_Palette palette);
|
||||||
void Palette_256_to_64(T_Palette palette);
|
void Palette_256_to_64(T_Palette palette);
|
||||||
|
|||||||
10
readini.c
10
readini.c
@ -453,14 +453,16 @@ int Load_INI(T_Config * conf)
|
|||||||
|
|
||||||
if ((return_code=Load_INI_get_values (file,buffer,"X_sensitivity",1,values)))
|
if ((return_code=Load_INI_get_values (file,buffer,"X_sensitivity",1,values)))
|
||||||
goto Erreur_Retour;
|
goto Erreur_Retour;
|
||||||
if ((values[0]<1) || (values[0]>255))
|
if ((values[0]<1) || (values[0]>4))
|
||||||
goto Erreur_ERREUR_INI_CORROMPU;
|
conf->Mouse_sensitivity_index_x=1;
|
||||||
|
else
|
||||||
conf->Mouse_sensitivity_index_x=values[0];
|
conf->Mouse_sensitivity_index_x=values[0];
|
||||||
|
|
||||||
if ((return_code=Load_INI_get_values (file,buffer,"Y_sensitivity",1,values)))
|
if ((return_code=Load_INI_get_values (file,buffer,"Y_sensitivity",1,values)))
|
||||||
goto Erreur_Retour;
|
goto Erreur_Retour;
|
||||||
if ((values[0]<1) || (values[0]>255))
|
if ((values[0]<1) || (values[0]>4))
|
||||||
goto Erreur_ERREUR_INI_CORROMPU;
|
conf->Mouse_sensitivity_index_y=1;
|
||||||
|
else
|
||||||
conf->Mouse_sensitivity_index_y=values[0];
|
conf->Mouse_sensitivity_index_y=values[0];
|
||||||
|
|
||||||
if ((return_code=Load_INI_get_values (file,buffer,"X_correction_factor",1,values)))
|
if ((return_code=Load_INI_get_values (file,buffer,"X_correction_factor",1,values)))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user