Re: Patch for chat_window.c

penguin365 <[email protected]> Sat, 28 Dec 2002 09:14:29 -0600
Newsgroups gmane.network.everybuddy.devel
Message-ID <[email protected]>
Ok.  I have the new patch.  I've copied and pasted it into the email.
I also attached it as well. (was sure which format worked best)


And the problem is that if the chat window is *already* open, but is being covered by another application,  my patch makes everybuddy raise the chat window to the top again.


On Sat, 28 Dec 2002 11:44:23 +0100
Colin Leroy <[email protected]> wrote:

> On Fri, 27 Dec 2002 23:51:38 -0600 penguin365 <[email protected]>
> wrote:
> 
> Hi,
> 
> > This patch causes Everybuddy to refocus and raise the chat window when
> > the user double clicks on a new or already open contact or account name.
> 
> this is already the case. Or doesn't it work with every WM ?
> 
> Btw, your patch is unreadable ;) try with 
> "diff -u old.file new.file > diff.file" or
> "cvs diff -u > diff.file"
> 
> Thanks,
> -- 
> Colin
> Random BOFH excuse:
> 	Yes, yes, its called a design limitation
> 


---------------begin chat_window.patch-------------------
--- chat_window.c	Wed Dec 11 05:29:28 2002
+++ /home/zadio/downloads/everybuddy/everybuddy-0.4.3cvs/src/chat_window.c	Fri Dec 27 23:40:59 2002
@@ -2169,7 +2169,7 @@
 		 cur_time->tm_hour, cur_time->tm_min, cur_time->tm_sec,
 		 account->alias);
       gtk_eb_html_add(EXT_GTK_TEXT(remote_contact->chatwindow->chat), buff,0,0,0);
-      gtk_eb_html_add(EXT_GTK_TEXT(remote_contact->chatwindow->chat),
+      gtk_eb_html_add(EXT_GTK_TEXT(remote_contact->chatwindow->chat),
 		      gtk_entry_get_text(GTK_ENTRY(away_message)),do_ignore_back,do_ignore_fore,do_ignore_font);
       gtk_eb_html_add(EXT_GTK_TEXT(remote_contact->chatwindow->chat), "<br>", 0,0,0);

@@ -2212,7 +2212,10 @@
 	make_safe_filename (buff, remote_contact->nick);
 	eb_restore_last_conv (buff, remote_contact->chatwindow);
       }
-      gtk_window_set_focus (GTK_WINDOW
+
+          gdk_window_raise(remote_contact->chatwindow->window->window);
+
+	gtk_window_set_focus (GTK_WINDOW
 			    (remote_contact->chatwindow->window),
 			    remote_contact->chatwindow->entry);
     }
@@ -2222,7 +2225,7 @@
     gtk_window_set_focus (GTK_WINDOW
 			    (remote_contact->chatwindow->window),
 			    remote_contact->chatwindow->entry);
-
+
   }

   if (remote_contact->chatwindow->notebook != NULL)
@@ -2259,46 +2262,62 @@
       if(remote_contact->chatwindow)
 	{
 	  gtk_widget_show(remote_contact->chatwindow->window);
-	  if (do_restore_last_conv)
+	  if (do_restore_last_conv)
 	    {
 	      gchar buff[NAME_MAX];
 	      make_safe_filename(buff, remote_contact->nick);
-	      eb_restore_last_conv(buff,remote_contact->chatwindow);	
+	      eb_restore_last_conv(buff,remote_contact->chatwindow);
 	    }
+
+          gdk_window_raise(remote_contact->chatwindow->window->window);
+
+	gtk_window_set_focus (GTK_WINDOW
+			    (remote_contact->chatwindow->window),
+			    remote_contact->chatwindow->entry);
+
 	}
-      else /* Did they get denied because they're in the Unknown group? */
+      else  /* Did they get denied because they're in the Unknown group? */
 	return;
     }
+    else
+    {
+        gdk_window_raise(remote_contact->chatwindow->window->window);
+
+	gtk_window_set_focus (GTK_WINDOW
+			    (remote_contact->chatwindow->window),
+			    remote_contact->chatwindow->entry);
+
+    }

   eb_update_window_title(remote_contact->chatwindow, FALSE);
