diff options
-rw-r--r-- | src/tab-body.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/tab-body.c b/src/tab-body.c index 99b52ca..b98b65f 100644 --- a/src/tab-body.c +++ b/src/tab-body.c @@ -338,8 +338,11 @@ context_menu_cb(WebKitWebView __attribute__((unused)) *web_view, media_ctrl_items = g_list_reverse(media_ctrl_items); media_toggle_items = g_list_reverse(media_toggle_items); + /* Clear the menu. */ webkit_context_menu_remove_all(context_menu); + /* Get the reported context (which isn't very descriptive) and save the + * hit test result for use by action callbacks. */ context = webkit_hit_test_result_get_context(hit_test_result); if (body->hit_test_result) { g_object_unref(body->hit_test_result); @@ -348,6 +351,7 @@ context_menu_cb(WebKitWebView __attribute__((unused)) *web_view, g_object_ref(body->hit_test_result); context_handled = FALSE; + /* Build the context menu. */ if (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK) { context_menu_link_cb(context_menu, body); context_handled = TRUE; @@ -386,6 +390,7 @@ context_menu_cb(WebKitWebView __attribute__((unused)) *web_view, NEW_STOCK_ITEM(INSPECT_ELEMENT); /* Inspect Element */ } + /* Propagate the event further and show the context menu. */ return FALSE; } |