Skip to content
This repository has been archived by the owner on Jan 22, 2022. It is now read-only.

Commit

Permalink
Arrow fixed (final fix) and with new look
Browse files Browse the repository at this point in the history
  • Loading branch information
PAXANDDOS committed Feb 4, 2021
1 parent 140668a commit 7b12e86
Show file tree
Hide file tree
Showing 13 changed files with 60 additions and 41 deletions.
4 changes: 3 additions & 1 deletion client/data/css/msg_screen.css
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 153,12 @@
}
#arrowdown
{
border-radius: 20px;
border-top-left-radius: 20px;
border-bottom-left-radius: 20px;
background-size: 100%;
background-position: top;
background-repeat: no-repeat;
background-image: none;
transition: 0.1s cubic-bezier(0.18,0.62,0.71,0.5);
}
#msggroup
Expand Down
3 changes: 1 addition & 2 deletions client/data/css/themes/dark/msg_dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 106,11 @@
}
#arrowdown
{
background-image: url("../../../images/arrow-down-dark.png");
background-size: 100%;
background-color: rgba(53, 53, 53, 0.4);
}
#arrowdown:hover
{
background-image: url("../../../images/arrow-down-dark.png");
background-color: rgba(53, 53, 53, 0.6);
}
#msggroup
Expand Down
2 changes: 1 addition & 1 deletion client/data/css/themes/default/msg_default.css
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 111,11 @@
}
#arrowdown
{
background-image: url("../../../images/arrow-down.png");
background-color: #18254e;
}
#arrowdown:hover
{
background-image: url("../../../images/arrow-down.png");
background-color: #344065;
}
#msggroup
Expand Down
3 changes: 1 addition & 2 deletions client/data/css/themes/light/msg_light.css
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 106,11 @@
}
#arrowdown
{
background-image: url("../../../images/arrow-down-light.png");
background-size: 100%;
background-color: #343740;
}
#arrowdown:hover
{
background-image: url("../../../images/arrow-down-light.png");
background-color: rgba(214, 214, 214, 0.6);
}
#msggroup
Expand Down
Binary file modified client/data/images/arrow-down-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified client/data/images/arrow-down-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified client/data/images/arrow-down.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 7 additions & 5 deletions client/inc/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 210,7 @@ struct
GtkWidget *chatlist;
GtkWidget *scrolled_message;
GtkWidget *chat_screen;
GtkWidget *arrow;
char* current;
} t_msg;

Expand Down Expand Up @@ -354,17 355,18 @@ void status_click(GtkWidget *widget, GdkEventButton *event, gpointer menu);
void settings_click(GtkWidget *widget, GdkEventButton *event, gpointer menu);

void active_click(GtkWidget *widget, GdkEventButton *event);
void gtk_widget_reshow(GtkWidget *widget);

void adduser_click(GtkWidget *widget, GdkEventButton *event, gpointer search_field);
void attach_click(GtkWidget *widget, GdkEventButton *event);
void send_click(GtkWidget *widget, GdkEventButton *event, GtkWidget *entry_text);
void send_click(GtkWidget *widget, GdkEventButton *event);
void send_press(GtkWidget *widget);
void entry_text_change_event(GtkWidget *widget);
void sticker_click(GtkWidget *widget, GdkEventButton *event, GtkWidget *main);
void arrow_click(GtkWidget *widget, GdkEventButton *event, GtkWidget* arrow);
void sticker_click(GtkWidget *widget, GdkEventButton *event, gpointer main);
void arrow_click(GtkWidget *widget, GdkEventButton *event);
void chat_push_back(t_chat_list **list, t_chat_data* chat);
void person_click(GtkWidget *widget, GdkEventButton *event);
void msggroup_click(GtkWidget *widget, GdkEventButton *event, GtkWidget *main);
void msggroup_click(GtkWidget *widget, GdkEventButton *event, gpointer main);

void username_field_change_event(GtkWidget *widget);
void firstname_field_change_event(GtkWidget *widget);
Expand All @@ -376,7 378,7 @@ void repass_field_change_event(GtkWidget *widget);
void apply_butt_click(GtkWidget *widget);
void exit_button_click(GtkWidget *widget, GdkEventButton *event);
void add_button_click(GtkWidget *widget, GdkEventButton *event);
void gallery_button_click(GtkWidget *widget, GdkEventButton *event, GtkWidget *main);
void gallery_button_click(GtkWidget *widget, GdkEventButton *event, gpointer main);
void team_mystic_click(GtkWidget *widget, GdkEventButton *event, gpointer menu);
void team_instinct_click(GtkWidget *widget, GdkEventButton *event, gpointer menu);
void team_valor_click(GtkWidget *widget, GdkEventButton *event, gpointer menu);
Expand Down
7 changes: 3 additions & 4 deletions client/src/creator_message.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 10,8 @@ void *scrolling_msg() {
gtk_scrolled_window_set_vadjustment(GTK_SCROLLED_WINDOW(t_msg.scrolled_message), adjustment);
usleep(5000);
}
gtk_widget_hide(t_msg.scrolled_message);
gtk_widget_show(t_msg.scrolled_message);
gtk_widget_reshow(t_msg.scrolled_message);
gtk_widget_reshow(t_msg.arrow);
return NULL;
}

