Colors customizable - 'w' + 'f' "fix" - Alex
[terminatorX.git] / src / tX_mouse.cc
index df71f9a3e5d297a2846628057fe75a89602b71d0..196d48d190fd919e2cc523ebc09cb0c358799e1d 100644 (file)
@@ -59,6 +59,8 @@ int tx_mouse :: grab() {
 
        if (grabbed) return(0);
 
+       warp_override=false;
+       
        dpy=XOpenDisplay(NULL);
        if (!dpy)
        {
@@ -133,7 +135,20 @@ int tx_mouse :: grab() {
        otime=CurrentTime;
        
        grabbed=1;
-       vtt_class::focus_no(0);
+       
+       std::list<vtt_class *> :: iterator v;
+       int c=0;
+       
+       for (v=vtt_class::main_list.begin(); v!=vtt_class::main_list.end(); v++) {
+               if (!(*v)->audio_hidden) {
+                       vtt_class::focus_no(c);
+                       break;
+               }
+               c++;
+               //vtt_class::focus_no(0);
+       }
+       
+       
        warp=TX_MOUSE_SPEED_NORMAL;
        
        tX_debug("tX_mouse::grab(): this: %08x, dpy: %08x", (int) this, (int) dpy);
@@ -286,7 +301,12 @@ int tx_mouse :: check_event()
                switch(xev.type)
                {
                        case MotionNotify:
-                               vtt->xy_input(((f_prec) xmot->x_root)*warp,((f_prec) xmot->y_root)*warp);
+                               
+                               if (warp_override) {
+                                       vtt->sp_speed.handle_mouse_input(((f_prec) xmot->x_root)*globals.mouse_speed*warp);
+                               } else {
+                                       vtt->xy_input((f_prec) xmot->x_root, (f_prec) xmot->y_root);
+                               }
                                break;
                        
                        case ButtonPress:
@@ -344,6 +364,7 @@ int tx_mouse :: check_event()
                                        case XK_w:
                                        vtt->sp_mute.receive_input_value(1);
                                        case XK_f: 
+                                       warp_override=true;
                                        warp=((float) vtt->samples_in_buffer)/TX_MOUSE_SPEED_WARP;      
                                        vtt->set_scratch(1);
                                        break;
@@ -385,6 +406,7 @@ int tx_mouse :: check_event()
                                        case XK_w:
                                        vtt->sp_mute.receive_input_value(0);
                                        case XK_f: warp=TX_MOUSE_SPEED_NORMAL;
+                                       warp_override=false;
                                        vtt->set_scratch(0);
                                        break;                                  
                                }