logo

qmk_firmware

custom branch of QMK firmware git clone https://anongit.hacktivis.me/git/qmk_firmware.git

dilemma.h (3618B)


  1. /**
  2. * Copyright 2022 Charly Delay <charly@codesink.dev> (@0xcharly)
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #pragma once
  18. #include "quantum.h"
  19. #ifdef POINTING_DEVICE_ENABLE
  20. # ifndef NO_DILEMMA_KEYCODES
  21. enum dilemma_keycodes {
  22. POINTER_DEFAULT_DPI_FORWARD = QK_KB_0,
  23. POINTER_DEFAULT_DPI_REVERSE,
  24. POINTER_SNIPING_DPI_FORWARD,
  25. POINTER_SNIPING_DPI_REVERSE,
  26. SNIPING_MODE,
  27. SNIPING_MODE_TOGGLE,
  28. DRAGSCROLL_MODE,
  29. DRAGSCROLL_MODE_TOGGLE,
  30. };
  31. # define DPI_MOD POINTER_DEFAULT_DPI_FORWARD
  32. # define DPI_RMOD POINTER_DEFAULT_DPI_REVERSE
  33. # define S_D_MOD POINTER_SNIPING_DPI_FORWARD
  34. # define S_D_RMOD POINTER_SNIPING_DPI_REVERSE
  35. # define SNIPING SNIPING_MODE
  36. # define SNP_TOG SNIPING_MODE_TOGGLE
  37. # define DRGSCRL DRAGSCROLL_MODE
  38. # define DRG_TOG DRAGSCROLL_MODE_TOGGLE
  39. # endif // !NO_DILEMMA_KEYCODES
  40. /** \brief Return the current DPI value for the pointer's default mode. */
  41. uint16_t dilemma_get_pointer_default_dpi(void);
  42. /**
  43. * \brief Update the pointer's default DPI to the next or previous step.
  44. *
  45. * Increases the DPI value if `forward` is `true`, decreases it otherwise.
  46. * The increment/decrement steps are equal to DILEMMA_DEFAULT_DPI_CONFIG_STEP.
  47. *
  48. * The new value is persisted in EEPROM.
  49. */
  50. void dilemma_cycle_pointer_default_dpi(bool forward);
  51. /**
  52. * \brief Same as `dilemma_cycle_pointer_default_dpi`, but do not write to
  53. * EEPROM.
  54. *
  55. * This means that reseting the board will revert the value to the last
  56. * persisted one.
  57. */
  58. void dilemma_cycle_pointer_default_dpi_noeeprom(bool forward);
  59. /** \brief Return the current DPI value for the pointer's sniper-mode. */
  60. uint16_t dilemma_get_pointer_sniping_dpi(void);
  61. /**
  62. * \brief Update the pointer's sniper-mode DPI to the next or previous step.
  63. *
  64. * Increases the DPI value if `forward` is `true`, decreases it otherwise.
  65. * The increment/decrement steps are equal to DILEMMA_SNIPING_DPI_CONFIG_STEP.
  66. *
  67. * The new value is persisted in EEPROM.
  68. */
  69. void dilemma_cycle_pointer_sniping_dpi(bool forward);
  70. /**
  71. * \brief Same as `dilemma_cycle_pointer_sniping_dpi`, but do not write to
  72. * EEPROM.
  73. *
  74. * This means that reseting the board will revert the value to the last
  75. * persisted one.
  76. */
  77. void dilemma_cycle_pointer_sniping_dpi_noeeprom(bool forward);
  78. /** \brief Whether sniper-mode is enabled. */
  79. bool dilemma_get_pointer_sniping_enabled(void);
  80. /**
  81. * \brief Enable/disable sniper mode.
  82. *
  83. * When sniper mode is enabled the dpi is reduced to slow down the pointer for
  84. * more accurate movements.
  85. */
  86. void dilemma_set_pointer_sniping_enabled(bool enable);
  87. /** \brief Whether drag-scroll is enabled. */
  88. bool dilemma_get_pointer_dragscroll_enabled(void);
  89. /**
  90. * \brief Enable/disable drag-scroll mode.
  91. *
  92. * When drag-scroll mode is enabled, horizontal and vertical pointer movements
  93. * are translated into horizontal and vertical scroll movements.
  94. */
  95. void dilemma_set_pointer_dragscroll_enabled(bool enable);
  96. #endif // POINTING_DEVICE_ENABLE