Expand All @@ -23,8 23,7 @@ void *scrolling_sticker() {
gtk_scrolled_window_set_vadjustment(GTK_SCROLLED_WINDOW(t_msg.scrolled_message), adjustment);
usleep(5000);
}
gtk_widget_hide(t_msg.scrolled_message);
gtk_widget_show(t_msg.scrolled_message);
gtk_widget_reshow(t_msg.scrolled_message);
return NULL;
}

Expand Down
5 changes: 5 additions & 0 deletions client/src/events_home.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 27,8 @@ void active_click(GtkWidget *widget, GdkEventButton *event) {
if(event) {}
}

void gtk_widget_reshow(GtkWidget *widget)
{
gtk_widget_hide(GTK_WIDGET(widget));
gtk_widget_show_all(GTK_WIDGET(widget));
}
25 changes: 11 additions & 14 deletions client/src/events_msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 112,7 @@ void attach_click(GtkWidget *widget, GdkEventButton *event) {
free(path);
}

void send_click(GtkWidget *widget, GdkEventButton *event, GtkWidget *entry_text) {
void send_click(GtkWidget *widget, GdkEventButton *event) {
if(widget) {}
if(event->type == GDK_BUTTON_PRESS && event->button == 1 && msg_data.chat_id)
{
Expand All @@ -131,7 131,7 @@ void send_click(GtkWidget *widget, GdkEventButton *event, GtkWidget *entry_text)
pthread_t thread = NULL;
pthread_create(&thread, NULL, send_message, NULL);
new_outgoing_message(t_msg.chat_screen); // Передавать как параметры: имя, фото, текст сообщения
gtk_entry_set_text(GTK_ENTRY(entry_text), "");
gtk_entry_set_text(GTK_ENTRY(t_msg.entry), "");
msg_data.content = NULL;

GList *inner = gtk_container_get_children(GTK_CONTAINER(t_msg.chatlist));
Expand Down Expand Up @@ -175,10 175,10 @@ void entry_text_change_event(GtkWidget *widget) {
msg_data.content = (char*)gtk_entry_buffer_get_text(gtk_entry_get_buffer(GTK_ENTRY(widget)));
}

void sticker_click(GtkWidget *widget, GdkEventButton *event, GtkWidget *main) {
void sticker_click(GtkWidget *widget, GdkEventButton *event, gpointer main) {
if(widget) {}
if(event->type == GDK_BUTTON_PRESS && event->button == 1)
create_stickerlist(main);
create_stickerlist((GtkWidget*)main);
}

void person_click(GtkWidget *widget, GdkEventButton *event) {
Expand Down Expand Up @@ -268,14 268,13 @@ void person_click(GtkWidget *widget, GdkEventButton *event) {
}
}

void msggroup_click(GtkWidget *widget, GdkEventButton *event, GtkWidget *main) {
void msggroup_click(GtkWidget *widget, GdkEventButton *event, gpointer main) {
if(widget) {}
if(event->type == GDK_BUTTON_PRESS && event->button == 1)
creator_group(main);
creator_group((GtkWidget*)main);
}

static void *scrolling_to_bottom(void *p) {
GtkWidget *arrow = (GtkWidget*)p;
static void *scrolling_to_bottom() {
GtkAdjustment *adjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(t_msg.scrolled_message));
for (int i = 1; i <= 30; i ) {
gtk_adjustment_set_value(adjustment, gtk_adjustment_get_value(adjustment) i);
Expand All @@ -284,17 283,15 @@ static void *scrolling_to_bottom(void *p) {
}
gtk_adjustment_set_value(adjustment, G_MAXDOUBLE);
gtk_scrolled_window_set_vadjustment(GTK_SCROLLED_WINDOW(t_msg.scrolled_message), adjustment);
gtk_widget_hide(t_msg.scrolled_message);
gtk_widget_show(t_msg.scrolled_message);
gtk_widget_hide(arrow);
gtk_widget_show(arrow);
gtk_widget_reshow(t_msg.scrolled_message);
gtk_widget_reshow(t_msg.arrow);
return NULL;
}

void arrow_click(GtkWidget *widget, GdkEventButton *event, GtkWidget *arrow) {
void arrow_click(GtkWidget *widget, GdkEventButton *event) {
if(widget) {}
if(event->type == GDK_BUTTON_PRESS && event->button == 1) {
pthread_t scrolling_thread = NULL;
pthread_create(&scrolling_thread, NULL, scrolling_to_bottom, (void*)arrow);
pthread_create(&scrolling_thread, NULL, scrolling_to_bottom, NULL);
}
}
4 changes: 2 additions & 2 deletions client/src/events_settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 116,10 @@ void add_button_click(GtkWidget *widget, GdkEventButton *event) {
}
}

void gallery_button_click(GtkWidget *widget, GdkEventButton *event, GtkWidget *main) {
void gallery_button_click(GtkWidget *widget, GdkEventButton *event, gpointer main) {
if(widget) {}
if(event->type == GDK_BUTTON_PRESS && event->button == 1)
create_gallery(main);
create_gallery((GtkWidget*)main);
}

//
Expand Down
36 changes: 26 additions & 10 deletions client/src/screen_messanger.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 44,22 @@ void chat_clear_list(t_chat_list **list) {
}
}

static void arrow_move_enter_event(GtkWidget *widget) {
GtkStateFlags flags = gtk_widget_get_state_flags(GTK_WIDGET(widget));
if (!(flags & GTK_STATE_FLAG_LINK))
gtk_widget_set_state_flags(GTK_WIDGET(widget), GTK_STATE_FLAG_PRELIGHT, TRUE);
gtk_fixed_move(GTK_FIXED(t_msg.main), GTK_WIDGET(widget), WINDOW_WIDTH-LEFTBAR_W-40, WINDOW_HEIGHT-ENTRY_H-40);
gtk_widget_set_size_request(GTK_WIDGET(widget), 40, 40);
}

static void arrow_move_leave_event(GtkWidget *widget) {
GtkStateFlags flags = gtk_widget_get_state_flags(GTK_WIDGET(widget));
if (!(flags & GTK_STATE_FLAG_LINK))
gtk_widget_unset_state_flags(GTK_WIDGET(widget), GTK_STATE_FLAG_PRELIGHT);
gtk_fixed_move(GTK_FIXED(t_msg.main), GTK_WIDGET(widget), WINDOW_WIDTH-LEFTBAR_W-16, WINDOW_HEIGHT-ENTRY_H-40);
gtk_widget_set_size_request(GTK_WIDGET(widget), 16, 40);
}

static void build_list(GtkWidget *main)
{
GtkWidget *list_block = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
Expand Down Expand Up @@ -103,12 119,12 @@ static void build_list(GtkWidget *main)

static void build_entryfield(GtkWidget *main)
{
GtkWidget *arrow = gtk_event_box_new();
gtk_event_box_set_above_child(GTK_EVENT_BOX(arrow), TRUE);
gtk_widget_set_name(GTK_WIDGET(arrow), "arrowdown");
gtk_widget_set_size_request(GTK_WIDGET(arrow), 40, 70);
tooltip("Jump to present",arrow);
gtk_fixed_put(GTK_FIXED(main), arrow, WINDOW_WIDTH-117, WINDOW_HEIGHT-82);
t_msg.arrow = gtk_event_box_new();
gtk_event_box_set_above_child(GTK_EVENT_BOX(t_msg.arrow), TRUE);
gtk_widget_set_name(GTK_WIDGET(t_msg.arrow), "arrowdown");
gtk_widget_set_size_request(GTK_WIDGET(t_msg.arrow), 16, 40);
tooltip("Jump to present", t_msg.arrow);
gtk_fixed_put(GTK_FIXED(main), t_msg.arrow, WINDOW_WIDTH-LEFTBAR_W-16, WINDOW_HEIGHT-ENTRY_H-40);

GtkWidget *entry_block = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 10);
gtk_widget_set_name(GTK_WIDGET(entry_block), "entry_block");
Expand Down Expand Up @@ -154,16 170,16 @@ static void build_entryfield(GtkWidget *main)

g_signal_connect(G_OBJECT(send), "enter-notify-event", G_CALLBACK(event_enter_notify), NULL);
g_signal_connect(G_OBJECT(send), "leave-notify-event", G_CALLBACK(event_leave_notify), NULL);
g_signal_connect(G_OBJECT(send), "button_press_event", G_CALLBACK(send_click), t_msg.entry);
g_signal_connect(G_OBJECT(send), "button_press_event", G_CALLBACK(send_click), NULL);
g_signal_connect(G_OBJECT(t_msg.entry), "activate", G_CALLBACK(send_press), NULL);

g_signal_connect(G_OBJECT(sticker), "enter-notify-event", G_CALLBACK(event_enter_notify), NULL);
g_signal_connect(G_OBJECT(sticker), "leave-notify-event", G_CALLBACK(event_leave_notify), NULL);
g_signal_connect(G_OBJECT(sticker), "button_press_event", G_CALLBACK(sticker_click), main);

g_signal_connect(G_OBJECT(arrow), "enter-notify-event", G_CALLBACK(event_enter_notify), NULL);
g_signal_connect(G_OBJECT(arrow), "leave-notify-event", G_CALLBACK(event_leave_notify), NULL);
g_signal_connect(G_OBJECT(arrow), "button_press_event", G_CALLBACK(arrow_click), arrow);
g_signal_connect(G_OBJECT(t_msg.arrow), "enter-notify-event", G_CALLBACK(arrow_move_enter_event), NULL);
g_signal_connect(G_OBJECT(t_msg.arrow), "leave-notify-event", G_CALLBACK(arrow_move_leave_event), NULL);
g_signal_connect(G_OBJECT(t_msg.arrow), "button_press_event", G_CALLBACK(arrow_click), NULL);
}

// static gboolean scrolled (GtkWidget *widget, GdkEventButton *event)
Expand Down

0 comments on commit 7b12e86

Please sign in to comment.