Add support for WebGL

WebKitGTK+ can be built with WebGL support and if we
are running under a version that includes it, expose
an option to enable it.

The feature is enabled by default for git builds.

Fixes: https://bugs.launchpad.net/midori/+bug/853665
This commit is contained in:
Martin Robinson 2012-01-02 18:28:22 -08:00 committed by Christian Dywan
parent bf7cfa902c
commit 5396456ec2
2 changed files with 26 additions and 0 deletions

View file

@ -393,6 +393,13 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
INDENTED_ADD (button); INDENTED_ADD (button);
button = katze_property_proxy (settings, "flash-window-on-new-bg-tabs", NULL); button = katze_property_proxy (settings, "flash-window-on-new-bg-tabs", NULL);
SPANNED_ADD (button); SPANNED_ADD (button);
if (katze_object_has_property (settings, "enable-webgl"))
{
button = katze_property_proxy (settings, "enable-webgl", NULL);
INDENTED_ADD (button);
}
FRAME_NEW (NULL); FRAME_NEW (NULL);
button = katze_property_label (settings, "preferred-languages"); button = katze_property_label (settings, "preferred-languages");
INDENTED_ADD (button); INDENTED_ADD (button);

View file

@ -145,6 +145,7 @@ enum
PROP_OPEN_TABS_NEXT_TO_CURRENT, PROP_OPEN_TABS_NEXT_TO_CURRENT,
PROP_OPEN_POPUPS_IN_TABS, PROP_OPEN_POPUPS_IN_TABS,
PROP_FLASH_WINDOW_ON_BG_TABS, PROP_FLASH_WINDOW_ON_BG_TABS,
PROP_ENABLE_WEBGL,
PROP_AUTO_LOAD_IMAGES, PROP_AUTO_LOAD_IMAGES,
PROP_ENABLE_SCRIPTS, PROP_ENABLE_SCRIPTS,
@ -788,6 +789,16 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
_("Flash the browser window if a new tab was opened in the background"), _("Flash the browser window if a new tab was opened in the background"),
FALSE, FALSE,
flags)); flags));
if (g_object_class_find_property (gobject_class, "enable-webgl"))
g_object_class_install_property (gobject_class,
PROP_ENABLE_WEBGL,
g_param_spec_boolean (
"enable-webgl",
_("Enable WebGL support"),
_("Allow websites to use OpenGL rendering"),
/* Enable by default for git builds */
!g_str_equal (PACKAGE_VERSION, MIDORI_VERSION),
flags));
/** /**
* MidoriWebSettings:zoom-text-and-images: * MidoriWebSettings:zoom-text-and-images:
@ -1574,6 +1585,10 @@ midori_web_settings_set_property (GObject* object,
case PROP_FLASH_WINDOW_ON_BG_TABS: case PROP_FLASH_WINDOW_ON_BG_TABS:
web_settings->flash_window_on_bg_tabs = g_value_get_boolean (value); web_settings->flash_window_on_bg_tabs = g_value_get_boolean (value);
break; break;
case PROP_ENABLE_WEBGL:
g_object_set (web_settings, "WebKitWebSettings::enable-webgl",
g_value_get_boolean (value), NULL);
break;
case PROP_USER_STYLESHEET_URI: case PROP_USER_STYLESHEET_URI:
{ {
gint old_len = web_settings->user_stylesheet_uri_cached gint old_len = web_settings->user_stylesheet_uri_cached
@ -1859,6 +1874,10 @@ midori_web_settings_get_property (GObject* object,
case PROP_FLASH_WINDOW_ON_BG_TABS: case PROP_FLASH_WINDOW_ON_BG_TABS:
g_value_set_boolean (value, web_settings->flash_window_on_bg_tabs); g_value_set_boolean (value, web_settings->flash_window_on_bg_tabs);
break; break;
case PROP_ENABLE_WEBGL:
g_value_set_boolean (value, katze_object_get_boolean (web_settings,
"WebKitWebSettings::enable-webgl"));
break;
case PROP_USER_STYLESHEET_URI: case PROP_USER_STYLESHEET_URI:
g_value_take_string (value, katze_object_get_string (web_settings, g_value_take_string (value, katze_object_get_string (web_settings,
"WebKitWebSettings::user-stylesheet-uri")); "WebKitWebSettings::user-stylesheet-uri"));