Project

General

Profile

Bug #3677 » 0001-Raise-WDialog-to-front-on-mousedown-not-click.patch

Bruce Toll, 11/25/2014 09:24 PM

View differences:

src/Wt/WDialog
385 385
  void create();
386 386
  void onEscapePressed();
387 387
  void onDefaultPressed();
388
  void bringToFront();
388
  void bringToFront(const WMouseEvent &e);
389 389

  
390 390
  DialogCover *cover();
391 391
};
src/Wt/WDialog.C
406 406
  }
407 407

  
408 408
  if (!isModal())
409
    titleBar()->clicked().connect(this, &WDialog::bringToFront);
409
    titleBar()->mouseWentDown().connect(this, &WDialog::bringToFront);
410 410

  
411 411
  if ( (flags & RenderFull) && autoFocus_)
412 412
    impl_->setFirstFocus();
......
635 635
    return 0;
636 636
}
637 637

  
638
void WDialog::bringToFront()
638
void WDialog::bringToFront(const WMouseEvent &e)
639 639
{
640
  doJavaScript("jQuery.data(" + jsRef() + ", 'obj').bringToFront()");
641
  DialogCover *c = cover();
642
  c->bringToFront(this);
640
  if (e.button() == WMouseEvent::LeftButton &&
641
      e.modifiers() == KeyboardModifier::NoModifier) {
642
    doJavaScript("jQuery.data(" + jsRef() + ", 'obj').bringToFront()");
643
    DialogCover *c = cover();
644
    c->bringToFront(this);
645
  }
643 646
}
644 647

  
645 648
}
src/js/WDialog.js
59 59
   };
60 60

  
61 61
   if (titlebar) {
62
     titlebar.onmousedown = function(event) {
62
     $(titlebar).mousedown(function(event) {
63 63
       var e = event||window.event;
64
       if (e.which !== 1) {
65
         return;
66
       }
64 67
       WT.capture(titlebar);
65 68
       var pc = WT.pageCoordinates(e);
66 69
       dsx = pc.x;
67 70
       dsy = pc.y;
68 71

  
69 72
       titlebar.onmousemove = handleMove;
70
     };
73
     });
71 74

  
72 75
     titlebar.onmouseup = function(event) {
73 76
       titlebar.onmousemove = null;
74
- 
(1-1/3)