Last Comment Bug 554919 - Support panels which can be moved by dragging their background
: Support panels which can be moved by dragging their background
Status: RESOLVED FIXED
: dev-doc-complete
Product: Core
Classification: Components
Component: XP Toolkit/Widgets: XUL (show other bugs)
: Trunk
: All All
: -- normal (vote)
: ---
Assigned To: Neil Deakin (away until Oct 3)
:
:
Mentors:
Depends on: 577377
Blocks:
  Show dependency treegraph
 
Reported: 2010-03-25 06:47 PDT by Neil Deakin (away until Oct 3)
Modified: 2011-08-09 06:10 PDT (History)
8 users (show)
enndeakin: in‑testsuite+
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
implement this (3.72 KB, patch)
2010-07-07 15:23 PDT, Neil Deakin (away until Oct 3)
no flags Details | Diff | Splinter Review
patch, with gtk support and test (8.58 KB, patch)
2011-03-21 06:48 PDT, Neil Deakin (away until Oct 3)
dao+bmo: review-
Details | Diff | Splinter Review
Address comments (9.50 KB, patch)
2011-03-23 08:33 PDT, Neil Deakin (away until Oct 3)
dao+bmo: review+
bugs: review+
Details | Diff | Splinter Review

Description Neil Deakin (away until Oct 3) 2010-03-25 06:47:08 PDT
This involves:
 - modifying WindowDraggingUtils.jsm to support panels as well as windows
 - hooking this up if some attribute is set on the panel
Comment 1 amirjanyan@gmail.com 2010-04-18 02:53:18 PDT
 popup's moveTo method

<method name="moveTo">
        <parameter name="aLeft"/>
        <parameter name="aTop"/>
        <body>
        <![CDATA[
          this.popupBoxObject.moveTo(aLeft, aTop);
        ]]>
        </body>
      </method>
  
uses popupBoxObject property

<property name="popupBoxObject">
        <getter>
          return this.boxObject.QueryInterface(Components.interfaces.nsIPopupBoxObject);
        </getter>
      </property>

which calls QueryInterface every time without a reason, making everything slow

so making lazygetter for popupBoxObject is needed for this too
Comment 2 Neil Deakin (away until Oct 3) 2010-07-07 15:23:14 PDT
Created attachment 456350 [details] [diff] [review]
implement this
Comment 3 Neil Deakin (away until Oct 3) 2011-03-21 06:48:19 PDT
Created attachment 520629 [details] [diff] [review]
patch, with gtk support and test
Comment 4 Dão Gottwald [:dao] 2011-03-21 07:04:58 PDT
Comment on attachment 520629 [details] [diff] [review]
patch, with gtk support and test

>   handleEvent: function(aEvent) {
>-#ifdef XP_WIN
>-    if (this.shouldDrag(aEvent))
>-      aEvent.preventDefault();
>-#else
>     switch (aEvent.type) {
>       case "mousedown":
>         if (!this.shouldDrag(aEvent))
>           return;
> 
>+        let isPanel = this.isPanel();
>+#ifdef XP_WIN
>+        if (!isPanel) {
>+          aEvent.preventDefault();
>+          return;
>+        }
>+#endif

This new code seems unreachable, since MozMouseHittest is used instead of mousedown in the XP_WIN case.

>--- a/toolkit/content/widgets/popup.xml
>+++ b/toolkit/content/widgets/popup.xml

>+      <field name="_alive">true</field>

That doesn't work this way anymore, we changed this in bug 624157.

smaug, sicking, jst or bz should probably review the change to beginWindowMove.
Comment 5 Neil Deakin (away until Oct 3) 2011-03-23 08:33:00 PDT
Created attachment 521187 [details] [diff] [review]
Address comments
Comment 6 Olli Pettay [:smaug] (reviewing overload) 2011-03-23 09:12:17 PDT
Comment on attachment 521187 [details] [diff] [review]
Address comments

r+ for the dom/ part.


Is 'backdrag' such attribute that it can be set only before ctor has
run? Is there some way to disable the feature for sometime and then
enable it again?
Comment 7 Neil Deakin (away until Oct 3) 2011-03-23 09:25:02 PDT
There isn't a way to modify it currently. I can add that in a followup bug.
Comment 8 Dão Gottwald [:dao] 2011-03-24 08:54:06 PDT
Comment on attachment 521187 [details] [diff] [review]
Address comments

WindowDraggingUtils.jsm doesn't seem to handle elements inside of panels in a sensible way. This can be taken care of in a separate bug (I could do it in bug 574971).

>+        if (isPanel) {
>+          var screenRect = this._elem.getOuterScreenRect();
>+          this._deltaX = aEvent.screenX - screenRect.left;
>+          this._deltaY = aEvent.screenY - screenRect.top;
>+        }

>+        if (this._draggingWindow) {
>+          var toDrag = this.isPanel() ? this._elem : this._window;
>+          toDrag.moveTo(aEvent.screenX - this._deltaX, aEvent.screenY - this._deltaY);
>+        }

s/var/let/
Comment 9 Neil Deakin (away until Oct 3) 2011-06-03 14:03:15 PDT
http://hg.mozilla.org/mozilla-central/rev/9c21ad3d7f72
Comment 10 Eric Shepherd [:sheppy] 2011-08-08 11:31:23 PDT
To clarify before I begin writing: this is about the new "backdrag" attribute on the XUL panel element, correct?
Comment 11 Neil Deakin (away until Oct 3) 2011-08-08 15:17:18 PDT
Yes, setting backdrag="true" allows the panel to be moved around on the screen by dragging on a background area of the panel.

Note You need to log in before you can comment on or make changes to this bug.