jun7 / rox-filer

ROX file manager
24 stars 6 forks source link

request: option for "Pointer warp on window shrink on mouse event" #125

Closed step- closed 8 years ago

step- commented 8 years ago

Would you please add an option to disable "Pointer warp on window shrink on mouse event"? Some people here find the pointer warp disorienting. Personally I like it. Thanks for considering this request.

JakeSFR commented 8 years ago

Some people here find the pointer warp disorienting.

Yeah, that would be me. Thanks Step.

I already found that 'Compatibility -> Override control of the window move in auto-resize' disables mouse warp on auto-resize, but I couldn't find an option for the 'shrink' one, so if this is not much of a hassle, could you please add it?

jun7 commented 8 years ago

Let me think. Anyway thanks for the report.

jun7 commented 8 years ago

Could you explain bad cases? In my use case in my env, I can't find any reason to disable it. It may be not good on a machin very slow that have to start moving of pointer before the window shrink, it may be annoying if you use only keyboard though.

JakeSFR commented 8 years ago

Well, I have no "technical" reasons against it. It's simply distracting and disorientating to me. The mouse pointer is in one place and a second later gets teleported somewhere else, what causes the unpleasant feeling of lack of continuity and control over it.

Btw, may I ask what are practical advantages of pointer warp? How it improves user experience? I guess I just fail to grasp this idea...

jun7 commented 8 years ago

advantages of pointer warp?

It is mainly for rocker jesture. Also, it tells us position of window shrinked because the pointer moving is easy-to-find. And when a window shrinks, we have to move pointer to shrinked area because open a dir and do nothing is rare case. Doing no choice is waste.

JakeSFR commented 8 years ago

I don't know C practically at all, but turned out it wasn't that hard to make 'pointer warp' optional. However, I didn't want to make a pull request, because although it seems to work just fine, I'm not sure if it's implemented 100% properly.

Anyway, please take a look at this patch and if the code is ok and you're ok with this change, could you please merge it?

diff -Naur rox-filer-master/ROX-Filer/Options.xml rox-filer-master_new/ROX-Filer/Options.xml
--- rox-filer-master/ROX-Filer/Options.xml  2016-08-06 14:38:53.000000000 +0200
+++ rox-filer-master_new/ROX-Filer/Options.xml  2016-08-12 15:19:55.012678471 +0200
@@ -404,6 +404,9 @@
        <toggle name='purge_dir_cache' label='Purge Dir Cache'>
            Don't check this if you haven't problems with RAM.
        </toggle>
+       <toggle name='disable_pointer_warp' label='Disable pointer warp'>
+           Check this if you don't want your mouse pointer to be moved on window shrink/auto-move.
+       </toggle>
    </frame>
   </section>
 </options>
diff -Naur rox-filer-master/ROX-Filer/src/filer.c rox-filer-master_new/ROX-Filer/src/filer.c
--- rox-filer-master/ROX-Filer/src/filer.c  2016-08-06 14:38:53.000000000 +0200
+++ rox-filer-master_new/ROX-Filer/src/filer.c  2016-08-12 15:15:53.659358532 +0200
@@ -199,6 +199,7 @@
 Option o_filer_size_limit;
 Option o_filer_width_limit;
 Option o_fast_font_calc;
+Option o_disable_pointer_warp;
 static Option o_right_gap, o_bottom_gap, o_auto_move;
 static Option o_create_sub_dir_thumbs;
 static Option o_thumb_processes_num;
@@ -225,6 +226,7 @@
    option_add_int(&o_bottom_gap, "bottom_gap", 0);
    option_add_int(&o_auto_move, "auto_move", TRUE);
    option_add_int(&o_fast_font_calc, "fast_font_calc", TRUE);
+   option_add_int(&o_disable_pointer_warp, "disable_pointer_warp", FALSE);
    option_add_int(&o_create_sub_dir_thumbs, "create_sub_dir_thumbs", TRUE);
    option_add_int(&o_thumb_processes_num, "thumb_processes_num", 6);

@@ -388,7 +390,7 @@

        if (dx != 0 || dy != 0)
        {
-           if (gtk_window_is_active(GTK_WINDOW(window)))
+           if (gtk_window_is_active(GTK_WINDOW(window)) && (! o_disable_pointer_warp.int_value))
            {
                gdk_window_get_pointer(gdk_window, &px, &py, NULL);
                XWarpPointer(gdk_x11_drawable_get_xdisplay(gdk_window),
@@ -434,7 +436,7 @@
            nx = CLAMP(px, 2, w - 2);
            ny = CLAMP(py, 2, h - 2);

-           if (nx != px || ny != py)
+           if ((nx != px || ny != py) && (! o_disable_pointer_warp.int_value))
            {
                XWarpPointer(gdk_x11_drawable_get_xdisplay(win),
                        None,
jun7 commented 8 years ago

Thanks.

JakeSFR commented 8 years ago

Thank you. :)