chat windows opened in maximized state, stealing focus
Konrad Gräfe
kglists at teamblind.de
Mon Jul 1 10:10:35 EDT 2019
Hello Olaf,
When you connect to an IRC bouncer like ZNC it sends JOINs for every
channel you are joined to. I guess your patch breaks Pidgin's behavior
in that case?
Also this patch has the potential to break a lot of 3rd party protocol
plugins (just as it did for the in-tree protocols you manually fixed).
Regards,
Konrad Gräfe
Am 27.06.2019 um 14:31 schrieb Olaf Hering:
> Am Fri, 22 Mar 2019 07:56:25 +0100
> schrieb Olaf Hering <olaf at aepfle.de>:
>
>> If for some reason the connection to GroupWise, IRC or RocketChat has to be (re)stablished, pidgin will just open a maximized, non-foreground window over all other open windows. This window may sometimes still have the keyboard focus, so test one is about to type ends up in the wrong window.
>
> I think the required fix in the release-2.x.y and default branch will look like shown below.
>
> It unveiled an longstanding bug:
> irc_msg_topicinfo() marks every just joined channel with a topic as unread. IRC msg "333" is most likely not very useful, despite bug#13317. Bug#15502 exist to track this breakage. The call to purple_conv_chat_write() needs a flag to mark the message as read, not sure which of the existing PurpleMessageFlags allows that.
>
> Now that chats are not stealing focus anymore once they are joined (joining is an asynchronous event that will happen multiple times at any random point in the future) it turned out that the IRC '/join #channel' command will not work anymore. If a channel is joined via the Buddy menu, gtk_blist_join_chat() uses the purple_conversation_present() API to present the joined chat. In this context it is known that the window must be shown. But a simple '/JOIN' typed into a chat window does not have any context. Such chat will be joined, but it will not have a UI representation. I'm not sure how to fix that. Perhaps the code that receives the typed text needs to extract potential commands and create an UI representation. Are there other protocols that have a concept of a manual '/JOIN' command?
>
> Let me know if I shall open a pull request for this patch.
>
> Olaf
>
> ---
> pidgin/gtkblist.c | 7 ++++---
> pidgin/gtkconv.c | 35 ++++++++---------------------------
> 2 files changed, 12 insertions(+), 30 deletions(-)
>
> --- a/pidgin/gtkblist.c
> +++ b/pidgin/gtkblist.c
> @@ -394,11 +394,12 @@ static void gtk_blist_join_chat(PurpleChat *chat)
> conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, name,
> account);
>
> - if (conv != NULL) {
> + if (conv)
> pidgin_conv_attach_to_conversation(conv);
> - purple_conversation_present(conv);
> - }
> + else
> + conv = purple_conversation_new(PURPLE_CONV_TYPE_CHAT, account, name);
>
> + purple_conversation_present(conv);
> serv_join_chat(purple_account_get_connection(account), components);
> g_free(chat_name);
> }
> --- a/pidgin/gtkconv.c
> +++ b/pidgin/gtkconv.c
> @@ -5312,8 +5312,8 @@ static void set_typing_font(GtkWidget *widget, GtkStyle *style, PidginConversati
> /**************************************************************************
> * Conversation UI operations
> **************************************************************************/
> -static void
> -private_gtkconv_new(PurpleConversation *conv, gboolean hidden)
> +void
> +pidgin_conv_new(PurpleConversation *conv)
> {
> PidginConversation *gtkconv;
> PurpleConversationType conv_type = purple_conversation_get_type(conv);
> @@ -5429,10 +5429,7 @@ private_gtkconv_new(PurpleConversation *conv, gboolean hidden)
> G_CALLBACK(gtk_widget_grab_focus),
> gtkconv->entry);
>
> - if (hidden)
> - pidgin_conv_window_add_gtkconv(hidden_convwin, gtkconv);
> - else
> - pidgin_conv_placement_place(gtkconv);
> + pidgin_conv_window_add_gtkconv(hidden_convwin, gtkconv);
>
> if (nick_colors == NULL) {
> nbr_nick_colors = NUM_NICK_COLORS;
> @@ -5443,26 +5440,10 @@ private_gtkconv_new(PurpleConversation *conv, gboolean hidden)
> pidgin_themes_smiley_themeize_custom(gtkconv->entry);
> }
>
> -static void
> -pidgin_conv_new_hidden(PurpleConversation *conv)
> -{
> - private_gtkconv_new(conv, TRUE);
> -}
> -
> -void
> -pidgin_conv_new(PurpleConversation *conv)
> -{
> - private_gtkconv_new(conv, FALSE);
> - if (PIDGIN_IS_PIDGIN_CONVERSATION(conv))
> - purple_signal_emit(pidgin_conversations_get_handle(),
> - "conversation-displayed", PIDGIN_CONVERSATION(conv));
> -}
> -
> static void
> received_im_msg_cb(PurpleAccount *account, char *sender, char *message,
> PurpleConversation *conv, PurpleMessageFlags flags)
> {
> - PurpleConversationUiOps *ui_ops = pidgin_conversations_get_conv_ui_ops();
> gboolean hide = FALSE;
> guint timer;
>
> @@ -5483,11 +5464,11 @@ received_im_msg_cb(PurpleAccount *account, char *sender, char *message,
> return;
> }
>
> - if (hide) {
> - ui_ops->create_conversation = pidgin_conv_new_hidden;
> + if (hide)
> purple_conversation_new(PURPLE_CONV_TYPE_IM, account, sender);
> - ui_ops->create_conversation = pidgin_conv_new;
> - }
> + else if (conv)
> + purple_conversation_present(conv);
> +
>
> /* Somebody wants to keep this conversation around, so don't time it out */
> if (conv) {
> @@ -7792,7 +7773,7 @@ pidgin_conv_attach(PurpleConversation *conv)
> purple_conversation_set_data(conv, "unseen-state", NULL);
> purple_conversation_set_ui_ops(conv, pidgin_conversations_get_conv_ui_ops());
> if (!PIDGIN_CONVERSATION(conv))
> - private_gtkconv_new(conv, FALSE);
> + pidgin_conv_new(conv);
> timer = GPOINTER_TO_INT(purple_conversation_get_data(conv, "close-timer"));
> if (timer) {
> purple_timeout_remove(timer);
>
>
> _______________________________________________
> Devel mailing list
> Devel at pidgin.im
> https://lists.pidgin.im/listinfo/devel
>
More information about the Devel
mailing list