diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/QuickMedia.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index da5453e..860d216 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -3536,6 +3536,9 @@ namespace QuickMedia { float prev_chat_height = chat_input.get_height(); float chat_input_height_full = 0.0f; + const float logo_padding_x = 15.0f; + const float chat_input_padding_x = 15.0f; + const float chat_input_padding_y = 15.0f; std::regex url_extract_regex("(http(s?):\\/\\/)?([a-zA-Z0-9\\-_]+\\.)+[a-zA-Z]+[^\\s.,]+"); @@ -3619,6 +3622,7 @@ namespace QuickMedia { tabs[selected_tab].body->clear_thumbnails(); selected_tab = std::max(0, selected_tab - 1); read_marker_timer.restart(); + redraw = true; if(typing) { fprintf(stderr, "Stopped typing\n"); typing = false; @@ -3628,6 +3632,7 @@ namespace QuickMedia { tabs[selected_tab].body->clear_thumbnails(); selected_tab = std::min((int)tabs.size() - 1, selected_tab + 1); read_marker_timer.restart(); + redraw = true; if(typing) { fprintf(stderr, "Stopped typing\n"); typing = false; @@ -3804,6 +3809,8 @@ namespace QuickMedia { room_name_text.setString(current_room_body_data->body_item->get_title()); room_avatar_thumbnail_data = std::make_shared<ThumbnailData>(); } + + redraw = true; } } } @@ -3893,16 +3900,17 @@ namespace QuickMedia { const float room_name_padding_y = (selected_tab == MESSAGES_TAB_INDEX ? room_name_total_height : 0.0f); const float tab_shade_height = tab_spacer_height + std::floor(tab_vertical_offset) + tab_height + 10.0f + room_name_padding_y; + chat_input_height_full = chat_input.get_height() + chat_input_padding_y * 2.0f; + if(selected_tab != MESSAGES_TAB_INDEX) + chat_input_height_full = 0.0f; + const float chat_height = chat_input.get_height(); if(std::abs(chat_height - prev_chat_height) > 1.0f) { prev_chat_height = chat_height; redraw = true; } - if(redraw) { - const float logo_padding_x = 15.0f; - const float chat_input_padding_x = 15.0f; - const float chat_input_padding_y = 15.0f; + if(redraw) { //chat_height += 10.0f; redraw = false; chat_input.set_max_width(window_size.x - (logo_padding_x + plugin_logo.getSize().x + chat_input_padding_x * 2.0f)); @@ -3918,9 +3926,6 @@ namespace QuickMedia { body_padding_horizontal = 0.0f; } - chat_input_height_full = chat_input.get_height() + chat_input_padding_y * 2.0f; - if(selected_tab != MESSAGES_TAB_INDEX) - chat_input_height_full = 0.0f; chat_input_shade.setSize(sf::Vector2f(window_size.x, chat_input_height_full)); chat_input_shade.setPosition(0.0f, window_size.y - chat_input_shade.getSize().y); @@ -3936,7 +3941,7 @@ namespace QuickMedia { if(!sync_running && sync_timer.getElapsedTime().asMilliseconds() >= sync_min_time_ms) { fprintf(stderr, "Time since last sync: %d ms\n", sync_timer.getElapsedTime().asMilliseconds()); - // TODO: Ignore matrix->sync() call the first time, its already called above for the first time + // TODO: What if the server just always responds immediately? sync_min_time_ms = 50; sync_running = true; sync_timer.restart(); @@ -3996,7 +4001,6 @@ namespace QuickMedia { current_room_body_data = &room_body_item_it->second; room_name_text.setString(current_room_body_data->body_item->get_title()); } - redraw = true; } process_new_room_messages(sync_result.room_sync_messages, !synced); |