Author: andreia
Date: 2008-02-05 22:12:07 -0500 (Tue, 05 Feb 2008)
New Revision: 94986

Modified:
   branches/mono-1-9/gluezilla/src/BrowserWindow.cpp
   branches/mono-1-9/gluezilla/src/ChangeLog
Log:
2008-02-06  Andreia Gaita <[EMAIL PROTECTED]>
[Backport to 1.9]
* BrowserWindow.cpp: use ns strings, easier. Don't call up status 
with the text yet, there's a problem with the string being released
somewhere. Only attach focus events on non-win32, windows seems to work
perfectly fine without it (and it loops endlessly with it)

Modified: branches/mono-1-9/gluezilla/src/BrowserWindow.cpp
===================================================================
--- branches/mono-1-9/gluezilla/src/BrowserWindow.cpp   2008-02-06 03:06:58 UTC 
(rev 94985)
+++ branches/mono-1-9/gluezilla/src/BrowserWindow.cpp   2008-02-06 03:12:07 UTC 
(rev 94986)
@@ -303,10 +303,10 @@
 // Events
 nsresult BrowserWindow::AttachEvent (nsIDOMEventTarget * target, const char * 
type, const char * name) 
 {
-       char * string = (char*)malloc (strlen(type) + strlen(name) + 1);
-       if (!string)
-               return NS_ERROR_FAILURE;
-       sprintf(string, "%s:%s", type, name);
+       nsEmbedCString typeName (type);
+       typeName.Append (":");
+       typeName.Append (name);
+       const char * string = typeName.get();
        listeners [string] = new EventListener ();
        listeners [string]->target = target;
        listeners [string]->owner = this;
@@ -317,10 +317,10 @@
 
 nsresult BrowserWindow::DettachEvent (const char * type, const char * name) 
 {
-       char * string = (char*)malloc (strlen(type) + strlen(name) + 1);
-       if (!string)
-               return NS_ERROR_FAILURE;
-       sprintf(string, "%s:%s", type, name);
+       nsEmbedCString typeName (type);
+       typeName.Append (":");
+       typeName.Append (name);
+       const char * string = typeName.get();
        if (listeners[string] != nsnull) {
                nsresult rv = listeners[string]->target->RemoveEventListener 
(NS_ConvertUTF8toUTF16 (name, strlen (name)), listeners[string], PR_TRUE);
                listeners.erase (string);
@@ -372,8 +372,8 @@
 NS_IMETHODIMP 
 BrowserWindow::SetStatus(PRUint32 statusType, const PRUnichar *status)
 {
-       statusText = (char *)NS_ConvertUTF16toUTF8( status ).get();
-       owner->events->OnStatusChange (statusText, 100);
+       //statusText = (char *)NS_ConvertUTF16toUTF8( status ).get();
+       owner->events->OnStatusChange ("", 100);
        return NS_OK;
 }
 
@@ -476,7 +476,9 @@
                nsCOMPtr< nsIDOMEventTarget > target = do_QueryInterface( 
window );
                AttachEvent ( target, "window", "load" );
                AttachEvent ( target, "window", "unload" );
+#ifndef XP_WIN32
                AttachEvent ( target, "window", "focus" );
+#endif
                AttachEvent ( target, "window", "blur" );
                AttachEvent ( target, "window", "abort" );
                AttachEvent ( target, "window", "error" );

Modified: branches/mono-1-9/gluezilla/src/ChangeLog
===================================================================
--- branches/mono-1-9/gluezilla/src/ChangeLog   2008-02-06 03:06:58 UTC (rev 
94985)
+++ branches/mono-1-9/gluezilla/src/ChangeLog   2008-02-06 03:12:07 UTC (rev 
94986)
@@ -1,3 +1,10 @@
+2008-02-06  Andreia Gaita <[EMAIL PROTECTED]>
+       [Backport to 1.9]
+       * BrowserWindow.cpp: use ns strings, easier. Don't call up status 
+       with the text yet, there's a problem with the string being released
+       somewhere. Only attach focus events on non-win32, windows seems to work
+       perfectly fine without it (and it loops endlessly with it)
+
 2008-01-30  Andreia Gaita <[EMAIL PROTECTED]>
 
        * windows.mak: add local directory for includes.

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to