about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMarco Peereboom <marco@conformal.com>2011-11-01 13:40:51 -0500
committerMarco Peereboom <marco@conformal.com>2011-11-01 13:40:51 -0500
commite9113922584a76a7f742116c9928033aba057acc (patch)
tree956771566b5a4e3935289806b94e2bc1d23370c8
parent2a18f0b29b50153241524d1d64e15c9bd5e83c1a (diff)
downloadxombrero-e9113922584a76a7f742116c9928033aba057acc.tar.gz
Should have been part of the previous commit
-rw-r--r--Makefile2
-rw-r--r--xxxterm.c229
2 files changed, 5 insertions, 226 deletions
diff --git a/Makefile b/Makefile
index ff49393..92d3adc 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@ BINDIR=${PREFIX}/bin
 PROG=xxxterm
 MAN=xxxterm.1
 
-SRCS= xxxterm.c marco.c
+SRCS= xxxterm.c inspector.c marco.c
 CFLAGS+= -O2
 DEBUG= -ggdb3
 LDADD= -lutil -lgcrypt
diff --git a/xxxterm.c b/xxxterm.c
index 767f73a..eb4b20f 100644
--- a/xxxterm.c
+++ b/xxxterm.c
@@ -19,104 +19,7 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/*
- * TODO:
- *	create privacy browsing
- *		- encrypted local data
- */
-
-#include <ctype.h>
-#include <dlfcn.h>
-#include <err.h>
-#include <errno.h>
-#include <libgen.h>
-#include <pwd.h>
-#include <regex.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <dirent.h>
-
-#include <sys/types.h>
-#include <sys/wait.h>
-#if defined(__linux__)
-#include "linux/util.h"
-#include "linux/tree.h"
-#include <bsd/stdlib.h>
-# if !defined(sane_libbsd_headers)
-void arc4random_buf(void *, size_t);
-# endif
-#elif defined(__FreeBSD__)
-#include <libutil.h>
-#include "freebsd/util.h"
-#include <sys/tree.h>
-#else /* OpenBSD */
-#include <util.h>
-#include <sys/tree.h>
-#endif
-#include <sys/queue.h>
-#include <sys/resource.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/un.h>
-
-#include <gtk/gtk.h>
-#include <gdk/gdkkeysyms.h>
-
-#if GTK_CHECK_VERSION(3,0,0)
-/* we still use GDK_* instead of GDK_KEY_* */
-#include <gdk/gdkkeysyms-compat.h>
-#endif
-
-#include <webkit/webkit.h>
-#include <libsoup/soup.h>
-#include <JavaScriptCore/JavaScript.h>
-#include <gnutls/gnutls.h>
-#include <gnutls/x509.h>
-
-/* comment if you don't want to use threads */
-#define USE_THREADS
-
-#ifdef USE_THREADS
-#include <gcrypt.h>
-#include <pthread.h>
-GCRY_THREAD_OPTION_PTHREAD_IMPL;
-#endif
-
-#include "version.h"
-#include "javascript.h"
-/*
-javascript.h borrowed from vimprobable2 under the following license:
-
-Copyright (c) 2009 Leon Winter
-Copyright (c) 2009-2011 Hannes Schueller
-Copyright (c) 2009-2010 Matto Fransen
-Copyright (c) 2010-2011 Hans-Peter Deifel
-Copyright (c) 2010-2011 Thomas Adam
-Copyright (c) 2011 Albert Kim
-Copyright (c) 2011 Daniel Carl
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
+#include "xxxterm.h"
 
 static char		*version = XXXTERM_VERSION;
 
@@ -127,23 +30,6 @@ void		(*_soup_cookie_jar_delete_cookie)(SoupCookieJar *,
 
 /*#define XT_DEBUG*/
 #ifdef XT_DEBUG
-#define DPRINTF(x...)		do { if (swm_debug) fprintf(stderr, x); } while (0)
-#define DNPRINTF(n,x...)	do { if (swm_debug & n) fprintf(stderr, x); } while (0)
-#define XT_D_MOVE		0x0001
-#define XT_D_KEY		0x0002
-#define XT_D_TAB		0x0004
-#define XT_D_URL		0x0008
-#define XT_D_CMD		0x0010
-#define XT_D_NAV		0x0020
-#define XT_D_DOWNLOAD		0x0040
-#define XT_D_CONFIG		0x0080
-#define XT_D_JS			0x0100
-#define XT_D_FAVORITE		0x0200
-#define XT_D_PRINTING		0x0400
-#define XT_D_COOKIE		0x0800
-#define XT_D_KEYBINDING		0x1000
-#define XT_D_CLIP		0x2000
-#define XT_D_BUFFERCMD		0x4000
 u_int32_t		swm_debug = 0
 			    | XT_D_MOVE
 			    | XT_D_KEY
