From 39d66598f3641749bd3e2b9b2588e921912d4ec7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jaakko=20Ker=C3=A4nen?= jaakko.keranen@iki.fi
Date: Fri, 4 Dec 2020 09:26:52 +0200
Subject: [PATCH 1/1] SidebarWidget: Interaction with the right sidebar
src/ui/keys.h | 2 ++
src/ui/sidebarwidget.c | 5 ++++-
src/ui/window.c | 5 +++++
3 files changed, 11 insertions(+), 1 deletion(-)
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 rightSidebar_KeyModifier KMOD_CTRL
#else
@@ -47,6 +48,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
+# define rightSidebar_KeyModifier KMOD_SHIFT | KMOD_CTRL
#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");
}
}
--
2.25.1
text/plain
This content has been proxied by September (ba2dc).