[gtk+] [broadway] Make the toplevel mode a url parameter



commit d6beabbff271910bcfd51b906cbbe84a355a5857
Author: Alexander Larsson <alexl redhat com>
Date:   Fri Apr 8 15:36:07 2011 +0200

    [broadway] Make the toplevel mode a url parameter

 gdk/broadway/broadway.js           |    7 +++++++
 gdk/broadway/gdkdisplay-broadway.c |    6 +++++-
 2 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/gdk/broadway/broadway.js b/gdk/broadway/broadway.js
index f9b5949..8cefb06 100644
--- a/gdk/broadway/broadway.js
+++ b/gdk/broadway/broadway.js
@@ -1078,6 +1078,13 @@ function setupDocument(document)
 
 function connect()
 {
+    var url = window.location.toString();
+    var query_string = url.split("?");
+    if (query_string.length > 1) {
+	var params = query_string[1].split("&");
+	if (params[0].indexOf("toplevel") != -1)
+	    useToplevelWindows = true;
+    }
     var xhr = createXHR();
     if (xhr) {
 	if (typeof xhr.multipart == 'undefined') {
diff --git a/gdk/broadway/gdkdisplay-broadway.c b/gdk/broadway/gdkdisplay-broadway.c
index ff1180e..75a639f 100644
--- a/gdk/broadway/gdkdisplay-broadway.c
+++ b/gdk/broadway/gdkdisplay-broadway.c
@@ -750,7 +750,7 @@ send_data (HttpRequest *request,
 static void
 got_request (HttpRequest *request)
 {
-  char *start, *escaped, *tmp, *version;
+  char *start, *escaped, *tmp, *version, *query;
 
   if (!g_str_has_prefix (request->request->str, "GET "))
     {
@@ -777,6 +777,10 @@ got_request (HttpRequest *request)
       version = g_strndup (start, tmp - start);
     }
 
+  query = strchr (escaped, '?');
+  if (query)
+    *query = 0;
+
   if (strcmp (escaped, "/client.html") == 0 || strcmp (escaped, "/") == 0)
     send_data (request, "text/html", client_html, G_N_ELEMENTS(client_html) - 1);
   else if (strcmp (escaped, "/broadway.js") == 0)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]