diff options
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/Makefile.target | 2 | ||||
-rw-r--r-- | gtk/bitmap.c | 52 | ||||
-rw-r--r-- | gtk/completion.c | 2 | ||||
-rw-r--r-- | gtk/dialogs/preferences.c | 10 | ||||
-rw-r--r-- | gtk/dialogs/source.c | 2 | ||||
-rw-r--r-- | gtk/download.c | 2 | ||||
-rw-r--r-- | gtk/font_pango.c | 4 | ||||
-rw-r--r-- | gtk/gui.c | 87 | ||||
-rw-r--r-- | gtk/hotlist.c | 2 | ||||
-rw-r--r-- | gtk/options.h | 114 | ||||
-rw-r--r-- | gtk/plotters.c | 2 | ||||
-rw-r--r-- | gtk/print.c | 2 | ||||
-rw-r--r-- | gtk/scaffolding.c | 6 | ||||
-rw-r--r-- | gtk/system_colour.c | 282 | ||||
-rw-r--r-- | gtk/tabs.c | 2 | ||||
-rw-r--r-- | gtk/theme.c | 2 | ||||
-rw-r--r-- | gtk/window.c | 8 |
17 files changed, 186 insertions, 395 deletions
diff --git a/gtk/Makefile.target b/gtk/Makefile.target index 16b9325a7..ae67fd7f4 100644 --- a/gtk/Makefile.target +++ b/gtk/Makefile.target @@ -111,7 +111,7 @@ S_GTK := font_pango.c bitmap.c gui.c schedule.c thumbnail.c plotters.c \ treeview.c scaffolding.c gdk.c completion.c login.c throbber.c \ selection.c history.c window.c filetype.c download.c menu.c \ print.c search.c tabs.c theme.c toolbar.c gettext.c \ - compat.c cookies.c hotlist.c system_colour.c \ + compat.c cookies.c hotlist.c \ $(addprefix dialogs/,preferences.c about.c source.c) S_GTK := $(addprefix gtk/,$(S_GTK)) $(addprefix utils/,container.c) diff --git a/gtk/bitmap.c b/gtk/bitmap.c index 0f89c6748..96e9edaee 100644 --- a/gtk/bitmap.c +++ b/gtk/bitmap.c @@ -185,11 +185,56 @@ bool bitmap_get_opaque(void *vbitmap) unsigned char *bitmap_get_buffer(void *vbitmap) { struct bitmap *gbitmap = (struct bitmap *)vbitmap; + int pixel_loop; + int pixel_count; + uint32_t *pixels; + uint32_t pixel; + cairo_format_t fmt; + assert(gbitmap); cairo_surface_flush(gbitmap->surface); + pixels = (uint32_t *)cairo_image_surface_get_data(gbitmap->surface); + + if (!gbitmap->converted) + return (unsigned char *) pixels; + + fmt = cairo_image_surface_get_format(gbitmap->surface); + pixel_count = cairo_image_surface_get_width(gbitmap->surface) * + cairo_image_surface_get_height(gbitmap->surface); + + if (fmt == CAIRO_FORMAT_RGB24) { + for (pixel_loop=0; pixel_loop < pixel_count; pixel_loop++) { + pixel = pixels[pixel_loop]; + pixels[pixel_loop] = (pixel & 0xff00ff00) | + ((pixel & 0xff) << 16) | + ((pixel & 0xff0000) >> 16); + } + } else { + uint32_t t, r, g, b; + for (pixel_loop=0; pixel_loop < pixel_count; pixel_loop++) { + pixel = pixels[pixel_loop]; + t = (pixel & 0xff000000) >> 24; + if (t == 0) { + pixels[pixel_loop] = 0; + } else { + r = ((pixel & 0xff0000) >> 8) / t; + g = ((pixel & 0xff00)) / t; + b = ((pixel & 0xff) << 8) / t; + + r = (r > 255) ? 255 : r; + g = (g > 255) ? 255 : g; + b = (b > 255) ? 255 : b; + + pixels[pixel_loop] = (t << 24) | + (r) | (g << 8) | (b << 16); + } + } + } + + gbitmap->converted = false; - return cairo_image_surface_get_data(gbitmap->surface); + return (unsigned char *) pixels; } @@ -286,6 +331,11 @@ void bitmap_modified(void *vbitmap) { cairo_image_surface_get_height(gbitmap->surface); pixels = (uint32_t *)cairo_image_surface_get_data(gbitmap->surface); + if (gbitmap->converted) { + cairo_surface_mark_dirty(gbitmap->surface); + return; + } + if (fmt == CAIRO_FORMAT_RGB24) { for (pixel_loop=0; pixel_loop < pixel_count; pixel_loop++) { pixel = pixels[pixel_loop]; diff --git a/gtk/completion.c b/gtk/completion.c index d249db160..a0df08ad9 100644 --- a/gtk/completion.c +++ b/gtk/completion.c @@ -21,7 +21,7 @@ #include "content/urldb.h" #include "utils/log.h" -#include "desktop/options.h" +#include "utils/nsoption.h" GtkListStore *nsgtk_completion_list; diff --git a/gtk/dialogs/preferences.c b/gtk/dialogs/preferences.c index 2784eb7a1..f17f1ccb0 100644 --- a/gtk/dialogs/preferences.c +++ b/gtk/dialogs/preferences.c @@ -20,7 +20,7 @@ #include <math.h> #include "desktop/browser_private.h" -#include "desktop/options.h" +#include "utils/nsoption.h" #include "desktop/searchweb.h" #include "utils/log.h" #include "utils/utils.h" @@ -374,7 +374,7 @@ SPINBUTTON_SIGNALS(spinDiscCacheAge, disc_cache_age, 1.0) TOGGLEBUTTON_SIGNALS(checkDisablePopups, disable_popups) /* hide adverts */ -TOGGLEBUTTON_SIGNALS(checkHideAdverts, block_ads) +TOGGLEBUTTON_SIGNALS(checkHideAdverts, block_advertisements) /* enable javascript */ TOGGLEBUTTON_SIGNALS(checkEnableJavascript, enable_javascript) @@ -999,7 +999,7 @@ G_MODULE_EXPORT void nsgtk_preferences_dialogPreferences_response(GtkDialog *dlg, gint resid) { if (resid == GTK_RESPONSE_CLOSE) { - nsoption_write(options_file_location); + nsoption_write(options_file_location, NULL, NULL); gtk_widget_hide(GTK_WIDGET(dlg)); } } @@ -1008,7 +1008,7 @@ G_MODULE_EXPORT gboolean nsgtk_preferences_dialogPreferences_deleteevent(GtkDialog *dlg, struct ppref *priv) { - nsoption_write(options_file_location); + nsoption_write(options_file_location, NULL, NULL); gtk_widget_hide(GTK_WIDGET(dlg)); /* delt with it by hiding window, no need to destory widget by @@ -1019,7 +1019,7 @@ nsgtk_preferences_dialogPreferences_deleteevent(GtkDialog *dlg, G_MODULE_EXPORT void nsgtk_preferences_dialogPreferences_destroy(GtkDialog *dlg, struct ppref *priv) { - nsoption_write(options_file_location); + nsoption_write(options_file_location, NULL, NULL); } diff --git a/gtk/dialogs/source.c b/gtk/dialogs/source.c index c50679066..ef4e36eb3 100644 --- a/gtk/dialogs/source.c +++ b/gtk/dialogs/source.c @@ -33,7 +33,7 @@ #include "desktop/browser_private.h" #include "desktop/netsurf.h" #include "desktop/print.h" -#include "desktop/options.h" +#include "utils/nsoption.h" #include "utils/messages.h" #include "utils/url.h" #include "utils/utils.h" diff --git a/gtk/download.c b/gtk/download.c index 71b1aa633..e882ec798 100644 --- a/gtk/download.c +++ b/gtk/download.c @@ -30,7 +30,7 @@ #include "desktop/gui.h" #include "gtk/gui.h" #include "gtk/scaffolding.h" -#include "desktop/options.h" +#include "utils/nsoption.h" #include "gtk/download.h" #include "gtk/window.h" #include "gtk/compat.h" diff --git a/gtk/font_pango.c b/gtk/font_pango.c index de115fa64..6c7f1592f 100644 --- a/gtk/font_pango.c +++ b/gtk/font_pango.c @@ -34,7 +34,7 @@ #include "render/font.h" #include "utils/utils.h" #include "utils/log.h" -#include "desktop/options.h" +#include "utils/nsoption.h" static bool nsfont_width(const plot_font_style_t *fstyle, const char *string, size_t length, @@ -253,7 +253,7 @@ bool nsfont_paint(int x, int y, const char *string, size_t length, pango_layout_set_text(layout, string, length); line = pango_layout_get_line(layout, 0); - cairo_move_to(current_cr, x, y + 0.5); + cairo_move_to(current_cr, x, y); nsgtk_set_colour(fstyle->foreground); pango_cairo_show_layout_line(current_cr, line); @@ -49,7 +49,7 @@ #include "desktop/gui.h" #include "desktop/history_global_core.h" #include "desktop/netsurf.h" -#include "desktop/options.h" +#include "utils/nsoption.h" #include "desktop/save_complete.h" #include "desktop/save_pdf/pdf_plotters.h" #include "desktop/searchweb.h" @@ -241,8 +241,13 @@ nsgtk_init_glade(char **respath) widWarning = GTK_WIDGET(gtk_builder_get_object(gladeWarning, "labelWarning")); } -/* Documented in desktop/options.h */ -void gui_options_init_defaults(void) +/** + * Set option defaults for gtk frontend + * + * @param defaults The option table to update. + * @return error status. + */ +static nserror set_defaults(struct nsoption_s *defaults) { char *hdir = getenv("HOME"); char buf[PATH_MAX]; @@ -252,8 +257,10 @@ void gui_options_init_defaults(void) nsoption_setnull_charp(cookie_file, strdup(buf)); nsoption_setnull_charp(cookie_jar, strdup(buf)); if (nsoption_charp(cookie_file) == NULL || - nsoption_charp(cookie_jar) == NULL) - die("Failed initialising cookie options"); + nsoption_charp(cookie_jar) == NULL) { + LOG(("Failed initialising cookie options")); + return NSERROR_BAD_PARAMETER; + } if (nsoption_charp(downloads_directory) == NULL) { snprintf(buf, PATH_MAX, "%s/", hdir); @@ -276,8 +283,18 @@ void gui_options_init_defaults(void) nsoption_charp(ca_path) == NULL || nsoption_charp(downloads_directory) == NULL || nsoption_charp(hotlist_path) == NULL) { - die("Failed initialising string options"); + LOG(("Failed initialising string options")); + return NSERROR_BAD_PARAMETER; } + + /* set default font names */ + nsoption_set_charp(font_sans, strdup("Sans")); + nsoption_set_charp(font_serif, strdup("Serif")); + nsoption_set_charp(font_mono, strdup("Monospace")); + nsoption_set_charp(font_cursive, strdup("Serif")); + nsoption_set_charp(font_fantasy, strdup("Serif")); + + return NSERROR_OK; } static void check_options(char **respath) @@ -292,8 +309,8 @@ static void check_options(char **respath) * The GTK front end now correctly uses it as a proportion of window * width. Here we assume that a value of less than 15% is wrong * and set to the default two thirds. */ - if (nsoption_int(toolbar_status_width) < 1500) { - nsoption_set_int(toolbar_status_width, 6667); + if (nsoption_int(toolbar_status_size) < 1500) { + nsoption_set_int(toolbar_status_size, 6667); } /* user options should be stored in the users home directory */ @@ -308,15 +325,6 @@ static void check_options(char **respath) LOG(("Using '%s' as Print Settings file", buf)); print_options_file_location = strdup(buf); - /* check what the font settings are, setting them to a default font - * if they're not set - stops Pango whinging - */ -#define SETFONTDEFAULT(OPTION,y) if (nsoption_charp(OPTION) == NULL) nsoption_set_charp(OPTION, strdup((y))) - SETFONTDEFAULT(font_sans, "Sans"); - SETFONTDEFAULT(font_serif, "Serif"); - SETFONTDEFAULT(font_mono, "Monospace"); - SETFONTDEFAULT(font_cursive, "Serif"); - SETFONTDEFAULT(font_fantasy, "Serif"); } @@ -355,9 +363,6 @@ static void gui_init(int argc, char** argv, char **respath) nsurl *url; nserror error; - /* check user options */ - check_options(respath); - /* find the languages file */ languages_file_location = filepath_find(respath, "languages"); if ((languages_file_location == NULL) || @@ -515,12 +520,24 @@ static void nsgtk_check_homedir(void) } /** + * Ensures output logging stream is correctly configured + */ +static bool nslog_stream_configure(FILE *fptr) +{ + /* set log stream to be non-buffering */ + setbuf(fptr, NULL); + + return true; +} + +/** * Main entry point from OS. */ int main(int argc, char** argv) { char *messages; char *options; + nserror ret; /* check home directory is available */ nsgtk_check_homedir(); @@ -529,23 +546,39 @@ int main(int argc, char** argv) gtk_init(&argc, &argv); - /* set standard error to be non-buffering */ - setbuf(stderr, NULL); + /* initialise logging. Not fatal if it fails but not much we + * can do about it either. + */ + nslog_init(nslog_stream_configure, &argc, argv); + /* user options setup */ + ret = nsoption_init(set_defaults, &nsoptions, &nsoptions_default); + if (ret != NSERROR_OK) { + die("Options failed to initialise"); + } options = filepath_find(respaths, "Choices"); - messages = filepath_find(respaths, "Messages"); - - netsurf_init(&argc, &argv, options, messages); + nsoption_read(options, NULL); + free(options); + nsoption_commandline(&argc, argv, NULL); + check_options(respaths); /* check user options */ + /* common initialisation */ + messages = filepath_find(respaths, "Messages"); + ret = netsurf_init(messages); free(messages); - free(options); + if (ret != NSERROR_OK) { + die("NetSurf failed to initialise"); + } + /* run the browser */ gui_init(argc, argv, respaths); /* Ensure all scaffoldings are destroyed before we go into exit */ - while (scaf_list != NULL) + while (scaf_list != NULL) { nsgtk_scaffolding_destroy(scaf_list); + } + /* common finalisation */ netsurf_exit(); return 0; diff --git a/gtk/hotlist.c b/gtk/hotlist.c index d7b5b9e8f..d249d3444 100644 --- a/gtk/hotlist.c +++ b/gtk/hotlist.c @@ -18,7 +18,7 @@ #include "desktop/hotlist.h" -#include "desktop/options.h" +#include "utils/nsoption.h" #include "desktop/plotters.h" #include "desktop/tree.h" #include "gtk/gui.h" diff --git a/gtk/options.h b/gtk/options.h index 795eca91d..612809eac 100644 --- a/gtk/options.h +++ b/gtk/options.h @@ -1,5 +1,5 @@ /* - * Copyright 2006 Rob Kendrick <rjek@rjek.com> + * Copyright 2012 Vincent Sanders <vince@netsurf-browser.org> * * This file is part of NetSurf, http://www.netsurf-browser.org/ * @@ -16,68 +16,60 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef _NETSURF_DESKTOP_OPTIONS_INCLUDING_ -#error "Frontend options header cannot be included directly" -#endif - #ifndef _NETSURF_GTK_OPTIONS_H_ #define _NETSURF_GTK_OPTIONS_H_ -#define NSOPTION_EXTRA_DEFINE \ - bool render_resample; \ - bool downloads_clear; \ - bool request_overwrite; \ - char *downloads_directory; \ - char *url_file; \ - bool show_single_tab; \ - int button_type; \ - bool disable_popups; \ - bool disable_plugins; \ - int history_age; \ - bool hover_urls; \ - bool focus_new; \ - bool new_blank; \ - char *hotlist_path; \ - bool source_tab; \ - int current_theme; \ - int position_tab - -#define NSOPTION_EXTRA_DEFAULTS \ - .render_resample = true, \ - .downloads_clear = false, \ - .request_overwrite = true, \ - .downloads_directory = NULL, \ - .url_file = NULL, \ - .show_single_tab = false, \ - .button_type = 0, \ - .disable_popups = false, \ - .disable_plugins = false, \ - .history_age = 0, \ - .hover_urls = false, \ - .focus_new = false, \ - .new_blank = false, \ - .hotlist_path = NULL, \ - .source_tab = false, \ - .current_theme = 0, \ - .position_tab = 0 - -#define NSOPTION_EXTRA_TABLE \ -{ "render_resample", OPTION_BOOL, &nsoptions.render_resample }, \ -{ "downloads_clear", OPTION_BOOL, &nsoptions.downloads_clear }, \ -{ "request_overwrite", OPTION_BOOL, &nsoptions.request_overwrite }, \ -{ "downloads_directory",OPTION_STRING, &nsoptions.downloads_directory }, \ -{ "url_file", OPTION_STRING, &nsoptions.url_file }, \ -{ "show_single_tab", OPTION_BOOL, &nsoptions.show_single_tab }, \ -{ "button_type", OPTION_INTEGER, &nsoptions.button_type}, \ -{ "disable_popups", OPTION_BOOL, &nsoptions.disable_popups}, \ -{ "disable_plugins", OPTION_BOOL, &nsoptions.disable_plugins}, \ -{ "history_age", OPTION_INTEGER, &nsoptions.history_age}, \ -{ "hover_urls", OPTION_BOOL, &nsoptions.hover_urls}, \ -{ "focus_new", OPTION_BOOL, &nsoptions.focus_new}, \ -{ "new_blank", OPTION_BOOL, &nsoptions.new_blank}, \ -{ "hotlist_path", OPTION_STRING, &nsoptions.hotlist_path}, \ -{ "source_tab", OPTION_BOOL, &nsoptions.source_tab},\ -{ "current_theme", OPTION_INTEGER, &nsoptions.current_theme}, \ -{ "position_tab", OPTION_INTEGER, &nsoptions.position_tab} +/* currently nothing here */ #endif + +/* High quality image scaling */ +NSOPTION_BOOL(render_resample, true) + +/* clear downloads */ +NSOPTION_BOOL(downloads_clear, false) + +/* prompt before overwriting downloads */ +NSOPTION_BOOL(request_overwrite, true) + +/* location to download files to */ +NSOPTION_STRING(downloads_directory, NULL) + +/* where to store URL database */ +NSOPTION_STRING(url_file, NULL) + +/* Always show tabs even if there is only one */ +NSOPTION_BOOL(show_single_tab, false) + +/* size of buttons */ +NSOPTION_INTEGER(button_type, 0) + +/* disallow popup windows */ +NSOPTION_BOOL(disable_popups, false) + +/* disable content plugins */ +NSOPTION_BOOL(disable_plugins, false) + +/* number of days to keep history data */ +NSOPTION_INTEGER(history_age, 0) + +/* show urls in local history browser */ +NSOPTION_BOOL(hover_urls, false) + +/* bring new tabs to front */ +NSOPTION_BOOL(focus_new, false) + +/* new tabs are blank instead of homepage */ +NSOPTION_BOOL(new_blank, false) + +/* path to save hotlist file */ +NSOPTION_STRING(hotlist_path, NULL) + +/* open source views in a tab */ +NSOPTION_BOOL(source_tab, false) + +/* currently selected theme */ +NSOPTION_INTEGER(current_theme, 0) + +/* where tabs are positioned */ +NSOPTION_INTEGER(position_tab, 0) diff --git a/gtk/plotters.c b/gtk/plotters.c index 3af55b9d5..265061188 100644 --- a/gtk/plotters.c +++ b/gtk/plotters.c @@ -37,7 +37,7 @@ #include "gtk/plotters.h" #include "gtk/scaffolding.h" #include "render/font.h" -#include "desktop/options.h" +#include "utils/nsoption.h" #include "gtk/bitmap.h" GtkWidget *current_widget; diff --git a/gtk/print.c b/gtk/print.c index 02d89bbdb..68a96dc2d 100644 --- a/gtk/print.c +++ b/gtk/print.c @@ -33,7 +33,7 @@ #include "content/content.h" #include "content/hlcache.h" -#include "desktop/options.h" +#include "utils/nsoption.h" #include "desktop/plotters.h" #include "desktop/print.h" #include "desktop/printer.h" diff --git a/gtk/scaffolding.c b/gtk/scaffolding.c index 5abda6276..566197dcd 100644 --- a/gtk/scaffolding.c +++ b/gtk/scaffolding.c @@ -37,7 +37,7 @@ #include "desktop/hotlist.h" #include "desktop/gui.h" #include "desktop/netsurf.h" -#include "desktop/options.h" +#include "utils/nsoption.h" #include "desktop/plotters.h" #include "desktop/print.h" #include "desktop/save_complete.h" @@ -1286,7 +1286,7 @@ MULTIHANDLER(savewindowsize) int x,y,w,h; if (GTK_IS_PANED(g->status_pane)) { - nsoption_set_int(toolbar_status_width, + nsoption_set_int(toolbar_status_size, gtk_paned_get_position(g->status_pane)); } gtk_window_get_position(g->window, &x, &y); @@ -1297,7 +1297,7 @@ MULTIHANDLER(savewindowsize) nsoption_set_int(window_x, x); nsoption_set_int(window_y, y); - nsoption_write(options_file_location); + nsoption_write(options_file_location, NULL, NULL); return TRUE; } diff --git a/gtk/system_colour.c b/gtk/system_colour.c deleted file mode 100644 index 6c1fd81b5..000000000 --- a/gtk/system_colour.c +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Copyright 2011 Vincent Sanders <vince@netsurf-browser.org> - * - * This file is part of NetSurf, http://www.netsurf-browser.org/ - * - * NetSurf is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * NetSurf is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -/** \file - * System colour handling - * - */ - -#include "utils/utils.h" -#include "utils/log.h" -#include "desktop/gui.h" -#include "desktop/options.h" - -struct gui_system_colour_ctx { - const char *name; - int length; - css_color colour; - colour *option_colour; - lwc_string *lwcstr; -}; - -static struct gui_system_colour_ctx colour_list[] = { - { - "ActiveBorder", - SLEN("ActiveBorder"), - 0xff000000, - &nsoption_charp(sys_colour_ActiveBorder), - NULL - }, { - "ActiveCaption", - SLEN("ActiveCaption"), - 0xffdddddd, - &nsoption_charp(sys_colour_ActiveCaption), - NULL - }, { - "AppWorkspace", - SLEN("AppWorkspace"), - 0xffeeeeee, - &nsoption_charp(sys_colour_AppWorkspace), - NULL - }, { - "Background", - SLEN("Background"), - 0xff0000aa, - &nsoption_charp(sys_colour_Background), - NULL - }, { - "ButtonFace", - SLEN("ButtonFace"), - 0xffaaaaaa, - &nsoption_charp(sys_colour_ButtonFace), - NULL - }, { - "ButtonHighlight", - SLEN("ButtonHighlight"), - 0xffdddddd, - &nsoption_charp(sys_colour_ButtonHighlight), - NULL - }, { - "ButtonShadow", - SLEN("ButtonShadow"), - 0xffbbbbbb, - &nsoption_charp(sys_colour_ButtonShadow), - NULL - }, { - "ButtonText", - SLEN("ButtonText"), - 0xff000000, - &nsoption_charp(sys_colour_ButtonText), - NULL - }, { - "CaptionText", - SLEN("CaptionText"), - 0xff000000, - &nsoption_charp(sys_colour_CaptionText), - NULL - }, { - "GrayText", - SLEN("GrayText"), - 0xffcccccc, - &nsoption_charp(sys_colour_GrayText), - NULL - }, { - "Highlight", - SLEN("Highlight"), - 0xff0000ee, - &nsoption_charp(sys_colour_Highlight), - NULL - }, { - "HighlightText", - SLEN("HighlightText"), - 0xff000000, - &nsoption_charp(sys_colour_HighlightText), - NULL - }, { - "InactiveBorder", - SLEN("InactiveBorder"), - 0xffffffff, - &nsoption_charp(sys_colour_InactiveBorder), - NULL - }, { - "InactiveCaption", - SLEN("InactiveCaption"), - 0xffffffff, - &nsoption_charp(sys_colour_InactiveCaption), - NULL - }, { - "InactiveCaptionText", - SLEN("InactiveCaptionText"), - 0xffcccccc, - &nsoption_charp(sys_colour_InactiveCaptionText), - NULL - }, { - "InfoBackground", - SLEN("InfoBackground"), - 0xffaaaaaa, - &nsoption_charp(sys_colour_InfoBackground), - NULL - }, { - "InfoText", - SLEN("InfoText"), - 0xff000000, - &nsoption_charp(sys_colour_InfoText), - NULL - }, { - "Menu", - SLEN("Menu"), - 0xffaaaaaa, - &nsoption_charp(sys_colour_Menu), - NULL - }, { - "MenuText", - SLEN("MenuText"), - 0xff000000, - &nsoption_charp(sys_colour_MenuText), - NULL - }, { - "Scrollbar", - SLEN("Scrollbar"), - 0xffaaaaaa, - &nsoption_charp(sys_colour_Scrollbar), - NULL - }, { - "ThreeDDarkShadow", - SLEN("ThreeDDarkShadow"), - 0xff555555, - &nsoption_charp(sys_colour_ThreeDDarkShadow), - NULL - }, { - "ThreeDFace", - SLEN("ThreeDFace"), - 0xffdddddd, - &nsoption_charp(sys_colour_ThreeDFace), - NULL - }, { - "ThreeDHighlight", - SLEN("ThreeDHighlight"), - 0xffaaaaaa, - &nsoption_charp(sys_colour_ThreeDHighlight), - NULL - }, { - "ThreeDLightShadow", - SLEN("ThreeDLightShadow"), - 0xff999999, - &nsoption_charp(sys_colour_ThreeDLightShadow), - NULL - }, { - "ThreeDShadow", - SLEN("ThreeDShadow"), - 0xff777777, - &nsoption_charp(sys_colour_ThreeDShadow), - NULL - }, { - "Window", - SLEN("Window"), - 0xffaaaaaa, - &nsoption_charp(sys_colour_Window), - NULL - }, { - "WindowFrame", - SLEN("WindowFrame"), - 0xff000000, - &nsoption_charp(sys_colour_WindowFrame), - NULL - }, { - - "WindowText", - SLEN("WindowText"), - 0xff000000, - &nsoption_charp(sys_colour_WindowText), - NULL - }, - -}; - -#define colour_list_len (sizeof(colour_list) / sizeof(struct gui_system_colour_ctx)) - -static struct gui_system_colour_ctx *gui_system_colour_pw = NULL; - - -bool gui_system_colour_init(void) -{ - unsigned int ccount; - - if (gui_system_colour_pw != NULL) - return false; - - /* Intern colour strings */ - for (ccount = 0; ccount < colour_list_len; ccount++) { - if (lwc_intern_string(colour_list[ccount].name, - colour_list[ccount].length, - &(colour_list[ccount].lwcstr)) != lwc_error_ok) { - return false; - } - } - - /* pull in options if set (ie not transparent) */ - for (ccount = 0; ccount < colour_list_len; ccount++) { - if (*(colour_list[ccount].option_colour) != 0) { - colour_list[ccount].colour = *(colour_list[ccount].option_colour); - } - } - - gui_system_colour_pw = colour_list; - - return true; -} - -void gui_system_colour_finalize(void) -{ - unsigned int ccount; - - for (ccount = 0; ccount < colour_list_len; ccount++) { - lwc_string_unref(colour_list[ccount].lwcstr); - } -} - -colour gui_system_colour_char(const char *name) -{ - colour ret = 0xff00000; - unsigned int ccount; - - for (ccount = 0; ccount < colour_list_len; ccount++) { - if (strcmp(name, colour_list[ccount].name) == 0) { - ret = colour_list[ccount].colour; - break; - } - } - return ret; -} - -css_error gui_system_colour(void *pw, lwc_string *name, css_color *colour) -{ - unsigned int ccount; - bool match; - - for (ccount = 0; ccount < colour_list_len; ccount++) { - if (lwc_string_caseless_isequal(name, - colour_list[ccount].lwcstr, - &match) == lwc_error_ok && match) { - *colour = colour_list[ccount].colour; - return CSS_OK; - } - } - - return CSS_INVALID; -} diff --git a/gtk/tabs.c b/gtk/tabs.c index e68a192ad..462f6668e 100644 --- a/gtk/tabs.c +++ b/gtk/tabs.c @@ -24,7 +24,7 @@ #include "gtk/gui.h" #include "desktop/browser.h" #include "content/content.h" -#include "desktop/options.h" +#include "utils/nsoption.h" #include "desktop/search.h" #include "utils/utils.h" #include "gtk/search.h" diff --git a/gtk/theme.c b/gtk/theme.c index 402433c32..9d50c5931 100644 --- a/gtk/theme.c +++ b/gtk/theme.c @@ -31,7 +31,7 @@ #include "gtk/menu.h" #include "gtk/theme.h" #include "gtk/window.h" -#include "desktop/options.h" +#include "utils/nsoption.h" #include "gtk/dialogs/preferences.h" #include "utils/container.h" #include "utils/log.h" diff --git a/gtk/window.c b/gtk/window.c index 798181ae1..5edace8f3 100644 --- a/gtk/window.c +++ b/gtk/window.c @@ -30,7 +30,7 @@ #include "gtk/window.h" #include "desktop/browser_private.h" #include "desktop/mouse.h" -#include "desktop/options.h" +#include "utils/nsoption.h" #include "desktop/searchweb.h" #include "desktop/textinput.h" #include "gtk/compat.h" @@ -426,8 +426,6 @@ nsgtk_window_scroll_event(GtkWidget *widget, deltax *= nsgtk_adjustment_get_step_increment(hscroll); deltay *= nsgtk_adjustment_get_step_increment(vscroll); - LOG(("Scrolling %f, %f", deltax, deltay)); - if (browser_window_scroll_at_point(g->bw, event->x / g->bw->scale, event->y / g->bw->scale, @@ -595,12 +593,12 @@ static gboolean nsgtk_window_size_allocate_event(GtkWidget *widget, if (g->paned != NULL) { /* Set status bar / scroll bar proportion according to - * option_toolbar_status_width */ + * option_toolbar_status_size */ /* TODO: Probably want to detect when the user adjusts the * status bar width, remember that proportion for the * window, and use that here. */ gtk_paned_set_position(g->paned, - (nsoption_int(toolbar_status_width) * + (nsoption_int(toolbar_status_size) * allocation->width) / 10000); } |