GrafX2 2.9.3227
The ultimate 256-color painting program
input.h File Reference

Functions for mouse, keyboard and joystick input. More...

#include "keycodes.h"
+ Include dependency graph for input.h:
+ This graph shows which files directly or indirectly include this file:

Macros

#define SHORTCUT_COPY   (KEY_c|GFX2_MOD_ALT)
 
#define SHORTCUT_PASTE   (KEY_v|GFX2_MOD_ALT)
 

Functions

int Get_input (int sleep_time)
 This is the keyboard/mouse/joystick input polling function. More...
 
int Is_shortcut (word key, word function)
 Returns true if the keycode has been set as a keyboard shortcut for the function. More...
 
int Has_shortcut (word function)
 Returns true if the function has any shortcut key. More...
 
void Adjust_mouse_sensitivity (word fullscreen)
 Adjust mouse sensitivity (and actual mouse input mode) More...
 
int Move_cursor_with_constraints (int x, int y)
 Called each time there is a cursor move, either triggered by mouse or keyboard shortcuts. More...
 
int Handle_mouse_btn_change (void)
 

Variables

int Input_sticky_control
 This holds the ID of the GUI control that the mouse is manipulating. More...
 
byte Pan_shortcut_pressed
 State of the shortcut for panning (SPECIAL_HOLD_PAN) : pressed or not. More...
 
int Snap_axis
 Allows locking movement to X or Y axis: 0=normal, 1=lock on next move, 2=locked horizontally, 3=locked vertically. More...
 
int Snap_axis_origin_X
 For the :Snap_axis mode, sets the origin's point (in image coordinates) More...
 
int Snap_axis_origin_Y
 For the :Snap_axis mode, sets the origin's point (in image coordinates) More...
 
char * Drop_file_name
 This malloced string is set when a drag-and-drop event brings a file to Grafx2's window. More...
 
wordDrop_file_name_unicode
 

Detailed Description

Functions for mouse, keyboard and joystick input.

Joystick input is used to emulate mouse on platforms that don't have a pointing device, ie: the GP2X.

Macro Definition Documentation

◆ SHORTCUT_COPY

#define SHORTCUT_COPY   (KEY_c|GFX2_MOD_ALT)

◆ SHORTCUT_PASTE

#define SHORTCUT_PASTE   (KEY_v|GFX2_MOD_ALT)

Function Documentation

◆ Get_input()

int Get_input ( int  sleep_time)

This is the keyboard/mouse/joystick input polling function.

Returns 1 if a significant changed occurred, such as a mouse button pressed or depressed, or a new keypress was in the keyboard buffer. The latest input variables are held in Key, Key_ANSI, Key_UNICODE, Mouse_X, Mouse_Y, Mouse_K. Note that Key, Key_ANSI and Key_UNICODE are not persistent, they will be reset to 0 on subsequent calls to Get_input().

References Button_inverter, Color_cycling(), Compute_paintbrush_coordinates(), Config, Display_cursor(), Drop_file_name, Flush_update(), format, Get_Key_modifiers(), GFX2_DEBUG, GFX2_ERROR, GFX2_INFO, GFX2_Log(), GFX2_WARNING, GFX2_WINDOW_MAXIMIZED, GFX2_WINDOW_MINIMIZED, GFX2_WINDOW_STANDARD, Handle_mouse_btn_change(), Handle_special_key_press(), Input_new_mouse_K, Input_new_mouse_X, Input_new_mouse_Y, Key, Key_ANSI, KEY_MOUSEMIDDLE, KEY_MOUSEWHEELDOWN, KEY_MOUSEWHEELUP, Key_UNICODE, Mouse_Emulation(), Mouse_K, T_Config::Mouse_motion_debounce, Mouse_moved, Mouse_X, Mouse_Y, Move_cursor_with_constraints(), NULL, Pixel_height, Pixel_width, Quit_is_required, Release_control(), render_scale_x, render_scale_y, Resize_height, Resize_width, Update_rect(), user_feedback_required, T_Config::Window_pos_x, T_Config::Window_pos_y, Window_state, X11_display, and X11_window.

