summaryrefslogtreecommitdiff
path: root/src/ui/window.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-03-12 22:27:02 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-03-12 22:27:02 +0200
commit9cdf86dc8dda0ebf777dfdec5c1eeef53371a1ee (patch)
tree340b4bac4c96c9711e4845ff994701176a3dd267 /src/ui/window.c
parent3e56e0f1ca20d7d0489036ce0f0bca97d596f0d5 (diff)
Cut/copy/paste paste via menus
IssueID #175
Diffstat (limited to 'src/ui/window.c')
-rw-r--r--src/ui/window.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/ui/window.c b/src/ui/window.c
index 16f217a3..5b65f173 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -262,7 +262,10 @@ static const iMenuItem fileMenuItems_[] = {
262}; 262};
263 263
264static const iMenuItem editMenuItems_[] = { 264static const iMenuItem editMenuItems_[] = {
265 { "Cut", SDLK_x, KMOD_PRIMARY, "input.copy cut:1" },
265 { "Copy", SDLK_c, KMOD_PRIMARY, "copy" }, 266 { "Copy", SDLK_c, KMOD_PRIMARY, "copy" },
267 { "Paste", SDLK_v, KMOD_PRIMARY, "input.paste" },
268 { "---", 0, 0, NULL },
266 { "Copy Link to Page", SDLK_c, KMOD_PRIMARY | KMOD_SHIFT, "document.copylink" }, 269 { "Copy Link to Page", SDLK_c, KMOD_PRIMARY | KMOD_SHIFT, "document.copylink" },
267 { "---", 0, 0, NULL }, 270 { "---", 0, 0, NULL },
268 { "Find", SDLK_f, KMOD_PRIMARY, "focus.set id:find.input" }, 271 { "Find", SDLK_f, KMOD_PRIMARY, "focus.set id:find.input" },
@@ -581,7 +584,6 @@ static iBool handleNavBarCommands_(iWidget *navBar, const char *cmd) {
581 iWidget *urlBar = findChild_Widget(navBar, "url"); 584 iWidget *urlBar = findChild_Widget(navBar, "url");
582 urlBar->rect.size.x = iMini(navBarAvailableSpace_(navBar), 167 * gap_UI); 585 urlBar->rect.size.x = iMini(navBarAvailableSpace_(navBar), 167 * gap_UI);
583 arrange_Widget(navBar); 586 arrange_Widget(navBar);
584 printTree_Widget(urlBar);
585 } 587 }
586 refresh_Widget(navBar); 588 refresh_Widget(navBar);
587 postCommand_Widget(navBar, "layout.changed id:navbar"); 589 postCommand_Widget(navBar, "layout.changed id:navbar");
@@ -1134,7 +1136,7 @@ static void setupUserInterface_Window(iWindow *d) {
1134 } 1136 }
1135#endif 1137#endif
1136 updatePadding_Window_(d); 1138 updatePadding_Window_(d);
1137 /* Context menus. */ { 1139 /* Global context menus. */ {
1138 iWidget *tabsMenu = makeMenu_Widget(d->root, 1140 iWidget *tabsMenu = makeMenu_Widget(d->root,
1139 (iMenuItem[]){ 1141 (iMenuItem[]){
1140 { close_Icon " Close Tab", 0, 0, "tabs.close" }, 1142 { close_Icon " Close Tab", 0, 0, "tabs.close" },
@@ -1145,13 +1147,22 @@ static void setupUserInterface_Window(iWindow *d) {
1145 { barRightArrow_Icon " Close Tabs To Right", 0, 0, "tabs.close toright:1" }, 1147 { barRightArrow_Icon " Close Tabs To Right", 0, 0, "tabs.close toright:1" },
1146 }, 1148 },
1147 6); 1149 6);
1148 setId_Widget(tabsMenu, "doctabs.menu");
1149 iWidget *barMenu = makeMenu_Widget(d->root, 1150 iWidget *barMenu = makeMenu_Widget(d->root,
1150 (iMenuItem[]) { 1151 (iMenuItem[]) {
1151 { "Toggle Left Sidebar", 0, 0, "sidebar.toggle" }, 1152 { leftHalf_Icon " Toggle Left Sidebar", 0, 0, "sidebar.toggle" },
1152 { "Toggle Right Sidebar", 0, 0, "sidebar2.toggle" }, 1153 { rightHalf_Icon " Toggle Right Sidebar", 0, 0, "sidebar2.toggle" },
1153 }, 2); 1154 }, 2);
1155 iWidget *clipMenu = makeMenu_Widget(d->root,
1156 (iMenuItem[]){
1157 { scissor_Icon " Cut", 0, 0, "input.copy cut:1" },
1158 { clipCopy_Icon " Copy", 0, 0, "input.copy" },
1159 { "---", 0, 0, NULL },
1160 { clipboard_Icon " Paste", 0, 0, "input.paste" },
1161 },
1162 4);
1163 setId_Widget(tabsMenu, "doctabs.menu");
1154 setId_Widget(barMenu, "barmenu"); 1164 setId_Widget(barMenu, "barmenu");
1165 setId_Widget(clipMenu, "clipmenu");
1155 } 1166 }
1156 /* Global keyboard shortcuts. */ { 1167 /* Global keyboard shortcuts. */ {
1157 addAction_Widget(d->root, 'l', KMOD_PRIMARY, "navigate.focus"); 1168 addAction_Widget(d->root, 'l', KMOD_PRIMARY, "navigate.focus");