Back to index

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

List of all members.

Public Member Functions

virtual void init ()
virtual void press (guint b, RTriple e)
virtual void motion (RTriple e)
virtual void release (guint b, RTriple e)
virtual std::string name ()
virtual Grabber::State grab_mode ()
Handlertop ()
virtual void raw_motion (RTriple e, bool, bool)
virtual void press_master (guint b, Time t)
virtual void pressure ()
virtual void proximity_out ()
virtual void pong ()
void replace_child (Handler *c)

Static Public Member Functions

static Handlercreate (RStroke s, RTriple e, guint b1, guint b2, RPreStroke replay)
static bool idle ()

Public Attributes

Handlerparent

Protected Attributes

Handlerchild

Private Member Functions

void show_ranking (guint b, RTriple e)
 AdvancedHandler (RStroke s, RTriple e_, guint b1, guint b2, RPreStroke replay_)

Private Attributes

RTriple e
guint remap_from
guint remap_to
Time click_time
guint replay_button
RTriple replay_orig
std::map< guint, RActionas
std::map< guint, RRankingrs
std::map< guint, RModifiersmods
RModifiers sticky_mods
guint button1
guint button2
RPreStroke replay

Detailed Description

Definition at line 539 of file main.cc.


Constructor & Destructor Documentation

AdvancedHandler::AdvancedHandler ( RStroke  s,
RTriple  e_,
guint  b1,
guint  b2,
RPreStroke  replay_ 
) [inline, private]

Definition at line 558 of file main.cc.

                                                                                      :
              e(e_), remap_from(0), remap_to(0), click_time(0), replay_button(0),
              button1(b1), button2(b2), replay(replay_) {
                     if (s)
                            actions.get_action_list(grabber->current_class->get())->handle_advanced(s, as, rs, b1, b2);
              }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Function Documentation

static Handler* AdvancedHandler::create ( RStroke  s,
RTriple  e,
guint  b1,
guint  b2,
RPreStroke  replay 
) [inline, static]

Definition at line 565 of file main.cc.

                                                                                           {
              if (stroke_action && s)
                     return new AdvancedStrokeActionHandler(s, e);
              else
                     return new AdvancedHandler(s, e, b1, b2, replay);

       }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual Grabber::State AdvancedHandler::grab_mode ( ) [inline, virtual]

Implements Handler.

Definition at line 672 of file main.cc.

{ return Grabber::NONE; }
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 AdvancedHandler::init ( ) [inline, virtual]

Reimplemented from Handler.

Definition at line 572 of file main.cc.

                           {
              if (replay && replay->size()) {
                     bool replay_first = !as.count(button2);
                     PreStroke::iterator i = replay->begin();
                     if (replay_first)
                            press(button2 ? button2 : button1, *i);
                     while (i != replay->end())
                            motion(*i++);
                     if (!replay_first)
                            press(button2 ? button2 : button1, e);
              } else {
                     press(button2 ? button2 : button1, e);
              }
              replay.reset();
       }

Here is the call graph for this function:

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

Reimplemented from Handler.

Definition at line 639 of file main.cc.

                                      {
              if (replay_button && hypot(replay_orig->x - e->x, replay_orig->y - e->y) > 16)
                     replay_button = 0;
              if (current_dev->master)
                     XTestFakeMotionEvent(dpy, DefaultScreen(dpy), e->x, e->y, 0);
       }

Here is the caller graph for this function:

virtual std::string AdvancedHandler::name ( ) [inline, virtual]

Implements Handler.

Definition at line 671 of file main.cc.

{ return "Advanced"; }
virtual void Handler::pong ( ) [inline, virtual, inherited]

Reimplemented in WaitForPongHandler.

Definition at line 144 of file main.cc.

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

Reimplemented from Handler.

