diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-09-21 09:19:21 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-09-21 09:19:21 +0300 |
commit | e48a9a27bd11dbef9531bd12d3c0c60cc771b2c3 (patch) | |
tree | 0044e6de2a788c061f0fe0eb239ab96d22acadd4 /src/ui/sidebarwidget.c | |
parent | ba6d544b1237aea6901cf5b4f6562db9eb0f46c4 (diff) |
macOS: Native context menus
Popup context menus now use NSMenu. There are still has a few glitches with the navbar identity button, but most menus are working.
SDL required another little tweak to force it to update mouse button state after the synchronously handled context menu goes away. Otherwise SDL's internal mouse button state shows that the right mouse button is held down.
Diffstat (limited to 'src/ui/sidebarwidget.c')
-rw-r--r-- | src/ui/sidebarwidget.c | 37 |
1 files changed, 11 insertions, 26 deletions
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c index fe33c540..fdfb5300 100644 --- a/src/ui/sidebarwidget.c +++ b/src/ui/sidebarwidget.c | |||
@@ -1457,40 +1457,25 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev) | |||
1457 | if (d->mode == bookmarks_SidebarMode && d->contextItem) { | 1457 | if (d->mode == bookmarks_SidebarMode && d->contextItem) { |
1458 | const iBookmark *bm = get_Bookmarks(bookmarks_App(), d->contextItem->id); | 1458 | const iBookmark *bm = get_Bookmarks(bookmarks_App(), d->contextItem->id); |
1459 | if (bm) { | 1459 | if (bm) { |
1460 | iLabelWidget *menuItem = findMenuItem_Widget(d->menu, | 1460 | updateMenuItemLabel_Widget(d->menu, "bookmark.tag tag:homepage", |
1461 | "bookmark.tag tag:homepage"); | 1461 | hasTag_Bookmark(bm, homepage_BookmarkTag) |
1462 | if (menuItem) { | 1462 | ? home_Icon " ${bookmark.untag.home}" |
1463 | setTextCStr_LabelWidget(menuItem, | 1463 | : home_Icon " ${bookmark.tag.home}"); |
1464 | hasTag_Bookmark(bm, homepage_BookmarkTag) | 1464 | updateMenuItemLabel_Widget(d->menu, "bookmark.tag tag:subscribed", |
1465 | ? home_Icon " ${bookmark.untag.home}" | 1465 | hasTag_Bookmark(bm, subscribed_BookmarkTag) |
1466 | : home_Icon " ${bookmark.tag.home}"); | ||
1467 | checkIcon_LabelWidget(menuItem); | ||
1468 | } | ||
1469 | menuItem = findMenuItem_Widget(d->menu, "bookmark.tag tag:subscribed"); | ||
1470 | if (menuItem) { | ||
1471 | setTextCStr_LabelWidget(menuItem, | ||
1472 | hasTag_Bookmark(bm, subscribed_BookmarkTag) | ||
1473 | ? star_Icon " ${bookmark.untag.sub}" | 1466 | ? star_Icon " ${bookmark.untag.sub}" |
1474 | : star_Icon " ${bookmark.tag.sub}"); | 1467 | : star_Icon " ${bookmark.tag.sub}"); |
1475 | checkIcon_LabelWidget(menuItem); | 1468 | updateMenuItemLabel_Widget(d->menu, "bookmark.tag tag:remotesource", |
1476 | } | 1469 | hasTag_Bookmark(bm, remoteSource_BookmarkTag) |
1477 | menuItem = findMenuItem_Widget(d->menu, "bookmark.tag tag:remotesource"); | ||
1478 | if (menuItem) { | ||
1479 | setTextCStr_LabelWidget(menuItem, | ||
1480 | hasTag_Bookmark(bm, remoteSource_BookmarkTag) | ||
1481 | ? downArrowBar_Icon " ${bookmark.untag.remote}" | 1470 | ? downArrowBar_Icon " ${bookmark.untag.remote}" |
1482 | : downArrowBar_Icon " ${bookmark.tag.remote}"); | 1471 | : downArrowBar_Icon " ${bookmark.tag.remote}"); |
1483 | checkIcon_LabelWidget(menuItem); | ||
1484 | } | ||
1485 | } | 1472 | } |
1486 | } | 1473 | } |
1487 | else if (d->mode == feeds_SidebarMode && d->contextItem) { | 1474 | else if (d->mode == feeds_SidebarMode && d->contextItem) { |
1488 | iLabelWidget *menuItem = findMenuItem_Widget(d->menu, "feed.entry.toggleread"); | ||
1489 | const iBool isRead = d->contextItem->indent == 0; | 1475 | const iBool isRead = d->contextItem->indent == 0; |
1490 | setTextCStr_LabelWidget(menuItem, | 1476 | updateMenuItemLabel_Widget(d->menu, "feed.entry.toggleread", |
1491 | isRead ? circle_Icon " ${feeds.entry.markunread}" | 1477 | isRead ? circle_Icon " ${feeds.entry.markunread}" |
1492 | : circleWhite_Icon " ${feeds.entry.markread}"); | 1478 | : circleWhite_Icon " ${feeds.entry.markread}"); |
1493 | checkIcon_LabelWidget(menuItem); | ||
1494 | } | 1479 | } |
1495 | else if (d->mode == identities_SidebarMode) { | 1480 | else if (d->mode == identities_SidebarMode) { |
1496 | const iGmIdentity *ident = constHoverIdentity_SidebarWidget_(d); | 1481 | const iGmIdentity *ident = constHoverIdentity_SidebarWidget_(d); |