@@ -161,20 +47,11 @@ u_int32_t		swm_debug = 0
 			    | XT_D_CLIP
 			    | XT_D_BUFFERCMD
 			    ;
-#else
-#define DPRINTF(x...)
-#define DNPRINTF(n,x...)
 #endif
 
-#define LENGTH(x)		(sizeof x / sizeof x[0])
-#define CLEAN(mask)		(mask & ~(GDK_MOD2_MASK) &	\
-				    ~(GDK_BUTTON1_MASK) &	\
-				    ~(GDK_BUTTON2_MASK) &	\
-				    ~(GDK_BUTTON3_MASK) &	\
-				    ~(GDK_BUTTON4_MASK) &	\
-				    ~(GDK_BUTTON5_MASK))
-
-#define XT_NOMARKS		(('z' - 'a' + 1) * 2 + 10)
+#ifdef USE_THREADS
+GCRY_THREAD_OPTION_PTHREAD_IMPL;
+#endif
 
 char		*icons[] = {
 	"xxxtermicon16.png",
@@ -184,89 +61,6 @@ char		*icons[] = {
 	"xxxtermicon128.png"
 };
 
-struct tab {
-	TAILQ_ENTRY(tab)	entry;
-	GtkWidget		*vbox;
-	GtkWidget		*tab_content;
-	struct {
-		GtkWidget	*label;
-		GtkWidget	*eventbox;
-		GtkWidget	*box;
-		GtkWidget	*sep;
-	} tab_elems;
-	GtkWidget		*label;
-	GtkWidget		*spinner;
-	GtkWidget		*uri_entry;
-	GtkWidget		*search_entry;
-	GtkWidget		*toolbar;
-	GtkWidget		*browser_win;
-	GtkWidget		*statusbar_box;
-	struct {
-		GtkWidget	*statusbar;
-		GtkWidget	*buffercmd;
-		GtkWidget	*zoom;
-		GtkWidget	*position;
-	} sbe;
-	GtkWidget		*cmd;
-	GtkWidget		*buffers;
-	GtkWidget		*oops;
-	GtkWidget		*backward;
-	GtkWidget		*forward;
-	GtkWidget		*stop;
-	GtkWidget		*gohome;
-	GtkWidget		*js_toggle;
-	GtkEntryCompletion	*completion;
-	guint			tab_id;
-	WebKitWebView		*wv;
-
-	WebKitWebHistoryItem		*item;
-	WebKitWebBackForwardList	*bfl;
-
-	/* favicon */
-	WebKitNetworkRequest	*icon_request;
-	WebKitDownload		*icon_download;
-	gchar			*icon_dest_uri;
-
-	/* adjustments for browser */
-	GtkScrollbar		*sb_h;
-	GtkScrollbar		*sb_v;
-	GtkAdjustment		*adjust_h;
-	GtkAdjustment		*adjust_v;
-
-	/* flags */
-	int			focus_wv;
-	int			ctrl_click;
-	gchar			*status;
-	int			xtp_meaning; /* identifies dls/favorites */
-	gchar			*tmp_uri;
-	int			popup; /* 1 if cmd_entry has popup visible */
-#ifdef USE_THREADS
-	/* https thread stuff */
-	GThread			*thread;
-#endif
-	/* hints */
-	int			script_init;
-	int			hints_on;
-	int			new_tab;
-
-	/* custom stylesheet */
-	int			styled;
-	char			*stylesheet;
-
-	/* search */
-	char			*search_text;
-	int			search_forward;
-	guint			search_id;
-
-	/* settings */
-	WebKitWebSettings	*settings;
-	gchar			*user_agent;
-
-	/* marks */
-	double			mark[XT_NOMARKS];
-};
-TAILQ_HEAD(tab_list, tab);
-
 struct history {
 	RB_ENTRY(history)	entry;
 	const gchar		*uri;
@@ -8971,21 +8765,6 @@ create_window(const gchar *name)
 	return (w);
 }
 
-WebKitWebView*
-inspector_inspect_web_view_cb(WebKitWebInspector inspector, WebKitWebView* wv,
-    struct tab *t;)
-{
-	GtkWidget	*inspector_window;
-	GtkWidget	*inspector_view;
-
-	inspector_window = create_window("inspector");
-	inspector_view = webkit_web_view_new();
-	gtk_container_add(GTK_CONTAINER(inspector_window), inspector_view);
-	gtk_widget_show_all(inspector_window);
-
-	return WEBKIT_WEB_VIEW(inspector_view);
-}
-
 GtkWidget *
 create_browser(struct tab *t)
 {