Back to index

easystroke  0.5.5.1
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Attributes
AbstractScrollHandler Class Reference
Inheritance diagram for AbstractScrollHandler:
Inheritance graph
[legend]
Collaboration diagram for AbstractScrollHandler:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual void raw_motion (RTriple e, bool abs_x, bool abs_y)
Handlertop ()
virtual void motion (RTriple e)
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)
virtual void init ()
virtual std::string name ()=0
virtual Grabber::State grab_mode ()=0

Static Public Member Functions

static bool idle ()

Public Attributes

Handlerparent

Protected Member Functions

 AbstractScrollHandler ()
virtual void fake_wheel (int b1, int n1, int b2, int n2)
void move_back ()

Static Protected Member Functions

static float curve (float v)

Protected Attributes

Handlerchild

Private Attributes

bool have_x
bool have_y
float last_x
float last_y
Time last_t
float offset_x
float offset_y
Glib::ustring str
int orig_x
int orig_y

Detailed Description

Definition at line 372 of file main.cc.


Constructor & Destructor Documentation

Definition at line 381 of file main.cc.

                               : last_t(0), offset_x(0.0), offset_y(0.0) {
              if (!prefs.move_back.get() || current_dev->absolute)
                     return;
              Window dummy1, dummy2;
              int dummy3, dummy4;
              unsigned int dummy5;
              XQueryPointer(dpy, ROOT, &dummy1, &dummy2, &orig_x, &orig_y, &dummy3, &dummy4, &dummy5);
       }

Here is the call graph for this function:


Member Function Documentation

static float AbstractScrollHandler::curve ( float  v) [inline, static, protected]

