summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/tab-body.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/src/tab-body.c b/src/tab-body.c
index 3c8d4de..88da124 100644
--- a/src/tab-body.c
+++ b/src/tab-body.c
@@ -213,6 +213,18 @@ context_menu_media_cb(WebKitContextMenu *context_menu, GList *media_ctrl_items,
}
static void
+context_menu_editable_cb(WebKitContextMenu *context_menu, GList *edit_items,
+ GList *input_items, MqTabBody *body)
+{
+ ITEM_DECLS_NO_CUSTOM
+
+ RESTORE_ITEMS(edit_items); /* Cu_t, _Copy, _Paste, _Delete */
+ NEW_SEPARATOR_ITEM(); /* --- */
+ NEW_STOCK_ITEM(SELECT_ALL); /* Select _All */
+ NEW_SEPARATOR_ITEM(); /* --- */
+ RESTORE_ITEMS(input_items); /* _Insert Unicode Character */
+}
+static void
context_menu_document_cb(WebKitContextMenu *context_menu, GList *nav_items,
MqTabBody *body)
{
@@ -239,6 +251,7 @@ context_menu_cb(WebKitWebView __attribute__((unused)) *web_view,
{
GList *items;
GList *nav_items;
+ GList *edit_items;
GList *input_items;
GList *spell_items;
GList *media_ctrl_items;
@@ -256,6 +269,7 @@ context_menu_cb(WebKitWebView __attribute__((unused)) *web_view,
* guesses). */
items = webkit_context_menu_get_items(context_menu);
nav_items = NULL;
+ edit_items = NULL;
input_items = NULL;
spell_items = NULL;
media_ctrl_items = NULL;
@@ -275,8 +289,14 @@ context_menu_cb(WebKitWebView __attribute__((unused)) *web_view,
PRESERVE_ITEM(nav_items);
break;
case WKCMA(COPY):
+ PRESERVE_ITEM(edit_items);
is_selection = TRUE;
break;
+ case WKCMA(CUT):
+ case WKCMA(PASTE):
+ case WKCMA(DELETE):
+ PRESERVE_ITEM(edit_items);
+ break;
case WKCMA(INPUT_METHODS):
case WKCMA(UNICODE):
PRESERVE_ITEM(input_items);
@@ -312,6 +332,7 @@ context_menu_cb(WebKitWebView __attribute__((unused)) *web_view,
#pragma GCC diagnostic pop
}
nav_items = g_list_reverse(nav_items);
+ edit_items = g_list_reverse(edit_items);
input_items = g_list_reverse(input_items);
spell_items = g_list_reverse(spell_items);
media_ctrl_items = g_list_reverse(media_ctrl_items);
@@ -345,14 +366,8 @@ context_menu_cb(WebKitWebView __attribute__((unused)) *web_view,
context_handled = TRUE;
}
if (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE) {
- /* Cut (stock)
- * Copy (stock)
- * Paste (stock)
- * Delete (stock)
- * ---
- * Select All (stock)
- * Insert Unicode Character (preserved) */
- g_print(" editable");
+ context_menu_editable_cb(context_menu, edit_items, input_items,
+ body);
context_handled = TRUE;
}
if (!context_handled &&