Definition at line 587 of file main.cc.

                                              {
              if (current_dev->master)
                     XTestFakeMotionEvent(dpy, DefaultScreen(dpy), e->x, e->y, 0);
              click_time = 0;
              if (remap_to) {
                     fake_core_button(remap_to, false);
              }
              remap_from = 0;
              remap_to = 0;
              replay_button = 0;
              guint bb = (b == button1) ? button2 : b;
              show_ranking(bb, e);
              if (!as.count(bb)) {
                     sticky_mods.reset();
                     if (current_dev->master)
                            XTestFakeButtonEvent(dpy, b, true, CurrentTime);
                     return;
              }
              RAction act = as[bb];
              if (IS_SCROLL(act)) {
                     click_time = e->t;
                     replay_button = b;
                     replay_orig = e;
                     RModifiers m = act->prepare();
                     sticky_mods.reset();
                     return replace_child(new ScrollAdvancedHandler(m, replay_button));
              }
              if (IS_IGNORE(act)) {
                     click_time = e->t;
                     replay_button = b;
                     replay_orig = e;
              }
              IF_BUTTON(act, b2) {
                     // This is kind of a hack:  Store modifiers in
                     // sticky_mods, so that they are automatically released
                     // on the next press
                     sticky_mods = act->prepare();
                     remap_from = b;
                     remap_to = b2;
                     fake_core_button(b2, true);
                     return;
              }
              mods[b] = act->prepare();
              if (IS_KEY(act)) {
                     if (mods_equal(sticky_mods, mods[b]))
                            mods[b] = sticky_mods;
                     else
                            sticky_mods = mods[b];
              } else
                     sticky_mods.reset();
              act->run();
       }

Here is the call graph for this function:

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 Handler::raw_motion ( RTriple  e,
bool  ,
bool   
) [inline, virtual, inherited]

Reimplemented in ScrollHandler, and AbstractScrollHandler.

Definition at line 138 of file main.cc.

{}
virtual void AdvancedHandler::release ( guint  b,
RTriple  e 
) [inline, virtual]

Reimplemented from Handler.

Definition at line 645 of file main.cc.

                                                {
              if (current_dev->master)
                     XTestFakeMotionEvent(dpy, DefaultScreen(dpy), e->x, e->y, 0);
              if (remap_to) {
                     fake_core_button(remap_to, false);
              }
              guint bb = (b == button1) ? button2 : b;
              if (!as.count(bb)) {
                     sticky_mods.reset();
                     if (current_dev->master)
                            XTestFakeButtonEvent(dpy, b, false, CurrentTime);
              }
              if (xinput_pressed.size() == 0) {
                     if (e->t < click_time + 250 && b == replay_button) {
                            sticky_mods.reset();
                            mods.clear();
                            fake_click(b);
                     }
                     return parent->replace_child(NULL);
              }
              replay_button = 0;
              mods.erase((b == button1) ? button2 : b);
              if (remap_from)
                     sticky_mods.reset();
              remap_from = 0;
       }

Here is the call 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:

void AdvancedHandler::show_ranking ( guint  b,
RTriple  e 
) [inline, private]

Definition at line 552 of file main.cc.

                                             {
              if (!rs.count(b))
                     return;
              Ranking::queue_show(rs[b], e);
              rs.erase(b);
       }

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

std::map<guint, RAction> AdvancedHandler::as [private]

Definition at line 545 of file main.cc.

guint AdvancedHandler::button1 [private]

Definition at line 549 of file main.cc.

guint AdvancedHandler::button2 [private]

Definition at line 549 of file main.cc.

Handler* Handler::child [protected, inherited]

Definition at line 125 of file main.cc.

Definition at line 542 of file main.cc.

Definition at line 540 of file main.cc.

std::map<guint, RModifiers> AdvancedHandler::mods [private]

Definition at line 547 of file main.cc.

Handler* Handler::parent [inherited]

Definition at line 127 of file main.cc.

guint AdvancedHandler::remap_from [private]

Definition at line 541 of file main.cc.

guint AdvancedHandler::remap_to [private]

Definition at line 541 of file main.cc.

Definition at line 550 of file main.cc.

Definition at line 543 of file main.cc.

Definition at line 544 of file main.cc.

std::map<guint, RRanking> AdvancedHandler::rs [private]

Definition at line 546 of file main.cc.

Definition at line 548 of file main.cc.


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