Make sure separation between modifier keys is communicated from GHOST upwards too...
authorNathan Letwory <nathan@letworyinteractive.com>
Sun, 24 Oct 2010 12:45:47 +0000 (12:45 +0000)
committerNathan Letwory <nathan@letworyinteractive.com>
Sun, 24 Oct 2010 12:45:47 +0000 (12:45 +0000)
intern/ghost/intern/GHOST_SystemWin32.cpp
intern/ghost/intern/GHOST_SystemWin32.h
source/blender/blenkernel/intern/curve.c
source/blender/blenkernel/intern/customdata.c
source/blender/blenkernel/intern/effect.c
source/blender/editors/space_view3d/drawobject.c
source/blender/modifiers/intern/MOD_screw.c

index fb419aef5268f57d928d29469b3a9c897186e6d4..42bb240389570e0e331aa76c5c242d41cf2a24f2 100644 (file)
@@ -289,16 +289,19 @@ GHOST_TSuccess GHOST_SystemWin32::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32
 
 GHOST_TSuccess GHOST_SystemWin32::getModifierKeys(GHOST_ModifierKeys& keys) const
 {
-       bool down = HIBYTE(::GetKeyState(VK_SHIFT)) != 0;
+       bool down = HIBYTE(::GetKeyState(VK_LSHIFT)) != 0;
        keys.set(GHOST_kModifierKeyLeftShift, down);
+       down = HIBYTE(::GetKeyState(VK_RSHIFT)) != 0;
        keys.set(GHOST_kModifierKeyRightShift, down);
        
-       down = HIBYTE(::GetKeyState(VK_MENU)) != 0;
+       down = HIBYTE(::GetKeyState(VK_LMENU)) != 0;
        keys.set(GHOST_kModifierKeyLeftAlt, down);
+       down = HIBYTE(::GetKeyState(VK_RMENU)) != 0;
        keys.set(GHOST_kModifierKeyRightAlt, down);
        
-       down = HIBYTE(::GetKeyState(VK_CONTROL)) != 0;
+       down = HIBYTE(::GetKeyState(VK_LCONTROL)) != 0;
        keys.set(GHOST_kModifierKeyLeftControl, down);
+       down = HIBYTE(::GetKeyState(VK_RCONTROL)) != 0;
        keys.set(GHOST_kModifierKeyRightControl, down);
        
        bool lwindown = HIBYTE(::GetKeyState(VK_LWIN)) != 0;
@@ -407,6 +410,7 @@ GHOST_TKey GHOST_SystemWin32::convertKey(GHOST_IWindow *window, WPARAM wParam, L
        system->retrieveModifierKeys(oldModifiers);
        system->getModifierKeys(newModifiers);
        
+       //std::cout << wParam << " " << system->m_curKeyStatus[wParam] << " shift pressed: " << system->shiftPressed() << std::endl;
 
        if ((wParam >= '0') && (wParam <= '9')) {
                // VK_0 thru VK_9 are the same as ASCII '0' thru '9' (0x30 - 0x39)
@@ -432,7 +436,14 @@ GHOST_TKey GHOST_SystemWin32::convertKey(GHOST_IWindow *window, WPARAM wParam, L
                case VK_PRIOR:    key = GHOST_kKeyUpPage;                       break;
                case VK_NEXT:     key = GHOST_kKeyDownPage;                     break;
                case VK_END:      key = GHOST_kKeyEnd;                          break;
-               case VK_HOME:     key = GHOST_kKeyHome;                         break;
+               case VK_HOME:
+                       {
+                               if(system->m_curKeyStatus[VK_NUMPAD7] && system->shiftPressed())
+                                       key = GHOST_kKeyNumpad7;
+                               else
+                                       key = GHOST_kKeyHome;
+                       }
+                       break;
                case VK_INSERT:   key = GHOST_kKeyInsert;                       break;
                case VK_DELETE:   key = GHOST_kKeyDelete;                       break;
                case VK_LEFT:     key = GHOST_kKeyLeftArrow;            break;
@@ -672,23 +683,38 @@ void GHOST_SystemWin32::processMinMaxInfo(MINMAXINFO * minmax)
 LRESULT CALLBACK GHOST_SystemWin32::s_llKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
 {
        GHOST_SystemWin32* system = ((GHOST_SystemWin32*)getSystem());
+       
+       bool down = false;
+       if(wParam==WM_KEYDOWN || wParam==WM_SYSKEYDOWN ){
+               down = true;
+       }
+       
+       if(nCode!=HC_ACTION)
+               return CallNextHookEx(system->m_llKeyboardHook, nCode, wParam, lParam);
+               
        KBDLLHOOKSTRUCT &keyb = *(PKBDLLHOOKSTRUCT)(lParam);
        system->m_prevKeyStatus[keyb.vkCode] = system->m_curKeyStatus[keyb.vkCode];
+       //std::cout << "ll: " << keyb.vkCode << " " << down << " ";
        if(keyb.flags) {
                if((keyb.flags & LLKHF_EXTENDED) == LLKHF_EXTENDED) {
+                       //std::cout << "extended ";
                }
                if((keyb.flags & LLKHF_ALTDOWN) == LLKHF_ALTDOWN) {
                }
+               if((keyb.flags & LLKHF_INJECTED)== LLKHF_INJECTED) {
+                       //std::cout << "injected ";
+               }
                if((keyb.flags & LLKHF_UP) == LLKHF_UP) {
                        system->m_curKeyStatus[keyb.vkCode] = false;
+                       //std::cout << "up" << std::endl;
                } else {
                        system->m_curKeyStatus[keyb.vkCode] = true;
-               }
-               if((keyb.flags & LLKHF_INJECTED)== LLKHF_INJECTED) {
+                       //std::cout << "down" << std::endl;
                }
        }
        else {
                system->m_curKeyStatus[keyb.vkCode] = true;
+               //std::cout << "down" << std::endl;
        }
        
        return CallNextHookEx(system->m_llKeyboardHook, nCode, wParam, lParam);
index ab2f34cc27a7a3b25658d77e83c8b7f892bdb41e..88705fe2ce441d3f7a8af826740d032ffecfbc0e 100644 (file)
@@ -248,7 +248,7 @@ protected:
         * events generated for both keys.
         * @param window        The window receiving the event (the active window).
         */
-       GHOST_EventKey* processModifierKeys(GHOST_IWindow *window);
+       //GHOST_EventKey* processModifierKeys(GHOST_IWindow *window);
 
        /**
         * Creates mouse button event.
@@ -314,7 +314,7 @@ protected:
        /**
         * Check current key layout for AltGr
         */
-       inline virtual void keyboardAltGr();
+       inline virtual void keyboardAltGr(void);
 
        /**
         * Windows call back routine for our window class.
@@ -325,6 +325,11 @@ protected:
         * Low-level inspection of keyboard events
         */
        static LRESULT CALLBACK s_llKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam);
+       
+       /**
+        * Check if any shiftkey is pressed
+        */
+       inline virtual bool shiftPressed(void);
 
        /** The current state of the modifier keys. */
        GHOST_ModifierKeys m_modifierKeys;
@@ -352,7 +357,7 @@ inline void GHOST_SystemWin32::storeModifierKeys(const GHOST_ModifierKeys& keys)
        m_modifierKeys = keys;
 }
 
-inline void GHOST_SystemWin32::keyboardAltGr()
+inline void GHOST_SystemWin32::keyboardAltGr(void)
 {
        HKL keylayout = GetKeyboardLayout(0); // get keylayout for current thread
        int i;
@@ -369,5 +374,10 @@ inline void GHOST_SystemWin32::keyboardAltGr()
        }
 }
 
+inline bool GHOST_SystemWin32::shiftPressed(void)
+{
+       return (m_curKeyStatus[VK_SHIFT] || m_curKeyStatus[VK_RSHIFT] || m_curKeyStatus[VK_LSHIFT]);
+}
+
 #endif // _GHOST_SYSTEM_WIN32_H_
 
index 06ba066efddd9228fc94bdbe6f2b9e91120a437c..a7dd80bff4d10701402fa5e619e2e4f96a2b1bce 100644 (file)
@@ -1939,10 +1939,11 @@ static void make_bevel_list_3D_tangent(BevList *bl)
 
                /* make perpendicular, modify tan in place, is ok */
                float cross_tmp[3];
+               float zero[3] = {0,0,0};
 
                cross_v3_v3v3(cross_tmp, bevp1->tan, bevp1->dir);
                normalize_v3(cross_tmp);
-               tri_to_quat( bevp1->quat, (float [3]){0,0,0}, cross_tmp, bevp1->tan); /* XXX - could be faster */
+               tri_to_quat( bevp1->quat,zero, cross_tmp, bevp1->tan); /* XXX - could be faster */
 
                bevp0= bevp1;
                bevp1= bevp2;
index 3eec761169729c1a27e36120a62ab73c859710fe..9c4f0d790cab0c04c11f44eda066c4a49f59c161 100644 (file)
@@ -502,7 +502,8 @@ static void layerInterp_mdisps(void **UNUSED(sources), float *UNUSED(weights),
 
        /* Initialize the destination */
        for(i = 0; i < d->totdisp; ++i) {
-               zero_v3(d->disps[i]);
+               float z[3] = {0,0,0};
+               copy_v3_v3(d->disps[i], z);
        }
 
        /* For now, some restrictions on the input */
index 47606c399376a9b910cfd44b41e573759e99a949..70e814ef9560ca0ea9703367825ee91ee47ac357 100644 (file)
@@ -1007,7 +1007,8 @@ void pdDoEffectors(ListBase *effectors, ListBase *colliders, EffectorWeights *we
                                else if(eff->pd->forcefield == PFIELD_TEXTURE)
                                        do_texture_effector(eff, &efd, point, force);
                                else {
-                                       float temp1[3]={force[0], force[1], force[2]}, temp2[3];
+                                       float temp1[3]={0,0,0}, temp2[3];
+                                       VECCOPY(temp1, force);
 
                                        do_physical_effector(eff, &efd, point, force);
                                        
index 171c5a311c1b43541df37b03ced9cb94e1c06794..bc340ef5b4b13a70af36eb7f2abbe9da52dfdf03 100644 (file)
@@ -6139,7 +6139,8 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
                                /* patch for several 3d cards (IBM mostly) that crash on glSelect with text drawing */
                                /* but, we also dont draw names for sets or duplicators */
                                if(flag == 0) {
-                                       view3d_cached_text_draw_add((float [3]){0,0,0}, ob->id.name+2, 10, 0);
+                                       float zero[3]= {0,0,0};
+                                       view3d_cached_text_draw_add(zero, ob->id.name+2, 10, 0);
                                }
                        }
                        /*if(dtx & OB_DRAWIMAGE) drawDispListwire(&ob->disp);*/
index b71249880a697957900f8c2efd090f014961e521..668f0a086d10a3b1906ceb13f9db9b7c108658d9 100644 (file)
@@ -212,8 +212,9 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
                        float totlen = len_v3(mtx_tx[3]);
 
                        if(totlen != 0.0f) {
+                               float zero[3]={0.0f, 0.0f, 0.0f};
                                float cp[3];                            
-                               screw_ofs= closest_to_line_v3(cp, mtx_tx[3], (float []){0,0,0}, axis_vec);
+                               screw_ofs= closest_to_line_v3(cp, mtx_tx[3], zero, axis_vec);
                        }
                        else {
                                screw_ofs= 0.0f;