Colors customizable - 'w' + 'f' "fix" - Alex
[terminatorX.git] / src / tX_mouse.cc
index 9e2ae2d80afaa645a99af0d970d7f75a21bd4625..196d48d190fd919e2cc523ebc09cb0c358799e1d 100644 (file)
@@ -59,6 +59,8 @@ int tx_mouse :: grab() {
 
        if (grabbed) return(0);
 
+       warp_override=false;
+       
        dpy=XOpenDisplay(NULL);
        if (!dpy)
        {
@@ -133,15 +135,32 @@ 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);
+       
        return(0);
 }
 
 void tx_mouse :: ungrab()
 {
        if (!grabbed) return;
+
+       tX_debug("tX_mouse::ungrab(): this: %08x, dpy: %08x", (int) this, (int) dpy);
        
 #ifdef USE_DGA2        
        XDGASetMode(dpy, DefaultScreen(dpy), 0);
@@ -162,6 +181,8 @@ void tx_mouse :: ungrab()
 
        vtt_class::unfocus();
 
+       tX_debug("tX_mouse::ungrab(): done");
+       
        grabbed=0;
 }
 
@@ -280,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:
@@ -338,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;
@@ -379,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;                                  
                                }