Changeset 354

Show
Ignore:
Timestamp:
06/03/08 07:00:11 (6 months ago)
Author:
FeepingCreature
Message:
  • Removed stackthreads based event handling from test2
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/qd/qd.d

    r351 r354  
    608608  mouse.pos = pt(x, y); 
    609609  if (pushed == 1) { 
     610    mouse.pressed = true; 
    610611    if (button == 1) mouse._leftclicked = true; 
    611612    if (button == 3) mouse._rightclicked = true; 
    612613  } 
     614  if (pushed == -1) mouse.pressed = false; 
    613615} 
    614616 
    615617struct mouse { 
    616618  static { 
    617     union { 
    618       pt pos; 
    619       int x, y; 
    620     } 
     619    pt pos; 
     620    int x() { return pos.x; } int y() { return pos.y; } 
    621621    bool _leftclicked, _rightclicked; 
     622    bool pressed; 
    622623    bool clicked() { if (!_leftclicked) return false; _leftclicked = false; return true; } 
    623624    bool rightclicked() { if (!_rightclicked) return false; _rightclicked = false; return true; } 
  • trunk/qd/test2.d

    r353 r354  
    8383    // auto backup = myArea; area = null; area = backup; 
    8484  } 
    85   void handleMouse(proc yield) { 
     85  /*void handleMouse(proc yield) { 
    8686    enum State { start, inside, drag_zoomin, doZoomin, drag_zoomout, doZoomout }; 
    8787    pt start, end; 
     
    117117    ); 
    118118    tf.runState(yield); 
    119   } 
     119  }*/ 
    120120  alias void delegate(T p, void delegate(float)) func; 
    121121  void lyapunov(T p, void delegate(float) dg) { 
     
    303303      } 
    304304    ]; 
    305     transitions.addBidirectionalEdge({ return mouse.button; }, State.inside, State.dragging); 
     305    transitions.addBidirectionalEdge({ return mouse.pressed; }, State.inside, State.dragging); 
    306306    transitions.addEdges( 
    307       { return (mouse.pos in this)&&!mouse.button; }, State.start, State.inside, 
     307      { return (mouse.pos in this)&&!mouse.pressed; }, State.start, State.inside, 
    308308      { return !(mouse.pos in this); }, State.inside, State.start 
    309309    ); 
     
    441441   
    442442  list!(Window) windows; 
    443   this() { mouse.sched~=stackthread=&mousethr; } 
     443  // this() { mouse.sched~=stackthread=&mousethr; } 
    444444  void draw() { windows.each((Window w) { w.draw(); }); } 
    445   void mousethr(proc yield) { 
    446     assert(mouse.sched.runsMe); 
     445  /*void mousethr(proc yield) { 
     446    // assert(mouse.sched.runsMe); 
    447447    enum State { start, title_inside, title_dragging, resize_inside, resize_dragging } 
    448448    pt lastpos; 
     
    484484    ); 
    485485    transitions.runState(yield); 
    486   } 
     486  }*/ 
    487487} 
    488488