diff --git a/.gitignore b/.gitignore index 86ff749..17b3504 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,5 @@ ipch/ .vs **/vc2013/enc_temp_folder/** **/vc2015/enc_temp_folder/** + +samples/Basic/xcode/build diff --git a/include/CinderImGui.h b/include/CinderImGui.h index ec072ca..9155919 100644 --- a/include/CinderImGui.h +++ b/include/CinderImGui.h @@ -176,6 +176,9 @@ namespace ImGui { //! disconnects window signals from imgui void disconnectWindow( ci::app::WindowRef window ); + //! clear all key events, this should be called after open/save file dialog to reset the events + void clearKeyEvents(); + // Cinder Helpers void Image( const ci::gl::Texture2dRef &texture, const ImVec2& size, const ImVec2& uv0 = ImVec2(0,1), const ImVec2& uv1 = ImVec2(1,0), const ImVec4& tint_col = ImVec4(1,1,1,1), const ImVec4& border_col = ImVec4(0,0,0,0) ); bool ImageButton( const ci::gl::Texture2dRef &texture, const ImVec2& size, const ImVec2& uv0 = ImVec2(0,1), const ImVec2& uv1 = ImVec2(1,0), int frame_padding = -1, const ImVec4& bg_col = ImVec4(0,0,0,1), const ImVec4& tint_col = ImVec4(1,1,1,1) ); @@ -451,4 +454,4 @@ namespace ImGui { } return false; } -} \ No newline at end of file +} diff --git a/lib/imgui b/lib/imgui index 0828a1f..6e04ced 160000 --- a/lib/imgui +++ b/lib/imgui @@ -1 +1 @@ -Subproject commit 0828a1fd6c0ee7d53d4a7013a56002aaffc86896 +Subproject commit 6e04cedd5f972ae00a5a6c8719eec5e4015849e8 diff --git a/src/CinderImGui.cpp b/src/CinderImGui.cpp index 335f214..c351bb7 100644 --- a/src/CinderImGui.cpp +++ b/src/CinderImGui.cpp @@ -545,7 +545,8 @@ ImFont* Renderer::addFont( const ci::fs::path &font, float size, const ImWchar* if( merge && ! mFonts.empty() ) { config.MergeMode = true; config.PixelSnapH = true; - config.MergeGlyphCenterV = true; + config.MergeMode = true; + // config.MergeGlyphCenterV = true; //config.OversampleV = 4; } /*else if( merge ) { @@ -775,7 +776,10 @@ bool Combo( const char* label, int* current_item, const std::vector bool result = Combo( label, current_item, (const char*) &charArray[0], height_in_items ); return result; } - + + +vector sAccelKeys; + namespace { //! sets the right mouseDown IO values in imgui @@ -827,10 +831,6 @@ namespace { event.setHandled( io.WantCaptureMouse ); } - - - vector sAccelKeys; - //! sets the right keyDown IO values in imgui void keyDown( ci::app::KeyEvent& event ) { @@ -848,7 +848,7 @@ namespace { && event.isAccelDown() && find( sAccelKeys.begin(), sAccelKeys.end(), event.getCode() ) == sAccelKeys.end() ){ sAccelKeys.push_back( event.getCode() ); - } + } io.KeyCtrl = io.KeysDown[KeyEvent::KEY_LCTRL] || io.KeysDown[KeyEvent::KEY_RCTRL] || io.KeysDown[KeyEvent::KEY_LMETA] || io.KeysDown[KeyEvent::KEY_RMETA]; io.KeyShift = io.KeysDown[KeyEvent::KEY_LSHIFT] || io.KeysDown[KeyEvent::KEY_RSHIFT]; @@ -862,7 +862,7 @@ namespace { ImGuiIO& io = ImGui::GetIO(); io.KeysDown[event.getCode()] = false; - + for( auto key : sAccelKeys ){ io.KeysDown[key] = false; } @@ -874,6 +874,7 @@ namespace { event.setHandled( io.WantCaptureKeyboard ); } + void resize() { ImGuiIO& io = ImGui::GetIO(); @@ -925,7 +926,19 @@ namespace { // wrong... and would not work in a multi-windows scenario static signals::ConnectionList sWindowConnections; - +void clearKeyEvents() +{ + // bool KeysDown[512]; imgui.h #787 + ImGuiIO& io = ImGui::GetIO(); + for( size_t k=0; k < 512; k++ ){ + io.KeysDown[k] = false; + } + sAccelKeys.clear(); + + io.KeyCtrl = false; + io.KeyShift = false; + io.KeyAlt = false; +} void initialize( const Options &options ) { @@ -1001,8 +1014,10 @@ void initialize( const Options &options ) renderer->addFont( font.first, font.second, options.getFontGlyphRanges( name ), options.getFontMergeMode() ); } renderer->initFontTexture(); - -#ifndef CINDER_LINUX + + +// #ifndef CINDER_LINUX +#if defined(CINDER_LINUX) && !defined(CINDER_ANDROID) // clipboard callbacks io.SetClipboardTextFn = []( void* user_data, const char* text ) { const char* text_end = text + strlen(text); @@ -1053,7 +1068,6 @@ void initialize( const Options &options ) currentContext->makeCurrent(); } - void connectWindow( ci::app::WindowRef window ) { sWindowConnections += window->getSignalMouseDown().connect( mouseDown );