-
Notifications
You must be signed in to change notification settings - Fork 534
Fixed issue #1451 #2026
base: master
Are you sure you want to change the base?
Fixed issue #1451 #2026
Conversation
When --minimize flag is specified in HexChat execution command, its window now minimizes right after it starts. In the past, the Hexchat window oftem did not minimize until it finishes joining the network.
Seems to work on Windows 10. Without the patch it doesn't wait for a network to be joined for me but the window does appear for a brief second or two, with patch it's minimized from the start. |
src/common/hexchat.h
Outdated
@@ -359,6 +359,12 @@ typedef enum { | |||
TAB_STATE_NEW_HILIGHT = (1 << 2), | |||
} tab_state_flags; | |||
|
|||
typedef enum { //Works with gtkutil_window_new() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C89 style comments please: /* Works with gtkutil_window_new() */
src/common/hexchat.h
Outdated
START_WINDOWED = 0, | ||
START_ICONIFIED = 4, | ||
START_ON_TRAY = 8, | ||
} start_type; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
start_type_flags
to be consistent with other similar enums.
src/fe-gtk/chanview-tree.c
Outdated
@@ -264,7 +264,8 @@ cv_tree_focus (chan *ch) | |||
dest_y = cell_rect.y - ((vis_rect.height - cell_rect.height) * 0.5); | |||
if (dest_y < 0) | |||
dest_y = 0; | |||
gtk_tree_view_scroll_to_point (tree, -1, dest_y); | |||
if (gtk_widget_get_realized( GTK_WIDGET (tree) )) //When Hexchat is started with the flag --minimize=2, Fixes Gtk-CRITICAL **: IA__gtk_tree_view_scroll_to_point: assertion 'gtk_widget_get_realized (GTK_WIDGET (tree_view))' failed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whitespace issues
gtk_widget_get_realized (GTK_WIDGET (tree)))
src/fe-gtk/maingui.c
Outdated
@@ -3168,7 +3168,8 @@ mg_create_topwindow (session *sess) | |||
|
|||
mg_place_userlist_and_chanview (sess->gui); | |||
|
|||
gtk_widget_show (win); | |||
if(sess->start_state!=START_ON_TRAY) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whitespace
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the one below OK?
+ if(sess->start_state != START_ON_TRAY)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add space after if
src/fe-gtk/maingui.c
Outdated
@@ -3262,7 +3263,8 @@ mg_create_tabwindow (session *sess) | |||
|
|||
mg_place_userlist_and_chanview (sess->gui); | |||
|
|||
gtk_widget_show (win); | |||
if(sess->start_state!=START_ON_TRAY) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whitespace
src/fe-gtk/plugin-tray.c
Outdated
win = GTK_WINDOW (hexchat_get_info (ph, "gtkwin_ptr")); | ||
if (!win) | ||
return FALSE; | ||
return tray_toggle_visibility_win(win, force_hide); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whitespace
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to clarify. Is the code below the correct format?
+ win = GTK_WINDOW (hexchat_get_info (ph, "gtkwin_ptr"));
+ if (!win)
+ return FALSE;
+ return tray_toggle_visibility_win (win, force_hide);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
@TingPing Thanks for reviewing my code. Is there a coding style guideline for HexChat? I couldn't find it anywhere. :( |
@SadaleNet Sorry there is no formal document over it. =\ |
Some warnings to fix: ../src/fe-gtk/gtkutil.c: In function ‘gtkutil_window_new’:
../src/fe-gtk/gtkutil.c:605:31: warning: passing argument 1 of ‘tray_toggle_visibility_win’ from incompatible pointer type [-Wincompatible-pointer-types]
tray_toggle_visibility_win (win, TRUE);
^~~
In file included from ../src/fe-gtk/gtkutil.c:28:0:
../src/fe-gtk/plugin-tray.h:26:10: note: expected ‘GtkWindow * {aka struct _GtkWindow *}’ but argument is of type ‘GtkWidget * {aka struct _GtkWidget *}’
gboolean tray_toggle_visibility_win (GtkWindow *win, gboolean force_hide); |
src/fe-gtk/gtkutil.c
Outdated
@@ -598,6 +599,10 @@ gtkutil_window_new (char *title, char *role, int width, int height, int flags) | |||
gtk_window_set_transient_for (GTK_WINDOW (win), GTK_WINDOW (parent_window)); | |||
gtk_window_set_destroy_with_parent (GTK_WINDOW (win), TRUE); | |||
} | |||
if (flags & START_ICONIFIED) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are mixing two different sets of flags here which is very unclear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I knew. My pull request try to minimize the changes on the code.
How would you like me to fix that? Make the function accept one more parameter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any idea on how am I supposed to fix that? I wouldn't continue until you give me a pointer to the solution that you'd like to have.
Also, please try to give me all the feedback in batch. It's more time-efficient for us.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could add another argument for start flags.
When --minimize flag is specified in HexChat execution command, its window now minimizes right after it starts.
In the past, the Hexchat window often did not minimize until it finishes joining the network.