Definition at line 395 of file main.cc.

                                   {
              return v * exp(log(abs(v))/3);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void AbstractScrollHandler::fake_wheel ( int  b1,
int  n1,
int  b2,
int  n2 
) [inline, protected, virtual]

Reimplemented in ScrollAdvancedHandler.

Definition at line 389 of file main.cc.

                                                               {
              for (int i = 0; i<n1; i++)
                     fake_click(b1);
              for (int i = 0; i<n2; i++)
                     fake_click(b2);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual Grabber::State Handler::grab_mode ( ) [pure virtual, inherited]
static bool Handler::idle ( ) [inline, static, inherited]

Definition at line 135 of file main.cc.

{ return !handler->child; }

Here is the caller graph for this function:

virtual void Handler::init ( ) [inline, virtual, inherited]

Reimplemented in IdleHandler, StrokeHandler, and AdvancedHandler.

Definition at line 167 of file main.cc.

{}

Here is the caller graph for this function:

virtual void Handler::motion ( RTriple  e) [inline, virtual, inherited]

Reimplemented in StrokeHandler, AdvancedHandler, ButtonHandler, and IgnoreHandler.

Definition at line 137 of file main.cc.

{}
void AbstractScrollHandler::move_back ( ) [inline, protected]

Definition at line 399 of file main.cc.

                        {
              if (!prefs.move_back.get() || current_dev->absolute)
                     return;
              XTestFakeMotionEvent(dpy, DefaultScreen(dpy), orig_x, orig_y, 0);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual std::string Handler::name ( ) [pure virtual, inherited]
virtual void Handler::pong ( ) [inline, virtual, inherited]

Reimplemented in WaitForPongHandler.

Definition at line 144 of file main.cc.

{}
virtual void Handler::press ( guint  b,
RTriple  e 
) [inline, virtual, inherited]

Reimplemented in IdleHandler, StrokeHandler, AdvancedHandler, AdvancedStrokeActionHandler, ScrollAdvancedHandler, ButtonHandler, and IgnoreHandler.

Definition at line 139 of file main.cc.

{}

Here is the caller graph for this function:

virtual void Handler::press_master ( guint  b,
Time  t 
) [inline, virtual, inherited]

Reimplemented in SelectHandler, and ScrollHandler.

Definition at line 141 of file main.cc.

{}
virtual void Handler::pressure ( ) [inline, virtual, inherited]

Reimplemented in StrokeHandler.

Definition at line 142 of file main.cc.

{}
virtual void Handler::proximity_out ( ) [inline, virtual, inherited]

Reimplemented in ScrollHandler.

Definition at line 143 of file main.cc.

{}
virtual void AbstractScrollHandler::raw_motion ( RTriple  e,
bool  abs_x,
bool  abs_y 
) [inline, virtual]

Reimplemented from Handler.

Reimplemented in ScrollHandler.

Definition at line 405 of file main.cc.

                                                                  {
              float dx = abs_x ? (have_x ? e->x - last_x : 0) : e->x;
              float dy = abs_y ? (have_y ? e->y - last_y : 0) : e->y;

              if (abs_x) {
                     last_x = e->x;
                     have_x = true;
              }

              if (abs_y) {
                     last_y = e->y;
                     have_y = true;
              }

              if (!last_t) {
                     last_t = e->t;
                     return;
              }

              if (e->t == last_t)
                     return;

              int dt = e->t - last_t;
              last_t = e->t;

              double factor = (prefs.scroll_invert.get() ? 1.0 : -1.0) * prefs.scroll_speed.get();
              offset_x += factor * curve(dx/dt)*dt/20.0;
              offset_y += factor * curve(dy/dt)*dt/10.0;
              int b1 = 0, n1 = 0, b2 = 0, n2 = 0;
              if (abs(offset_x) > 1.0) {
                     n1 = (int)floor(abs(offset_x));
                     if (offset_x > 0) {
                            b1 = 7;
                            offset_x -= n1;
                     } else {
                            b1 = 6;
                            offset_x += n1;
                     }
              }
              if (abs(offset_y) > 1.0) {
                     if (abs(offset_y) < 1.0)
                            return;
                     n2 = (int)floor(abs(offset_y));
                     if (offset_y > 0) {
                            b2 = 5;
                            offset_y -= n2;
                     } else {
                            b2 = 4;
                            offset_y += n2;
                     }
              }
              if (n1 || n2)
                     fake_wheel(b1,n1, b2,n2);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void Handler::release ( guint  b,
RTriple  e 
) [inline, virtual, inherited]

Reimplemented in StrokeHandler, AdvancedHandler, AdvancedStrokeActionHandler, ScrollAdvancedHandler, ScrollHandler, ButtonHandler, and IgnoreHandler.

Definition at line 140 of file main.cc.

{}

Here is the caller graph for this function:

void Handler::replace_child ( Handler c) [inline, inherited]

Definition at line 145 of file main.cc.

                                      {
              if (child)
                     delete child;
              child = c;
              if (child)
                     child->parent = this;
              if (verbosity >= 2) {
                     std::string stack;
                     for (Handler *h = child ? child : this; h; h=h->parent) {
                            stack = h->name() + " " + stack;
                     }
                     printf("New event handling stack: %s\n", stack.c_str());
              }
              Handler *new_handler = child ? child : this;
              grabber->grab(new_handler->grab_mode());
              if (child)
                     child->init();
              while (queued.size() && Handler::idle()) {
                     (*queued.begin())();
                     queued.pop_front();
              }
       }

Here is the call graph for this function:

Here is the caller graph for this function:

Handler* Handler::top ( ) [inline, inherited]

Definition at line 129 of file main.cc.

                      {
              if (child)
                     return child->top();
              else
                     return this;
       }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Handler* Handler::child [protected, inherited]

Definition at line 125 of file main.cc.

Definition at line 373 of file main.cc.

Definition at line 373 of file main.cc.

Definition at line 375 of file main.cc.

Definition at line 374 of file main.cc.

Definition at line 374 of file main.cc.

Definition at line 376 of file main.cc.

Definition at line 376 of file main.cc.

Reimplemented in ScrollHandler.

Definition at line 378 of file main.cc.

Reimplemented in ScrollHandler.

Definition at line 378 of file main.cc.

Handler* Handler::parent [inherited]

Definition at line 127 of file main.cc.

Glib::ustring AbstractScrollHandler::str [private]

Definition at line 377 of file main.cc.


The documentation for this class was generated from the following file: