Re: chat windows opened in maximized state, stealing focus
Olaf Hering <[email protected]> Thu, 27 Jun 2019 14:31:31 +0200
| Newsgroups | gmane.comp.gnome.gaim.devel |
|---|---|
| Message-ID | <[email protected]> |
--===============6702079447607872716== Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/1ce_axk6ZlWkm6=+lT_2hyJ"; protocol="application/pgp-signature" --Sig_/1ce_axk6ZlWkm6=+lT_2hyJ Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Am Fri, 22 Mar 2019 07:56:25 +0100 schrieb Olaf Hering <[email protected]>: > 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 keyb= oard 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:=20 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 PurpleMes= sageFlags 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 poi= nt 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 ch= at. 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 f= ix that. Perhaps the code that receives the typed text needs to extract pot= ential 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 =3D purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, nam= e, account); =20 - if (conv !=3D NULL) { + if (conv) pidgin_conv_attach_to_conversation(conv); - purple_conversation_present(conv); - } + else + conv =3D purple_conversation_new(PURPLE_CONV_TYPE_CHAT, account, name); =20 + 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, GtkSty= le *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 =3D purple_conversation_get_type(conv); @@ -5429,10 +5429,7 @@ private_gtkconv_new(PurpleConversation *conv, gboole= an hidden) G_CALLBACK(gtk_widget_grab_focus), gtkconv->entry); =20 - if (hidden) - pidgin_conv_window_add_gtkconv(hidden_convwin, gtkconv); - else - pidgin_conv_placement_place(gtkconv); + pidgin_conv_window_add_gtkconv(hidden_convwin, gtkconv); =20 if (nick_colors =3D=3D NULL) { nbr_nick_colors =3D NUM_NICK_COLORS; @@ -5443,26 +5440,10 @@ private_gtkconv_new(PurpleConversation *conv, gbool= ean hidden) pidgin_themes_smiley_themeize_custom(gtkconv->entry); } =20 -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 =3D pidgin_conversations_get_conv_ui_ops(= ); gboolean hide =3D FALSE; guint timer; =20 @@ -5483,11 +5464,11 @@ received_im_msg_cb(PurpleAccount *account, char *se= nder, char *message, return; } =20 - if (hide) { - ui_ops->create_conversation =3D pidgin_conv_new_hidden; + if (hide) purple_conversation_new(PURPLE_CONV_TYPE_IM, account, sender); - ui_ops->create_conversation =3D pidgin_conv_new; - } + else if (conv) + purple_conversation_present(conv); + =20 /* 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 =3D GPOINTER_TO_INT(purple_conversation_get_data(conv, "close-timer= ")); if (timer) { purple_timeout_remove(timer); --Sig_/1ce_axk6ZlWkm6=+lT_2hyJ Content-Type: application/pgp-signature Content-Description: Digitale Signatur von OpenPGP -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEE97o7Um30LT3B+5b/86SN7mm1DoAFAl0UtyMACgkQ86SN7mm1 DoBJmQ//QF7d8wP0wta4KG/8yL2nZ0W1oWjZ977cSAvbFc5Bfwe0DkZ+iFiccmFE KN7tJdqPxdDyLgfJpsdVQFMhX3+FzAtaKkcN8yIhsuQZxycwhnkCk702cPhFW1Ya U63o8gYf1YIX6nwyy2dxo3ZZ8lzfXh+dKaihF7IdeK0et1cS5VTiGWkCGyraQe8R fFpjmDXo+HF1UKq3+dW4/7aWT7BJq/erxh6n2r2+KrllTCoLWJZF1XlMjBmRON5p cChjDqctMpyZJeuI6Ecdhg35XhEu2bJIvs9eDlyB99cjJwijAfu8uR4hRqIBqzgs k2kG+b+3UcDD7dvJxR6v/C4NfyGXpfnJLtGq5kurjmrZjdExtZmlmmz0PC7WIl1v cMpEOf9MotX4On+GJJlFaPM9bkl3wU3lvYYVPqQlQ4STlZpW4aeBuJCLnCe+Ae02 UviaBIJiHuofEqRrotp2ITDcXpjX35jMB57p6NrAysgD+U8icABScCzKPDhejaDj gO46guDFnKqb7/D6x/W1BPB+Wb+4igpv3rNJJsRpCmJSVvWUtJXN10nW2yWST5GV f93V/BsoPzPkqEzQcIKoYyqlLGdeogF+XZA7lMdtZKXMTC0NlKCQ62F3jrJz3v99 POtcPBAZnIHOH/tbqo4BWvO+J7jmhO7tuTzCHBZ8I9cN959Coxk= =U1Kk -----END PGP SIGNATURE----- --Sig_/1ce_axk6ZlWkm6=+lT_2hyJ-- --===============6702079447607872716== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KRGV2ZWwgbWFp bGluZyBsaXN0CkRldmVsQHBpZGdpbi5pbQpodHRwczovL2xpc3RzLnBpZGdpbi5pbS9saXN0aW5m by9kZXZlbA== --===============6702079447607872716==--