diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-04-27 17:01:58 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-04-27 17:01:58 +0300 |
commit | 852689943bfbbbb933ba617cb0a971f82923a2f3 (patch) | |
tree | 11f7b934e5ea0fdd4f96efabbb213eb3189d6863 /src/ui/sidebarwidget.c | |
parent | 379c1f8befcc30b72f0b50dcbd653704348e4761 (diff) |
Refactor: Update event processing to not assume a single UI root
Most actions should occur in the context of the current UI root.
Diffstat (limited to 'src/ui/sidebarwidget.c')
-rw-r--r-- | src/ui/sidebarwidget.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c index f31dd195..62d195fb 100644 --- a/src/ui/sidebarwidget.c +++ b/src/ui/sidebarwidget.c | |||
@@ -709,7 +709,7 @@ static void itemClicked_SidebarWidget_(iSidebarWidget *d, const iSidebarItem *it | |||
709 | const iGmDocument *doc = document_DocumentWidget(document_App()); | 709 | const iGmDocument *doc = document_DocumentWidget(document_App()); |
710 | const iGmHeading *head = constAt_Array(headings_GmDocument(doc), item->id); | 710 | const iGmHeading *head = constAt_Array(headings_GmDocument(doc), item->id); |
711 | postCommandf_App("document.goto loc:%p", head->text.start); | 711 | postCommandf_App("document.goto loc:%p", head->text.start); |
712 | dismissPortraitPhoneSidebars_Root(get_Root()); | 712 | dismissPortraitPhoneSidebars_Root(as_Widget(d)->root); |
713 | break; | 713 | break; |
714 | } | 714 | } |
715 | case feeds_SidebarMode: { | 715 | case feeds_SidebarMode: { |
@@ -792,7 +792,7 @@ void setWidth_SidebarWidget(iSidebarWidget *d, float widthAsGaps) { | |||
792 | /* Even less space if the other sidebar is visible, too. */ | 792 | /* Even less space if the other sidebar is visible, too. */ |
793 | const int otherWidth = | 793 | const int otherWidth = |
794 | width_Widget(findWidget_App(d->side == left_SideBarSide ? "sidebar2" : "sidebar")); | 794 | width_Widget(findWidget_App(d->side == left_SideBarSide ? "sidebar2" : "sidebar")); |
795 | width = iClamp(width, 30 * gap_UI, size_Root(get_Root()).x - 50 * gap_UI - otherWidth); | 795 | width = iClamp(width, 30 * gap_UI, size_Root(w->root).x - 50 * gap_UI - otherWidth); |
796 | } | 796 | } |
797 | d->widthAsGaps = (float) width / (float) gap_UI; | 797 | d->widthAsGaps = (float) width / (float) gap_UI; |
798 | if (isVisible_Widget(w)) { | 798 | if (isVisible_Widget(w)) { |
@@ -967,7 +967,7 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev) | |||
967 | d, | 967 | d, |
968 | ((d->side == left_SideBarSide | 968 | ((d->side == left_SideBarSide |
969 | ? local.x | 969 | ? local.x |
970 | : (size_Root(get_Root()).x - coord_Command(cmd).x)) + | 970 | : (size_Root(w->root).x - coord_Command(cmd).x)) + |
971 | resMid) / (float) gap_UI); | 971 | resMid) / (float) gap_UI); |
972 | } | 972 | } |
973 | return iTrue; | 973 | return iTrue; |
@@ -1170,7 +1170,7 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev) | |||
1170 | else if (isCommand_Widget(w, ev, "ident.edit")) { | 1170 | else if (isCommand_Widget(w, ev, "ident.edit")) { |
1171 | const iGmIdentity *ident = menuIdentity_SidebarWidget_(d); | 1171 | const iGmIdentity *ident = menuIdentity_SidebarWidget_(d); |
1172 | if (ident) { | 1172 | if (ident) { |
1173 | makeValueInput_Widget(get_Window()->root.widget, | 1173 | makeValueInput_Widget(get_Root()->widget, |
1174 | &ident->notes, | 1174 | &ident->notes, |
1175 | uiHeading_ColorEscape "${heading.ident.notes}", | 1175 | uiHeading_ColorEscape "${heading.ident.notes}", |
1176 | format_CStr(cstr_Lang("dlg.ident.notes"), cstr_String(name_GmIdentity(ident))), | 1176 | format_CStr(cstr_Lang("dlg.ident.notes"), cstr_String(name_GmIdentity(ident))), |