Lagrange [work/v1.10]

SidebarWidget: Interaction with the right sidebar

=> 39d66598f3641749bd3e2b9b2588e921912d4ec7

diff --git a/src/ui/keys.h b/src/ui/keys.h
index cc56f8d1..8bcd4f53 100644
--- a/src/ui/keys.h
+++ b/src/ui/keys.h
@@ -36,6 +36,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
 #   define navigateRoot_KeyShortcut     SDLK_UP,            KMOD_SHIFT | KMOD_PRIMARY
 #   define byWord_KeyModifier           KMOD_ALT
 #   define byLine_KeyModifier           KMOD_PRIMARY
+#   define rightSidebar_KeyModifier     KMOD_CTRL
 #   define subscribeToPage_KeyModifier  SDLK_d,             KMOD_SHIFT | KMOD_PRIMARY
 #else
 #   define reload_KeyShortcut           SDLK_r,             KMOD_PRIMARY
@@ -47,6 +48,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
 #   define navigateRoot_KeyShortcut     SDLK_UP,            KMOD_SHIFT | KMOD_ALT
 #   define byWord_KeyModifier           KMOD_CTRL
 #   define byLine_KeyModifier           0
+#   define rightSidebar_KeyModifier     KMOD_SHIFT | KMOD_CTRL
 #   define subscribeToPage_KeyModifier  SDLK_d,             KMOD_SHIFT | KMOD_PRIMARY
 #endif
 
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c
index 121e9a7c..ca4404d5 100644
--- a/src/ui/sidebarwidget.c
+++ b/src/ui/sidebarwidget.c
@@ -580,7 +580,8 @@ void setWidth_SidebarWidget(iSidebarWidget *d, int width) {
 
 iBool handleBookmarkEditorCommands_SidebarWidget_(iWidget *editor, const char *cmd) {
     if (equal_Command(cmd, "bmed.accept") || equal_Command(cmd, "cancel")) {
-        iSidebarWidget *d = findWidget_App("sidebar");
+        iAssert(startsWith_String(id_Widget(editor), "bmed."));
+        iSidebarWidget *d = findWidget_App(cstr_String(id_Widget(editor)) + 5); /* bmed.sidebar */
         if (equal_Command(cmd, "bmed.accept")) {
             const iString *title = text_InputWidget(findChild_Widget(editor, "bmed.title"));
             const iString *url   = text_InputWidget(findChild_Widget(editor, "bmed.url"));
@@ -719,6 +720,7 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev)
             if (d->mode == bookmarks_SidebarMode && item) {
                 setFlags_Widget(w, disabled_WidgetFlag, iTrue);
                 iWidget *dlg = makeBookmarkEditor_Widget();
+                setId_Widget(dlg, format_CStr("bmed.%s", cstr_String(id_Widget(w))));
                 iBookmark *bm = get_Bookmarks(bookmarks_App(), item->id);
                 setText_InputWidget(findChild_Widget(dlg, "bmed.title"), &bm->title);
                 setText_InputWidget(findChild_Widget(dlg, "bmed.url"), &bm->url);
@@ -800,6 +802,7 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev)
                     if (isCommand_Widget(w, ev, "feed.entry.edit")) {
                         setFlags_Widget(w, disabled_WidgetFlag, iTrue);
                         iWidget *dlg = makeBookmarkEditor_Widget();
+                        setId_Widget(dlg, format_CStr("bmed.%s", cstr_String(id_Widget(w))));
                         setText_InputWidget(findChild_Widget(dlg, "bmed.title"), &feedBookmark->title);
                         setText_InputWidget(findChild_Widget(dlg, "bmed.url"), &feedBookmark->url);
                         setText_InputWidget(findChild_Widget(dlg, "bmed.tags"), &feedBookmark->tags);
diff --git a/src/ui/window.c b/src/ui/window.c
index 53300d24..6441a2e3 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -511,6 +511,11 @@ static void setupUserInterface_Window(iWindow *d) {
         addAction_Widget(d->root, '3', KMOD_PRIMARY, "sidebar.mode arg:2 toggle:1");
         addAction_Widget(d->root, '4', KMOD_PRIMARY, "sidebar.mode arg:3 toggle:1");
         addAction_Widget(d->root, '5', KMOD_PRIMARY, "sidebar.mode arg:4 toggle:1");
+        addAction_Widget(d->root, '1', rightSidebar_KeyModifier, "sidebar2.mode arg:0 toggle:1");
+        addAction_Widget(d->root, '2', rightSidebar_KeyModifier, "sidebar2.mode arg:1 toggle:1");
+        addAction_Widget(d->root, '3', rightSidebar_KeyModifier, "sidebar2.mode arg:2 toggle:1");
+        addAction_Widget(d->root, '4', rightSidebar_KeyModifier, "sidebar2.mode arg:3 toggle:1");
+        addAction_Widget(d->root, '5', rightSidebar_KeyModifier, "sidebar2.mode arg:4 toggle:1");
     }
 }
 
Proxy Information
Original URL
gemini://git.skyjake.fi/lagrange/work%2Fv1.10/cdiff/39d66598f3641749bd3e2b9b2588e921912d4ec7
Status Code
Success (20)
Meta
text/gemini; charset=utf-8
Capsule Response Time
423.660429 milliseconds
Gemini-to-HTML Time
0.564863 milliseconds

This content has been proxied by September (ba2dc).