Kill the pressure abort feature
This feature has been broken for at least a year now and nobody complained.
+6 −104 · 7 files changed
-
grabber.cc+2 −11 -
grabber.h+0 −5 -
gui.glade+0 −54 -
main.cc+0 −15 -
prefdb.cc+4 −5 -
prefdb.h+0 −3 -
prefs.cc+0 −11
@@ -373,7 +373,7 @@ void Grabber::new_device(XIDeviceInfo *info) { } } -Grabber::XiDevice::XiDevice(Grabber *parent, XIDeviceInfo *info) : supports_pressure(false), absolute(false), scale_x(1.0), scale_y(1.0), num_buttons(0) { +Grabber::XiDevice::XiDevice(Grabber *parent, XIDeviceInfo *info) : absolute(false), scale_x(1.0), scale_y(1.0), num_buttons(0) { dev = info->deviceid; name = info->name; master = info->attachment; @@ -392,20 +392,11 @@ Grabber::XiDevice::XiDevice(Grabber *parent, XIDeviceInfo *info) : supports_pres scale_y = (double)DisplayHeight(dpy, DefaultScreen(dpy)) / (double)(v->max - v->min); } - if (v->number == 2) { - pressure_min = v->min; - pressure_max = v->max; - if (pressure_min < pressure_max) - supports_pressure = true; - } } } if (verbosity >= 1) - printf("Opened Device %d ('%s'%s).\n", dev, info->name, - absolute ? - supports_pressure ? ": absolute, pressure" : ": absolute" : - supports_pressure ? ": pressure" : ""); + printf("Opened Device %d ('%s'%s).\n", dev, info->name, absolute ? ": absolute" : ""); } Grabber::XiDevice *Grabber::get_xi_dev(int id) { @@ -67,17 +67,12 @@ public: struct XiDevice { int dev; std::string name; - bool supports_pressure; bool absolute; bool active; double scale_x, scale_y; - int pressure_min, pressure_max; int num_buttons; int master; XiDevice(Grabber *, XIDeviceInfo *); - int normalize_pressure(int pressure) { - return 255 * (pressure - pressure_min) / (pressure_max - pressure_min); - } void grab_device(GrabState grab); void grab_button(ButtonInfo &bi, bool grab); }; @@ -1722,60 +1722,6 @@ Van Diep Duong (Vietnamese)</property> <property name="position">0</property> </packing> </child> - <child> - <object class="GtkHBox" id="hbox_pressure"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="spacing">6</property> - <child> - <object class="GtkSpinButton" id="spin_pressure_threshold"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="adjustment">adjustment_pressure_threshold</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkButton" id="button_default_pressure_threshold"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="use_action_appearance">False</property> - <property name="relief">none</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="check_pressure_abort"> - <property name="label" translatable="yes">Abort stroke if pressure exceeds the number on the left (out of 255)</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_action_appearance">False</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> </object> </child> </object> @@ -140,7 +140,6 @@ public: virtual void press(guint b, RTriple e) {} virtual void release(guint b, RTriple e) {} virtual void press_master(guint b, Time t) {} - virtual void pressure() {} virtual void proximity_out() {} virtual void pong() {} void replace_child(Handler *c) { @@ -877,10 +876,6 @@ protected: void abort_stroke() { parent->replace_child(AdvancedHandler::create(RStroke(), last, button, 0, cur)); } - virtual void pressure() { - abort_stroke(); - timeout(); - } virtual void motion(RTriple e) { cur->add(e); float dist = hypot(e->x-orig->x, e->y-orig->y); @@ -1487,16 +1482,6 @@ void Main::handle_xi2_event(XIDeviceEvent *event) { report_xi2_event(event, "Motion"); if (!current_dev || current_dev->dev != event->deviceid) break; - if (current_dev->supports_pressure && XIMaskIsSet(event->valuators.mask, 2)) { - int i = 0; - if (XIMaskIsSet(event->valuators.mask, 0)) - i++; - if (XIMaskIsSet(event->valuators.mask, 1)) - i++; - int z = current_dev->normalize_pressure(event->valuators.values[i]); - if (prefs.pressure_abort.get() && z >= prefs.pressure_threshold.get()) - H->pressure(); - } H->motion(create_triple(event->root_x, event->root_y, event->time)); break; case XI_RawMotion: @@ -29,7 +29,6 @@ #include <boost/serialization/export.hpp> const ButtonInfo default_button(Button2); -const int default_pressure_threshold = 192; PrefDB::PrefDB() : TimeoutWatcher(5000), @@ -37,8 +36,6 @@ PrefDB::PrefDB() : button(default_button), trace(TraceDefault), advanced_ignore(false), - pressure_abort(false), - pressure_threshold(default_pressure_threshold), proximity(false), feedback(true), left_handed(false), @@ -98,8 +95,10 @@ template<class Archive> void PrefDB::serialize(Archive & ar, const unsigned int ar & timing_workaround; bool show_clicks = false; ar & show_clicks; - ar & pressure_abort.unsafe_ref(); - ar & pressure_threshold.unsafe_ref(); + bool pressure_abort = false; + ar & pressure_abort; + int pressure_threshold = 192; + ar & pressure_threshold; ar & proximity.unsafe_ref(); if (version < 5) return; ar & feedback.unsafe_ref(); @@ -96,7 +96,6 @@ struct RGBA { }; extern const ButtonInfo default_button; -extern const int default_pressure_threshold; class PrefDB : public TimeoutWatcher { friend class boost::serialization::access; @@ -114,8 +113,6 @@ public: PrefSource<ButtonInfo> button; PrefSource<TraceType> trace; PrefSource<bool> advanced_ignore; - PrefSource<bool> pressure_abort; - PrefSource<int> pressure_threshold; PrefSource<bool> proximity; PrefSource<bool> feedback; PrefSource<bool> left_handed; @@ -234,11 +234,6 @@ void remove_last_entry(const Glib::ustring & name) { Prefs::Prefs() { new Check(prefs.advanced_ignore, "check_advanced_ignore"); - new Check(prefs.pressure_abort, "check_pressure_abort"); - new Adjustment<int>(prefs.pressure_threshold, "adjustment_pressure_threshold"); - new Sensitive(prefs.pressure_abort, "spin_pressure_threshold"); - new Sensitive(prefs.pressure_abort, "button_default_pressure_threshold"); - new Check(prefs.proximity, "check_proximity"); new Check(prefs.feedback, "check_feedback"); @@ -257,8 +252,6 @@ Prefs::Prefs() { new Adjustment<int>(prefs.init_timeout, "adjustment_init_timeout"); new Adjustment<int>(prefs.final_timeout, "adjustment_final_timeout"); - new ButtonSet<int>(prefs.pressure_threshold, "button_default_pressure_threshold", default_pressure_threshold); - new Combo<TraceType>(prefs.trace, "box_trace", trace_info); new Color(prefs.color, "button_color"); new Adjustment<int>(prefs.trace_width, "adjustment_trace_width"); @@ -286,10 +279,6 @@ Prefs::Prefs() { widgets->get_widget("treeview_extra", etv); new Sensitive(*fun(&is_custom, prefs.timeout_profile), "hbox_timeout"); - /* - new Sensitive(supports_pressure, "hbox_pressure"); - new Sensitive(supports_proximity, "check_proximity"); - */ new Sensitive(*fun(&draw_trace, prefs.trace), "button_color"); new Sensitive(*fun(&draw_trace, prefs.trace), "spin_trace_width");