aboutsummaryrefslogtreecommitdiff
path: root/src/ChatWindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ChatWindow.cpp')
-rw-r--r--src/ChatWindow.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/ChatWindow.cpp b/src/ChatWindow.cpp
index 9fc810b..d33c824 100644
--- a/src/ChatWindow.cpp
+++ b/src/ChatWindow.cpp
@@ -303,8 +303,11 @@ namespace dchat
{
if(chatInput.get_editable())
{
- currentRoom->publishMessage(chatInput.get_buffer()->get_text());
+ Glib::ustring str = chatInput.get_buffer()->get_text();
chatInput.get_buffer()->set_text("");
+ while(gtk_events_pending())
+ gtk_main_iteration_do(FALSE);
+ currentRoom->publishMessage(str);
}
return true;
}
@@ -441,14 +444,19 @@ namespace dchat
if(msgTimeDiff <= MERGE_MESSAGE_TIMESTAMP_DIFF_SEC)
{
auto message = messageById[request.prevMessage->id];
- message->text.set_text(message->text.get_text() + "\n" + request.message->text);
+ message->appendText("\n");
+ message->appendText(request.message->text);
// Since messages that are sent withing a timeframe are combined, several message ids can refer to the same message
messageById[request.message->id] = message;
if(!request.loadedFromCache && *request.room->id == *currentRoom->id)
{
- currentRoomData->messageAreaLayout->queue_draw();
+ currentRoomData->messageAreaLayout->signal_draw();
scrollToBottom();
}
+ else
+ {
+ currentRoomData->messageAreaLayout->signal_draw();
+ }
return;
}
}
@@ -471,7 +479,7 @@ namespace dchat
// TODO: When we get a message in the current room we scroll to the bottom, but this should only be done if we are not manually scrolling to view old messages
if(!request.loadedFromCache && *request.room->id == *currentRoom->id)
{
- roomData->messageAreaLayout->queue_draw();
+ roomData->messageAreaLayout->signal_draw();
scrollToBottom();
}
}