aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2019-02-16 23:17:26 +0100
committerdec05eba <dec05eba@protonmail.com>2020-08-19 00:14:44 +0200
commit9c37b2dca4edaf8e9d487c6a18ab53b178161f37 (patch)
tree998514073ef5747745ea0f7c42ae4d3b16095ecc
parent4a23517b6beddad8f4e2c5264d309fec590847e7 (diff)
asdf
-rwxr-xr-xrun.sh7
-rw-r--r--src/ChatMessage.cpp4
-rw-r--r--src/ChatWindow.cpp9
-rw-r--r--src/main.cpp23
4 files changed, 28 insertions, 15 deletions
diff --git a/run.sh b/run.sh
index c66d369..ce9fd13 100755
--- a/run.sh
+++ b/run.sh
@@ -16,4 +16,9 @@ if [ ! -f ~/.local/share/fonts/Lato-Bold.ttf ]; then
fc-cache
fi
platform=`sibs platform`
-env GTK_THEME=Adwaita:light ./sibs-build/$platform/debug/dchat
+
+if [[ "$NATIVE_STYLE" -eq 1 ]]; then
+ ./sibs-build/$platform/debug/dchat $@
+else
+ env GTK_THEME=Adwaita:light ./sibs-build/$platform/debug/dchat $@
+fi
diff --git a/src/ChatMessage.cpp b/src/ChatMessage.cpp
index e440409..3c1db66 100644
--- a/src/ChatMessage.cpp
+++ b/src/ChatMessage.cpp
@@ -55,6 +55,7 @@ namespace dchat
//text.set_halign(Gtk::ALIGN_START);
//text.set_valign(Gtk::ALIGN_START);
text.set_hexpand(true);
+ //text.set_vexpand(true);
text.set_editable(false);
applyRichText(&text, _text);
text.get_style_context()->add_class("message-message-text");
@@ -66,7 +67,8 @@ namespace dchat
set_column_spacing(10);
set_row_spacing(0);
- set_vexpand(false);
+ //set_vexpand(true);
+ set_hexpand(true);
}
void ChatMessage::appendText(const Glib::ustring &_text)
diff --git a/src/ChatWindow.cpp b/src/ChatWindow.cpp
index 76df69e..437282a 100644
--- a/src/ChatWindow.cpp
+++ b/src/ChatWindow.cpp
@@ -249,7 +249,7 @@ namespace dchat
{
Gtk::Grid *chatArea = Gtk::manage(new Gtk::Grid());
chatArea->set_name("chat-area");
- rightPanel->attach(*chatArea, 0, 2, 1, 1);
+ rightPanel->attach(*chatArea, 0, 3, 1, 1);
Gtk::ScrolledWindow *chatScrollWindow = Gtk::manage(new Gtk::ScrolledWindow());
chatScrollWindow->set_hexpand(true);
@@ -372,12 +372,13 @@ namespace dchat
Gtk::ScrolledWindow *messageArea = Gtk::manage(new Gtk::ScrolledWindow());
messageArea->set_vexpand(true);
messageArea->set_overlay_scrolling(false);
- messageArea->set_policy(Gtk::PolicyType::POLICY_NEVER, Gtk::PolicyType::POLICY_AUTOMATIC);
+ messageArea->set_policy(Gtk::PolicyType::POLICY_NEVER, Gtk::PolicyType::POLICY_ALWAYS);
messageAreaStack.add(*messageArea, roomIdStr, "Room name");
if(!messageAreaStack.get_visible_child())
messageAreaStack.set_visible_child(roomIdStr);
Gtk::Grid *messageAreaLayout = new Gtk::Grid();
+ messageAreaLayout->set_valign(Gtk::ALIGN_START);
messageArea->add(*messageAreaLayout);
messageArea->show_all();
@@ -477,8 +478,8 @@ namespace dchat
message->avatar.url = "https://discordemoji.com/assets/emoji/PeepoHide.png";
else
message->avatar.url = request.message->creator->avatarUrl;
- message->set_valign(Gtk::Align::ALIGN_START);
- message->set_hexpand(true);
+ //message->set_valign(Gtk::Align::ALIGN_START);
+ //message->set_hexpand(true);
message->show_all();
messageById[request.message->id] = message;
RoomData *roomData = roomDataById[*request.room->id];
diff --git a/src/main.cpp b/src/main.cpp
index b985d53..861796c 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -36,21 +36,26 @@ static int setWindowCss(dchat::Window &window, Glib::RefPtr<Gtk::CssProvider> cs
int main (int argc, char *argv[])
{
+ char *nativeStyle = std::getenv("NATIVE_STYLE");
+ bool useNativeStyle = nativeStyle && strcmp(nativeStyle, "1") == 0;
auto app = Gtk::Application::create(argc, argv, "dec05eba.dchat", Gio::APPLICATION_NON_UNIQUE);
auto css = Gtk::CssProvider::create();
dchat::Window window;
- if(setWindowCss(window, css) != 0)
- return 1;
+ if(!useNativeStyle)
+ {
+ if(setWindowCss(window, css) != 0)
+ return 1;
#ifndef NDEBUG
- auto cssFile = Gio::File::create_for_path("css/style.css");
- auto cssFileMonitor = cssFile->monitor_file();
- cssFileMonitor->signal_changed().connect([&window, css](const Glib::RefPtr<Gio::File> &file, const Glib::RefPtr<Gio::File> &otherFile, Gio::FileMonitorEvent event)
- {
- fprintf(stderr, "Css file modified, reloading\n");
- setWindowCss(window, css);
- });
+ auto cssFile = Gio::File::create_for_path("css/style.css");
+ auto cssFileMonitor = cssFile->monitor_file();
+ cssFileMonitor->signal_changed().connect([&window, css](const Glib::RefPtr<Gio::File> &file, const Glib::RefPtr<Gio::File> &otherFile, Gio::FileMonitorEvent event)
+ {
+ fprintf(stderr, "Css file modified, reloading\n");
+ setWindowCss(window, css);
+ });
#endif
+ }
return app->run(window);
}