Merge branch 'master' into navigation

# Conflicts:
#	imgui.cpp
#	imgui_internal.h
This commit is contained in:
omar 2018-01-12 19:21:12 +01:00
commit c9be7d7254
2 changed files with 18 additions and 18 deletions

View File

@ -718,7 +718,8 @@ namespace ImGui
static void NavUpdate(); static void NavUpdate();
static void NavUpdateWindowing(); static void NavUpdateWindowing();
static void NavProcessItem(ImGuiWindow* window, const ImRect& nav_bb, const ImGuiID id); static void NavProcessItem(ImGuiWindow* window, const ImRect& nav_bb, const ImGuiID id);
static void UpdateManualResize(ImGuiWindow* window, const ImVec2& size_auto_fit, int* border_held, ImU32 resize_grip_col[4]);
static void UpdateManualResize(ImGuiWindow* window, const ImVec2& size_auto_fit, int* border_held, int resize_grip_count, ImU32 resize_grip_col[4]);
static void FocusFrontMostActiveWindow(ImGuiWindow* ignore_window); static void FocusFrontMostActiveWindow(ImGuiWindow* ignore_window);
} }
@ -5237,14 +5238,13 @@ static ImRect GetBorderRect(ImGuiWindow* window, int border_n, float perp_paddin
} }
// Handle resize for: Resize Grips, Borders, Gamepad // Handle resize for: Resize Grips, Borders, Gamepad
static void ImGui::UpdateManualResize(ImGuiWindow* window, const ImVec2& size_auto_fit, int* border_held, ImU32 resize_grip_col[4]) static void ImGui::UpdateManualResize(ImGuiWindow* window, const ImVec2& size_auto_fit, int* border_held, int resize_grip_count, ImU32 resize_grip_col[4])
{ {
ImGuiContext& g = *GImGui; ImGuiContext& g = *GImGui;
ImGuiWindowFlags flags = window->Flags; ImGuiWindowFlags flags = window->Flags;
if ((flags & ImGuiWindowFlags_NoResize) || (flags & ImGuiWindowFlags_AlwaysAutoResize) || window->AutoFitFramesX > 0 || window->AutoFitFramesY > 0) if ((flags & ImGuiWindowFlags_NoResize) || (flags & ImGuiWindowFlags_AlwaysAutoResize) || window->AutoFitFramesX > 0 || window->AutoFitFramesY > 0)
return; return;
const int resize_grip_count = (flags & ImGuiWindowFlags_ResizeFromAnySide) ? 2 : 1; // 4
const int resize_border_count = (flags & ImGuiWindowFlags_ResizeFromAnySide) ? 4 : 0; const int resize_border_count = (flags & ImGuiWindowFlags_ResizeFromAnySide) ? 4 : 0;
const float grip_draw_size = (float)(int)ImMax(g.FontSize * 1.35f, window->WindowRounding + 1.0f + g.FontSize * 0.2f); const float grip_draw_size = (float)(int)ImMax(g.FontSize * 1.35f, window->WindowRounding + 1.0f + g.FontSize * 0.2f);
const float grip_hover_size = (float)(int)(grip_draw_size * 0.75f); const float grip_hover_size = (float)(int)(grip_draw_size * 0.75f);
@ -5668,6 +5668,14 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
if (!(flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Tooltip)) || (flags & ImGuiWindowFlags_Popup)) if (!(flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Tooltip)) || (flags & ImGuiWindowFlags_Popup))
want_focus = true; want_focus = true;
// Handle manual resize: Resize Grips, Borders, Gamepad
int border_held = -1;
ImU32 resize_grip_col[4] = { 0 };
const int resize_grip_count = (flags & ImGuiWindowFlags_ResizeFromAnySide) ? 2 : 1; // 4
const float grip_draw_size = (float)(int)ImMax(g.FontSize * 1.35f, window->WindowRounding + 1.0f + g.FontSize * 0.2f);
if (!window->Collapsed)
UpdateManualResize(window, size_auto_fit, &border_held, resize_grip_count, &resize_grip_col[0]);
// DRAWING // DRAWING
// Setup draw list and outer clipping rectangle // Setup draw list and outer clipping rectangle
@ -5708,14 +5716,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
} }
else else
{ {
// Handle resize for: Resize Grips, Borders, Gamepad
int border_held = -1;
ImU32 resize_grip_col[4] = { 0 };
const int resize_grip_count = (flags & ImGuiWindowFlags_ResizeFromAnySide) ? 2 : 1; // 4
const float grip_draw_size = (float)(int)ImMax(g.FontSize * 1.35f, window->WindowRounding + 1.0f + g.FontSize * 0.2f);
UpdateManualResize(window, size_auto_fit, &border_held, &resize_grip_col[0]);
title_bar_rect = window->TitleBarRect();
// Window background, Default Alpha // Window background, Default Alpha
ImU32 bg_col = GetColorU32(GetWindowBgColorIdxFromFlags(flags)); ImU32 bg_col = GetColorU32(GetWindowBgColorIdxFromFlags(flags));
window->DrawList->AddRectFilled(window->Pos+ImVec2(0,window->TitleBarHeight()), window->Pos+window->Size, bg_col, window_rounding, (flags & ImGuiWindowFlags_NoTitleBar) ? ImDrawCornerFlags_All : ImDrawCornerFlags_Bot); window->DrawList->AddRectFilled(window->Pos+ImVec2(0,window->TitleBarHeight()), window->Pos+window->Size, bg_col, window_rounding, (flags & ImGuiWindowFlags_NoTitleBar) ? ImDrawCornerFlags_All : ImDrawCornerFlags_Bot);

View File

@ -688,7 +688,6 @@ struct ImGuiContext
ActiveIdSource = ImGuiInputSource_None; ActiveIdSource = ImGuiInputSource_None;
MovingWindow = NULL; MovingWindow = NULL;
MovingWindowMoveId = 0; MovingWindowMoveId = 0;
NextTreeNodeOpenVal = false; NextTreeNodeOpenVal = false;
NextTreeNodeOpenCond = 0; NextTreeNodeOpenCond = 0;
@ -717,10 +716,17 @@ struct ImGuiContext
NavMoveResultParentId = 0; NavMoveResultParentId = 0;
NavMoveResultDistBox = NavMoveResultDistCenter = NavMoveResultDistAxial = 0.0f; NavMoveResultDistBox = NavMoveResultDistCenter = NavMoveResultDistAxial = 0.0f;
ModalWindowDarkeningRatio = 0.0f;
OverlayDrawList._Data = &DrawListSharedData;
OverlayDrawList._OwnerName = "##Overlay"; // Give it a name for debugging
MouseCursor = ImGuiMouseCursor_Arrow;
memset(MouseCursorData, 0, sizeof(MouseCursorData));
DragDropActive = false; DragDropActive = false;
DragDropSourceFlags = 0; DragDropSourceFlags = 0;
DragDropMouseButton = -1; DragDropMouseButton = -1;
DragDropTargetId = 0; DragDropTargetId = 0;
DragDropAcceptIdCurrRectSurface = 0.0f;
DragDropAcceptIdPrev = DragDropAcceptIdCurr = 0; DragDropAcceptIdPrev = DragDropAcceptIdCurr = 0;
DragDropAcceptFrameCount = -1; DragDropAcceptFrameCount = -1;
memset(DragDropPayloadBufLocal, 0, sizeof(DragDropPayloadBufLocal)); memset(DragDropPayloadBufLocal, 0, sizeof(DragDropPayloadBufLocal));
@ -736,12 +742,6 @@ struct ImGuiContext
TooltipOverrideCount = 0; TooltipOverrideCount = 0;
OsImePosRequest = OsImePosSet = ImVec2(-1.0f, -1.0f); OsImePosRequest = OsImePosSet = ImVec2(-1.0f, -1.0f);
ModalWindowDarkeningRatio = 0.0f;
OverlayDrawList._Data = &DrawListSharedData;
OverlayDrawList._OwnerName = "##Overlay"; // Give it a name for debugging
MouseCursor = ImGuiMouseCursor_Arrow;
memset(MouseCursorData, 0, sizeof(MouseCursorData));
SettingsDirtyTimer = 0.0f; SettingsDirtyTimer = 0.0f;
LogEnabled = false; LogEnabled = false;