Referenced by Button_Anim_continuous_next(), Button_Anim_continuous_prev(), Button_Message_initial(), Button_Select_backcolor(), Button_Select_forecolor(), Curve_3_points_0_5(), Delay_with_active_mouse(), Dropdown_activate(), Get_color_behind_window(), GFX2_GetTextClipboard(), Load_ClipBoard_Image(), Main_handler(), Move_separator(), Move_window(), Readline_ex_unicode(), Redefine_control(), Tilemap_update(), Wait_click_in_palette(), Wait_click_in_shade_table(), Wait_end_of_click(), Window_clicked_button(), and Window_normal_button_onclick().

◆ Is_shortcut()

◆ Has_shortcut()

int Has_shortcut ( word  function)

Returns true if the function has any shortcut key.

References Buttons_Pool, Config_Key, and KEY_NONE.

◆ Adjust_mouse_sensitivity()

void Adjust_mouse_sensitivity ( word  fullscreen)

Adjust mouse sensitivity (and actual mouse input mode)

Referenced by Init_mode_video().

◆ Move_cursor_with_constraints()

int Move_cursor_with_constraints ( int  x,
int  y 
)

Called each time there is a cursor move, either triggered by mouse or keyboard shortcuts.

Parameters
xnew cursor X coordinate
ynew cursor Y coordinate
Returns
feedback

References Config, Current_operation, Hide_cursor, Input_new_mouse_X, Input_new_mouse_Y, T_Document::magnifier_mode, Main, Menu_Y, Mouse_K_unique, T_Config::Mouse_merge_movement, Mouse_moved, Mouse_X, Mouse_Y, Operation, Operation_in_magnifier, Operation_stack_size, Screen_height, Screen_width, T_Document::separator_position, Set_mouse_position(), and T_Document::X_zoom.

Referenced by Cursor_displace(), Get_input(), and Win32_WindowProc().

◆ Handle_mouse_btn_change()

Variable Documentation

◆ Input_sticky_control

int Input_sticky_control
extern

This holds the ID of the GUI control that the mouse is manipulating.

The input system will reset it to zero when mouse button is released, but it's the engine that will record and retrieve a real control ID.

Referenced by Button_Effects(), Button_Gradients(), Button_Palette(), Handle_mouse_btn_change(), Readline_ex_unicode(), Window_clicked_button(), and Window_get_clicked_button().

◆ Pan_shortcut_pressed

byte Pan_shortcut_pressed
extern

State of the shortcut for panning (SPECIAL_HOLD_PAN) : pressed or not.

Referenced by Handle_special_key_press(), Main_handler(), Pan_view_0_0(), Pan_view_0_2(), and Release_control().

◆ Snap_axis

int Snap_axis
extern

Allows locking movement to X or Y axis: 0=normal, 1=lock on next move, 2=locked horizontally, 3=locked vertically.

Referenced by Compute_paintbrush_coordinates(), and Release_control().

◆ Snap_axis_origin_X

int Snap_axis_origin_X
extern

For the :Snap_axis mode, sets the origin's point (in image coordinates)

Referenced by Compute_paintbrush_coordinates().

◆ Snap_axis_origin_Y

int Snap_axis_origin_Y
extern

For the :Snap_axis mode, sets the origin's point (in image coordinates)

Referenced by Compute_paintbrush_coordinates().

◆ Drop_file_name

char* Drop_file_name
extern

This malloced string is set when a drag-and-drop event brings a file to Grafx2's window.

Referenced by Get_input(), Main_handler(), and Win32_WindowProc().

◆ Drop_file_name_unicode

word* Drop_file_name_unicode
extern

Referenced by Main_handler(), and Win32_WindowProc().