]> git.decadent.org.uk Git - ion3.git/blobdiff - ioncore/kbresize.c
Imported Upstream version 20090110
[ion3.git] / ioncore / kbresize.c
index b4dbc7b058002d186c1d8f7d82e9dd76aa394948..99f908d696ff769ddbd663444fbe3b30501b56e5 100644 (file)
@@ -1,12 +1,9 @@
 /*
  * ion/ioncore/kbresize.c
  *
- * Copyright (c) Tuomo Valkonen 1999-2007
+ * Copyright (c) Tuomo Valkonen 1999-2009
  *
- * Ion is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
+ * See the included file LICENSE for details.
  */
 
 #include <math.h>
@@ -36,6 +33,8 @@ static int last_accel_mode=0;
 static double accel=1, accelinc=30, accelmax=100*100;
 static long actmax=200, uptmin=50;
 static int resize_delay=CF_RESIZE_DELAY;
+/* Here to not have to write other set callback for resize code... */
+int ioncore_edge_resistance=CF_EDGE_RESISTANCE;
 
 
 static void accel_reset()
@@ -49,7 +48,7 @@ static void accel_reset()
 
 void ioncore_set_moveres_accel(ExtlTab tab)
 {
-    int t_max, t_min, rd;
+    int t_max, t_min, rd, er;
     double step, maxacc;
     
     if(extl_table_gets_i(tab, "kbresize_t_max", &t_max))
@@ -62,6 +61,8 @@ void ioncore_set_moveres_accel(ExtlTab tab)
        accelmax=(maxacc>0 ? maxacc*maxacc : 1);
     if(extl_table_gets_i(tab, "kbresize_delay", &rd))
         resize_delay=maxof(0, rd);
+    if(extl_table_gets_i(tab, "edge_resistance", &er))
+        ioncore_edge_resistance=maxof(0, er);
 }
 
 
@@ -72,6 +73,7 @@ void ioncore_get_moveres_accel(ExtlTab tab)
     extl_table_sets_d(tab, "kbresize_step", accelinc);
     extl_table_sets_d(tab, "kbresize_maxacc", accelmax);
     extl_table_sets_d(tab, "kbresize_delay", resize_delay);
+    extl_table_sets_i(tab, "edge_resistance", ioncore_edge_resistance);
 }
 
 
@@ -101,7 +103,8 @@ void moveresmode_accel(WMoveresMode *mode, int *wu, int *hu, int accel_mode)
     struct timeval tv;
     long adiff, udiff;
     
-    gettimeofday(&tv, NULL);
+    if(mainloop_gettime(&tv)!=0)
+        return;
     
     adiff=tvdiffmsec(&tv, &last_action_tv);
     udiff=tvdiffmsec(&tv, &last_update_tv);