summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2011-12-01 21:51:04 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2011-12-01 21:51:04 +0000
commit71a8a8118c05e58728591dbd8ed9465922355810 (patch)
tree7368990276a5ca21427f3c74f6f5b24d1c7f94ee
parent02780e1f2d557390442abf26fd02ed0d01c3f334 (diff)
downloadnetsurf-71a8a8118c05e58728591dbd8ed9465922355810.tar.gz
netsurf-71a8a8118c05e58728591dbd8ed9465922355810.tar.bz2
Currently untested (and unused) "drop file on browser window" handling.
svn path=/trunk/netsurf/; revision=13215
-rw-r--r--desktop/browser.c37
-rw-r--r--desktop/browser.h12
2 files changed, 49 insertions, 0 deletions
diff --git a/desktop/browser.c b/desktop/browser.c
index 80c84a16a..e703358ba 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -575,6 +575,43 @@ bool browser_window_scroll_at_point(struct browser_window *bw,
return handled_scroll;
}
+/* exported interface, documented in browser.h */
+bool browser_window_drop_file_at_point(struct browser_window *bw,
+ int x, int y, char *file)
+{
+ assert(bw != NULL);
+
+ if (bw->children) {
+ /* Browser window has children, so pass request on to
+ * appropriate child */
+ struct browser_window *bwc;
+ int cur_child;
+ int children = bw->rows * bw->cols;
+
+ /* Loop through all children of bw */
+ for (cur_child = 0; cur_child < children; cur_child++) {
+ /* Set current child */
+ bwc = &bw->children[cur_child];
+
+ /* Skip this frame if (x, y) coord lies outside */
+ if (x < bwc->x || bwc->x + bwc->width < x ||
+ y < bwc->y || bwc->y + bwc->height < y)
+ continue;
+
+ /* Pass request into this child */
+ return browser_window_drop_file_at_point(bwc,
+ (x - bwc->x), (y - bwc->y), file);
+ }
+ }
+
+ /* Pass file drop on to any content */
+ if (bw->current_content != NULL)
+ return content_drop_file_at_point(bw->current_content,
+ x, y, file);
+
+ return false;
+}
+
/**
* Create and open a new root browser window with the given page.
diff --git a/desktop/browser.h b/desktop/browser.h
index f2298b59f..563d31431 100644
--- a/desktop/browser.h
+++ b/desktop/browser.h
@@ -264,6 +264,18 @@ void browser_window_get_contextual_content(struct browser_window *bw,
bool browser_window_scroll_at_point(struct browser_window *bw,
int x, int y, int scrx, int scry);
+/**
+ * Drop a file onto a browser window at a particular point.
+ *
+ * \param bw browser window to look inside
+ * \param x x-coordinate of point of interest
+ * \param y y-coordinate of point of interest
+ * \param file path to file to be dropped
+ * \return true iff file drop has been handled
+ */
+bool browser_window_drop_file_at_point(struct browser_window *bw,
+ int x, int y, char *file);
+
void browser_window_refresh_url_bar(struct browser_window *bw, nsurl *url,
lwc_string *frag);