diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/documentwidget.c | 46 | ||||
-rw-r--r-- | src/ui/window.c | 8 |
2 files changed, 37 insertions, 17 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 6ca6e4c2..fb3c9ad5 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -241,18 +241,12 @@ void init_DocumentWidget(iDocumentWidget *d) { | |||
241 | init_PtrArray(&d->visibleLinks); | 241 | init_PtrArray(&d->visibleLinks); |
242 | init_Click(&d->click, d, SDL_BUTTON_LEFT); | 242 | init_Click(&d->click, d, SDL_BUTTON_LEFT); |
243 | addChild_Widget(w, iClob(d->scroll = new_ScrollWidget())); | 243 | addChild_Widget(w, iClob(d->scroll = new_ScrollWidget())); |
244 | d->menu = | 244 | d->menu = NULL; /* created when clicking */ |
245 | makeMenu_Widget(w, | ||
246 | (iMenuItem[]){ { "Go Back", SDLK_LEFT, KMOD_PRIMARY, "navigate.back" }, | ||
247 | { "Go Forward", SDLK_RIGHT, KMOD_PRIMARY, "navigate.forward" }, | ||
248 | { "Reload Page", 0, 0, "navigate.reload" }, | ||
249 | { "---", 0, 0, NULL }, | ||
250 | { "Copy", 'c', KMOD_PRIMARY, "copy" }, | ||
251 | { "Copy Link", 0, 0, "document.copylink" } }, | ||
252 | 6); | ||
253 | #if !defined (iPlatformApple) /* in system menu */ | 245 | #if !defined (iPlatformApple) /* in system menu */ |
254 | addAction_Widget(w, SDLK_w, KMOD_PRIMARY, "tabs.close"); | 246 | addAction_Widget(w, SDLK_w, KMOD_PRIMARY, "tabs.close"); |
255 | #endif | 247 | #endif |
248 | addAction_Widget(w, SDLK_LEFT, KMOD_PRIMARY, "navigate.back"); | ||
249 | addAction_Widget(w, SDLK_RIGHT, KMOD_PRIMARY, "navigate.forward"); | ||
256 | } | 250 | } |
257 | 251 | ||
258 | void deinit_DocumentWidget(iDocumentWidget *d) { | 252 | void deinit_DocumentWidget(iDocumentWidget *d) { |
@@ -1429,11 +1423,37 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e | |||
1429 | postCommand_App("navigate.forward"); | 1423 | postCommand_App("navigate.forward"); |
1430 | return iTrue; | 1424 | return iTrue; |
1431 | } | 1425 | } |
1426 | if (ev->button.button == SDL_BUTTON_RIGHT) { | ||
1427 | if (!d->menu || !isVisible_Widget(d->menu)) { | ||
1428 | d->contextLink = d->hoverLink; | ||
1429 | if (d->menu) { | ||
1430 | destroy_Widget(d->menu); | ||
1431 | } | ||
1432 | iArray items; | ||
1433 | init_Array(&items, sizeof(iMenuItem)); | ||
1434 | pushBackN_Array( | ||
1435 | &items, | ||
1436 | (iMenuItem[]){ | ||
1437 | { "Go Back", SDLK_LEFT, KMOD_PRIMARY, "navigate.back" }, | ||
1438 | { "Go Forward", SDLK_RIGHT, KMOD_PRIMARY, "navigate.forward" }, | ||
1439 | { "Reload Page", 0, 0, "navigate.reload" }, | ||
1440 | { "---", 0, 0, NULL }, | ||
1441 | { d->contextLink ? "Copy Link URL" : "Copy Page URL", | ||
1442 | 0, | ||
1443 | 0, | ||
1444 | "document.copylink" }, | ||
1445 | { isEmpty_Range(&d->selectMark) ? "Copy Full Source" : "Copy Selected", | ||
1446 | 'c', | ||
1447 | KMOD_PRIMARY, | ||
1448 | "copy" }, | ||
1449 | }, | ||
1450 | 6); | ||
1451 | d->menu = makeMenu_Widget(w, data_Array(&items), size_Array(&items)); | ||
1452 | deinit_Array(&items); | ||
1453 | } | ||
1454 | processContextMenuEvent_Widget(d->menu, ev, d->hoverLink = NULL); | ||
1455 | } | ||
1432 | } | 1456 | } |
1433 | if (!isVisible_Widget(d->menu)) { | ||
1434 | d->contextLink = d->hoverLink; | ||
1435 | } | ||
1436 | processContextMenuEvent_Widget(d->menu, ev, d->hoverLink = NULL); | ||
1437 | switch (processEvent_Click(&d->click, ev)) { | 1457 | switch (processEvent_Click(&d->click, ev)) { |
1438 | case started_ClickResult: | 1458 | case started_ClickResult: |
1439 | d->selecting = iFalse; | 1459 | d->selecting = iFalse; |
diff --git a/src/ui/window.c b/src/ui/window.c index 6f60fbb2..69730445 100644 --- a/src/ui/window.c +++ b/src/ui/window.c | |||
@@ -329,10 +329,10 @@ static void setupUserInterface_Window(iWindow *d) { | |||
329 | addChild_Widget(div, iClob(navBar)); | 329 | addChild_Widget(div, iClob(navBar)); |
330 | setBackgroundColor_Widget(navBar, uiBackground_ColorId); | 330 | setBackgroundColor_Widget(navBar, uiBackground_ColorId); |
331 | setCommandHandler_Widget(navBar, handleNavBarCommands_); | 331 | setCommandHandler_Widget(navBar, handleNavBarCommands_); |
332 | addChild_Widget(navBar, iClob(newIcon_LabelWidget("\U0001f850", 0, 0, "navigate.back"))); | 332 | addChild_Widget(navBar, iClob(newIcon_LabelWidget("\U0001f870", 0, 0, "navigate.back"))); |
333 | addChild_Widget(navBar, iClob(newIcon_LabelWidget("\U0001f852", 0, 0, "navigate.forward"))); | 333 | addChild_Widget(navBar, iClob(newIcon_LabelWidget("\U0001f872", 0, 0, "navigate.forward"))); |
334 | iLabelWidget *idMenu = | 334 | iLabelWidget *idMenu = makeMenuButton_LabelWidget( |
335 | makeMenuButton_LabelWidget("\U0001f464", identityButtonMenuItems, iElemCount(identityButtonMenuItems)); | 335 | "\U0001f464", identityButtonMenuItems, iElemCount(identityButtonMenuItems)); |
336 | setAlignVisually_LabelWidget(idMenu, iTrue); | 336 | setAlignVisually_LabelWidget(idMenu, iTrue); |
337 | addChild_Widget(navBar, iClob(idMenu)); | 337 | addChild_Widget(navBar, iClob(idMenu)); |
338 | setId_Widget(as_Widget(idMenu), "navbar.ident"); | 338 | setId_Widget(as_Widget(idMenu), "navbar.ident"); |