-
-  if (remote_contact->chatwindow->notebook != NULL) 
+
+  if (remote_contact->chatwindow->notebook != NULL)
   {
     int page_num = gtk_notebook_page_num(GTK_NOTEBOOK(remote_contact->chatwindow->notebook),
 			                         remote_contact->chatwindow->notebook_child);
     /* no more icons in the tabs */
     /* gtk_widget_hide(remote_contact->chatwindow->talk_pixmap); */
-    set_tab_normal(GTK_NOTEBOOK(remote_contact->chatwindow->notebook), 
+    set_tab_normal(GTK_NOTEBOOK(remote_contact->chatwindow->notebook),
 		   remote_contact->chatwindow->notebook_child);
-    gtk_notebook_set_page(GTK_NOTEBOOK(remote_contact->chatwindow->notebook),
+    gtk_notebook_set_page(GTK_NOTEBOOK(remote_contact->chatwindow->notebook),
 			  page_num);
-	    
+
   } else {
     gtk_window_set_focus(GTK_WINDOW(remote_contact->chatwindow->window),
 			 remote_contact->chatwindow->entry);
   }
-	
+
   remote_contact->chatwindow->perfered = remote_account;
 }
-	
+
 void eb_log_status_changed(eb_account *ea, gchar *status)
 {
-	if(ea == NULL || ea->account_contact == NULL || 
+	if(ea == NULL || ea->account_contact == NULL ||
 			ea->account_contact->chatwindow == NULL ||
 			ea->account_contact->chatwindow->fp == NULL)
 		return;

-	eb_log_message(ea->account_contact->chatwindow->fp, ea->handle, 
+	eb_log_message(ea->account_contact->chatwindow->fp, ea->handle,
 			((status && status[0])?status:"Available"));
 }
 

---------------end chat_window.patch-------------------


-- 
+-----------------------------------------------------------------------------+
| penguin365                                                                  |
+-----------------------------------------------------------------------------+
| USER, n.:                                                                   |
|         The word computer professionals use when they mean "idiot".         |
|                 -- Dave Barry, "Claw Your Way to the Top"                   |
+-----------------------------------------------------------------------------+
chat_window.patch (application/octet-stream, 3.7 KB)
--- chat_window.c	Wed Dec 11 05:29:28 2002
+++ /home/zadio/downloads/everybuddy/everybuddy-0.4.3cvs/src/chat_window.c	Fri Dec 27 23:40:59 2002
@@ -2169,7 +2169,7 @@
 		 cur_time->tm_hour, cur_time->tm_min, cur_time->tm_sec,
 		 account->alias);
       gtk_eb_html_add(EXT_GTK_TEXT(remote_contact->chatwindow->chat), buff,0,0,0);
-      gtk_eb_html_add(EXT_GTK_TEXT(remote_contact->chatwindow->chat), 
+      gtk_eb_html_add(EXT_GTK_TEXT(remote_contact->chatwindow->chat),
 		      gtk_entry_get_text(GTK_ENTRY(away_message)),do_ignore_back,do_ignore_fore,do_ignore_font);
       gtk_eb_html_add(EXT_GTK_TEXT(remote_contact->chatwindow->chat), "<br>", 0,0,0);
 
@@ -2212,7 +2212,10 @@
 	make_safe_filename (buff, remote_contact->nick);
 	eb_restore_last_conv (buff, remote_contact->chatwindow);
       }
-      gtk_window_set_focus (GTK_WINDOW
+
+          gdk_window_raise(remote_contact->chatwindow->window->window);
+
+	gtk_window_set_focus (GTK_WINDOW
 			    (remote_contact->chatwindow->window),
 			    remote_contact->chatwindow->entry);
     }
@@ -2222,7 +2225,7 @@
     gtk_window_set_focus (GTK_WINDOW
 			    (remote_contact->chatwindow->window),
 			    remote_contact->chatwindow->entry);
-  
+
   }
 
   if (remote_contact->chatwindow->notebook != NULL)
@@ -2259,46 +2262,62 @@
       if(remote_contact->chatwindow)
 	{
 	  gtk_widget_show(remote_contact->chatwindow->window);
-	  if (do_restore_last_conv) 
+	  if (do_restore_last_conv)
 	    {
 	      gchar buff[NAME_MAX];
 	      make_safe_filename(buff, remote_contact->nick);
-	      eb_restore_last_conv(buff,remote_contact->chatwindow);	
+	      eb_restore_last_conv(buff,remote_contact->chatwindow);
 	    }
+
+          gdk_window_raise(remote_contact->chatwindow->window->window);
+
+	gtk_window_set_focus (GTK_WINDOW
+			    (remote_contact->chatwindow->window),
+			    remote_contact->chatwindow->entry);
+
 	}
-      else /* Did they get denied because they're in the Unknown group? */
+      else  /* Did they get denied because they're in the Unknown group? */
 	return;
     }
+    else
+    {
+        gdk_window_raise(remote_contact->chatwindow->window->window);
+
+	gtk_window_set_focus (GTK_WINDOW
+			    (remote_contact->chatwindow->window),
+			    remote_contact->chatwindow->entry);
+
+    }
 
   eb_update_window_title(remote_contact->chatwindow, FALSE);
-	
-  if (remote_contact->chatwindow->notebook != NULL) 
+
+  if (remote_contact->chatwindow->notebook != NULL)
   {
     int page_num = gtk_notebook_page_num(GTK_NOTEBOOK(remote_contact->chatwindow->notebook),
 			                         remote_contact->chatwindow->notebook_child);
     /* no more icons in the tabs */
     /* gtk_widget_hide(remote_contact->chatwindow->talk_pixmap); */
-    set_tab_normal(GTK_NOTEBOOK(remote_contact->chatwindow->notebook), 
+    set_tab_normal(GTK_NOTEBOOK(remote_contact->chatwindow->notebook),
 		   remote_contact->chatwindow->notebook_child);
-    gtk_notebook_set_page(GTK_NOTEBOOK(remote_contact->chatwindow->notebook), 
+    gtk_notebook_set_page(GTK_NOTEBOOK(remote_contact->chatwindow->notebook),
 			  page_num);
-	    
+
   } else {
     gtk_window_set_focus(GTK_WINDOW(remote_contact->chatwindow->window),
 			 remote_contact->chatwindow->entry);
   }
-	
+
   remote_contact->chatwindow->perfered = remote_account;
 }
-	
+
 void eb_log_status_changed(eb_account *ea, gchar *status)
 {
-	if(ea == NULL || ea->account_contact == NULL || 
+	if(ea == NULL || ea->account_contact == NULL ||
 			ea->account_contact->chatwindow == NULL ||
 			ea->account_contact->chatwindow->fp == NULL)
 		return;
 
-	eb_log_message(ea->account_contact->chatwindow->fp, ea->handle, 
+	eb_log_message(ea->account_contact->chatwindow->fp, ea->handle,
 			((status && status[0])?status:"Available"));
 }