mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-11 18:34:58 +01:00
Fixed window resize
This commit is contained in:
@@ -188,6 +188,7 @@ bool Rendering::init()
|
|||||||
// additional window callbacks for main window
|
// additional window callbacks for main window
|
||||||
glfwSetWindowRefreshCallback( main_.window(), WindowRefreshCallback );
|
glfwSetWindowRefreshCallback( main_.window(), WindowRefreshCallback );
|
||||||
glfwSetDropCallback( main_.window(), Rendering::FileDropped);
|
glfwSetDropCallback( main_.window(), Rendering::FileDropped);
|
||||||
|
glfwSetWindowSizeLimits( main_.window(), 800, 500, GLFW_DONT_CARE, GLFW_DONT_CARE);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Gstreamer setup
|
// Gstreamer setup
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ void ShowAboutGStreamer(bool* p_open);
|
|||||||
void ShowAboutOpengl(bool* p_open);
|
void ShowAboutOpengl(bool* p_open);
|
||||||
void ShowSandbox(bool* p_open);
|
void ShowSandbox(bool* p_open);
|
||||||
void SetMouseCursor(ImVec2 mousepos, View::Cursor c = View::Cursor());
|
void SetMouseCursor(ImVec2 mousepos, View::Cursor c = View::Cursor());
|
||||||
void SetNextWindowVisible(ImVec2 pos, ImVec2 size, float margin = 80.f);
|
void SetNextWindowVisible(ImVec2 pos, ImVec2 size, float margin = 180.f);
|
||||||
|
|
||||||
// static objects for multithreaded file dialog
|
// static objects for multithreaded file dialog
|
||||||
const std::chrono::milliseconds timeout = std::chrono::milliseconds(4);
|
const std::chrono::milliseconds timeout = std::chrono::milliseconds(4);
|
||||||
@@ -2984,7 +2984,7 @@ void Navigator::RenderMainPannelVimix()
|
|||||||
// display the sessions list and detect if one was selected (double clic)
|
// display the sessions list and detect if one was selected (double clic)
|
||||||
bool session_selected = false;
|
bool session_selected = false;
|
||||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||||
ImGui::ListBoxHeader("##Sessions", CLAMP(sessions_list.size(), 4, 8));
|
if (ImGui::ListBoxHeader("##Sessions", CLAMP(sessions_list.size(), 4, 8)) ) {
|
||||||
static std::string file_info = "";
|
static std::string file_info = "";
|
||||||
static std::list<std::string>::iterator file_selected = sessions_list.end();
|
static std::list<std::string>::iterator file_selected = sessions_list.end();
|
||||||
for(auto it = sessions_list.begin(); it != sessions_list.end(); ++it) {
|
for(auto it = sessions_list.begin(); it != sessions_list.end(); ++it) {
|
||||||
@@ -3024,7 +3024,6 @@ void Navigator::RenderMainPannelVimix()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::ListBoxFooter();
|
ImGui::ListBoxFooter();
|
||||||
ImVec2 pos_bot = ImGui::GetCursorPos();
|
|
||||||
|
|
||||||
// done the selection !
|
// done the selection !
|
||||||
if (session_selected) {
|
if (session_selected) {
|
||||||
@@ -3034,6 +3033,9 @@ void Navigator::RenderMainPannelVimix()
|
|||||||
// reload the list next time
|
// reload the list next time
|
||||||
selection_session_mode_changed = true;
|
selection_session_mode_changed = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
ImVec2 pos_bot = ImGui::GetCursorPos();
|
||||||
|
|
||||||
|
|
||||||
// Right side of the list: helper and options
|
// Right side of the list: helper and options
|
||||||
ImGui::SetCursorPos( ImVec2( pannel_width_ IMGUI_RIGHT_ALIGN, pos_top.y ));
|
ImGui::SetCursorPos( ImVec2( pannel_width_ IMGUI_RIGHT_ALIGN, pos_top.y ));
|
||||||
@@ -3061,7 +3063,7 @@ void Navigator::RenderMainPannelVimix()
|
|||||||
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_LARGE);
|
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_LARGE);
|
||||||
std::string tooltip_ = "";
|
std::string tooltip_ = "";
|
||||||
|
|
||||||
if ( ImGuiToolkit::IconButton( ICON_FA_EXPAND ) )
|
if ( ImGuiToolkit::IconButton( Rendering::manager().mainWindow().isFullscreen() ? ICON_FA_COMPRESS_ALT : ICON_FA_EXPAND_ALT ) )
|
||||||
Rendering::manager().mainWindow().toggleFullscreen();
|
Rendering::manager().mainWindow().toggleFullscreen();
|
||||||
if (ImGui::IsItemHovered())
|
if (ImGui::IsItemHovered())
|
||||||
tooltip_ = "Fullscreen " CTRL_MOD "Shift+F";
|
tooltip_ = "Fullscreen " CTRL_MOD "Shift+F";
|
||||||
@@ -3138,7 +3140,7 @@ void Navigator::RenderMainPannelVimix()
|
|||||||
|
|
||||||
pos_top = ImGui::GetCursorPos();
|
pos_top = ImGui::GetCursorPos();
|
||||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||||
ImGui::ListBoxHeader("##Snapshots", CLAMP(snapshots.size(), 4, 8));
|
if ( ImGui::ListBoxHeader("##Snapshots", CLAMP(snapshots.size(), 4, 8)) ) {
|
||||||
|
|
||||||
ImVec2 size = ImVec2( ImGui::GetContentRegionAvailWidth(), ImGui::GetTextLineHeight() );
|
ImVec2 size = ImVec2( ImGui::GetContentRegionAvailWidth(), ImGui::GetTextLineHeight() );
|
||||||
for (auto snapit = snapshots.begin(); snapit != snapshots.end(); ++snapit)
|
for (auto snapit = snapshots.begin(); snapit != snapshots.end(); ++snapit)
|
||||||
@@ -3192,6 +3194,7 @@ void Navigator::RenderMainPannelVimix()
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImGui::ListBoxFooter();
|
ImGui::ListBoxFooter();
|
||||||
|
}
|
||||||
pos_bot = ImGui::GetCursorPos();
|
pos_bot = ImGui::GetCursorPos();
|
||||||
|
|
||||||
// right buttons
|
// right buttons
|
||||||
@@ -3717,22 +3720,22 @@ void SetNextWindowVisible(ImVec2 pos, ImVec2 size, float margin)
|
|||||||
const ImGuiIO& io = ImGui::GetIO();
|
const ImGuiIO& io = ImGui::GetIO();
|
||||||
|
|
||||||
if ( pos_target.y > io.DisplaySize.y - margin ){
|
if ( pos_target.y > io.DisplaySize.y - margin ){
|
||||||
pos_target.y -= margin;
|
pos_target.y = io.DisplaySize.y - margin;
|
||||||
need_update = true;
|
need_update = true;
|
||||||
}
|
}
|
||||||
if ( pos_target.y + size.y < margin ){
|
if ( pos_target.y + size.y < margin ){
|
||||||
pos_target.y += margin;
|
pos_target.y = margin - size.y;
|
||||||
need_update = true;
|
need_update = true;
|
||||||
}
|
}
|
||||||
if ( pos_target.x > io.DisplaySize.x - margin){
|
if ( pos_target.x > io.DisplaySize.x - margin){
|
||||||
pos_target.x -= margin;
|
pos_target.x = io.DisplaySize.x - margin;
|
||||||
need_update = true;
|
need_update = true;
|
||||||
}
|
}
|
||||||
if ( pos_target.x + size.x < margin ){
|
if ( pos_target.x + size.x < margin ){
|
||||||
pos_target.x += margin;
|
pos_target.x = margin - size.x;
|
||||||
need_update = true;
|
need_update = true;
|
||||||
}
|
}
|
||||||
if (need_update)
|
if (need_update)
|
||||||
ImGui::SetNextWindowPos(pos_target, ImGuiCond_Appearing);
|
ImGui::SetNextWindowPos(pos_target, ImGuiCond_Always);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user