Bug 435739 Poor performance of Firefox 3 with no X RENDER extension
[wine-gecko.git] / embedding / browser / gtk / tests / TestGtkEmbedNotebook.cpp
blob8f08bd55a41db0a1d13787d23d5115024ed769ff
1 #include <gtk/gtk.h>
2 #include <gtkmozembed.h>
3 #include <stdio.h>
4 #include "nsStringAPI.h"
5 #include "gtkmozembed_glue.cpp"
7 int main(int argc, char *argv[])
9 GtkWidget *window;
10 GtkWidget *label;
11 GtkWidget *mozembed;
12 GtkWidget *container;
13 char *url;
15 gtk_init(&argc, &argv);
17 static const GREVersionRange greVersion = {
18 "1.9a", PR_TRUE,
19 "2", PR_TRUE
22 char xpcomPath[PATH_MAX];
24 nsresult rv =
25 GRE_GetGREPathWithProperties(&greVersion, 1, nsnull, 0,
26 xpcomPath, sizeof(xpcomPath));
27 if (NS_FAILED(rv)) {
28 fprintf(stderr, "Couldn't find a compatible GRE.\n");
29 return 1;
32 rv = XPCOMGlueStartup(xpcomPath);
33 if (NS_FAILED(rv)) {
34 fprintf(stderr, "Couldn't start XPCOM.");
35 return 1;
38 rv = GTKEmbedGlueStartup();
39 if (NS_FAILED(rv)) {
40 fprintf(stderr, "Couldn't find GTKMozEmbed symbols.");
41 return 1;
44 char *lastSlash = strrchr(xpcomPath, '/');
45 if (lastSlash)
46 *lastSlash = '\0';
48 gtk_moz_embed_set_path(xpcomPath);
50 window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
52 container = gtk_notebook_new();
53 mozembed = gtk_moz_embed_new();
54 label = gtk_label_new("Can you see this message?\n"
55 "Once you switch to mozembed page "
56 "you never see this message.");
58 gtk_signal_connect(GTK_OBJECT(mozembed), "destroy",
59 GTK_SIGNAL_FUNC(gtk_main_quit),
60 NULL);
62 gtk_container_add(GTK_CONTAINER(window), container);
64 gtk_notebook_append_page(GTK_NOTEBOOK(container),
65 label,
66 gtk_label_new("gtk label"));
68 gtk_notebook_append_page(GTK_NOTEBOOK(container),
69 mozembed,
70 gtk_label_new("mozembed"));
75 gtk_widget_set_usize(window, 400, 300);
76 gtk_widget_show(mozembed);
77 gtk_widget_show(label);
78 gtk_widget_show_all(window);
80 url = (argc > 1) ? argv[1] : (char *)"localhost";
81 gtk_moz_embed_load_url(GTK_MOZ_EMBED(mozembed), url);
83 gtk_main();
85 return 0;