/dev/qulogic/ckeditor: a8936349334b: Set up an automatic widget ...

Elliott Sales de Andrade qulogic at pidgin.im
Fri Aug 9 03:13:30 EDT 2013


Changeset: a8936349334b32aec0fb92c6c50e5dbc7a18d792
Author:	 Elliott Sales de Andrade <qulogic at pidgin.im>
Date:	 2013-08-08 17:17 -0400
Branch:	 default
URL: https://hg.pidgin.im/dev/qulogic/ckeditor/rev/a8936349334b

Description:

Set up an automatic widget height event.

diffstat:

 pidgin/gtkwebview.c          |  23 +++++++++++++++++++++++
 pidgin/gtkwebvieweditor.html |   8 ++++++++
 2 files changed, 31 insertions(+), 0 deletions(-)

diffs (68 lines):

diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c
--- a/pidgin/gtkwebview.c
+++ b/pidgin/gtkwebview.c
@@ -937,6 +937,25 @@ webview_navigation_decision(WebKitWebVie
 	return TRUE;
 }
 
+static gboolean
+webview_script_alert(WebKitWebView  *webview,
+                     WebKitWebFrame *frame,
+                     const gchar    *message)
+{
+	if (purple_str_has_prefix(message, "resize:")) {
+		int height;
+
+		if (sscanf(message, "resize:%d", &height) != 1)
+			return TRUE;
+
+		gtk_widget_set_size_request(GTK_WIDGET(webview), -1, height);
+
+		return TRUE;
+	}
+
+	return FALSE;
+}
+
 static GtkWidget *
 get_input_methods_menu(WebKitWebView *webview)
 {
@@ -1460,9 +1479,11 @@ static void
 gtk_webview_class_init(GtkWebViewClass *klass, gpointer userdata)
 {
 	GObjectClass *gobject_class;
+	WebKitWebViewClass *webview_class;
 	GtkBindingSet *binding_set;
 
 	parent_class = g_type_class_ref(webkit_web_view_get_type());
+	webview_class = WEBKIT_WEB_VIEW_CLASS(klass);
 	gobject_class = G_OBJECT_CLASS(klass);
 
 	g_type_class_add_private(klass, sizeof(GtkWebViewPriv));
@@ -1507,6 +1528,8 @@ gtk_webview_class_init(GtkWebViewClass *
 	klass->toggle_format = webview_toggle_format;
 	klass->clear_format = webview_clear_formatting;
 
+	webview_class->script_alert = webview_script_alert;
+
 	gobject_class->finalize = gtk_webview_finalize;
 
 	/* Key Bindings */
diff --git a/pidgin/gtkwebvieweditor.html b/pidgin/gtkwebvieweditor.html
--- a/pidgin/gtkwebvieweditor.html
+++ b/pidgin/gtkwebvieweditor.html
@@ -2,6 +2,14 @@
 <html>
 <head>
 	<script type="text/javascript" src="file://%s"></script>
+	<script type="text/javascript">
+	CKEDITOR.domReady(function () {
+		CKEDITOR.instances.input.on('autoGrow', function (event) {
+			console.log('autogrow: ' + event.data.newHeight);
+			alert('resize:' + event.data.newHeight);
+		});
+	});
+	</script>
 	<style>
 	body {margin: 0px; height:100%;}
 	#inform {height:100%;}



More information about the Commits mailing list