OSX only: the Apple key now is a normal modifier in code, so can be
authorTon Roosendaal <ton@blender.org>
Sat, 18 Sep 2004 13:25:29 +0000 (13:25 +0000)
committerTon Roosendaal <ton@blender.org>
Sat, 18 Sep 2004 13:25:29 +0000 (13:25 +0000)
detected as others, LR_COMMANDKEY

Unline previous commit, Apple key doesnt map to control anymore, but is
handled separate where needed. Now only for undo (Apple-Z)

source/blender/blenkernel/BKE_global.h
source/blender/include/mydevice.h
source/blender/src/editscreen.c
source/blender/src/ghostwinlay.c
source/blender/src/toets.c

index 205c417d79c0ad6b801be6e2665b5e60f0ecb0ae..d54b6232c6abefc33f11b6aba0bd3dcc38e8d927 100644 (file)
@@ -233,15 +233,16 @@ typedef struct Global {
 #define G_FLAGS_AUTOPLAY               (1 << G_FLAGS_AUTOPLAY_BIT)
 
 /* G.qual */
-#define R_SHIFTKEY     1
-#define L_SHIFTKEY     2
-#define LR_SHIFTKEY 3
-#define R_ALTKEY       4
-#define L_ALTKEY       8
-#define LR_ALTKEY      12
-#define R_CTRLKEY      16
-#define L_CTRLKEY      32
-#define LR_CTRLKEY  48
+#define R_SHIFTKEY             1
+#define L_SHIFTKEY             2
+#define LR_SHIFTKEY    3
+#define R_ALTKEY               4
+#define L_ALTKEY               8
+#define LR_ALTKEY              12
+#define R_CTRLKEY              16
+#define L_CTRLKEY              32
+#define LR_CTRLKEY     48
+#define LR_COMMANDKEY  64
 
 /* G.order: indicates what endianness the platform where the file was
  * written had. */
index ceca8ce267378c96c8ad9b8a4bfcea85adf951c0..e4ede3a7578fdfbf443aa9ec4cca04b85d1eefb6 100644 (file)
 #define        ENDKEY          170
 
 #define UNKNOWNKEY     171
+#define COMMANDKEY     172
 
 /* **************** BLENDER QUEUE EVENTS ********************* */
 
index a71a20f68f01ca6887fac683d2927bb84e1bcd80..d768903da1c32882eec4d4779654ce30afd90616 100644 (file)
@@ -832,6 +832,10 @@ unsigned short screen_qread(short *val, char *ascii)
                if(*val) G.qual |= LR_CTRLKEY;
                else G.qual &= ~LR_CTRLKEY;
        }
+       else if(event==COMMANDKEY) {            // OSX
+               if(*val) G.qual |= LR_COMMANDKEY;
+               else G.qual &= ~LR_COMMANDKEY;
+       }
 
        return event;
 }
index 9957d331aad85ed5e77a142f43772ddefdb975b7..762769e91ed2dd782731248a89b72e5d7a23bf91 100644 (file)
@@ -83,7 +83,7 @@ struct _Window {
        
                /* Last known mouse/button/qualifier state */
        int             lmouse[2];
-       int             lqual;          /* (LR_SHFTKEY, LR_CTRLKEY, LR_ALTKEY) */
+       int             lqual;          /* (LR_SHFTKEY, LR_CTRLKEY, LR_ALTKEY, LR_COMMANDKEY) */
        int             lmbut;          /* (L_MOUSE, M_MOUSE, R_MOUSE) */
        int             commandqual;
 
@@ -238,7 +238,7 @@ static int convert_key(GHOST_TKey key) {
                case GHOST_kKeyRightShift:              return RIGHTSHIFTKEY;
                case GHOST_kKeyLeftControl:             return LEFTCTRLKEY;
                case GHOST_kKeyRightControl:    return RIGHTCTRLKEY;
-               case GHOST_kKeyCommand:                 return LEFTCTRLKEY;
+               case GHOST_kKeyCommand:                 return COMMANDKEY;
                case GHOST_kKeyLeftAlt:                 return LEFTALTKEY;
                case GHOST_kKeyRightAlt:                return RIGHTALTKEY;
 
@@ -560,6 +560,8 @@ static int event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
                                        win->lqual= change_bit(win->lqual, LR_CTRLKEY, val);
                                } else if (bkey==LEFTALTKEY || bkey==RIGHTALTKEY) {
                                        win->lqual= change_bit(win->lqual, LR_ALTKEY, val);
+                               } else if (bkey==COMMANDKEY) {
+                                       win->lqual= change_bit(win->lqual, LR_COMMANDKEY, val);
                                }
 
                                window_handle_ext(win, bkey, val, kd->ascii);
@@ -596,6 +598,11 @@ static int event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
                                        win->lqual= change_bit(win->lqual, LR_ALTKEY, 0);
                                        window_handle(win, LEFTALTKEY, 0);
                                }
+                               if ((win->lqual & LR_COMMANDKEY) && !query_qual('C')) {
+                                       win->lqual= change_bit(win->lqual, LR_COMMANDKEY, 0);
+                                       window_handle(win, LR_COMMANDKEY, 0);
+                               }
+                               /* probably redundant now (ton) */
                                win->commandqual= query_qual('C');
 
                                /* 
index 14273892946bcf6f0ce3e7586466c817bb821d29..dde0fc834a173f44edef08381d17efbe66c3e7ae 100644 (file)
@@ -968,8 +968,8 @@ int blenderqread(unsigned short event, short val)
                }
                break;
        case ZKEY:      // undo
-               if(G.qual & LR_CTRLKEY) { // all combos with ctrl/cammandkey are accepted
-                       if(G.qual==LR_CTRLKEY) BIF_undo();
+               if(G.qual & (LR_CTRLKEY|LR_COMMANDKEY)) { // all combos with ctrl/cammandkey are accepted
+                       if ELEM(G.qual, LR_CTRLKEY, LR_COMMANDKEY) BIF_undo();
                        else BIF_redo(); // all combos with ctrl is redo
                        return 0;
                }