(defun help-fns--editable-variable (start end variable value buffer)
(when (and (readablep value)
- (not (boundp value))
- (not (fboundp value))
+ (not (and (symbolp value) (boundp value)))
+ (not (and (symbolp value) (fboundp value)))
help-enable-variable-value-editing)
(add-text-properties
start end
(defvar haiku-initialized)
(defvar haiku-signal-invalid-refs)
(defvar haiku-drag-track-function)
+(defvar haiku-allowed-ui-colors)
(defvar haiku-dnd-selection-value nil
"The local value of the special `XdndSelection' selection.")
`gui-set-selection'. See the doc string of `haiku-drag-message'
for more details on the structure of the associations.")
+;; This list has to be set correctly, otherwise Emacs will crash upon
+;; encountering an invalid color.
+(setq haiku-allowed-ui-colors
+ ["B_PANEL_BACKGROUND_COLOR" "B_MENU_BACKGROUND_COLOR"
+ "B_WINDOW_TAB_COLOR" "B_KEYBOARD_NAVIGATION_COLOR"
+ "B_DESKTOP_COLOR" "B_MENU_SELECTED_BACKGROUND_COLOR"
+ "B_MENU_ITEM_TEXT_COLOR" "B_MENU_SELECTED_ITEM_TEXT_COLOR"
+ "B_MENU_SELECTED_BORDER_COLOR" "B_PANEL_TEXT_COLOR"
+ "B_DOCUMENT_BACKGROUND_COLOR" "B_DOCUMENT_TEXT_COLOR"
+ "B_CONTROL_BACKGROUND_COLOR" "B_CONTROL_TEXT_COLOR"
+ "B_CONTROL_BORDER_COLOR" "B_CONTROL_HIGHLIGHT_COLOR"
+ "B_NAVIGATION_PULSE_COLOR" "B_SHINE_COLOR"
+ "B_SHADOW_COLOR" "B_TOOLTIP_BACKGROUND_COLOR"
+ "B_TOOLTIP_TEXT_COLOR" "B_WINDOW_TEXT_COLOR"
+ "B_WINDOW_INACTIVE_TAB_COLOR" "B_WINDOW_INACTIVE_TEXT_COLOR"
+ "B_WINDOW_BORDER_COLOR" "B_WINDOW_INACTIVE_BORDER_COLOR"
+ "B_CONTROL_MARK_COLOR" "B_LIST_BACKGROUND_COLOR"
+ "B_LIST_SELECTED_BACKGROUND_COLOR" "B_LIST_ITEM_TEXT_COLOR"
+ "B_LIST_SELECTED_ITEM_TEXT_COLOR" "B_SCROLL_BAR_THUMB_COLOR"
+ "B_LINK_TEXT_COLOR" "B_LINK_HOVER_COLOR"
+ "B_LINK_VISITED_COLOR" "B_LINK_ACTIVE_COLOR"
+ "B_STATUS_BAR_COLOR" "B_SUCCESS_COLOR" "B_FAILURE_COLOR"])
+
(defun haiku-selection-bounds (value)
"Return bounds of selection value VALUE.
The return value is a list (BEG END BUF) if VALUE is a cons of
w->UnlockLooper ();
}
}
+
+int
+be_get_ui_color (const char *name, uint32_t *color)
+{
+ color_which which;
+ rgb_color rgb;
+
+ which = which_ui_color (name);
+
+ if (which == B_NO_COLOR)
+ return 1;
+
+ rgb = ui_color (which);
+ *color = (rgb.blue | rgb.green << 8
+ | rgb.red << 16 | 255 << 24);
+
+ return 0;
+}
extern bool be_use_subpixel_antialiasing (void);
extern const char *be_find_setting (const char *);
extern haiku_font_family_or_style *be_list_font_families (size_t *);
+extern int be_get_ui_color (const char *, uint32 *);
extern void BMessage_delete (void *);
extern bool be_drag_and_drop_in_progress (void);
extern bool be_replay_menu_bar_event (void *, struct haiku_menu_bar_click_event *);
-
#ifdef __cplusplus
}
{
unsigned short r16, g16, b16;
Lisp_Object tem, col;
- int32 clr;
+ int32 clr, rc;
+ uint32_t ui_color;
+ ptrdiff_t size, i;
+ Lisp_Object string;
if (parse_color_spec (name, &r16, &g16, &b16))
{
return 0;
}
}
-
unblock_input ();
}
- return 1;
+ rc = 1;
+ if (VECTORP (Vhaiku_allowed_ui_colors))
+ {
+ size = ASIZE (Vhaiku_allowed_ui_colors);
+
+ for (i = 0; i < size; ++i)
+ {
+ string = AREF (Vhaiku_allowed_ui_colors, i);
+
+ block_input ();
+ if (STRINGP (string) && !strcmp (SSDATA (string), name))
+ rc = be_get_ui_color (name, &ui_color);
+ unblock_input ();
+ }
+ }
+
+ if (!rc)
+ {
+ color->pixel = ui_color;
+ color->red = RED_FROM_ULONG (ui_color) * 257;
+ color->green = GREEN_FROM_ULONG (ui_color) * 257;
+ color->blue = BLUE_FROM_ULONG (ui_color) * 257;
+ }
+
+ return rc;
}
static struct haiku_display_info *
doc: /* SKIP: real doc in xfns.c. */);
Vx_cursor_fore_pixel = Qnil;
+ DEFVAR_LISP ("haiku-allowed-ui-colors", Vhaiku_allowed_ui_colors,
+ doc: /* Vector of UI colors that Emacs can look up from the system.
+If this is set up incorrectly, Emacs can crash when encoutering an
+invalid color. */);
+ Vhaiku_allowed_ui_colors = Qnil;
+
#ifdef USE_BE_CAIRO
DEFVAR_LISP ("cairo-version-string", Vcairo_version_string,
doc: /* Version info for cairo. */);
color_file = Fexpand_file_name (build_string ("rgb.txt"),
Fsymbol_value (intern ("data-directory")));
-
color_map = Fx_load_color_file (color_file);
+
if (NILP (color_map))
fatal ("Could not read %s.\n", SDATA (color_file));
dpyinfo->color_map = color_map;
-
dpyinfo->display = BApplication_setup ();
-
- BScreen_res (&dpyinfo->resx, &dpyinfo->resy);
-
dpyinfo->next = x_display_list;
dpyinfo->n_planes = be_get_display_planes ();
x_display_list = dpyinfo;
+ BScreen_res (&dpyinfo->resx, &dpyinfo->resy);
+
terminal = haiku_create_terminal (dpyinfo);
if (current_kboard == initial_kboard)
current_kboard = terminal->kboard;