Closed Bug 102529 Opened 25 years ago Closed 24 years ago

Need to factor out dragdrop code for embedding.

Categories

(Core :: XUL, defect)

PowerPC
Mac System 8.5
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla0.9.8

People

(Reporter: mikepinkerton, Assigned: mikepinkerton)

References

Details

Attachments

(1 file, 2 obsolete files)

There is a bunch of dragdrop code in nsMacWindow that embedding doesn't necessarily want or need. We need to factor it out somehow. I was hoping that carbonEvents might be able to save us here, but that doesn't appear to be the case. The handlers are still registered at the window level.
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla0.9.6
The handlers do need to be registered at the top window level. What we need is to provide a way for the embeddor to install their own handlers and then pass control for a drop event into Gecko. One problem is that, on the Mac, you have to make a widget, which turns out to be an nsMacWindow, and pass it to nsIBaseWindow::InitWindow(). Having the nsMacWindow as the top level window object in an embedding app is wrong because it does things like installing root controls, drag and drop handlers and other things which should be handled by the embedding app. Maybe we need to define a nsINativeBaseWindow iface which the embeddor could implement and pass to InitWindow(). We could factor functionality out through that.
Target Milestone: mozilla0.9.6 → mozilla0.9.7
-> 098
Target Milestone: mozilla0.9.7 → mozilla0.9.8
Blocks: 102531
needing r/sr. this patch basically makes a simple api that wraps all our complicated mechanics for drag/drop. i converted nsMacWindow to use it, and embedding clients will use it too. I also tweaked our window creation code so that if we didn't make the window, we don't register handlers/etc on it that would get in the way of an embedding application's wishes.
As far as the refactoring and the things which are no longer done to the embedding apps's window, it's good. I tested this with PPEmbed. As far as the nsIDragHelperService API, I'm not sure if it's sufficient for proper visual feedback - though mozilla doesn't give any visual feedback when dropping in the content area. + /** + * Call when a drop occurs inside the rectangle bounding the browser. + * + * @param inDragRef the native DragReference + * @param inSink the event sink to which the event will be dispatched + * + * @result <code>PR_TRUE</code> if the drag was accepted by Gecko. + */ + boolean drop ( in DragReference inDragRef, in nsIEventSink inSink ) ; Given this - how do I know that, on entering the area, that the content will be accepted and I should draw drop target hiliting during tracking. It just returns a boolean which says, after the fact, that the drop worked. Also, this + * If the browser does not take up the entire window, call |enter| + * when the mouse enters the rectangle bounding the browser, |tracking| + * or |drop| while it is inside, and |leave| when the mouse leaves the rectangle. says to call tracking *or* drop. To me dropping either is a tracking operation or I would want to know up front whether the drop will work so I can handle the tracking myself. If enhancing the API for better visual feedback should be another bug altogether and this is just about the refactoring, that's fine.
1) how about i add a boolean result to |tracking| as well that indicates if the drop is allowed by gecko? is that sufficient? if not, we should probably move it out to another bug. 2) ok, that's a poorly worded comment. i tossed drop in there at the last minute figuring that it would be obvious that you don't call drop until you get a drop message. guess i was wrong ;) I'll re-word it.
Comment on attachment 62108 [details] [diff] [review] adds helper service and doesn't muck with windows we don't own On AIM'ing with Pink, he's going to do option 1 from comment #6. That will allow the app to do drop feedback. r=ccarlen.
Attachment #62108 - Flags: review+
Attached patch with conrad's suggestions (obsolete) — — Splinter Review
Attachment #62108 - Attachment is obsolete: true
Attachment #62224 - Flags: review+
Initial comments: +static const char *sDragServiceContractID = "@mozilla.org/widget/dragservice;1"; Better as const char sDragServiceContractID[] = "@mozilla.org/widget/dragservice;1"; otherwise the data itself is not const. Maybe you should just #define this. + NS_ASSERTION ( mDragService.get(), "A drag was not correctly ended by shutdown" ); You want !mDragService.get(), right? +nsDragHelperService::Enter ( DragReference inDragRef, nsIEventSink *inSink ) * quietly grumbles about spacing and the inability to search for the implementation of a method called "Enter" by searching for "::Enter(" * + NS_ASSERTION ( session, "If we don't have a drag session, we're fucked" ); Maybe tone that down a little ;) And since this is such a big deal, why not return an error at this point? +#define NS_DRAGHELPERSERVICE_CID \ +{ 0x75993200, 0xf3b2, 0x11d5, { 0xa3, 0x84, 0xc7, 0x05, 0x4d, 0x07, 0xd6, 0xfc } } Did you change this? Do you need to, if the API is changing? +[uuid(22ac1757-14c5-45ef-841e-ca6e932b989c)] Ditto I see lots of root control and carbon event handler changes in the patch too, that don't related to drag and drop. RCS file: /cvsroot/mozilla/widget/src/mac/nsWindow.cpp,v This contains dcone's patch for drawing widgets. Ignoring. I'm a little concerned about the removal of the root control stuff.
> I see lots of root control and carbon event handler changes in the patch too, > that don't related to drag and drop. See comment #3 That's the "doesn't muck with windows we don't own" part.
Attachment #62224 - Attachment is obsolete: true
forgot to mention that i tested PPEmbed with scrollbars (to test the root control stuff) and it seemed fine. didn't draw out of place. scrolled verically and horizontally, seemed to clip the form controls correctly. can i get an sr?
Attachment #62236 - Flags: superreview+
Comment on attachment 62236 [details] [diff] [review] addresses smfr's concerns sr=sfraser
checked in.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: