diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/paint.c | 17 | ||||
-rw-r--r-- | src/ui/sidebarwidget.c | 33 | ||||
-rw-r--r-- | src/ui/window.c | 2 |
3 files changed, 40 insertions, 12 deletions
diff --git a/src/ui/paint.c b/src/ui/paint.c index faaf403d..c575d5fc 100644 --- a/src/ui/paint.c +++ b/src/ui/paint.c | |||
@@ -62,20 +62,19 @@ void endTarget_Paint(iPaint *d) { | |||
62 | } | 62 | } |
63 | 63 | ||
64 | void setClip_Paint(iPaint *d, iRect rect) { | 64 | void setClip_Paint(iPaint *d, iRect rect) { |
65 | if (rect.pos.y < 0) { | 65 | rect = intersect_Rect(rect, rect_Root(get_Root())); |
66 | const int off = rect.pos.y; | 66 | if (isEmpty_Rect(rect)) { |
67 | rect.pos.y -= off; | 67 | rect = init_Rect(0, 0, 1, 1); |
68 | rect.size.y = iMax(0, rect.size.y + off); | ||
69 | } | ||
70 | if (rect.pos.x < 0) { | ||
71 | const int off = rect.pos.x; | ||
72 | rect.pos.x -= off; | ||
73 | rect.size.x = iMax(0, rect.size.x + off); | ||
74 | } | 68 | } |
75 | SDL_RenderSetClipRect(renderer_Paint_(d), (const SDL_Rect *) &rect); | 69 | SDL_RenderSetClipRect(renderer_Paint_(d), (const SDL_Rect *) &rect); |
76 | } | 70 | } |
77 | 71 | ||
78 | void unsetClip_Paint(iPaint *d) { | 72 | void unsetClip_Paint(iPaint *d) { |
73 | if (numRoots_Window(get_Window()) > 1) { | ||
74 | const iRect rect = rect_Root(get_Root()); | ||
75 | SDL_RenderSetClipRect(renderer_Paint_(d), (const SDL_Rect *) &rect); | ||
76 | return; | ||
77 | } | ||
79 | #if SDL_VERSION_ATLEAST(2, 0, 12) | 78 | #if SDL_VERSION_ATLEAST(2, 0, 12) |
80 | SDL_RenderSetClipRect(renderer_Paint_(d), NULL); | 79 | SDL_RenderSetClipRect(renderer_Paint_(d), NULL); |
81 | #else | 80 | #else |
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c index d4e2fb3b..436eb250 100644 --- a/src/ui/sidebarwidget.c +++ b/src/ui/sidebarwidget.c | |||
@@ -878,10 +878,31 @@ static iBool handleSidebarCommand_SidebarWidget_(iSidebarWidget *d, const char * | |||
878 | if (arg_Command(cmd) && isVisible_Widget(w)) { | 878 | if (arg_Command(cmd) && isVisible_Widget(w)) { |
879 | return iTrue; | 879 | return iTrue; |
880 | } | 880 | } |
881 | const iBool isAnimated = (deviceType_App() != phone_AppDeviceType); | ||
882 | int visX = 0; | ||
883 | if (isVisible_Widget(w)) { | ||
884 | visX = left_Rect(bounds_Widget(w)) - left_Rect(w->root->widget->rect); | ||
885 | } | ||
881 | setFlags_Widget(w, hidden_WidgetFlag, isVisible_Widget(w)); | 886 | setFlags_Widget(w, hidden_WidgetFlag, isVisible_Widget(w)); |
882 | if (isVisible_Widget(w)) { | 887 | if (isVisible_Widget(w)) { |
888 | setFlags_Widget(w, keepOnTop_WidgetFlag, iFalse); | ||
883 | w->rect.size.x = d->widthAsGaps * gap_UI; | 889 | w->rect.size.x = d->widthAsGaps * gap_UI; |
884 | invalidate_ListWidget(d->list); | 890 | invalidate_ListWidget(d->list); |
891 | if (isAnimated) { | ||
892 | setFlags_Widget(w, horizontalOffset_WidgetFlag, iTrue); | ||
893 | setVisualOffset_Widget(w, (d->side == left_SideBarSide ? -1 : 1) * w->rect.size.x, 0, 0); | ||
894 | setVisualOffset_Widget(w, 0, 300, easeOut_AnimFlag | softer_AnimFlag); | ||
895 | } | ||
896 | } | ||
897 | else if (isAnimated) { | ||
898 | if (d->side == right_SideBarSide) { | ||
899 | setVisualOffset_Widget(w, visX, 0, 0); | ||
900 | setVisualOffset_Widget(w, visX + w->rect.size.x, 300, easeOut_AnimFlag | softer_AnimFlag); | ||
901 | } | ||
902 | else { | ||
903 | setFlags_Widget(w, keepOnTop_WidgetFlag, iTrue); | ||
904 | setVisualOffset_Widget(w, -w->rect.size.x, 300, easeOut_AnimFlag | softer_AnimFlag); | ||
905 | } | ||
885 | } | 906 | } |
886 | arrange_Widget(w->parent); | 907 | arrange_Widget(w->parent); |
887 | /* BUG: Rearranging because the arrange above didn't fully resolve the height. */ | 908 | /* BUG: Rearranging because the arrange above didn't fully resolve the height. */ |
@@ -1433,9 +1454,17 @@ static void draw_SidebarWidget_(const iSidebarWidget *d) { | |||
1433 | const iRect bounds = bounds_Widget(w); | 1454 | const iRect bounds = bounds_Widget(w); |
1434 | iPaint p; | 1455 | iPaint p; |
1435 | init_Paint(&p); | 1456 | init_Paint(&p); |
1457 | if (flags_Widget(w) & visualOffset_WidgetFlag && isVisible_Widget(w)) { | ||
1458 | fillRect_Paint(&p, boundsWithoutVisualOffset_Widget(w), tmBackground_ColorId); | ||
1459 | } | ||
1436 | draw_Widget(w); | 1460 | draw_Widget(w); |
1437 | drawVLine_Paint( | 1461 | if (isVisible_Widget(w)) { |
1438 | &p, addX_I2(topRight_Rect(bounds), -1), height_Rect(bounds), uiSeparator_ColorId); | 1462 | drawVLine_Paint( |
1463 | &p, | ||
1464 | addX_I2(d->side == left_SideBarSide ? topRight_Rect(bounds) : topLeft_Rect(bounds), -1), | ||
1465 | height_Rect(bounds), | ||
1466 | uiSeparator_ColorId); | ||
1467 | } | ||
1439 | } | 1468 | } |
1440 | 1469 | ||
1441 | static void draw_SidebarItem_(const iSidebarItem *d, iPaint *p, iRect itemRect, | 1470 | static void draw_SidebarItem_(const iSidebarItem *d, iPaint *p, iRect itemRect, |
diff --git a/src/ui/window.c b/src/ui/window.c index ff565b84..abdc363d 100644 --- a/src/ui/window.c +++ b/src/ui/window.c | |||
@@ -1007,11 +1007,11 @@ void draw_Window(iWindow *d) { | |||
1007 | init_Paint(&p); | 1007 | init_Paint(&p); |
1008 | /* Clear the window. The clear color is visible as a border around the window | 1008 | /* Clear the window. The clear color is visible as a border around the window |
1009 | when the custom frame is being used. */ { | 1009 | when the custom frame is being used. */ { |
1010 | setCurrent_Root(d->roots[0]); | ||
1010 | #if defined (iPlatformAppleMobile) | 1011 | #if defined (iPlatformAppleMobile) |
1011 | iColor back = get_Color(uiBackground_ColorId); | 1012 | iColor back = get_Color(uiBackground_ColorId); |
1012 | if (deviceType_App() == phone_AppDeviceType) { | 1013 | if (deviceType_App() == phone_AppDeviceType) { |
1013 | /* Page background extends to safe area, so fill it completely. */ | 1014 | /* Page background extends to safe area, so fill it completely. */ |
1014 | setCurrent_Root(d->roots[0]); | ||
1015 | back = get_Color(tmBackground_ColorId); | 1015 | back = get_Color(tmBackground_ColorId); |
1016 | } | 1016 | } |
1017 | #else | 1017 | #else |