mirror of
git://projects.qi-hardware.com/openwrt-packages.git
synced 2024-11-22 22:49:41 +02:00
ase: fix handling detection of number keys for zoom, ignore 'Fn' (LCONTROL)
This commit is contained in:
parent
0244a530f5
commit
33eec1c9f0
81
ase/patches/060-fix-zoom-keys.patch
Normal file
81
ase/patches/060-fix-zoom-keys.patch
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
Index: ase-0.8.2/src/widgets/editor/keys.cpp
|
||||||
|
===================================================================
|
||||||
|
--- ase-0.8.2.orig/src/widgets/editor/keys.cpp 2011-06-16 21:04:19.000000000 +0200
|
||||||
|
+++ ase-0.8.2/src/widgets/editor/keys.cpp 2011-06-16 22:05:01.000000000 +0200
|
||||||
|
@@ -16,6 +16,11 @@
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
+#define DEBUGMODE
|
||||||
|
+#define PREFIX_I "keys INFO: "
|
||||||
|
+#define PREFIX_W "keys WARNING: "
|
||||||
|
+#define PREFIX_E "keys ERROR: "
|
||||||
|
+
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <allegro/keyboard.h>
|
||||||
|
@@ -36,8 +41,11 @@
|
||||||
|
#include "widgets/colbar.h"
|
||||||
|
#include "widgets/editor.h"
|
||||||
|
|
||||||
|
-bool Editor::editor_keys_toset_zoom(int scancode)
|
||||||
|
+bool Editor::editor_keys_toset_zoom(int scancode, int ascii)
|
||||||
|
{
|
||||||
|
+ TRACE(PREFIX_I "editor_keys_toset_zoom %i, '%c'; %i, %i; %i.\n", scancode, ascii,
|
||||||
|
+ (int)!!m_sprite, (int)this->hasMouse(), (int)key_shifts);
|
||||||
|
+
|
||||||
|
if ((m_sprite) &&
|
||||||
|
(this->hasMouse()) &&
|
||||||
|
!(key_shifts & (KB_SHIFT_FLAG | KB_CTRL_FLAG | KB_ALT_FLAG))) {
|
||||||
|
@@ -49,17 +57,18 @@
|
||||||
|
y = 0;
|
||||||
|
zoom = -1;
|
||||||
|
|
||||||
|
- switch (scancode) { // TODO make these keys configurable
|
||||||
|
- case KEY_1: zoom = 0; break;
|
||||||
|
- case KEY_2: zoom = 1; break;
|
||||||
|
- case KEY_3: zoom = 2; break;
|
||||||
|
- case KEY_4: zoom = 3; break;
|
||||||
|
- case KEY_5: zoom = 4; break;
|
||||||
|
- case KEY_6: zoom = 5; break;
|
||||||
|
+ switch (ascii) { // TODO make these keys configurable
|
||||||
|
+ case '1': zoom = 0; break;
|
||||||
|
+ case '2': zoom = 1; break;
|
||||||
|
+ case '3': zoom = 2; break;
|
||||||
|
+ case '4': zoom = 3; break;
|
||||||
|
+ case '5': zoom = 4; break;
|
||||||
|
+ case '6': zoom = 5; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Change zoom
|
||||||
|
if (zoom >= 0) {
|
||||||
|
+ TRACE(PREFIX_I "setting zoom to %i.\n", zoom);
|
||||||
|
editor_set_zoom_and_center_in_mouse(zoom, jmouse_x(0), jmouse_y(0));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
Index: ase-0.8.2/src/widgets/editor.h
|
||||||
|
===================================================================
|
||||||
|
--- ase-0.8.2.orig/src/widgets/editor.h 2011-06-16 22:06:26.000000000 +0200
|
||||||
|
+++ ase-0.8.2/src/widgets/editor.h 2011-06-16 22:06:30.000000000 +0200
|
||||||
|
@@ -180,7 +180,7 @@
|
||||||
|
|
||||||
|
// keys.c
|
||||||
|
|
||||||
|
- bool editor_keys_toset_zoom(int scancode);
|
||||||
|
+ bool editor_keys_toset_zoom(int scancode, int ascii);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Index: ase-0.8.2/src/widgets/editor/editor.cpp
|
||||||
|
===================================================================
|
||||||
|
--- ase-0.8.2.orig/src/widgets/editor/editor.cpp 2011-06-16 22:03:22.000000000 +0200
|
||||||
|
+++ ase-0.8.2/src/widgets/editor/editor.cpp 2011-06-16 22:07:35.000000000 +0200
|
||||||
|
@@ -1318,7 +1318,7 @@
|
||||||
|
case JM_KEYPRESSED:
|
||||||
|
if (m_state == EDITOR_STATE_STANDBY ||
|
||||||
|
m_state == EDITOR_STATE_DRAWING) {
|
||||||
|
- if (editor_keys_toset_zoom(msg->key.scancode))
|
||||||
|
+ if (editor_keys_toset_zoom(msg->key.scancode, msg->key.ascii))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
24
ase/patches/070-ignore-nanonote-fn-key.patch
Normal file
24
ase/patches/070-ignore-nanonote-fn-key.patch
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
Index: ase-0.8.2/src/widgets/editor/editor.cpp
|
||||||
|
===================================================================
|
||||||
|
--- ase-0.8.2.orig/src/widgets/editor/editor.cpp 2011-06-16 21:41:31.000000000 +0200
|
||||||
|
+++ ase-0.8.2/src/widgets/editor/editor.cpp 2011-06-16 21:42:02.000000000 +0200
|
||||||
|
@@ -1331,7 +1331,8 @@
|
||||||
|
editor_setcursor(jmouse_x(0), jmouse_y(0));
|
||||||
|
return true;
|
||||||
|
|
||||||
|
- case KEY_LCONTROL:
|
||||||
|
+ /* on nanonote, lcontrol is the 'Fn' key used to type in numbers */
|
||||||
|
+ // case KEY_LCONTROL:
|
||||||
|
case KEY_RCONTROL:
|
||||||
|
// If the user press the CTRL key when he is dragging pixels (but not pressing the mouse buttons)...
|
||||||
|
if (!m_ctrl_pressed && !jmouse_b(0) && m_pixelsMovement) {
|
||||||
|
@@ -1367,7 +1368,8 @@
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
- case KEY_LCONTROL:
|
||||||
|
+ /* on nanonote, lcontrol is the 'Fn' key used to type in numbers */
|
||||||
|
+ // case KEY_LCONTROL:
|
||||||
|
case KEY_RCONTROL:
|
||||||
|
if (m_ctrl_pressed) {
|
||||||
|
m_ctrl_pressed = false;
|
Loading…
Reference in New Issue
Block a user