Run source tree through uncrustify
.uncrustify.cfg committed for future reference also, but had to manually fix up a few things: it really likes justifying struct initialisers. Signed-off-by: Daniel Stone <daniel@fooishbar.org>master
parent
c6c937abc2
commit
9308a46039
|
@ -0,0 +1,228 @@
|
||||||
|
tok_split_gte=false
|
||||||
|
utf8_byte=true
|
||||||
|
utf8_force=true
|
||||||
|
indent_cmt_with_tabs=false
|
||||||
|
indent_align_string=false
|
||||||
|
indent_braces=false
|
||||||
|
indent_braces_no_func=false
|
||||||
|
indent_braces_no_class=false
|
||||||
|
indent_braces_no_struct=false
|
||||||
|
indent_brace_parent=false
|
||||||
|
indent_namespace=false
|
||||||
|
indent_extern=false
|
||||||
|
indent_class=false
|
||||||
|
indent_class_colon=false
|
||||||
|
indent_else_if=false
|
||||||
|
indent_var_def_cont=false
|
||||||
|
indent_func_call_param=false
|
||||||
|
indent_func_def_param=false
|
||||||
|
indent_func_proto_param=false
|
||||||
|
indent_func_class_param=false
|
||||||
|
indent_func_ctor_var_param=false
|
||||||
|
indent_template_param=false
|
||||||
|
indent_func_param_double=false
|
||||||
|
indent_relative_single_line_comments=false
|
||||||
|
indent_col1_comment=false
|
||||||
|
indent_access_spec_body=false
|
||||||
|
indent_paren_nl=false
|
||||||
|
indent_comma_paren=false
|
||||||
|
indent_bool_paren=false
|
||||||
|
indent_first_bool_expr=false
|
||||||
|
indent_square_nl=false
|
||||||
|
indent_preserve_sql=false
|
||||||
|
indent_align_assign=true
|
||||||
|
sp_balance_nested_parens=false
|
||||||
|
align_keep_tabs=false
|
||||||
|
align_with_tabs=false
|
||||||
|
align_on_tabstop=false
|
||||||
|
align_number_left=false
|
||||||
|
align_func_params=false
|
||||||
|
align_same_func_call_params=false
|
||||||
|
align_var_def_colon=true
|
||||||
|
align_var_def_attribute=true
|
||||||
|
align_var_def_inline=true
|
||||||
|
align_right_cmt_mix=false
|
||||||
|
align_on_operator=false
|
||||||
|
align_mix_var_proto=false
|
||||||
|
align_single_line_func=false
|
||||||
|
align_single_line_brace=false
|
||||||
|
align_nl_cont=false
|
||||||
|
align_left_shift=true
|
||||||
|
align_oc_decl_colon=true
|
||||||
|
nl_collapse_empty_body=true
|
||||||
|
nl_assign_leave_one_liners=true
|
||||||
|
nl_class_leave_one_liners=true
|
||||||
|
nl_enum_leave_one_liners=true
|
||||||
|
nl_getset_leave_one_liners=true
|
||||||
|
nl_func_leave_one_liners=true
|
||||||
|
nl_if_leave_one_liners=true
|
||||||
|
nl_multi_line_cond=false
|
||||||
|
nl_multi_line_define=false
|
||||||
|
nl_before_case=true
|
||||||
|
nl_after_case=true
|
||||||
|
nl_after_return=false
|
||||||
|
nl_after_semicolon=true
|
||||||
|
nl_after_brace_open=true
|
||||||
|
nl_after_brace_open_cmt=false
|
||||||
|
nl_after_vbrace_open=false
|
||||||
|
nl_after_vbrace_open_empty=false
|
||||||
|
nl_after_brace_close=false
|
||||||
|
nl_after_vbrace_close=false
|
||||||
|
nl_define_macro=false
|
||||||
|
nl_squeeze_ifdef=false
|
||||||
|
nl_ds_struct_enum_cmt=false
|
||||||
|
nl_ds_struct_enum_close_brace=false
|
||||||
|
nl_create_if_one_liner=false
|
||||||
|
nl_create_for_one_liner=false
|
||||||
|
nl_create_while_one_liner=false
|
||||||
|
ls_for_split_full=false
|
||||||
|
ls_func_split_full=false
|
||||||
|
nl_after_multiline_comment=false
|
||||||
|
eat_blanks_after_open_brace=false
|
||||||
|
eat_blanks_before_close_brace=false
|
||||||
|
mod_full_brace_if_chain=false
|
||||||
|
mod_pawn_semicolon=false
|
||||||
|
mod_full_paren_if_bool=false
|
||||||
|
mod_remove_extra_semicolon=false
|
||||||
|
mod_sort_import=false
|
||||||
|
mod_sort_using=false
|
||||||
|
mod_sort_include=false
|
||||||
|
mod_move_case_break=false
|
||||||
|
mod_remove_empty_return=false
|
||||||
|
cmt_indent_multi=true
|
||||||
|
cmt_c_group=false
|
||||||
|
cmt_c_nl_start=false
|
||||||
|
cmt_c_nl_end=false
|
||||||
|
cmt_cpp_group=false
|
||||||
|
cmt_cpp_nl_start=false
|
||||||
|
cmt_cpp_nl_end=false
|
||||||
|
cmt_cpp_to_c=true
|
||||||
|
cmt_star_cont=true
|
||||||
|
cmt_multi_check_last=true
|
||||||
|
cmt_insert_before_preproc=false
|
||||||
|
pp_indent_at_level=false
|
||||||
|
pp_region_indent_code=false
|
||||||
|
pp_if_indent_code=false
|
||||||
|
pp_define_at_level=false
|
||||||
|
indent_columns=4
|
||||||
|
indent_brace=0
|
||||||
|
indent_switch_case=0
|
||||||
|
align_struct_init_span=2
|
||||||
|
align_pp_define_gap=0
|
||||||
|
align_pp_define_span=2
|
||||||
|
align_oc_msg_colon_span=16
|
||||||
|
nl_end_of_file_min=1
|
||||||
|
nl_func_var_def_blk=0
|
||||||
|
code_width=78
|
||||||
|
nl_max=2
|
||||||
|
newlines=auto
|
||||||
|
indent_with_tabs=0
|
||||||
|
sp_arith=force
|
||||||
|
sp_assign=force
|
||||||
|
sp_assign_default=force
|
||||||
|
sp_before_assign=force
|
||||||
|
sp_after_assign=force
|
||||||
|
sp_enum_assign=force
|
||||||
|
sp_enum_before_assign=force
|
||||||
|
sp_enum_after_assign=force
|
||||||
|
sp_pp_stringify=add
|
||||||
|
sp_bool=force
|
||||||
|
sp_compare=force
|
||||||
|
sp_inside_paren=remove
|
||||||
|
sp_paren_paren=remove
|
||||||
|
sp_paren_brace=force
|
||||||
|
sp_before_ptr_star=ignore
|
||||||
|
sp_before_unnamed_ptr_star=force
|
||||||
|
sp_before_byref=force
|
||||||
|
sp_before_unnamed_byref=force
|
||||||
|
sp_after_byref=remove
|
||||||
|
sp_after_type=force
|
||||||
|
sp_before_sparen=force
|
||||||
|
sp_inside_sparen=remove
|
||||||
|
sp_inside_sparen_close=remove
|
||||||
|
sp_after_sparen=force
|
||||||
|
sp_sparen_brace=force
|
||||||
|
sp_special_semi=force
|
||||||
|
sp_before_semi=remove
|
||||||
|
sp_after_semi=force
|
||||||
|
sp_after_semi_for=force
|
||||||
|
sp_after_semi_for_empty=force
|
||||||
|
sp_before_square=remove
|
||||||
|
sp_inside_square=remove
|
||||||
|
sp_after_comma=force
|
||||||
|
sp_before_comma=remove
|
||||||
|
sp_paren_comma=force
|
||||||
|
sp_before_ellipsis=force
|
||||||
|
sp_after_class_colon=force
|
||||||
|
sp_before_class_colon=force
|
||||||
|
sp_before_case_colon=remove
|
||||||
|
sp_after_cast=force
|
||||||
|
sp_inside_paren_cast=remove
|
||||||
|
sp_sizeof_paren=remove
|
||||||
|
sp_inside_braces_enum=force
|
||||||
|
sp_inside_braces_struct=force
|
||||||
|
sp_inside_braces=force
|
||||||
|
sp_inside_braces_empty=force
|
||||||
|
sp_func_proto_paren=remove
|
||||||
|
sp_func_def_paren=remove
|
||||||
|
sp_inside_fparens=remove
|
||||||
|
sp_inside_fparen=remove
|
||||||
|
sp_square_fparen=remove
|
||||||
|
sp_fparen_brace=force
|
||||||
|
sp_func_call_paren=remove
|
||||||
|
sp_func_call_paren_empty=remove
|
||||||
|
sp_return_paren=force
|
||||||
|
sp_attribute_paren=remove
|
||||||
|
sp_defined_paren=remove
|
||||||
|
sp_macro=force
|
||||||
|
sp_macro_func=force
|
||||||
|
sp_else_brace=force
|
||||||
|
sp_brace_else=force
|
||||||
|
sp_brace_typedef=force
|
||||||
|
sp_not=remove
|
||||||
|
sp_inv=remove
|
||||||
|
nl_start_of_file=remove
|
||||||
|
nl_end_of_file=force
|
||||||
|
nl_assign_square=remove
|
||||||
|
nl_after_square_assign=remove
|
||||||
|
nl_fcall_brace=remove
|
||||||
|
nl_enum_brace=remove
|
||||||
|
nl_struct_brace=remove
|
||||||
|
nl_union_brace=remove
|
||||||
|
nl_if_brace=remove
|
||||||
|
nl_brace_else=force
|
||||||
|
nl_elseif_brace=remove
|
||||||
|
nl_else_brace=remove
|
||||||
|
nl_else_if=remove
|
||||||
|
nl_for_brace=remove
|
||||||
|
nl_do_brace=remove
|
||||||
|
nl_brace_while=remove
|
||||||
|
nl_switch_brace=remove
|
||||||
|
nl_case_colon_brace=force
|
||||||
|
nl_func_type_name=force
|
||||||
|
nl_func_type_name_class=force
|
||||||
|
nl_func_proto_type_name=force
|
||||||
|
nl_func_paren=remove
|
||||||
|
nl_func_def_paren=remove
|
||||||
|
nl_func_decl_start=remove
|
||||||
|
nl_func_def_start=remove
|
||||||
|
nl_func_decl_args=remove
|
||||||
|
nl_func_decl_end=remove
|
||||||
|
nl_func_def_end=remove
|
||||||
|
nl_func_decl_end_single=remove
|
||||||
|
nl_func_def_end_single=remove
|
||||||
|
nl_func_decl_empty=remove
|
||||||
|
nl_func_def_empty=remove
|
||||||
|
nl_fdef_brace=force
|
||||||
|
nl_return_expr=remove
|
||||||
|
nl_before_if=ignore
|
||||||
|
nl_after_if=ignore
|
||||||
|
nl_before_for=ignore
|
||||||
|
nl_after_for=ignore
|
||||||
|
nl_before_while=ignore
|
||||||
|
nl_after_while=ignore
|
||||||
|
nl_before_switch=ignore
|
||||||
|
nl_after_switch=ignore
|
||||||
|
nl_before_do=ignore
|
||||||
|
nl_after_do=ignore
|
||||||
|
pp_space=remove
|
|
@ -1,54 +1,54 @@
|
||||||
/*
|
/*
|
||||||
Copyright 1985, 1987, 1990, 1998 The Open Group
|
* Copyright 1985, 1987, 1990, 1998 The Open Group
|
||||||
Copyright 2008 Dan Nicholson
|
* Copyright 2008 Dan Nicholson
|
||||||
|
*
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
to deal in the Software without restriction, including without limitation
|
* to deal in the Software without restriction, including without limitation
|
||||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
and/or sell copies of the Software, and to permit persons to whom the
|
* and/or sell copies of the Software, and to permit persons to whom the
|
||||||
Software is furnished to do so, subject to the following conditions:
|
* Software is furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
The above copyright notice and this permission notice shall be included in
|
* The above copyright notice and this permission notice shall be included in
|
||||||
all copies or substantial portions of the Software.
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
* AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
Except as contained in this notice, the names of the authors or their
|
* Except as contained in this notice, the names of the authors or their
|
||||||
institutions shall not be used in advertising or otherwise to promote the
|
* institutions shall not be used in advertising or otherwise to promote the
|
||||||
sale, use or other dealings in this Software without prior written
|
* sale, use or other dealings in this Software without prior written
|
||||||
authorization from the authors.
|
* authorization from the authors.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/************************************************************
|
/************************************************************
|
||||||
Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
|
* Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
|
||||||
|
*
|
||||||
Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
software and its documentation for any purpose and without
|
* software and its documentation for any purpose and without
|
||||||
fee is hereby granted, provided that the above copyright
|
* fee is hereby granted, provided that the above copyright
|
||||||
notice appear in all copies and that both that copyright
|
* notice appear in all copies and that both that copyright
|
||||||
notice and this permission notice appear in supporting
|
* notice and this permission notice appear in supporting
|
||||||
documentation, and that the name of Silicon Graphics not be
|
* documentation, and that the name of Silicon Graphics not be
|
||||||
used in advertising or publicity pertaining to distribution
|
* used in advertising or publicity pertaining to distribution
|
||||||
of the software without specific prior written permission.
|
* of the software without specific prior written permission.
|
||||||
Silicon Graphics makes no representation about the suitability
|
* Silicon Graphics makes no representation about the suitability
|
||||||
of this software for any purpose. It is provided "as is"
|
* of this software for any purpose. It is provided "as is"
|
||||||
without any express or implied warranty.
|
* without any express or implied warranty.
|
||||||
|
*
|
||||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -76,7 +76,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
* Author: Daniel Stone <daniel@fooishbar.org>
|
* Author: Daniel Stone <daniel@fooishbar.org>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef _XKBCOMMON_H_
|
#ifndef _XKBCOMMON_H_
|
||||||
#define _XKBCOMMON_H_
|
#define _XKBCOMMON_H_
|
||||||
|
|
||||||
|
@ -283,8 +282,8 @@ enum xkb_keymap_format {
|
||||||
* file.
|
* file.
|
||||||
*/
|
*/
|
||||||
struct xkb_keymap *
|
struct xkb_keymap *
|
||||||
xkb_map_new_from_file(struct xkb_context *context,
|
xkb_map_new_from_file(struct xkb_context *context, FILE *file,
|
||||||
FILE *file, enum xkb_keymap_format format,
|
enum xkb_keymap_format format,
|
||||||
enum xkb_map_compile_flags flags);
|
enum xkb_map_compile_flags flags);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -292,8 +291,7 @@ xkb_map_new_from_file(struct xkb_context *context,
|
||||||
* enormous string.
|
* enormous string.
|
||||||
*/
|
*/
|
||||||
struct xkb_keymap *
|
struct xkb_keymap *
|
||||||
xkb_map_new_from_string(struct xkb_context *context,
|
xkb_map_new_from_string(struct xkb_context *context, const char *string,
|
||||||
const char *string,
|
|
||||||
enum xkb_keymap_format format,
|
enum xkb_keymap_format format,
|
||||||
enum xkb_map_compile_flags flags);
|
enum xkb_map_compile_flags flags);
|
||||||
|
|
||||||
|
@ -507,10 +505,8 @@ enum xkb_state_match {
|
||||||
* Please do not use this unless you fit the description above.
|
* Please do not use this unless you fit the description above.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
xkb_state_update_mask(struct xkb_state *state,
|
xkb_state_update_mask(struct xkb_state *state, xkb_mod_mask_t base_mods,
|
||||||
xkb_mod_mask_t base_mods,
|
xkb_mod_mask_t latched_mods, xkb_mod_mask_t locked_mods,
|
||||||
xkb_mod_mask_t latched_mods,
|
|
||||||
xkb_mod_mask_t locked_mods,
|
|
||||||
xkb_group_index_t base_group,
|
xkb_group_index_t base_group,
|
||||||
xkb_group_index_t latched_group,
|
xkb_group_index_t latched_group,
|
||||||
xkb_group_index_t locked_group);
|
xkb_group_index_t locked_group);
|
||||||
|
@ -594,7 +590,8 @@ xkb_state_group_name_is_active(struct xkb_state *state, const char *name,
|
||||||
* exist in the current map.
|
* exist in the current map.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
xkb_state_group_index_is_active(struct xkb_state *state, xkb_group_index_t idx,
|
xkb_state_group_index_is_active(struct xkb_state *state,
|
||||||
|
xkb_group_index_t idx,
|
||||||
enum xkb_state_component type);
|
enum xkb_state_component type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,29 +1,29 @@
|
||||||
/*
|
/*
|
||||||
|
*
|
||||||
Copyright 1990, 1998 The Open Group
|
* Copyright 1990, 1998 The Open Group
|
||||||
|
*
|
||||||
Permission to use, copy, modify, distribute, and sell this software and its
|
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||||
documentation for any purpose is hereby granted without fee, provided that
|
* documentation for any purpose is hereby granted without fee, provided that
|
||||||
the above copyright notice appear in all copies and that both that
|
* the above copyright notice appear in all copies and that both that
|
||||||
copyright notice and this permission notice appear in supporting
|
* copyright notice and this permission notice appear in supporting
|
||||||
documentation.
|
* documentation.
|
||||||
|
*
|
||||||
The above copyright notice and this permission notice shall be included
|
* The above copyright notice and this permission notice shall be included
|
||||||
in all copies or substantial portions of the Software.
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
* IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
OTHER DEALINGS IN THE SOFTWARE.
|
* OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
Except as contained in this notice, the name of The Open Group shall
|
* Except as contained in this notice, the name of The Open Group shall
|
||||||
not be used in advertising or otherwise to promote the sale, use or
|
* not be used in advertising or otherwise to promote the sale, use or
|
||||||
other dealings in this Software without prior written authorization
|
* other dealings in this Software without prior written authorization
|
||||||
from The Open Group.
|
* from The Open Group.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -109,7 +109,8 @@ main(int argc, char *argv[])
|
||||||
if (val == XKB_KEY_VoidSymbol)
|
if (val == XKB_KEY_VoidSymbol)
|
||||||
val = 0;
|
val = 0;
|
||||||
if (val > 0x1fffffff) {
|
if (val > 0x1fffffff) {
|
||||||
fprintf(stderr, "ignoring illegal keysym (%s, %"PRIx32")\n", key,
|
fprintf(stderr, "ignoring illegal keysym (%s, %" PRIx32 ")\n",
|
||||||
|
key,
|
||||||
val);
|
val);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
48
src/alloc.c
48
src/alloc.c
|
@ -1,26 +1,26 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
|
* Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
|
||||||
|
*
|
||||||
Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
software and its documentation for any purpose and without
|
* software and its documentation for any purpose and without
|
||||||
fee is hereby granted, provided that the above copyright
|
* fee is hereby granted, provided that the above copyright
|
||||||
notice appear in all copies and that both that copyright
|
* notice appear in all copies and that both that copyright
|
||||||
notice and this permission notice appear in supporting
|
* notice and this permission notice appear in supporting
|
||||||
documentation, and that the name of Silicon Graphics not be
|
* documentation, and that the name of Silicon Graphics not be
|
||||||
used in advertising or publicity pertaining to distribution
|
* used in advertising or publicity pertaining to distribution
|
||||||
of the software without specific prior written permission.
|
* of the software without specific prior written permission.
|
||||||
Silicon Graphics makes no representation about the suitability
|
* Silicon Graphics makes no representation about the suitability
|
||||||
of this software for any purpose. It is provided "as is"
|
* of this software for any purpose. It is provided "as is"
|
||||||
without any express or implied warranty.
|
* without any express or implied warranty.
|
||||||
|
*
|
||||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "xkb-priv.h"
|
#include "xkb-priv.h"
|
||||||
|
@ -279,7 +279,6 @@ XkbcAllocCompatMap(struct xkb_keymap *keymap, unsigned nSI)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
XkbcFreeCompatMap(struct xkb_keymap *keymap)
|
XkbcFreeCompatMap(struct xkb_keymap *keymap)
|
||||||
{
|
{
|
||||||
|
@ -292,7 +291,8 @@ XkbcFreeCompatMap(struct xkb_keymap *keymap)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
XkbcAllocNames(struct xkb_keymap *keymap, unsigned which, size_t nTotalAliases)
|
XkbcAllocNames(struct xkb_keymap *keymap, unsigned which,
|
||||||
|
size_t nTotalAliases)
|
||||||
{
|
{
|
||||||
if (!keymap)
|
if (!keymap)
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
|
|
46
src/alloc.h
46
src/alloc.h
|
@ -1,27 +1,27 @@
|
||||||
/*
|
/*
|
||||||
Copyright 2009 Dan Nicholson
|
* Copyright 2009 Dan Nicholson
|
||||||
|
*
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
to deal in the Software without restriction, including without limitation
|
* to deal in the Software without restriction, including without limitation
|
||||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
and/or sell copies of the Software, and to permit persons to whom the
|
* and/or sell copies of the Software, and to permit persons to whom the
|
||||||
Software is furnished to do so, subject to the following conditions:
|
* Software is furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
The above copyright notice and this permission notice shall be included in
|
* The above copyright notice and this permission notice shall be included in
|
||||||
all copies or substantial portions of the Software.
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
* AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
Except as contained in this notice, the names of the authors or their
|
* Except as contained in this notice, the names of the authors or their
|
||||||
institutions shall not be used in advertising or otherwise to promote the
|
* institutions shall not be used in advertising or otherwise to promote the
|
||||||
sale, use or other dealings in this Software without prior written
|
* sale, use or other dealings in this Software without prior written
|
||||||
authorization from the authors.
|
* authorization from the authors.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef ALLOC_H
|
#ifndef ALLOC_H
|
||||||
|
|
132
src/atom.c
132
src/atom.c
|
@ -1,73 +1,73 @@
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
Copyright 1987, 1998 The Open Group
|
* Copyright 1987, 1998 The Open Group
|
||||||
|
*
|
||||||
Permission to use, copy, modify, distribute, and sell this software and its
|
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||||
documentation for any purpose is hereby granted without fee, provided that
|
* documentation for any purpose is hereby granted without fee, provided that
|
||||||
the above copyright notice appear in all copies and that both that
|
* the above copyright notice appear in all copies and that both that
|
||||||
copyright notice and this permission notice appear in supporting
|
* copyright notice and this permission notice appear in supporting
|
||||||
documentation.
|
* documentation.
|
||||||
|
*
|
||||||
The above copyright notice and this permission notice shall be included in
|
* The above copyright notice and this permission notice shall be included in
|
||||||
all copies or substantial portions of the Software.
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
* OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
Except as contained in this notice, the name of The Open Group shall not be
|
* Except as contained in this notice, the name of The Open Group shall not be
|
||||||
used in advertising or otherwise to promote the sale, use or other dealings
|
* used in advertising or otherwise to promote the sale, use or other dealings
|
||||||
in this Software without prior written authorization from The Open Group.
|
* in this Software without prior written authorization from The Open Group.
|
||||||
|
*
|
||||||
|
*
|
||||||
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
* Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
||||||
|
*
|
||||||
All Rights Reserved
|
* All Rights Reserved
|
||||||
|
*
|
||||||
Permission to use, copy, modify, and distribute this software and its
|
* Permission to use, copy, modify, and distribute this software and its
|
||||||
documentation for any purpose and without fee is hereby granted,
|
* documentation for any purpose and without fee is hereby granted,
|
||||||
provided that the above copyright notice appear in all copies and that
|
* provided that the above copyright notice appear in all copies and that
|
||||||
both that copyright notice and this permission notice appear in
|
* both that copyright notice and this permission notice appear in
|
||||||
supporting documentation, and that the name of Digital not be
|
* supporting documentation, and that the name of Digital not be
|
||||||
used in advertising or publicity pertaining to distribution of the
|
* used in advertising or publicity pertaining to distribution of the
|
||||||
software without specific, written prior permission.
|
* software without specific, written prior permission.
|
||||||
|
*
|
||||||
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
* DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||||
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
* DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
||||||
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
* ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||||
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||||
SOFTWARE.
|
* SOFTWARE.
|
||||||
|
*
|
||||||
******************************************************************/
|
******************************************************************/
|
||||||
|
|
||||||
/************************************************************
|
/************************************************************
|
||||||
Copyright 1994 by Silicon Graphics Computer Systems, Inc.
|
* Copyright 1994 by Silicon Graphics Computer Systems, Inc.
|
||||||
|
*
|
||||||
Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
software and its documentation for any purpose and without
|
* software and its documentation for any purpose and without
|
||||||
fee is hereby granted, provided that the above copyright
|
* fee is hereby granted, provided that the above copyright
|
||||||
notice appear in all copies and that both that copyright
|
* notice appear in all copies and that both that copyright
|
||||||
notice and this permission notice appear in supporting
|
* notice and this permission notice appear in supporting
|
||||||
documentation, and that the name of Silicon Graphics not be
|
* documentation, and that the name of Silicon Graphics not be
|
||||||
used in advertising or publicity pertaining to distribution
|
* used in advertising or publicity pertaining to distribution
|
||||||
of the software without specific prior written permission.
|
* of the software without specific prior written permission.
|
||||||
Silicon Graphics makes no representation about the suitability
|
* Silicon Graphics makes no representation about the suitability
|
||||||
of this software for any purpose. It is provided "as is"
|
* of this software for any purpose. It is provided "as is"
|
||||||
without any express or implied warranty.
|
* without any express or implied warranty.
|
||||||
|
*
|
||||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
|
|
46
src/atom.h
46
src/atom.h
|
@ -1,27 +1,27 @@
|
||||||
/*
|
/*
|
||||||
Copyright 2009 Dan Nicholson
|
* Copyright 2009 Dan Nicholson
|
||||||
|
*
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
to deal in the Software without restriction, including without limitation
|
* to deal in the Software without restriction, including without limitation
|
||||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
and/or sell copies of the Software, and to permit persons to whom the
|
* and/or sell copies of the Software, and to permit persons to whom the
|
||||||
Software is furnished to do so, subject to the following conditions:
|
* Software is furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
The above copyright notice and this permission notice shall be included in
|
* The above copyright notice and this permission notice shall be included in
|
||||||
all copies or substantial portions of the Software.
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
* AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
Except as contained in this notice, the names of the authors or their
|
* Except as contained in this notice, the names of the authors or their
|
||||||
institutions shall not be used in advertising or otherwise to promote the
|
* institutions shall not be used in advertising or otherwise to promote the
|
||||||
sale, use or other dealings in this Software without prior written
|
* sale, use or other dealings in this Software without prior written
|
||||||
authorization from the authors.
|
* authorization from the authors.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef ATOM_H
|
#ifndef ATOM_H
|
||||||
|
|
176
src/darray.h
176
src/darray.h
|
@ -125,11 +125,13 @@
|
||||||
#define darray(type) struct { type *item; size_t size; size_t alloc; }
|
#define darray(type) struct { type *item; size_t size; size_t alloc; }
|
||||||
|
|
||||||
#define darray_new() { 0, 0, 0 }
|
#define darray_new() { 0, 0, 0 }
|
||||||
#define darray_init(arr) do {(arr).item=0; (arr).size=0; (arr).alloc=0;} while(0)
|
#define darray_init(arr) do { (arr).item = 0; (arr).size = 0; (arr).alloc = 0; \
|
||||||
|
} while (0)
|
||||||
#define darray_free(arr) do { free((arr).item); darray_init(arr); } while (0)
|
#define darray_free(arr) do { free((arr).item); darray_init(arr); } while (0)
|
||||||
|
|
||||||
/* Only use for immutable darray - e.g. for static const initialzers. */
|
/* Only use for immutable darray - e.g. for static const initialzers. */
|
||||||
#define darray_lit(c_array) {(c_array), sizeof(c_array) / sizeof(*(c_array)), 0}
|
#define darray_lit(c_array) { (c_array), sizeof(c_array) / sizeof(*(c_array)), \
|
||||||
|
0 }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Typedefs for darrays of common types. These are useful
|
* Typedefs for darrays of common types. These are useful
|
||||||
|
@ -160,7 +162,6 @@ typedef darray(unsigned short) darray_ushort;
|
||||||
typedef darray (unsigned int) darray_uint;
|
typedef darray (unsigned int) darray_uint;
|
||||||
typedef darray (unsigned long) darray_ulong;
|
typedef darray (unsigned long) darray_ulong;
|
||||||
|
|
||||||
|
|
||||||
/*** Access ***/
|
/*** Access ***/
|
||||||
|
|
||||||
#define darray_item(arr, i) ((arr).item[i])
|
#define darray_item(arr, i) ((arr).item[i])
|
||||||
|
@ -179,12 +180,12 @@ typedef darray(unsigned long) darray_ulong;
|
||||||
} while (0)
|
} while (0)
|
||||||
#define darray_prepend(arr, ...) do { \
|
#define darray_prepend(arr, ...) do { \
|
||||||
darray_resize(arr, (arr).size + 1); \
|
darray_resize(arr, (arr).size + 1); \
|
||||||
memmove((arr).item+1, (arr).item, ((arr).size-1)*sizeof(*(arr).item)); \
|
memmove((arr).item + 1, (arr).item, \
|
||||||
|
((arr).size - 1) * sizeof(*(arr).item)); \
|
||||||
(arr).item[0] = (__VA_ARGS__); \
|
(arr).item[0] = (__VA_ARGS__); \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define darray_push(arr, ...) darray_append(arr, __VA_ARGS__)
|
#define darray_push(arr, ...) darray_append(arr, __VA_ARGS__)
|
||||||
|
|
||||||
|
|
||||||
/*** Insertion (multiple items) ***/
|
/*** Insertion (multiple items) ***/
|
||||||
|
|
||||||
#define darray_append_items(arr, items, count) do { \
|
#define darray_append_items(arr, items, count) do { \
|
||||||
|
@ -196,7 +197,8 @@ typedef darray(unsigned long) darray_ulong;
|
||||||
#define darray_prepend_items(arr, items, count) do { \
|
#define darray_prepend_items(arr, items, count) do { \
|
||||||
size_t __count = (count), __oldSize = (arr).size; \
|
size_t __count = (count), __oldSize = (arr).size; \
|
||||||
darray_resize(arr, __count + __oldSize); \
|
darray_resize(arr, __count + __oldSize); \
|
||||||
memmove((arr).item + __count, (arr).item, __oldSize * sizeof(*(arr).item)); \
|
memmove((arr).item + __count, (arr).item, __oldSize * \
|
||||||
|
sizeof(*(arr).item)); \
|
||||||
memcpy((arr).item, items, __count * sizeof(*(arr).item)); \
|
memcpy((arr).item, items, __count * sizeof(*(arr).item)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
@ -210,14 +212,17 @@ typedef darray(unsigned long) darray_ulong;
|
||||||
#define darray_prepend_items_nullterminate(arr, items, count) do { \
|
#define darray_prepend_items_nullterminate(arr, items, count) do { \
|
||||||
size_t __count = (count), __oldSize = (arr).size; \
|
size_t __count = (count), __oldSize = (arr).size; \
|
||||||
darray_resize(arr, __count + __oldSize + 1); \
|
darray_resize(arr, __count + __oldSize + 1); \
|
||||||
memmove((arr).item + __count, (arr).item, __oldSize * sizeof(*(arr).item)); \
|
memmove((arr).item + __count, (arr).item, __oldSize * \
|
||||||
|
sizeof(*(arr).item)); \
|
||||||
memcpy((arr).item, items, __count * sizeof(*(arr).item)); \
|
memcpy((arr).item, items, __count * sizeof(*(arr).item)); \
|
||||||
(arr).item[--(arr).size] = 0; \
|
(arr).item[--(arr).size] = 0; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#if HAVE_TYPEOF
|
#if HAVE_TYPEOF
|
||||||
#define darray_appends(arr, ...) darray_appends_t(arr, typeof((*(arr).item)), __VA_ARGS__)
|
#define darray_appends(arr, ...) darray_appends_t(arr, typeof((*(arr).item)), \
|
||||||
#define darray_prepends(arr, ...) darray_prepends_t(arr, typeof((*(arr).item)), __VA_ARGS__)
|
__VA_ARGS__)
|
||||||
|
#define darray_prepends(arr, ...) darray_prepends_t(arr, typeof((*(arr).item)), \
|
||||||
|
__VA_ARGS__)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define darray_appends_t(arr, type, ...) do { \
|
#define darray_appends_t(arr, type, ...) do { \
|
||||||
|
@ -229,51 +234,77 @@ typedef darray(unsigned long) darray_ulong;
|
||||||
darray_prepend_items(arr, __src, sizeof(__src) / sizeof(*__src)); \
|
darray_prepend_items(arr, __src, sizeof(__src) / sizeof(*__src)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
/*** Removal ***/
|
/*** Removal ***/
|
||||||
|
|
||||||
/* Warning: Do not call darray_pop on an empty darray. */
|
/* Warning: Do not call darray_pop on an empty darray. */
|
||||||
#define darray_pop(arr) ((arr).item[--(arr).size])
|
#define darray_pop(arr) ((arr).item[--(arr).size])
|
||||||
#define darray_pop_check(arr) ((arr).size ? darray_pop(arr) : NULL)
|
#define darray_pop_check(arr) ((arr).size ? darray_pop(arr) : NULL)
|
||||||
|
|
||||||
|
|
||||||
/*** Replacement ***/
|
/*** Replacement ***/
|
||||||
|
|
||||||
#define darray_from_items(arr, items, count) do {size_t __count = (count); darray_resize(arr, __count); memcpy((arr).item, items, __count*sizeof(*(arr).item));} while(0)
|
#define darray_from_items(arr, items, count) do { size_t __count = (count); \
|
||||||
#define darray_from_c(arr, c_array) darray_from_items(arr, c_array, sizeof(c_array)/sizeof(*(c_array)))
|
darray_resize(arr, __count); \
|
||||||
#define darray_copy(arr_to, arr_from) darray_from_items(arr_to, (arr_from).item, (arr_from).size)
|
memcpy((arr).item, items, \
|
||||||
|
__count \
|
||||||
|
* sizeof(*(arr).item)); \
|
||||||
|
} while (0)
|
||||||
|
#define darray_from_c(arr, c_array) darray_from_items( \
|
||||||
|
arr, c_array, sizeof(c_array) / sizeof(*(c_array)))
|
||||||
|
#define darray_copy(arr_to, arr_from) darray_from_items( \
|
||||||
|
arr_to, \
|
||||||
|
(arr_from). \
|
||||||
|
item, (arr_from).size)
|
||||||
|
|
||||||
/*** String buffer ***/
|
/*** String buffer ***/
|
||||||
|
|
||||||
#define darray_append_string(arr, str) do {const char *__str = (str); darray_append_items(arr, __str, strlen(__str)+1); (arr).size--;} while(0)
|
#define darray_append_string(arr, str) do { const char *__str = (str); \
|
||||||
#define darray_append_lit(arr, stringLiteral) do {darray_append_items(arr, stringLiteral, sizeof(stringLiteral)); (arr).size--;} while(0)
|
darray_append_items( \
|
||||||
|
arr, __str, \
|
||||||
|
strlen(__str) + 1); \
|
||||||
|
(arr).size--; \
|
||||||
|
} while (0)
|
||||||
|
#define darray_append_lit(arr, stringLiteral) do { darray_append_items( \
|
||||||
|
arr, stringLiteral, \
|
||||||
|
sizeof(stringLiteral)); \
|
||||||
|
(arr).size--; } while (0)
|
||||||
|
|
||||||
#define darray_prepend_string(arr, str) do { \
|
#define darray_prepend_string(arr, str) do { \
|
||||||
const char *__str = (str); \
|
const char *__str = (str); \
|
||||||
darray_prepend_items_nullterminate(arr, __str, strlen(__str)); \
|
darray_prepend_items_nullterminate(arr, __str, strlen(__str)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define darray_prepend_lit(arr, stringLiteral) \
|
#define darray_prepend_lit(arr, stringLiteral) \
|
||||||
darray_prepend_items_nullterminate(arr, stringLiteral, sizeof(stringLiteral) - 1)
|
darray_prepend_items_nullterminate(arr, stringLiteral, \
|
||||||
|
sizeof(stringLiteral) - 1)
|
||||||
#define darray_from_string(arr, str) do {const char *__str = (str); darray_from_items(arr, __str, strlen(__str)+1); (arr).size--;} while(0)
|
|
||||||
#define darray_from_lit(arr, stringLiteral) do {darray_from_items(arr, stringLiteral, sizeof(stringLiteral)); (arr).size--;} while(0)
|
|
||||||
|
|
||||||
|
#define darray_from_string(arr, str) do { const char *__str = (str); \
|
||||||
|
darray_from_items( \
|
||||||
|
arr, __str, strlen( \
|
||||||
|
__str) + 1); \
|
||||||
|
(arr).size--; \
|
||||||
|
} while (0)
|
||||||
|
#define darray_from_lit(arr, stringLiteral) do { darray_from_items( \
|
||||||
|
arr, stringLiteral, \
|
||||||
|
sizeof(stringLiteral)); \
|
||||||
|
(arr).size--; } while (0)
|
||||||
|
|
||||||
/*** Size management ***/
|
/*** Size management ***/
|
||||||
|
|
||||||
#define darray_resize(arr, newSize) darray_growalloc(arr, (arr).size = (newSize))
|
#define darray_resize(arr, newSize) darray_growalloc(arr, (arr).size = \
|
||||||
|
(newSize))
|
||||||
#define darray_resize0(arr, newSize) do { \
|
#define darray_resize0(arr, newSize) do { \
|
||||||
size_t __oldSize = (arr).size, __newSize = (newSize); \
|
size_t __oldSize = (arr).size, __newSize = (newSize); \
|
||||||
(arr).size = __newSize; \
|
(arr).size = __newSize; \
|
||||||
if (__newSize > __oldSize) { \
|
if (__newSize > __oldSize) { \
|
||||||
darray_growalloc(arr, __newSize); \
|
darray_growalloc(arr, __newSize); \
|
||||||
memset(&(arr).item[__oldSize], 0, (__newSize - __oldSize) * sizeof(*(arr).item)); \
|
memset(&(arr).item[__oldSize], 0, \
|
||||||
|
(__newSize - __oldSize) * sizeof(*(arr).item)); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define darray_realloc(arr, newAlloc) do { \
|
#define darray_realloc(arr, newAlloc) do { \
|
||||||
(arr).item = realloc((arr).item, ((arr).alloc = (newAlloc)) * sizeof(*(arr).item)); \
|
(arr).item = \
|
||||||
|
realloc((arr).item, ((arr).alloc = (newAlloc)) * \
|
||||||
|
sizeof(*(arr).item)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define darray_growalloc(arr, need) do { \
|
#define darray_growalloc(arr, need) do { \
|
||||||
size_t __need = (need); \
|
size_t __need = (need); \
|
||||||
|
@ -282,10 +313,15 @@ typedef darray(unsigned long) darray_ulong;
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#if HAVE_STATEMENT_EXPR == 1
|
#if HAVE_STATEMENT_EXPR == 1
|
||||||
#define darray_make_room(arr, room) ({size_t newAlloc = (arr).size+(room); if ((arr).alloc<newAlloc) darray_realloc(arr, newAlloc); (arr).item+(arr).size; })
|
#define darray_make_room(arr, \
|
||||||
|
room) ({ size_t newAlloc = (arr).size + (room); \
|
||||||
|
if ((arr).alloc < \
|
||||||
|
newAlloc) darray_realloc(arr, newAlloc); \
|
||||||
|
(arr).item + (arr).size; })
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static inline size_t darray_next_alloc(size_t alloc, size_t need)
|
static inline size_t
|
||||||
|
darray_next_alloc(size_t alloc, size_t need)
|
||||||
{
|
{
|
||||||
if (alloc == 0)
|
if (alloc == 0)
|
||||||
alloc = 4;
|
alloc = 4;
|
||||||
|
@ -294,7 +330,6 @@ static inline size_t darray_next_alloc(size_t alloc, size_t need)
|
||||||
return alloc;
|
return alloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*** Traversal ***/
|
/*** Traversal ***/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -313,51 +348,50 @@ static inline size_t darray_next_alloc(size_t alloc, size_t need)
|
||||||
#define darray_foreach_reverse(i, arr) \
|
#define darray_foreach_reverse(i, arr) \
|
||||||
for ((i) = &(arr).item[(arr).size]; (i)-- > &(arr).item[0]; )
|
for ((i) = &(arr).item[(arr).size]; (i)-- > &(arr).item[0]; )
|
||||||
|
|
||||||
|
|
||||||
#endif /* CCAN_DARRAY_H */
|
#endif /* CCAN_DARRAY_H */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
*
|
||||||
darray_growalloc(arr, newAlloc) sees if the darray can currently hold newAlloc items;
|
* darray_growalloc(arr, newAlloc) sees if the darray can currently hold newAlloc items;
|
||||||
if not, it increases the alloc to satisfy this requirement, allocating slack
|
* if not, it increases the alloc to satisfy this requirement, allocating slack
|
||||||
space to avoid having to reallocate for every size increment.
|
* space to avoid having to reallocate for every size increment.
|
||||||
|
*
|
||||||
darray_from_string(arr, str) copies a string to an darray_char.
|
* darray_from_string(arr, str) copies a string to an darray_char.
|
||||||
|
*
|
||||||
darray_push(arr, item) pushes an item to the end of the darray.
|
* darray_push(arr, item) pushes an item to the end of the darray.
|
||||||
darray_pop(arr) pops it back out. Be sure there is at least one item in the darray before calling.
|
* darray_pop(arr) pops it back out. Be sure there is at least one item in the darray before calling.
|
||||||
darray_pop_check(arr) does the same as darray_pop, but returns NULL if there are no more items left in the darray.
|
* darray_pop_check(arr) does the same as darray_pop, but returns NULL if there are no more items left in the darray.
|
||||||
|
*
|
||||||
darray_make_room(arr, room) ensures there's 'room' elements of space after the end of the darray, and it returns a pointer to this space.
|
* darray_make_room(arr, room) ensures there's 'room' elements of space after the end of the darray, and it returns a pointer to this space.
|
||||||
Currently requires HAVE_STATEMENT_EXPR, but I plan to remove this dependency by creating an inline function.
|
* Currently requires HAVE_STATEMENT_EXPR, but I plan to remove this dependency by creating an inline function.
|
||||||
|
*
|
||||||
The following require HAVE_TYPEOF==1 :
|
* The following require HAVE_TYPEOF==1 :
|
||||||
|
*
|
||||||
darray_appends(arr, item0, item1...) appends a collection of comma-delimited items to the darray.
|
* darray_appends(arr, item0, item1...) appends a collection of comma-delimited items to the darray.
|
||||||
darray_prepends(arr, item0, item1...) prepends a collection of comma-delimited items to the darray.\
|
* darray_prepends(arr, item0, item1...) prepends a collection of comma-delimited items to the darray.\
|
||||||
|
*
|
||||||
|
*
|
||||||
Examples:
|
* Examples:
|
||||||
|
*
|
||||||
darray(int) arr;
|
* darray(int) arr;
|
||||||
int *i;
|
* int *i;
|
||||||
|
*
|
||||||
darray_appends(arr, 0,1,2,3,4);
|
* darray_appends(arr, 0,1,2,3,4);
|
||||||
darray_appends(arr, -5,-4,-3,-2,-1);
|
* darray_appends(arr, -5,-4,-3,-2,-1);
|
||||||
darray_foreach(i, arr)
|
* darray_foreach(i, arr)
|
||||||
printf("%d ", *i);
|
* printf("%d ", *i);
|
||||||
printf("\n");
|
* printf("\n");
|
||||||
|
*
|
||||||
darray_free(arr);
|
* darray_free(arr);
|
||||||
|
*
|
||||||
|
*
|
||||||
typedef struct {int n,d;} Fraction;
|
* typedef struct {int n,d;} Fraction;
|
||||||
darray(Fraction) fractions;
|
* darray(Fraction) fractions;
|
||||||
Fraction *i;
|
* Fraction *i;
|
||||||
|
*
|
||||||
darray_appends(fractions, {3,4}, {3,5}, {2,1});
|
* darray_appends(fractions, {3,4}, {3,5}, {2,1});
|
||||||
darray_foreach(i, fractions)
|
* darray_foreach(i, fractions)
|
||||||
printf("%d/%d\n", i->n, i->d);
|
* printf("%d/%d\n", i->n, i->d);
|
||||||
|
*
|
||||||
darray_free(fractions);
|
* darray_free(fractions);
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
/************************************************************
|
/************************************************************
|
||||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||||
|
*
|
||||||
Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
software and its documentation for any purpose and without
|
* software and its documentation for any purpose and without
|
||||||
fee is hereby granted, provided that the above copyright
|
* fee is hereby granted, provided that the above copyright
|
||||||
notice appear in all copies and that both that copyright
|
* notice appear in all copies and that both that copyright
|
||||||
notice and this permission notice appear in supporting
|
* notice and this permission notice appear in supporting
|
||||||
documentation, and that the name of Silicon Graphics not be
|
* documentation, and that the name of Silicon Graphics not be
|
||||||
used in advertising or publicity pertaining to distribution
|
* used in advertising or publicity pertaining to distribution
|
||||||
of the software without specific prior written permission.
|
* of the software without specific prior written permission.
|
||||||
Silicon Graphics makes no representation about the suitability
|
* Silicon Graphics makes no representation about the suitability
|
||||||
of this software for any purpose. It is provided "as is"
|
* of this software for any purpose. It is provided "as is"
|
||||||
without any express or implied warranty.
|
* without any express or implied warranty.
|
||||||
|
*
|
||||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -98,7 +98,7 @@ do { \
|
||||||
/* If it was truncated, embiggen the string and roll from the top. */ \
|
/* If it was truncated, embiggen the string and roll from the top. */ \
|
||||||
if (!do_realloc(buf, size, *offset, _printed)) { \
|
if (!do_realloc(buf, size, *offset, _printed)) { \
|
||||||
fprintf(stderr, \
|
fprintf(stderr, \
|
||||||
"xkbcommon: failed to allocate %zu bytes for keymap\n", \
|
"xkbcommon: couldn't allocate %zu bytes for keymap\n", \
|
||||||
*size); \
|
*size); \
|
||||||
free(*buf); \
|
free(*buf); \
|
||||||
*buf = NULL; \
|
*buf = NULL; \
|
||||||
|
@ -118,7 +118,8 @@ do { \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
write_vmods(struct xkb_keymap *keymap, char **buf, size_t *size, size_t *offset)
|
write_vmods(struct xkb_keymap *keymap, char **buf, size_t *size,
|
||||||
|
size_t *offset)
|
||||||
{
|
{
|
||||||
int num_vmods = 0;
|
int num_vmods = 0;
|
||||||
int i;
|
int i;
|
||||||
|
@ -167,7 +168,8 @@ get_mod_index_text(uint8_t real_mod)
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
get_mod_mask_text(struct xkb_keymap *keymap, uint8_t real_mods, uint32_t vmods)
|
get_mod_mask_text(struct xkb_keymap *keymap, uint8_t real_mods,
|
||||||
|
uint32_t vmods)
|
||||||
{
|
{
|
||||||
static char ret[GET_TEXT_BUF_SIZE], ret2[GET_TEXT_BUF_SIZE];
|
static char ret[GET_TEXT_BUF_SIZE], ret2[GET_TEXT_BUF_SIZE];
|
||||||
int i;
|
int i;
|
||||||
|
@ -338,7 +340,6 @@ write_keycodes(struct xkb_keymap *keymap, char **buf, size_t *size,
|
||||||
i + 1, keymap->names->indicators[i]);
|
i + 1, keymap->names->indicators[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
darray_foreach(alias, keymap->names->key_aliases)
|
darray_foreach(alias, keymap->names->key_aliases)
|
||||||
write_buf(keymap, buf, size, offset, "\t\talias %6s = %6s;\n",
|
write_buf(keymap, buf, size, offset, "\t\talias %6s = %6s;\n",
|
||||||
XkbcKeyNameText(alias->alias),
|
XkbcKeyNameText(alias->alias),
|
||||||
|
@ -415,8 +416,10 @@ write_indicator_map(struct xkb_keymap *keymap, char **buf, size_t *size,
|
||||||
|
|
||||||
if (led->which_groups) {
|
if (led->which_groups) {
|
||||||
if (led->which_groups != XkbIM_UseEffective) {
|
if (led->which_groups != XkbIM_UseEffective) {
|
||||||
write_buf(keymap, buf, size, offset, "\t\t\twhichGroupState= %s;\n",
|
write_buf(keymap, buf, size, offset,
|
||||||
get_indicator_state_text(led->which_groups));
|
"\t\t\twhichGroupState= %s;\n",
|
||||||
|
get_indicator_state_text(
|
||||||
|
led->which_groups));
|
||||||
}
|
}
|
||||||
write_buf(keymap, buf, size, offset, "\t\t\tgroups= 0x%02x;\n",
|
write_buf(keymap, buf, size, offset, "\t\t\tgroups= 0x%02x;\n",
|
||||||
led->groups);
|
led->groups);
|
||||||
|
@ -450,18 +453,23 @@ get_interp_match_text(uint8_t type)
|
||||||
case XkbSI_NoneOf:
|
case XkbSI_NoneOf:
|
||||||
sprintf(ret, "NoneOf");
|
sprintf(ret, "NoneOf");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XkbSI_AnyOfOrNone:
|
case XkbSI_AnyOfOrNone:
|
||||||
sprintf(ret, "AnyOfOrNone");
|
sprintf(ret, "AnyOfOrNone");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XkbSI_AnyOf:
|
case XkbSI_AnyOf:
|
||||||
sprintf(ret, "AnyOf");
|
sprintf(ret, "AnyOf");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XkbSI_AllOf:
|
case XkbSI_AllOf:
|
||||||
sprintf(ret, "AllOf");
|
sprintf(ret, "AllOf");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XkbSI_Exactly:
|
case XkbSI_Exactly:
|
||||||
sprintf(ret, "Exactly");
|
sprintf(ret, "Exactly");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
sprintf(ret, "0x%x", type & XkbSI_OpMask);
|
sprintf(ret, "0x%x", type & XkbSI_OpMask);
|
||||||
break;
|
break;
|
||||||
|
@ -501,11 +509,14 @@ write_action(struct xkb_keymap *keymap, char **buf, size_t *size,
|
||||||
write_buf(keymap, buf, size, offset, "%s%s(modifiers=%s%s%s)%s",
|
write_buf(keymap, buf, size, offset, "%s%s(modifiers=%s%s%s)%s",
|
||||||
prefix, type, args,
|
prefix, type, args,
|
||||||
(action->any.type != XkbSA_LockGroup &&
|
(action->any.type != XkbSA_LockGroup &&
|
||||||
action->mods.flags & XkbSA_ClearLocks) ? ",clearLocks" : "",
|
(action->mods.flags & XkbSA_ClearLocks)) ?
|
||||||
|
",clearLocks" : "",
|
||||||
(action->any.type != XkbSA_LockGroup &&
|
(action->any.type != XkbSA_LockGroup &&
|
||||||
action->mods.flags & XkbSA_LatchToLock) ? ",latchToLock" : "",
|
(action->mods.flags & XkbSA_LatchToLock)) ?
|
||||||
|
",latchToLock" : "",
|
||||||
suffix);
|
suffix);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XkbSA_SetGroup:
|
case XkbSA_SetGroup:
|
||||||
if (!type)
|
if (!type)
|
||||||
type = "SetGroup";
|
type = "SetGroup";
|
||||||
|
@ -515,21 +526,27 @@ write_action(struct xkb_keymap *keymap, char **buf, size_t *size,
|
||||||
case XkbSA_LockGroup:
|
case XkbSA_LockGroup:
|
||||||
if (!type)
|
if (!type)
|
||||||
type = "LockGroup";
|
type = "LockGroup";
|
||||||
write_buf(keymap, buf, size, offset, "%s%s(group=%s%d%s%s)%s",
|
write_buf(
|
||||||
|
keymap, buf, size, offset, "%s%s(group=%s%d%s%s)%s",
|
||||||
prefix, type,
|
prefix, type,
|
||||||
(!(action->group.flags & XkbSA_GroupAbsolute) &&
|
(!(action->group.flags & XkbSA_GroupAbsolute) &&
|
||||||
action->group.group > 0) ? "+" : "",
|
action->group.group > 0) ? "+" : "",
|
||||||
(action->group.flags & XkbSA_GroupAbsolute) ?
|
(action->group.flags & XkbSA_GroupAbsolute) ?
|
||||||
action->group.group + 1 : action->group.group,
|
action->group.group + 1 : action->group.group,
|
||||||
(action->any.type != XkbSA_LockGroup &&
|
(action->any.type != XkbSA_LockGroup &&
|
||||||
action->group.flags & XkbSA_ClearLocks) ? ",clearLocks" : "",
|
(action->group.flags & XkbSA_ClearLocks)) ?
|
||||||
|
",clearLocks" : "",
|
||||||
(action->any.type != XkbSA_LockGroup &&
|
(action->any.type != XkbSA_LockGroup &&
|
||||||
action->group.flags & XkbSA_LatchToLock) ? ",latchToLock" : "",
|
(action->group.flags & XkbSA_LatchToLock)) ?
|
||||||
|
",latchToLock" : "",
|
||||||
suffix);
|
suffix);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XkbSA_Terminate:
|
case XkbSA_Terminate:
|
||||||
write_buf(keymap, buf, size, offset, "%sTerminate()%s", prefix, suffix);
|
write_buf(keymap, buf, size, offset, "%sTerminate()%s", prefix,
|
||||||
|
suffix);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XkbSA_MovePtr:
|
case XkbSA_MovePtr:
|
||||||
write_buf(keymap, buf, size, offset, "%sMovePtr(x=%s%d,y=%s%d%s)%s",
|
write_buf(keymap, buf, size, offset, "%sMovePtr(x=%s%d,y=%s%d%s)%s",
|
||||||
prefix,
|
prefix,
|
||||||
|
@ -542,22 +559,27 @@ write_action(struct xkb_keymap *keymap, char **buf, size_t *size,
|
||||||
(action->ptr.flags & XkbSA_NoAcceleration) ? ",!accel" : "",
|
(action->ptr.flags & XkbSA_NoAcceleration) ? ",!accel" : "",
|
||||||
suffix);
|
suffix);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XkbSA_PtrBtn:
|
case XkbSA_PtrBtn:
|
||||||
if (!type)
|
if (!type)
|
||||||
type = "PtrBtn";
|
type = "PtrBtn";
|
||||||
case XkbSA_LockPtrBtn:
|
case XkbSA_LockPtrBtn:
|
||||||
if (!type) {
|
if (!type) {
|
||||||
type = "LockPtrBtn";
|
type = "LockPtrBtn";
|
||||||
switch (action->btn.flags & (XkbSA_LockNoUnlock | XkbSA_LockNoLock)) {
|
switch (action->btn.flags &
|
||||||
|
(XkbSA_LockNoUnlock | XkbSA_LockNoLock)) {
|
||||||
case XkbSA_LockNoUnlock:
|
case XkbSA_LockNoUnlock:
|
||||||
args = ",affect=lock";
|
args = ",affect=lock";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XkbSA_LockNoLock:
|
case XkbSA_LockNoLock:
|
||||||
args = ",affect=unlock";
|
args = ",affect=unlock";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XkbSA_LockNoLock | XkbSA_LockNoUnlock:
|
case XkbSA_LockNoLock | XkbSA_LockNoUnlock:
|
||||||
args = ",affect=neither";
|
args = ",affect=neither";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
args = ",affect=both";
|
args = ",affect=both";
|
||||||
break;
|
break;
|
||||||
|
@ -578,6 +600,7 @@ write_action(struct xkb_keymap *keymap, char **buf, size_t *size,
|
||||||
write_buf(keymap, buf, size, offset, "%s", args);
|
write_buf(keymap, buf, size, offset, "%s", args);
|
||||||
write_buf(keymap, buf, size, offset, ")%s", suffix);
|
write_buf(keymap, buf, size, offset, ")%s", suffix);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XkbSA_SetPtrDflt:
|
case XkbSA_SetPtrDflt:
|
||||||
write_buf(keymap, buf, size, offset, "%sSetPtrDflt(", prefix);
|
write_buf(keymap, buf, size, offset, "%sSetPtrDflt(", prefix);
|
||||||
if (action->dflt.affect == XkbSA_AffectDfltBtn)
|
if (action->dflt.affect == XkbSA_AffectDfltBtn)
|
||||||
|
@ -587,6 +610,7 @@ write_action(struct xkb_keymap *keymap, char **buf, size_t *size,
|
||||||
action->dflt.value);
|
action->dflt.value);
|
||||||
write_buf(keymap, buf, size, offset, ")%s", suffix);
|
write_buf(keymap, buf, size, offset, ")%s", suffix);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XkbSA_SwitchScreen:
|
case XkbSA_SwitchScreen:
|
||||||
write_buf(keymap, buf, size, offset,
|
write_buf(keymap, buf, size, offset,
|
||||||
"%sSwitchScreen(screen=%s%d,%ssame)%s", prefix,
|
"%sSwitchScreen(screen=%s%d,%ssame)%s", prefix,
|
||||||
|
@ -596,6 +620,7 @@ write_action(struct xkb_keymap *keymap, char **buf, size_t *size,
|
||||||
(action->screen.flags & XkbSA_SwitchApplication) ? "!" : "",
|
(action->screen.flags & XkbSA_SwitchApplication) ? "!" : "",
|
||||||
suffix);
|
suffix);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Deprecated actions below here */
|
/* Deprecated actions below here */
|
||||||
case XkbSA_SetControls:
|
case XkbSA_SetControls:
|
||||||
if (!type)
|
if (!type)
|
||||||
|
@ -607,6 +632,7 @@ write_action(struct xkb_keymap *keymap, char **buf, size_t *size,
|
||||||
prefix, type, get_control_mask_text(action->ctrls.ctrls),
|
prefix, type, get_control_mask_text(action->ctrls.ctrls),
|
||||||
suffix);
|
suffix);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XkbSA_ISOLock:
|
case XkbSA_ISOLock:
|
||||||
case XkbSA_ActionMessage:
|
case XkbSA_ActionMessage:
|
||||||
case XkbSA_RedirectKey:
|
case XkbSA_RedirectKey:
|
||||||
|
@ -616,6 +642,7 @@ write_action(struct xkb_keymap *keymap, char **buf, size_t *size,
|
||||||
/* XXX TODO */
|
/* XXX TODO */
|
||||||
write_buf(keymap, buf, size, offset, "%sNoAction()%s", prefix, suffix);
|
write_buf(keymap, buf, size, offset, "%sNoAction()%s", prefix, suffix);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XkbSA_XFree86Private:
|
case XkbSA_XFree86Private:
|
||||||
default:
|
default:
|
||||||
write_buf(keymap, buf, size, offset,
|
write_buf(keymap, buf, size, offset,
|
||||||
|
@ -623,7 +650,8 @@ write_action(struct xkb_keymap *keymap, char **buf, size_t *size,
|
||||||
prefix, action->any.type, action->any.data[0],
|
prefix, action->any.type, action->any.data[0],
|
||||||
action->any.data[1], action->any.data[2],
|
action->any.data[1], action->any.data[2],
|
||||||
action->any.data[3], action->any.data[4],
|
action->any.data[3], action->any.data[4],
|
||||||
action->any.data[5], action->any.data[6], suffix);
|
action->any.data[5], action->any.data[6],
|
||||||
|
suffix);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -638,14 +666,16 @@ write_compat(struct xkb_keymap *keymap, char **buf, size_t *size,
|
||||||
struct xkb_sym_interpret *interp;
|
struct xkb_sym_interpret *interp;
|
||||||
|
|
||||||
if (keymap->names->compat)
|
if (keymap->names->compat)
|
||||||
write_buf(keymap, buf, size, offset, "\txkb_compatibility \"%s\" {\n\n",
|
write_buf(keymap, buf, size, offset,
|
||||||
|
"\txkb_compatibility \"%s\" {\n\n",
|
||||||
keymap->names->compat);
|
keymap->names->compat);
|
||||||
else
|
else
|
||||||
write_buf(keymap, buf, size, offset, "\txkb_compatibility {\n\n");
|
write_buf(keymap, buf, size, offset, "\txkb_compatibility {\n\n");
|
||||||
|
|
||||||
write_vmods(keymap, buf, size, offset);
|
write_vmods(keymap, buf, size, offset);
|
||||||
|
|
||||||
write_buf(keymap, buf, size, offset, "\t\tinterpret.useModMapMods= AnyLevel;\n");
|
write_buf(keymap, buf, size, offset,
|
||||||
|
"\t\tinterpret.useModMapMods= AnyLevel;\n");
|
||||||
write_buf(keymap, buf, size, offset, "\t\tinterpret.repeat= False;\n");
|
write_buf(keymap, buf, size, offset, "\t\tinterpret.repeat= False;\n");
|
||||||
write_buf(keymap, buf, size, offset, "\t\tinterpret.locking= False;\n");
|
write_buf(keymap, buf, size, offset, "\t\tinterpret.locking= False;\n");
|
||||||
|
|
||||||
|
@ -663,12 +693,14 @@ write_compat(struct xkb_keymap *keymap, char **buf, size_t *size,
|
||||||
get_mod_mask_text(keymap, interp->mods, 0));
|
get_mod_mask_text(keymap, interp->mods, 0));
|
||||||
|
|
||||||
if (interp->virtual_mod != XkbNoModifier) {
|
if (interp->virtual_mod != XkbNoModifier) {
|
||||||
write_buf(keymap, buf, size, offset, "\t\t\tvirtualModifier= %s;\n",
|
write_buf(keymap, buf, size, offset,
|
||||||
|
"\t\t\tvirtualModifier= %s;\n",
|
||||||
keymap->names->vmods[interp->virtual_mod]);
|
keymap->names->vmods[interp->virtual_mod]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (interp->match & XkbSI_LevelOneOnly)
|
if (interp->match & XkbSI_LevelOneOnly)
|
||||||
write_buf(keymap, buf, size, offset, "\t\t\tuseModMapMods=level1;\n");
|
write_buf(keymap, buf, size, offset,
|
||||||
|
"\t\t\tuseModMapMods=level1;\n");
|
||||||
if (interp->flags & XkbSI_LockingKey)
|
if (interp->flags & XkbSI_LockingKey)
|
||||||
write_buf(keymap, buf, size, offset, "\t\t\tlocking= True;\n");
|
write_buf(keymap, buf, size, offset, "\t\t\tlocking= True;\n");
|
||||||
if (interp->flags & XkbSI_AutoRepeat)
|
if (interp->flags & XkbSI_AutoRepeat)
|
||||||
|
@ -785,7 +817,8 @@ write_symbols(struct xkb_keymap *keymap, char **buf, size_t *size,
|
||||||
|
|
||||||
simple = false;
|
simple = false;
|
||||||
|
|
||||||
for (group = 0; group < xkb_key_num_groups(keymap, key); group++) {
|
for (group = 0; group < xkb_key_num_groups(keymap, key);
|
||||||
|
group++) {
|
||||||
if (XkbKeyTypeIndex(keymap, key, group) != type) {
|
if (XkbKeyTypeIndex(keymap, key, group) != type) {
|
||||||
multi_type = true;
|
multi_type = true;
|
||||||
break;
|
break;
|
||||||
|
@ -810,7 +843,8 @@ write_symbols(struct xkb_keymap *keymap, char **buf, size_t *size,
|
||||||
darray_item(map->types, type).name);
|
darray_item(map->types, type).name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (keymap->ctrls && (srv->explicit[key] & XkbExplicitAutoRepeatMask)) {
|
if (keymap->ctrls &&
|
||||||
|
(srv->explicit[key] & XkbExplicitAutoRepeatMask)) {
|
||||||
if (keymap->ctrls->per_key_repeat[key / 8] & (1 << (key % 8)))
|
if (keymap->ctrls->per_key_repeat[key / 8] & (1 << (key % 8)))
|
||||||
write_buf(keymap, buf, size, offset,
|
write_buf(keymap, buf, size, offset,
|
||||||
"\n\t\t\trepeat= Yes,");
|
"\n\t\t\trepeat= Yes,");
|
||||||
|
@ -821,8 +855,10 @@ write_symbols(struct xkb_keymap *keymap, char **buf, size_t *size,
|
||||||
}
|
}
|
||||||
if (keymap->server->vmodmap[key] &&
|
if (keymap->server->vmodmap[key] &&
|
||||||
(srv->explicit[key] & XkbExplicitVModMapMask)) {
|
(srv->explicit[key] & XkbExplicitVModMapMask)) {
|
||||||
write_buf(keymap, buf, size, offset, "\n\t\t\tvirtualMods= %s,",
|
write_buf(keymap, buf, size, offset,
|
||||||
get_mod_mask_text(keymap, 0, keymap->server->vmodmap[key]));
|
"\n\t\t\tvirtualMods= %s,",
|
||||||
|
get_mod_mask_text(keymap, 0,
|
||||||
|
keymap->server->vmodmap[key]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -830,10 +866,12 @@ write_symbols(struct xkb_keymap *keymap, char **buf, size_t *size,
|
||||||
case XkbClampIntoRange:
|
case XkbClampIntoRange:
|
||||||
write_buf(keymap, buf, size, offset, "\n\t\t\tgroupsClamp,");
|
write_buf(keymap, buf, size, offset, "\n\t\t\tgroupsClamp,");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XkbRedirectIntoRange:
|
case XkbRedirectIntoRange:
|
||||||
write_buf(keymap, buf, size, offset,
|
write_buf(keymap, buf, size, offset,
|
||||||
"\n\t\t\tgroupsRedirect= Group%d,",
|
"\n\t\t\tgroupsRedirect= Group%d,",
|
||||||
XkbOutOfRangeGroupNumber(XkbKeyGroupInfo(keymap, key)) + 1);
|
XkbOutOfRangeGroupNumber(XkbKeyGroupInfo(keymap,
|
||||||
|
key)) + 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -857,7 +895,8 @@ write_symbols(struct xkb_keymap *keymap, char **buf, size_t *size,
|
||||||
int level;
|
int level;
|
||||||
|
|
||||||
acts = XkbKeyActionsPtr(keymap, key);
|
acts = XkbKeyActionsPtr(keymap, key);
|
||||||
for (group = 0; group < xkb_key_num_groups(keymap, key); group++) {
|
for (group = 0; group < xkb_key_num_groups(keymap, key);
|
||||||
|
group++) {
|
||||||
if (group != 0)
|
if (group != 0)
|
||||||
write_buf(keymap, buf, size, offset, ",");
|
write_buf(keymap, buf, size, offset, ",");
|
||||||
write_buf(keymap, buf, size, offset,
|
write_buf(keymap, buf, size, offset,
|
||||||
|
@ -884,7 +923,8 @@ write_symbols(struct xkb_keymap *keymap, char **buf, size_t *size,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (map && map->modmap) {
|
if (map && map->modmap) {
|
||||||
for (key = keymap->min_key_code; key <= keymap->max_key_code; key++) {
|
for (key = keymap->min_key_code; key <= keymap->max_key_code;
|
||||||
|
key++) {
|
||||||
int mod;
|
int mod;
|
||||||
|
|
||||||
if (map->modmap[key] == 0)
|
if (map->modmap[key] == 0)
|
||||||
|
|
|
@ -877,8 +877,6 @@ xkb_keysym_to_utf32(xkb_keysym_t keysym)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright © 2012 Intel Corporation
|
* Copyright © 2012 Intel Corporation
|
||||||
*
|
*
|
||||||
|
@ -914,19 +912,24 @@ utf32_to_utf8(uint32_t unichar, char *buffer)
|
||||||
buffer[0] = unichar;
|
buffer[0] = unichar;
|
||||||
buffer[1] = '\0';
|
buffer[1] = '\0';
|
||||||
return 2;
|
return 2;
|
||||||
} else if (unichar <= 0x07FF) {
|
}
|
||||||
|
else if (unichar <= 0x07FF) {
|
||||||
length = 2;
|
length = 2;
|
||||||
head = 0xc0;
|
head = 0xc0;
|
||||||
} else if (unichar <= 0xffff) {
|
}
|
||||||
|
else if (unichar <= 0xffff) {
|
||||||
length = 3;
|
length = 3;
|
||||||
head = 0xe0;
|
head = 0xe0;
|
||||||
} else if (unichar <= 0x1fffff) {
|
}
|
||||||
|
else if (unichar <= 0x1fffff) {
|
||||||
length = 4;
|
length = 4;
|
||||||
head = 0xf0;
|
head = 0xf0;
|
||||||
} else if (unichar <= 0x3ffffff) {
|
}
|
||||||
|
else if (unichar <= 0x3ffffff) {
|
||||||
length = 5;
|
length = 5;
|
||||||
head = 0xf8;
|
head = 0xf8;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
length = 6;
|
length = 6;
|
||||||
head = 0xfc;
|
head = 0xfc;
|
||||||
}
|
}
|
||||||
|
|
67
src/keysym.c
67
src/keysym.c
|
@ -1,28 +1,28 @@
|
||||||
/*
|
/*
|
||||||
Copyright 1985, 1987, 1990, 1998 The Open Group
|
* Copyright 1985, 1987, 1990, 1998 The Open Group
|
||||||
Copyright 2008 Dan Nicholson
|
* Copyright 2008 Dan Nicholson
|
||||||
|
*
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
to deal in the Software without restriction, including without limitation
|
* to deal in the Software without restriction, including without limitation
|
||||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
and/or sell copies of the Software, and to permit persons to whom the
|
* and/or sell copies of the Software, and to permit persons to whom the
|
||||||
Software is furnished to do so, subject to the following conditions:
|
* Software is furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
The above copyright notice and this permission notice shall be included in
|
* The above copyright notice and this permission notice shall be included in
|
||||||
all copies or substantial portions of the Software.
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
* AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
Except as contained in this notice, the names of the authors or their
|
* Except as contained in this notice, the names of the authors or their
|
||||||
institutions shall not be used in advertising or otherwise to promote the
|
* institutions shall not be used in advertising or otherwise to promote the
|
||||||
sale, use or other dealings in this Software without prior written
|
* sale, use or other dealings in this Software without prior written
|
||||||
authorization from the authors.
|
* authorization from the authors.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -104,8 +104,7 @@ xkb_keysym_from_name(const char *s)
|
||||||
entry = &_XkeyTable[idx];
|
entry = &_XkeyTable[idx];
|
||||||
|
|
||||||
if ((entry[0] == sig1) && (entry[1] == sig2) &&
|
if ((entry[0] == sig1) && (entry[1] == sig2) &&
|
||||||
!strcmp(s, (const char *)entry + 6))
|
!strcmp(s, (const char *) entry + 6)) {
|
||||||
{
|
|
||||||
val = (entry[2] << 24) | (entry[3] << 16) |
|
val = (entry[2] << 24) | (entry[3] << 16) |
|
||||||
(entry[4] << 8) | entry[5];
|
(entry[4] << 8) | entry[5];
|
||||||
if (!val)
|
if (!val)
|
||||||
|
@ -173,20 +172,25 @@ keysym_get_case(xkb_keysym_t ks)
|
||||||
switch (set) {
|
switch (set) {
|
||||||
case 0: /* latin 1 */
|
case 0: /* latin 1 */
|
||||||
if ((ks >= XKB_KEY_A && ks <= XKB_KEY_Z) ||
|
if ((ks >= XKB_KEY_A && ks <= XKB_KEY_Z) ||
|
||||||
(ks >= XKB_KEY_Agrave && ks <= XKB_KEY_THORN && ks != XKB_KEY_multiply))
|
(ks >= XKB_KEY_Agrave && ks <= XKB_KEY_THORN && ks !=
|
||||||
|
XKB_KEY_multiply))
|
||||||
return UPPERCASE;
|
return UPPERCASE;
|
||||||
if ((ks >= XKB_KEY_a && ks <= XKB_KEY_z) ||
|
if ((ks >= XKB_KEY_a && ks <= XKB_KEY_z) ||
|
||||||
(ks >= XKB_KEY_agrave && ks <= XKB_KEY_ydiaeresis))
|
(ks >= XKB_KEY_agrave && ks <= XKB_KEY_ydiaeresis))
|
||||||
return LOWERCASE;
|
return LOWERCASE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1: /* latin 2 */
|
case 1: /* latin 2 */
|
||||||
if ((ks >= XKB_KEY_Aogonek && ks <= XKB_KEY_Zabovedot && ks != XKB_KEY_breve) ||
|
if ((ks >= XKB_KEY_Aogonek && ks <= XKB_KEY_Zabovedot && ks !=
|
||||||
|
XKB_KEY_breve) ||
|
||||||
(ks >= XKB_KEY_Racute && ks <= XKB_KEY_Tcedilla))
|
(ks >= XKB_KEY_Racute && ks <= XKB_KEY_Tcedilla))
|
||||||
return UPPERCASE;
|
return UPPERCASE;
|
||||||
if ((ks >= XKB_KEY_aogonek && ks <= XKB_KEY_zabovedot && ks != XKB_KEY_caron) ||
|
if ((ks >= XKB_KEY_aogonek && ks <= XKB_KEY_zabovedot && ks !=
|
||||||
|
XKB_KEY_caron) ||
|
||||||
(ks >= XKB_KEY_racute && ks <= XKB_KEY_tcedilla))
|
(ks >= XKB_KEY_racute && ks <= XKB_KEY_tcedilla))
|
||||||
return LOWERCASE;
|
return LOWERCASE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: /* latin 3 */
|
case 2: /* latin 3 */
|
||||||
if ((ks >= XKB_KEY_Hstroke && ks <= XKB_KEY_Jcircumflex) ||
|
if ((ks >= XKB_KEY_Hstroke && ks <= XKB_KEY_Jcircumflex) ||
|
||||||
(ks >= XKB_KEY_Cabovedot && ks <= XKB_KEY_Scircumflex))
|
(ks >= XKB_KEY_Cabovedot && ks <= XKB_KEY_Scircumflex))
|
||||||
|
@ -195,6 +199,7 @@ keysym_get_case(xkb_keysym_t ks)
|
||||||
(ks >= XKB_KEY_cabovedot && ks <= XKB_KEY_scircumflex))
|
(ks >= XKB_KEY_cabovedot && ks <= XKB_KEY_scircumflex))
|
||||||
return LOWERCASE;
|
return LOWERCASE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3: /* latin 4 */
|
case 3: /* latin 4 */
|
||||||
if ((ks >= XKB_KEY_Rcedilla && ks <= XKB_KEY_Tslash) ||
|
if ((ks >= XKB_KEY_Rcedilla && ks <= XKB_KEY_Tslash) ||
|
||||||
(ks == XKB_KEY_ENG) ||
|
(ks == XKB_KEY_ENG) ||
|
||||||
|
@ -205,6 +210,7 @@ keysym_get_case(xkb_keysym_t ks)
|
||||||
(ks >= XKB_KEY_amacron && ks <= XKB_KEY_umacron))
|
(ks >= XKB_KEY_amacron && ks <= XKB_KEY_umacron))
|
||||||
return LOWERCASE;
|
return LOWERCASE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6: /* Cyrillic */
|
case 6: /* Cyrillic */
|
||||||
if ((ks >= XKB_KEY_Serbian_DJE && ks <= XKB_KEY_Serbian_DZE) ||
|
if ((ks >= XKB_KEY_Serbian_DJE && ks <= XKB_KEY_Serbian_DZE) ||
|
||||||
(ks >= XKB_KEY_Cyrillic_YU && ks <= XKB_KEY_Cyrillic_HARDSIGN))
|
(ks >= XKB_KEY_Cyrillic_YU && ks <= XKB_KEY_Cyrillic_HARDSIGN))
|
||||||
|
@ -213,6 +219,7 @@ keysym_get_case(xkb_keysym_t ks)
|
||||||
(ks >= XKB_KEY_Cyrillic_yu && ks <= XKB_KEY_Cyrillic_hardsign))
|
(ks >= XKB_KEY_Cyrillic_yu && ks <= XKB_KEY_Cyrillic_hardsign))
|
||||||
return LOWERCASE;
|
return LOWERCASE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 7: /* Greek */
|
case 7: /* Greek */
|
||||||
if ((ks >= XKB_KEY_Greek_ALPHAaccent &&
|
if ((ks >= XKB_KEY_Greek_ALPHAaccent &&
|
||||||
ks <= XKB_KEY_Greek_OMEGAaccent) ||
|
ks <= XKB_KEY_Greek_OMEGAaccent) ||
|
||||||
|
@ -223,6 +230,7 @@ keysym_get_case(xkb_keysym_t ks)
|
||||||
(ks >= XKB_KEY_Greek_alpha && ks <= XKB_KEY_Greek_OMEGA))
|
(ks >= XKB_KEY_Greek_alpha && ks <= XKB_KEY_Greek_OMEGA))
|
||||||
return LOWERCASE;
|
return LOWERCASE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 18: /* latin 8 */
|
case 18: /* latin 8 */
|
||||||
if ((ks == XKB_KEY_Wcircumflex) ||
|
if ((ks == XKB_KEY_Wcircumflex) ||
|
||||||
(ks == XKB_KEY_Ycircumflex) ||
|
(ks == XKB_KEY_Ycircumflex) ||
|
||||||
|
@ -249,6 +257,7 @@ keysym_get_case(xkb_keysym_t ks)
|
||||||
(ks == XKB_KEY_ygrave))
|
(ks == XKB_KEY_ygrave))
|
||||||
return LOWERCASE;
|
return LOWERCASE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 19: /* latin 9 */
|
case 19: /* latin 9 */
|
||||||
if (ks == XKB_KEY_OE || ks == XKB_KEY_Ydiaeresis)
|
if (ks == XKB_KEY_OE || ks == XKB_KEY_Ydiaeresis)
|
||||||
return UPPERCASE;
|
return UPPERCASE;
|
||||||
|
|
|
@ -281,9 +281,11 @@ xkb_key_get_group(struct xkb_state *state, xkb_keycode_t key)
|
||||||
if (ret >= num_groups)
|
if (ret >= num_groups)
|
||||||
ret = 0;
|
ret = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XkbClampIntoRange:
|
case XkbClampIntoRange:
|
||||||
ret = num_groups - 1;
|
ret = num_groups - 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XkbWrapIntoRange:
|
case XkbWrapIntoRange:
|
||||||
default:
|
default:
|
||||||
ret %= num_groups;
|
ret %= num_groups;
|
||||||
|
|
49
src/state.c
49
src/state.c
|
@ -1,27 +1,27 @@
|
||||||
/************************************************************
|
/************************************************************
|
||||||
Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
|
* Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
|
||||||
|
*
|
||||||
Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
software and its documentation for any purpose and without
|
* software and its documentation for any purpose and without
|
||||||
fee is hereby granted, provided that the above copyright
|
* fee is hereby granted, provided that the above copyright
|
||||||
notice appear in all copies and that both that copyright
|
* notice appear in all copies and that both that copyright
|
||||||
notice and this permission notice appear in supporting
|
* notice and this permission notice appear in supporting
|
||||||
documentation, and that the name of Silicon Graphics not be
|
* documentation, and that the name of Silicon Graphics not be
|
||||||
used in advertising or publicity pertaining to distribution
|
* used in advertising or publicity pertaining to distribution
|
||||||
of the software without specific prior written permission.
|
* of the software without specific prior written permission.
|
||||||
Silicon Graphics makes no representation about the suitability
|
* Silicon Graphics makes no representation about the suitability
|
||||||
of this software for any purpose. It is provided "as is"
|
* of this software for any purpose. It is provided "as is"
|
||||||
without any express or implied warranty.
|
* without any express or implied warranty.
|
||||||
|
*
|
||||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -575,7 +575,8 @@ xkb_state_led_update_all(struct xkb_state *state)
|
||||||
static void
|
static void
|
||||||
xkb_state_update_derived(struct xkb_state *state)
|
xkb_state_update_derived(struct xkb_state *state)
|
||||||
{
|
{
|
||||||
state->mods = (state->base_mods | state->latched_mods | state->locked_mods);
|
state->mods =
|
||||||
|
(state->base_mods | state->latched_mods | state->locked_mods);
|
||||||
/* FIXME: Clamp/wrap locked_group */
|
/* FIXME: Clamp/wrap locked_group */
|
||||||
state->group = state->locked_group + state->base_group +
|
state->group = state->locked_group + state->base_group +
|
||||||
state->latched_group;
|
state->latched_group;
|
||||||
|
|
50
src/text.c
50
src/text.c
|
@ -1,27 +1,27 @@
|
||||||
/************************************************************
|
/************************************************************
|
||||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||||
|
*
|
||||||
Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
software and its documentation for any purpose and without
|
* software and its documentation for any purpose and without
|
||||||
fee is hereby granted, provided that the above copyright
|
* fee is hereby granted, provided that the above copyright
|
||||||
notice appear in all copies and that both that copyright
|
* notice appear in all copies and that both that copyright
|
||||||
notice and this permission notice appear in supporting
|
* notice and this permission notice appear in supporting
|
||||||
documentation, and that the name of Silicon Graphics not be
|
* documentation, and that the name of Silicon Graphics not be
|
||||||
used in advertising or publicity pertaining to distribution
|
* used in advertising or publicity pertaining to distribution
|
||||||
of the software without specific prior written permission.
|
* of the software without specific prior written permission.
|
||||||
Silicon Graphics makes no representation about the suitability
|
* Silicon Graphics makes no representation about the suitability
|
||||||
of this software for any purpose. It is provided "as is"
|
* of this software for any purpose. It is provided "as is"
|
||||||
without any express or implied warranty.
|
* without any express or implied warranty.
|
||||||
|
*
|
||||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
||||||
#include "text.h"
|
#include "text.h"
|
||||||
|
@ -94,8 +94,8 @@ XkbcVModMaskText(struct xkb_keymap *keymap, unsigned modMask, unsigned mask)
|
||||||
rem = BUFFER_SIZE;
|
rem = BUFFER_SIZE;
|
||||||
|
|
||||||
if (mask) {
|
if (mask) {
|
||||||
for (i = 0, bit = 1; i < XkbNumVirtualMods && rem > 1; i++, bit <<= 1)
|
for (i = 0, bit = 1; i < XkbNumVirtualMods && rem > 1; i++, bit <<=
|
||||||
{
|
1) {
|
||||||
if (!(mask & bit))
|
if (!(mask & bit))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
46
src/text.h
46
src/text.h
|
@ -1,27 +1,27 @@
|
||||||
/*
|
/*
|
||||||
Copyright 2009 Dan Nicholson
|
* Copyright 2009 Dan Nicholson
|
||||||
|
*
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
to deal in the Software without restriction, including without limitation
|
* to deal in the Software without restriction, including without limitation
|
||||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
and/or sell copies of the Software, and to permit persons to whom the
|
* and/or sell copies of the Software, and to permit persons to whom the
|
||||||
Software is furnished to do so, subject to the following conditions:
|
* Software is furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
The above copyright notice and this permission notice shall be included in
|
* The above copyright notice and this permission notice shall be included in
|
||||||
all copies or substantial portions of the Software.
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
* AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
Except as contained in this notice, the names of the authors or their
|
* Except as contained in this notice, the names of the authors or their
|
||||||
institutions shall not be used in advertising or otherwise to promote the
|
* institutions shall not be used in advertising or otherwise to promote the
|
||||||
sale, use or other dealings in this Software without prior written
|
* sale, use or other dealings in this Software without prior written
|
||||||
authorization from the authors.
|
* authorization from the authors.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TEXT_H
|
#ifndef TEXT_H
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/*\
|
/*\
|
||||||
*
|
*
|
||||||
* COPYRIGHT 1990
|
* COPYRIGHT 1990
|
||||||
|
@ -40,8 +39,7 @@ static char *prefix = NULL;
|
||||||
bool
|
bool
|
||||||
uSetErrorFile(char *name)
|
uSetErrorFile(char *name)
|
||||||
{
|
{
|
||||||
if ((errorFile != NULL) && (errorFile != stderr))
|
if ((errorFile != NULL) && (errorFile != stderr)) {
|
||||||
{
|
|
||||||
fprintf(errorFile, "switching to %s\n", name ? name : "stderr");
|
fprintf(errorFile, "switching to %s\n", name ? name : "stderr");
|
||||||
fclose(errorFile);
|
fclose(errorFile);
|
||||||
}
|
}
|
||||||
|
@ -49,8 +47,7 @@ uSetErrorFile(char *name)
|
||||||
errorFile = fopen(name, "w");
|
errorFile = fopen(name, "w");
|
||||||
else
|
else
|
||||||
errorFile = stderr;
|
errorFile = stderr;
|
||||||
if (errorFile == NULL)
|
if (errorFile == NULL) {
|
||||||
{
|
|
||||||
errorFile = stderr;
|
errorFile = stderr;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
108
src/xkb-priv.h
108
src/xkb-priv.h
|
@ -1,54 +1,54 @@
|
||||||
/*
|
/*
|
||||||
Copyright 1985, 1987, 1990, 1998 The Open Group
|
* Copyright 1985, 1987, 1990, 1998 The Open Group
|
||||||
Copyright 2008 Dan Nicholson
|
* Copyright 2008 Dan Nicholson
|
||||||
|
*
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
to deal in the Software without restriction, including without limitation
|
* to deal in the Software without restriction, including without limitation
|
||||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
and/or sell copies of the Software, and to permit persons to whom the
|
* and/or sell copies of the Software, and to permit persons to whom the
|
||||||
Software is furnished to do so, subject to the following conditions:
|
* Software is furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
The above copyright notice and this permission notice shall be included in
|
* The above copyright notice and this permission notice shall be included in
|
||||||
all copies or substantial portions of the Software.
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
* AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
Except as contained in this notice, the names of the authors or their
|
* Except as contained in this notice, the names of the authors or their
|
||||||
institutions shall not be used in advertising or otherwise to promote the
|
* institutions shall not be used in advertising or otherwise to promote the
|
||||||
sale, use or other dealings in this Software without prior written
|
* sale, use or other dealings in this Software without prior written
|
||||||
authorization from the authors.
|
* authorization from the authors.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/************************************************************
|
/************************************************************
|
||||||
Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
|
* Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
|
||||||
|
*
|
||||||
Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
software and its documentation for any purpose and without
|
* software and its documentation for any purpose and without
|
||||||
fee is hereby granted, provided that the above copyright
|
* fee is hereby granted, provided that the above copyright
|
||||||
notice appear in all copies and that both that copyright
|
* notice appear in all copies and that both that copyright
|
||||||
notice and this permission notice appear in supporting
|
* notice and this permission notice appear in supporting
|
||||||
documentation, and that the name of Silicon Graphics not be
|
* documentation, and that the name of Silicon Graphics not be
|
||||||
used in advertising or publicity pertaining to distribution
|
* used in advertising or publicity pertaining to distribution
|
||||||
of the software without specific prior written permission.
|
* of the software without specific prior written permission.
|
||||||
Silicon Graphics makes no representation about the suitability
|
* Silicon Graphics makes no representation about the suitability
|
||||||
of this software for any purpose. It is provided "as is"
|
* of this software for any purpose. It is provided "as is"
|
||||||
without any express or implied warranty.
|
* without any express or implied warranty.
|
||||||
|
*
|
||||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -105,7 +105,8 @@ enum xkb_file_type {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Files needed for a complete keymap. */
|
/* Files needed for a complete keymap. */
|
||||||
#define REQUIRED_FILE_TYPES (FILE_TYPE_TYPES | FILE_TYPE_COMPAT | FILE_TYPE_SYMBOLS | FILE_TYPE_KEYCODES)
|
#define REQUIRED_FILE_TYPES (FILE_TYPE_TYPES | FILE_TYPE_COMPAT | \
|
||||||
|
FILE_TYPE_SYMBOLS | FILE_TYPE_KEYCODES)
|
||||||
#define LEGAL_FILE_TYPES REQUIRED_FILE_TYPES
|
#define LEGAL_FILE_TYPES REQUIRED_FILE_TYPES
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -295,7 +296,6 @@ struct xkb_server_map {
|
||||||
uint32_t *vmodmap; /* key -> vmod mapping */
|
uint32_t *vmodmap; /* key -> vmod mapping */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct xkb_indicator_map {
|
struct xkb_indicator_map {
|
||||||
unsigned char flags;
|
unsigned char flags;
|
||||||
unsigned char which_groups;
|
unsigned char which_groups;
|
||||||
|
@ -371,7 +371,9 @@ struct xkb_keymap {
|
||||||
#define XkbOutOfRangeGroupInfo(g) ((g) & 0xf0)
|
#define XkbOutOfRangeGroupInfo(g) ((g) & 0xf0)
|
||||||
#define XkbOutOfRangeGroupAction(g) ((g) & 0xc0)
|
#define XkbOutOfRangeGroupAction(g) ((g) & 0xc0)
|
||||||
#define XkbOutOfRangeGroupNumber(g) (((g) & 0x30) >> 4)
|
#define XkbOutOfRangeGroupNumber(g) (((g) & 0x30) >> 4)
|
||||||
#define XkbSetGroupInfo(g, w, n) (((w) & 0xc0) | (((n) & 3) << 4) | ((g) & 0x0f))
|
#define XkbSetGroupInfo(g, w, \
|
||||||
|
n) (((w) & \
|
||||||
|
0xc0) | (((n) & 3) << 4) | ((g) & 0x0f))
|
||||||
#define XkbSetNumGroups(g, n) (((g) & 0xf0) | ((n) & 0x0f))
|
#define XkbSetNumGroups(g, n) (((g) & 0xf0) | ((n) & 0x0f))
|
||||||
|
|
||||||
#define XkbKeyGroupInfo(d, k) \
|
#define XkbKeyGroupInfo(d, k) \
|
||||||
|
@ -387,11 +389,13 @@ struct xkb_keymap {
|
||||||
#define XkbKeyType(d, k, g) \
|
#define XkbKeyType(d, k, g) \
|
||||||
(&darray_item((d)->map->types, XkbKeyTypeIndex(d, k, g)))
|
(&darray_item((d)->map->types, XkbKeyTypeIndex(d, k, g)))
|
||||||
#define XkbKeyNumSyms(d, k, g, sl) \
|
#define XkbKeyNumSyms(d, k, g, sl) \
|
||||||
(darray_item((d)->map->key_sym_map, k).num_syms[(g * XkbKeyGroupsWidth(d, k)) + sl])
|
(darray_item((d)->map->key_sym_map, \
|
||||||
|
k).num_syms[(g * XkbKeyGroupsWidth(d, k)) + sl])
|
||||||
#define XkbKeySym(d, k, n) \
|
#define XkbKeySym(d, k, n) \
|
||||||
(&darray_item(darray_item((d)->map->key_sym_map, k).syms, n))
|
(&darray_item(darray_item((d)->map->key_sym_map, k).syms, n))
|
||||||
#define XkbKeySymOffset(d, k, g, sl) \
|
#define XkbKeySymOffset(d, k, g, sl) \
|
||||||
(darray_item((d)->map->key_sym_map, k).sym_index[(g * XkbKeyGroupsWidth(d, k)) + sl])
|
(darray_item((d)->map->key_sym_map, \
|
||||||
|
k).sym_index[(g * XkbKeyGroupsWidth(d, k)) + sl])
|
||||||
#define XkbKeySymEntry(d, k, g, sl) \
|
#define XkbKeySymEntry(d, k, g, sl) \
|
||||||
(XkbKeySym(d, k, XkbKeySymOffset(d, k, g, sl)))
|
(XkbKeySym(d, k, XkbKeySymOffset(d, k, g, sl)))
|
||||||
#define XkbKeyHasActions(d, k) \
|
#define XkbKeyHasActions(d, k) \
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
/************************************************************
|
/************************************************************
|
||||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||||
|
*
|
||||||
Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
software and its documentation for any purpose and without
|
* software and its documentation for any purpose and without
|
||||||
fee is hereby granted, provided that the above copyright
|
* fee is hereby granted, provided that the above copyright
|
||||||
notice appear in all copies and that both that copyright
|
* notice appear in all copies and that both that copyright
|
||||||
notice and this permission notice appear in supporting
|
* notice and this permission notice appear in supporting
|
||||||
documentation, and that the name of Silicon Graphics not be
|
* documentation, and that the name of Silicon Graphics not be
|
||||||
used in advertising or publicity pertaining to distribution
|
* used in advertising or publicity pertaining to distribution
|
||||||
of the software without specific prior written permission.
|
* of the software without specific prior written permission.
|
||||||
Silicon Graphics makes no representation about the suitability
|
* Silicon Graphics makes no representation about the suitability
|
||||||
of this software for any purpose. It is provided "as is"
|
* of this software for any purpose. It is provided "as is"
|
||||||
without any express or implied warranty.
|
* without any express or implied warranty.
|
||||||
|
*
|
||||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
||||||
#include "action.h"
|
#include "action.h"
|
||||||
|
@ -237,13 +237,11 @@ CheckModifierField(struct xkb_keymap *keymap, unsigned action, ExprDef *value,
|
||||||
{
|
{
|
||||||
ExprResult rtrn;
|
ExprResult rtrn;
|
||||||
|
|
||||||
if (value->op == ExprIdent)
|
if (value->op == ExprIdent) {
|
||||||
{
|
|
||||||
const char *valStr;
|
const char *valStr;
|
||||||
valStr = xkb_atom_text(keymap->ctx, value->value.str);
|
valStr = xkb_atom_text(keymap->ctx, value->value.str);
|
||||||
if (valStr && ((strcasecmp(valStr, "usemodmapmods") == 0) ||
|
if (valStr && ((strcasecmp(valStr, "usemodmapmods") == 0) ||
|
||||||
(strcasecmp(valStr, "modmapmods") == 0)))
|
(strcasecmp(valStr, "modmapmods") == 0))) {
|
||||||
{
|
|
||||||
|
|
||||||
*mods_rtrn = 0;
|
*mods_rtrn = 0;
|
||||||
*flags_inout |= XkbSA_UseModMapMods;
|
*flags_inout |= XkbSA_UseModMapMods;
|
||||||
|
@ -266,31 +264,27 @@ HandleSetLatchMods(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||||
unsigned t1, t2;
|
unsigned t1, t2;
|
||||||
|
|
||||||
act = (struct xkb_mod_action *) action;
|
act = (struct xkb_mod_action *) action;
|
||||||
if (array_ndx != NULL)
|
if (array_ndx != NULL) {
|
||||||
{
|
switch (field) {
|
||||||
switch (field)
|
|
||||||
{
|
|
||||||
case F_ClearLocks:
|
case F_ClearLocks:
|
||||||
case F_LatchToLock:
|
case F_LatchToLock:
|
||||||
case F_Modifiers:
|
case F_Modifiers:
|
||||||
return ReportActionNotArray(action->type, field);
|
return ReportActionNotArray(action->type, field);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch (field)
|
switch (field) {
|
||||||
{
|
|
||||||
case F_ClearLocks:
|
case F_ClearLocks:
|
||||||
case F_LatchToLock:
|
case F_LatchToLock:
|
||||||
rtrn = act->flags;
|
rtrn = act->flags;
|
||||||
if (CheckLatchLockFlags(keymap, action->type, field, value, &rtrn))
|
if (CheckLatchLockFlags(keymap, action->type, field, value, &rtrn)) {
|
||||||
{
|
|
||||||
act->flags = rtrn;
|
act->flags = rtrn;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case F_Modifiers:
|
case F_Modifiers:
|
||||||
t1 = act->flags;
|
t1 = act->flags;
|
||||||
if (CheckModifierField(keymap, action->type, value, &t1, &t2))
|
if (CheckModifierField(keymap, action->type, value, &t1, &t2)) {
|
||||||
{
|
|
||||||
act->flags = t1;
|
act->flags = t1;
|
||||||
act->real_mods = act->mask = (t2 & 0xff);
|
act->real_mods = act->mask = (t2 & 0xff);
|
||||||
act->vmods = (t2 >> 8) & 0xffff;
|
act->vmods = (t2 >> 8) & 0xffff;
|
||||||
|
@ -311,12 +305,10 @@ HandleLockMods(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||||
act = (struct xkb_mod_action *) action;
|
act = (struct xkb_mod_action *) action;
|
||||||
if ((array_ndx != NULL) && (field == F_Modifiers))
|
if ((array_ndx != NULL) && (field == F_Modifiers))
|
||||||
return ReportActionNotArray(action->type, field);
|
return ReportActionNotArray(action->type, field);
|
||||||
switch (field)
|
switch (field) {
|
||||||
{
|
|
||||||
case F_Modifiers:
|
case F_Modifiers:
|
||||||
t1 = act->flags;
|
t1 = act->flags;
|
||||||
if (CheckModifierField(keymap, action->type, value, &t1, &t2))
|
if (CheckModifierField(keymap, action->type, value, &t1, &t2)) {
|
||||||
{
|
|
||||||
act->flags = t1;
|
act->flags = t1;
|
||||||
act->real_mods = act->mask = (t2 & 0xff);
|
act->real_mods = act->mask = (t2 & 0xff);
|
||||||
act->vmods = (t2 >> 8) & 0xffff;
|
act->vmods = (t2 >> 8) & 0xffff;
|
||||||
|
@ -334,13 +326,11 @@ CheckGroupField(struct xkb_keymap *keymap, unsigned action,
|
||||||
ExprDef *spec;
|
ExprDef *spec;
|
||||||
ExprResult rtrn;
|
ExprResult rtrn;
|
||||||
|
|
||||||
if ((value->op == OpNegate) || (value->op == OpUnaryPlus))
|
if ((value->op == OpNegate) || (value->op == OpUnaryPlus)) {
|
||||||
{
|
|
||||||
*flags_inout &= ~XkbSA_GroupAbsolute;
|
*flags_inout &= ~XkbSA_GroupAbsolute;
|
||||||
spec = value->value.child;
|
spec = value->value.child;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
*flags_inout |= XkbSA_GroupAbsolute;
|
*flags_inout |= XkbSA_GroupAbsolute;
|
||||||
spec = value;
|
spec = value;
|
||||||
}
|
}
|
||||||
|
@ -366,31 +356,27 @@ HandleSetLatchGroup(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||||
int t2;
|
int t2;
|
||||||
|
|
||||||
act = (struct xkb_group_action *) action;
|
act = (struct xkb_group_action *) action;
|
||||||
if (array_ndx != NULL)
|
if (array_ndx != NULL) {
|
||||||
{
|
switch (field) {
|
||||||
switch (field)
|
|
||||||
{
|
|
||||||
case F_ClearLocks:
|
case F_ClearLocks:
|
||||||
case F_LatchToLock:
|
case F_LatchToLock:
|
||||||
case F_Group:
|
case F_Group:
|
||||||
return ReportActionNotArray(action->type, field);
|
return ReportActionNotArray(action->type, field);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch (field)
|
switch (field) {
|
||||||
{
|
|
||||||
case F_ClearLocks:
|
case F_ClearLocks:
|
||||||
case F_LatchToLock:
|
case F_LatchToLock:
|
||||||
rtrn = act->flags;
|
rtrn = act->flags;
|
||||||
if (CheckLatchLockFlags(keymap, action->type, field, value, &rtrn))
|
if (CheckLatchLockFlags(keymap, action->type, field, value, &rtrn)) {
|
||||||
{
|
|
||||||
act->flags = rtrn;
|
act->flags = rtrn;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case F_Group:
|
case F_Group:
|
||||||
t1 = act->flags;
|
t1 = act->flags;
|
||||||
if (CheckGroupField(keymap, action->type, value, &t1, &t2))
|
if (CheckGroupField(keymap, action->type, value, &t1, &t2)) {
|
||||||
{
|
|
||||||
act->flags = t1;
|
act->flags = t1;
|
||||||
act->group = t2;
|
act->group = t2;
|
||||||
return true;
|
return true;
|
||||||
|
@ -411,11 +397,9 @@ HandleLockGroup(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||||
act = (struct xkb_group_action *) action;
|
act = (struct xkb_group_action *) action;
|
||||||
if ((array_ndx != NULL) && (field == F_Group))
|
if ((array_ndx != NULL) && (field == F_Group))
|
||||||
return ReportActionNotArray(action->type, field);
|
return ReportActionNotArray(action->type, field);
|
||||||
if (field == F_Group)
|
if (field == F_Group) {
|
||||||
{
|
|
||||||
t1 = act->flags;
|
t1 = act->flags;
|
||||||
if (CheckGroupField(keymap, action->type, value, &t1, &t2))
|
if (CheckGroupField(keymap, action->type, value, &t1, &t2)) {
|
||||||
{
|
|
||||||
act->flags = t1;
|
act->flags = t1;
|
||||||
act->group = t2;
|
act->group = t2;
|
||||||
return true;
|
return true;
|
||||||
|
@ -437,30 +421,26 @@ HandleMovePtr(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||||
if ((array_ndx != NULL) && ((field == F_X) || (field == F_Y)))
|
if ((array_ndx != NULL) && ((field == F_X) || (field == F_Y)))
|
||||||
return ReportActionNotArray(action->type, field);
|
return ReportActionNotArray(action->type, field);
|
||||||
|
|
||||||
if ((field == F_X) || (field == F_Y))
|
if ((field == F_X) || (field == F_Y)) {
|
||||||
{
|
|
||||||
if ((value->op == OpNegate) || (value->op == OpUnaryPlus))
|
if ((value->op == OpNegate) || (value->op == OpUnaryPlus))
|
||||||
absolute = false;
|
absolute = false;
|
||||||
else
|
else
|
||||||
absolute = true;
|
absolute = true;
|
||||||
if (!ExprResolveInteger(keymap->ctx, value, &rtrn))
|
if (!ExprResolveInteger(keymap->ctx, value, &rtrn))
|
||||||
return ReportMismatch(action->type, field, "integer");
|
return ReportMismatch(action->type, field, "integer");
|
||||||
if (field == F_X)
|
if (field == F_X) {
|
||||||
{
|
|
||||||
if (absolute)
|
if (absolute)
|
||||||
act->flags |= XkbSA_MoveAbsoluteX;
|
act->flags |= XkbSA_MoveAbsoluteX;
|
||||||
act->x = rtrn.ival;
|
act->x = rtrn.ival;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
if (absolute)
|
if (absolute)
|
||||||
act->flags |= XkbSA_MoveAbsoluteY;
|
act->flags |= XkbSA_MoveAbsoluteY;
|
||||||
act->y = rtrn.ival;
|
act->y = rtrn.ival;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (field == F_Accel)
|
else if (field == F_Accel) {
|
||||||
{
|
|
||||||
if (!ExprResolveBoolean(keymap->ctx, value, &rtrn))
|
if (!ExprResolveBoolean(keymap->ctx, value, &rtrn))
|
||||||
return ReportMismatch(action->type, field, "boolean");
|
return ReportMismatch(action->type, field, "boolean");
|
||||||
if (rtrn.uval)
|
if (rtrn.uval)
|
||||||
|
@ -487,15 +467,13 @@ HandlePtrBtn(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||||
struct xkb_pointer_button_action *act;
|
struct xkb_pointer_button_action *act;
|
||||||
|
|
||||||
act = (struct xkb_pointer_button_action *) action;
|
act = (struct xkb_pointer_button_action *) action;
|
||||||
if (field == F_Button)
|
if (field == F_Button) {
|
||||||
{
|
|
||||||
if (array_ndx != NULL)
|
if (array_ndx != NULL)
|
||||||
return ReportActionNotArray(action->type, field);
|
return ReportActionNotArray(action->type, field);
|
||||||
if (!ExprResolveButton(keymap->ctx, value, &rtrn))
|
if (!ExprResolveButton(keymap->ctx, value, &rtrn))
|
||||||
return ReportMismatch(action->type, field,
|
return ReportMismatch(action->type, field,
|
||||||
"integer (range 1..5)");
|
"integer (range 1..5)");
|
||||||
if ((rtrn.ival < 0) || (rtrn.ival > 5))
|
if ((rtrn.ival < 0) || (rtrn.ival > 5)) {
|
||||||
{
|
|
||||||
ERROR("Button must specify default or be in the range 1..5\n");
|
ERROR("Button must specify default or be in the range 1..5\n");
|
||||||
ACTION("Illegal button value %d ignored\n", rtrn.ival);
|
ACTION("Illegal button value %d ignored\n", rtrn.ival);
|
||||||
return false;
|
return false;
|
||||||
|
@ -503,8 +481,7 @@ HandlePtrBtn(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||||
act->button = rtrn.ival;
|
act->button = rtrn.ival;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if ((action->type == XkbSA_LockPtrBtn) && (field == F_Affect))
|
else if ((action->type == XkbSA_LockPtrBtn) && (field == F_Affect)) {
|
||||||
{
|
|
||||||
if (array_ndx != NULL)
|
if (array_ndx != NULL)
|
||||||
return ReportActionNotArray(action->type, field);
|
return ReportActionNotArray(action->type, field);
|
||||||
if (!ExprResolveEnum(keymap->ctx, value, &rtrn, lockWhich))
|
if (!ExprResolveEnum(keymap->ctx, value, &rtrn, lockWhich))
|
||||||
|
@ -513,14 +490,12 @@ HandlePtrBtn(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||||
act->flags |= rtrn.ival;
|
act->flags |= rtrn.ival;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (field == F_Count)
|
else if (field == F_Count) {
|
||||||
{
|
|
||||||
if (array_ndx != NULL)
|
if (array_ndx != NULL)
|
||||||
return ReportActionNotArray(action->type, field);
|
return ReportActionNotArray(action->type, field);
|
||||||
if (!ExprResolveButton(keymap->ctx, value, &rtrn))
|
if (!ExprResolveButton(keymap->ctx, value, &rtrn))
|
||||||
return ReportMismatch(action->type, field, "integer");
|
return ReportMismatch(action->type, field, "integer");
|
||||||
if ((rtrn.ival < 0) || (rtrn.ival > 255))
|
if ((rtrn.ival < 0) || (rtrn.ival > 255)) {
|
||||||
{
|
|
||||||
ERROR("The count field must have a value in the range 0..255\n");
|
ERROR("The count field must have a value in the range 0..255\n");
|
||||||
ACTION("Illegal count %d ignored\n", rtrn.ival);
|
ACTION("Illegal count %d ignored\n", rtrn.ival);
|
||||||
return false;
|
return false;
|
||||||
|
@ -546,8 +521,7 @@ HandleSetPtrDflt(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||||
struct xkb_pointer_default_action *act;
|
struct xkb_pointer_default_action *act;
|
||||||
|
|
||||||
act = (struct xkb_pointer_default_action *) action;
|
act = (struct xkb_pointer_default_action *) action;
|
||||||
if (field == F_Affect)
|
if (field == F_Affect) {
|
||||||
{
|
|
||||||
if (array_ndx != NULL)
|
if (array_ndx != NULL)
|
||||||
return ReportActionNotArray(action->type, field);
|
return ReportActionNotArray(action->type, field);
|
||||||
if (!ExprResolveEnum(keymap->ctx, value, &rtrn, ptrDflts))
|
if (!ExprResolveEnum(keymap->ctx, value, &rtrn, ptrDflts))
|
||||||
|
@ -555,18 +529,15 @@ HandleSetPtrDflt(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||||
act->affect = rtrn.uval;
|
act->affect = rtrn.uval;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if ((field == F_Button) || (field == F_Value))
|
else if ((field == F_Button) || (field == F_Value)) {
|
||||||
{
|
|
||||||
ExprDef *btn;
|
ExprDef *btn;
|
||||||
if (array_ndx != NULL)
|
if (array_ndx != NULL)
|
||||||
return ReportActionNotArray(action->type, field);
|
return ReportActionNotArray(action->type, field);
|
||||||
if ((value->op == OpNegate) || (value->op == OpUnaryPlus))
|
if ((value->op == OpNegate) || (value->op == OpUnaryPlus)) {
|
||||||
{
|
|
||||||
act->flags &= ~XkbSA_DfltBtnAbsolute;
|
act->flags &= ~XkbSA_DfltBtnAbsolute;
|
||||||
btn = value->value.child;
|
btn = value->value.child;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
act->flags |= XkbSA_DfltBtnAbsolute;
|
act->flags |= XkbSA_DfltBtnAbsolute;
|
||||||
btn = value;
|
btn = value;
|
||||||
}
|
}
|
||||||
|
@ -574,14 +545,12 @@ HandleSetPtrDflt(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||||
if (!ExprResolveButton(keymap->ctx, btn, &rtrn))
|
if (!ExprResolveButton(keymap->ctx, btn, &rtrn))
|
||||||
return ReportMismatch(action->type, field,
|
return ReportMismatch(action->type, field,
|
||||||
"integer (range 1..5)");
|
"integer (range 1..5)");
|
||||||
if ((rtrn.ival < 0) || (rtrn.ival > 5))
|
if ((rtrn.ival < 0) || (rtrn.ival > 5)) {
|
||||||
{
|
|
||||||
ERROR("New default button value must be in the range 1..5\n");
|
ERROR("New default button value must be in the range 1..5\n");
|
||||||
ACTION("Illegal default button value %d ignored\n", rtrn.ival);
|
ACTION("Illegal default button value %d ignored\n", rtrn.ival);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (rtrn.ival == 0)
|
if (rtrn.ival == 0) {
|
||||||
{
|
|
||||||
ERROR("Cannot set default pointer button to \"default\"\n");
|
ERROR("Cannot set default pointer button to \"default\"\n");
|
||||||
ACTION("Illegal default button setting ignored\n");
|
ACTION("Illegal default button setting ignored\n");
|
||||||
return false;
|
return false;
|
||||||
|
@ -619,31 +588,30 @@ HandleISOLock(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||||
int group;
|
int group;
|
||||||
|
|
||||||
act = (struct xkb_iso_action *) action;
|
act = (struct xkb_iso_action *) action;
|
||||||
switch (field)
|
switch (field) {
|
||||||
{
|
|
||||||
case F_Modifiers:
|
case F_Modifiers:
|
||||||
if (array_ndx != NULL)
|
if (array_ndx != NULL)
|
||||||
return ReportActionNotArray(action->type, field);
|
return ReportActionNotArray(action->type, field);
|
||||||
flags = act->flags;
|
flags = act->flags;
|
||||||
if (CheckModifierField(keymap, action->type, value, &flags, &mods))
|
if (CheckModifierField(keymap, action->type, value, &flags, &mods)) {
|
||||||
{
|
|
||||||
act->flags = flags & (~XkbSA_ISODfltIsGroup);
|
act->flags = flags & (~XkbSA_ISODfltIsGroup);
|
||||||
act->real_mods = mods & 0xff;
|
act->real_mods = mods & 0xff;
|
||||||
act->vmods = (mods >> 8) & 0xff;
|
act->vmods = (mods >> 8) & 0xff;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case F_Group:
|
case F_Group:
|
||||||
if (array_ndx != NULL)
|
if (array_ndx != NULL)
|
||||||
return ReportActionNotArray(action->type, field);
|
return ReportActionNotArray(action->type, field);
|
||||||
flags = act->flags;
|
flags = act->flags;
|
||||||
if (CheckGroupField(keymap, action->type, value, &flags, &group))
|
if (CheckGroupField(keymap, action->type, value, &flags, &group)) {
|
||||||
{
|
|
||||||
act->flags = flags | XkbSA_ISODfltIsGroup;
|
act->flags = flags | XkbSA_ISODfltIsGroup;
|
||||||
act->group = group;
|
act->group = group;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case F_Affect:
|
case F_Affect:
|
||||||
if (array_ndx != NULL)
|
if (array_ndx != NULL)
|
||||||
return ReportActionNotArray(action->type, field);
|
return ReportActionNotArray(action->type, field);
|
||||||
|
@ -663,26 +631,22 @@ HandleSwitchScreen(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||||
struct xkb_switch_screen_action *act;
|
struct xkb_switch_screen_action *act;
|
||||||
|
|
||||||
act = (struct xkb_switch_screen_action *) action;
|
act = (struct xkb_switch_screen_action *) action;
|
||||||
if (field == F_Screen)
|
if (field == F_Screen) {
|
||||||
{
|
|
||||||
ExprDef *scrn;
|
ExprDef *scrn;
|
||||||
if (array_ndx != NULL)
|
if (array_ndx != NULL)
|
||||||
return ReportActionNotArray(action->type, field);
|
return ReportActionNotArray(action->type, field);
|
||||||
if ((value->op == OpNegate) || (value->op == OpUnaryPlus))
|
if ((value->op == OpNegate) || (value->op == OpUnaryPlus)) {
|
||||||
{
|
|
||||||
act->flags &= ~XkbSA_SwitchAbsolute;
|
act->flags &= ~XkbSA_SwitchAbsolute;
|
||||||
scrn = value->value.child;
|
scrn = value->value.child;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
act->flags |= XkbSA_SwitchAbsolute;
|
act->flags |= XkbSA_SwitchAbsolute;
|
||||||
scrn = value;
|
scrn = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ExprResolveInteger(keymap->ctx, scrn, &rtrn))
|
if (!ExprResolveInteger(keymap->ctx, scrn, &rtrn))
|
||||||
return ReportMismatch(action->type, field, "integer (0..255)");
|
return ReportMismatch(action->type, field, "integer (0..255)");
|
||||||
if ((rtrn.ival < 0) || (rtrn.ival > 255))
|
if ((rtrn.ival < 0) || (rtrn.ival > 255)) {
|
||||||
{
|
|
||||||
ERROR("Screen index must be in the range 1..255\n");
|
ERROR("Screen index must be in the range 1..255\n");
|
||||||
ACTION("Illegal screen value %d ignored\n", rtrn.ival);
|
ACTION("Illegal screen value %d ignored\n", rtrn.ival);
|
||||||
return false;
|
return false;
|
||||||
|
@ -693,8 +657,7 @@ HandleSwitchScreen(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||||
act->screen = rtrn.ival;
|
act->screen = rtrn.ival;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (field == F_Same)
|
else if (field == F_Same) {
|
||||||
{
|
|
||||||
if (array_ndx != NULL)
|
if (array_ndx != NULL)
|
||||||
return ReportActionNotArray(action->type, field);
|
return ReportActionNotArray(action->type, field);
|
||||||
if (!ExprResolveBoolean(keymap->ctx, value, &rtrn))
|
if (!ExprResolveBoolean(keymap->ctx, value, &rtrn))
|
||||||
|
@ -730,15 +693,16 @@ const LookupEntry ctrlNames[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
HandleSetLockControls(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
HandleSetLockControls(struct xkb_keymap *keymap,
|
||||||
unsigned field, ExprDef *array_ndx, ExprDef *value)
|
struct xkb_any_action *action,
|
||||||
|
unsigned field, ExprDef *array_ndx,
|
||||||
|
ExprDef *value)
|
||||||
{
|
{
|
||||||
ExprResult rtrn;
|
ExprResult rtrn;
|
||||||
struct xkb_controls_action *act;
|
struct xkb_controls_action *act;
|
||||||
|
|
||||||
act = (struct xkb_controls_action *) action;
|
act = (struct xkb_controls_action *) action;
|
||||||
if (field == F_Controls)
|
if (field == F_Controls) {
|
||||||
{
|
|
||||||
if (array_ndx != NULL)
|
if (array_ndx != NULL)
|
||||||
return ReportActionNotArray(action->type, field);
|
return ReportActionNotArray(action->type, field);
|
||||||
if (!ExprResolveMask(keymap->ctx, value, &rtrn, ctrlNames))
|
if (!ExprResolveMask(keymap->ctx, value, &rtrn, ctrlNames))
|
||||||
|
@ -767,8 +731,7 @@ HandleActionMessage(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||||
struct xkb_message_action *act;
|
struct xkb_message_action *act;
|
||||||
|
|
||||||
act = (struct xkb_message_action *) action;
|
act = (struct xkb_message_action *) action;
|
||||||
switch (field)
|
switch (field) {
|
||||||
{
|
|
||||||
case F_Report:
|
case F_Report:
|
||||||
if (array_ndx != NULL)
|
if (array_ndx != NULL)
|
||||||
return ReportActionNotArray(action->type, field);
|
return ReportActionNotArray(action->type, field);
|
||||||
|
@ -778,6 +741,7 @@ HandleActionMessage(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||||
act->flags =
|
act->flags =
|
||||||
rtrn.uval & (XkbSA_MessageOnPress | XkbSA_MessageOnRelease);
|
rtrn.uval & (XkbSA_MessageOnPress | XkbSA_MessageOnRelease);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case F_GenKeyEvent:
|
case F_GenKeyEvent:
|
||||||
if (array_ndx != NULL)
|
if (array_ndx != NULL)
|
||||||
return ReportActionNotArray(action->type, field);
|
return ReportActionNotArray(action->type, field);
|
||||||
|
@ -788,16 +752,14 @@ HandleActionMessage(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||||
else
|
else
|
||||||
act->flags &= ~XkbSA_MessageGenKeyEvent;
|
act->flags &= ~XkbSA_MessageGenKeyEvent;
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case F_Data:
|
case F_Data:
|
||||||
if (array_ndx == NULL)
|
if (array_ndx == NULL) {
|
||||||
{
|
|
||||||
if (!ExprResolveString(keymap->ctx, value, &rtrn))
|
if (!ExprResolveString(keymap->ctx, value, &rtrn))
|
||||||
return ReportMismatch(action->type, field, "string");
|
return ReportMismatch(action->type, field, "string");
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
int len = strlen(rtrn.str);
|
int len = strlen(rtrn.str);
|
||||||
if ((len < 1) || (len > 6))
|
if ((len < 1) || (len > 6)) {
|
||||||
{
|
|
||||||
WARN("An action message can hold only 6 bytes\n");
|
WARN("An action message can hold only 6 bytes\n");
|
||||||
ACTION("Extra %d bytes ignored\n", len - 6);
|
ACTION("Extra %d bytes ignored\n", len - 6);
|
||||||
}
|
}
|
||||||
|
@ -805,26 +767,22 @@ HandleActionMessage(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
unsigned ndx;
|
unsigned ndx;
|
||||||
if (!ExprResolveInteger(keymap->ctx, array_ndx, &rtrn))
|
if (!ExprResolveInteger(keymap->ctx, array_ndx, &rtrn)) {
|
||||||
{
|
|
||||||
ERROR("Array subscript must be integer\n");
|
ERROR("Array subscript must be integer\n");
|
||||||
ACTION("Illegal subscript ignored\n");
|
ACTION("Illegal subscript ignored\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ndx = rtrn.uval;
|
ndx = rtrn.uval;
|
||||||
if (ndx > 5)
|
if (ndx > 5) {
|
||||||
{
|
|
||||||
ERROR("An action message is at most 6 bytes long\n");
|
ERROR("An action message is at most 6 bytes long\n");
|
||||||
ACTION("Attempt to use data[%d] ignored\n", ndx);
|
ACTION("Attempt to use data[%d] ignored\n", ndx);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!ExprResolveInteger(keymap->ctx, value, &rtrn))
|
if (!ExprResolveInteger(keymap->ctx, value, &rtrn))
|
||||||
return ReportMismatch(action->type, field, "integer");
|
return ReportMismatch(action->type, field, "integer");
|
||||||
if ((rtrn.ival < 0) || (rtrn.ival > 255))
|
if ((rtrn.ival < 0) || (rtrn.ival > 255)) {
|
||||||
{
|
|
||||||
ERROR("Message data must be in the range 0..255\n");
|
ERROR("Message data must be in the range 0..255\n");
|
||||||
ACTION("Illegal datum %d ignored\n", rtrn.ival);
|
ACTION("Illegal datum %d ignored\n", rtrn.ival);
|
||||||
return false;
|
return false;
|
||||||
|
@ -850,24 +808,23 @@ HandleRedirectKey(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||||
return ReportActionNotArray(action->type, field);
|
return ReportActionNotArray(action->type, field);
|
||||||
|
|
||||||
act = (struct xkb_redirect_key_action *) action;
|
act = (struct xkb_redirect_key_action *) action;
|
||||||
switch (field)
|
switch (field) {
|
||||||
{
|
|
||||||
case F_Keycode:
|
case F_Keycode:
|
||||||
if (!ExprResolveKeyName(keymap->ctx, value, &rtrn))
|
if (!ExprResolveKeyName(keymap->ctx, value, &rtrn))
|
||||||
return ReportMismatch(action->type, field, "key name");
|
return ReportMismatch(action->type, field, "key name");
|
||||||
tmp = KeyNameToLong(rtrn.keyName.name);
|
tmp = KeyNameToLong(rtrn.keyName.name);
|
||||||
if (!FindNamedKey(keymap, tmp, &kc, true, CreateKeyNames(keymap), 0))
|
if (!FindNamedKey(keymap, tmp, &kc, true, CreateKeyNames(keymap),
|
||||||
{
|
0)) {
|
||||||
return ReportNotFound(action->type, field, "Key",
|
return ReportNotFound(action->type, field, "Key",
|
||||||
XkbcKeyNameText(rtrn.keyName.name));
|
XkbcKeyNameText(rtrn.keyName.name));
|
||||||
}
|
}
|
||||||
act->new_key = kc;
|
act->new_key = kc;
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case F_ModsToClear:
|
case F_ModsToClear:
|
||||||
case F_Modifiers:
|
case F_Modifiers:
|
||||||
t1 = 0;
|
t1 = 0;
|
||||||
if (CheckModifierField(keymap, action->type, value, &t1, &t2))
|
if (CheckModifierField(keymap, action->type, value, &t1, &t2)) {
|
||||||
{
|
|
||||||
act->mods_mask |= (t2 & 0xff);
|
act->mods_mask |= (t2 & 0xff);
|
||||||
if (field == F_Modifiers)
|
if (field == F_Modifiers)
|
||||||
act->mods |= (t2 & 0xff);
|
act->mods |= (t2 & 0xff);
|
||||||
|
@ -895,15 +852,13 @@ HandleDeviceBtn(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||||
struct xkb_device_button_action *act;
|
struct xkb_device_button_action *act;
|
||||||
|
|
||||||
act = (struct xkb_device_button_action *) action;
|
act = (struct xkb_device_button_action *) action;
|
||||||
if (field == F_Button)
|
if (field == F_Button) {
|
||||||
{
|
|
||||||
if (array_ndx != NULL)
|
if (array_ndx != NULL)
|
||||||
return ReportActionNotArray(action->type, field);
|
return ReportActionNotArray(action->type, field);
|
||||||
if (!ExprResolveInteger(keymap->ctx, value, &rtrn))
|
if (!ExprResolveInteger(keymap->ctx, value, &rtrn))
|
||||||
return ReportMismatch(action->type, field,
|
return ReportMismatch(action->type, field,
|
||||||
"integer (range 1..255)");
|
"integer (range 1..255)");
|
||||||
if ((rtrn.ival < 0) || (rtrn.ival > 255))
|
if ((rtrn.ival < 0) || (rtrn.ival > 255)) {
|
||||||
{
|
|
||||||
ERROR("Button must specify default or be in the range 1..255\n");
|
ERROR("Button must specify default or be in the range 1..255\n");
|
||||||
ACTION("Illegal button value %d ignored\n", rtrn.ival);
|
ACTION("Illegal button value %d ignored\n", rtrn.ival);
|
||||||
return false;
|
return false;
|
||||||
|
@ -911,8 +866,7 @@ HandleDeviceBtn(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||||
act->button = rtrn.ival;
|
act->button = rtrn.ival;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if ((action->type == XkbSA_LockDeviceBtn) && (field == F_Affect))
|
else if ((action->type == XkbSA_LockDeviceBtn) && (field == F_Affect)) {
|
||||||
{
|
|
||||||
if (array_ndx != NULL)
|
if (array_ndx != NULL)
|
||||||
return ReportActionNotArray(action->type, field);
|
return ReportActionNotArray(action->type, field);
|
||||||
if (!ExprResolveEnum(keymap->ctx, value, &rtrn, lockWhich))
|
if (!ExprResolveEnum(keymap->ctx, value, &rtrn, lockWhich))
|
||||||
|
@ -921,14 +875,12 @@ HandleDeviceBtn(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||||
act->flags |= rtrn.ival;
|
act->flags |= rtrn.ival;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (field == F_Count)
|
else if (field == F_Count) {
|
||||||
{
|
|
||||||
if (array_ndx != NULL)
|
if (array_ndx != NULL)
|
||||||
return ReportActionNotArray(action->type, field);
|
return ReportActionNotArray(action->type, field);
|
||||||
if (!ExprResolveButton(keymap->ctx, value, &rtrn))
|
if (!ExprResolveButton(keymap->ctx, value, &rtrn))
|
||||||
return ReportMismatch(action->type, field, "integer");
|
return ReportMismatch(action->type, field, "integer");
|
||||||
if ((rtrn.ival < 0) || (rtrn.ival > 255))
|
if ((rtrn.ival < 0) || (rtrn.ival > 255)) {
|
||||||
{
|
|
||||||
ERROR("The count field must have a value in the range 0..255\n");
|
ERROR("The count field must have a value in the range 0..255\n");
|
||||||
ACTION("Illegal count %d ignored\n", rtrn.ival);
|
ACTION("Illegal count %d ignored\n", rtrn.ival);
|
||||||
return false;
|
return false;
|
||||||
|
@ -936,15 +888,13 @@ HandleDeviceBtn(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||||
act->count = rtrn.ival;
|
act->count = rtrn.ival;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (field == F_Device)
|
else if (field == F_Device) {
|
||||||
{
|
|
||||||
if (array_ndx != NULL)
|
if (array_ndx != NULL)
|
||||||
return ReportActionNotArray(action->type, field);
|
return ReportActionNotArray(action->type, field);
|
||||||
if (!ExprResolveInteger(keymap->ctx, value, &rtrn))
|
if (!ExprResolveInteger(keymap->ctx, value, &rtrn))
|
||||||
return ReportMismatch(action->type, field,
|
return ReportMismatch(action->type, field,
|
||||||
"integer (range 1..255)");
|
"integer (range 1..255)");
|
||||||
if ((rtrn.ival < 0) || (rtrn.ival > 255))
|
if ((rtrn.ival < 0) || (rtrn.ival > 255)) {
|
||||||
{
|
|
||||||
ERROR("Device must specify default or be in the range 1..255\n");
|
ERROR("Device must specify default or be in the range 1..255\n");
|
||||||
ACTION("Illegal device value %d ignored\n", rtrn.ival);
|
ACTION("Illegal device value %d ignored\n", rtrn.ival);
|
||||||
return false;
|
return false;
|
||||||
|
@ -975,29 +925,25 @@ HandlePrivate(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||||
{
|
{
|
||||||
ExprResult rtrn;
|
ExprResult rtrn;
|
||||||
|
|
||||||
switch (field)
|
switch (field) {
|
||||||
{
|
|
||||||
case F_Type:
|
case F_Type:
|
||||||
if (!ExprResolveInteger(keymap->ctx, value, &rtrn))
|
if (!ExprResolveInteger(keymap->ctx, value, &rtrn))
|
||||||
return ReportMismatch(PrivateAction, field, "integer");
|
return ReportMismatch(PrivateAction, field, "integer");
|
||||||
if ((rtrn.ival < 0) || (rtrn.ival > 255))
|
if ((rtrn.ival < 0) || (rtrn.ival > 255)) {
|
||||||
{
|
|
||||||
ERROR("Private action type must be in the range 0..255\n");
|
ERROR("Private action type must be in the range 0..255\n");
|
||||||
ACTION("Illegal type %d ignored\n", rtrn.ival);
|
ACTION("Illegal type %d ignored\n", rtrn.ival);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
action->type = rtrn.uval;
|
action->type = rtrn.uval;
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case F_Data:
|
case F_Data:
|
||||||
if (array_ndx == NULL)
|
if (array_ndx == NULL) {
|
||||||
{
|
|
||||||
if (!ExprResolveString(keymap->ctx, value, &rtrn))
|
if (!ExprResolveString(keymap->ctx, value, &rtrn))
|
||||||
return ReportMismatch(action->type, field, "string");
|
return ReportMismatch(action->type, field, "string");
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
int len = strlen(rtrn.str);
|
int len = strlen(rtrn.str);
|
||||||
if ((len < 1) || (len > 7))
|
if ((len < 1) || (len > 7)) {
|
||||||
{
|
|
||||||
WARN("A private action has 7 data bytes\n");
|
WARN("A private action has 7 data bytes\n");
|
||||||
ACTION("Extra %d bytes ignored\n", len - 6);
|
ACTION("Extra %d bytes ignored\n", len - 6);
|
||||||
return false;
|
return false;
|
||||||
|
@ -1007,26 +953,22 @@ HandlePrivate(struct xkb_keymap *keymap, struct xkb_any_action *action,
|
||||||
free(rtrn.str);
|
free(rtrn.str);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
unsigned ndx;
|
unsigned ndx;
|
||||||
if (!ExprResolveInteger(keymap->ctx, array_ndx, &rtrn))
|
if (!ExprResolveInteger(keymap->ctx, array_ndx, &rtrn)) {
|
||||||
{
|
|
||||||
ERROR("Array subscript must be integer\n");
|
ERROR("Array subscript must be integer\n");
|
||||||
ACTION("Illegal subscript ignored\n");
|
ACTION("Illegal subscript ignored\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ndx = rtrn.uval;
|
ndx = rtrn.uval;
|
||||||
if (ndx >= sizeof action->data)
|
if (ndx >= sizeof action->data) {
|
||||||
{
|
|
||||||
ERROR("The data for a private action is 18 bytes long\n");
|
ERROR("The data for a private action is 18 bytes long\n");
|
||||||
ACTION("Attempt to use data[%d] ignored\n", ndx);
|
ACTION("Attempt to use data[%d] ignored\n", ndx);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!ExprResolveInteger(keymap->ctx, value, &rtrn))
|
if (!ExprResolveInteger(keymap->ctx, value, &rtrn))
|
||||||
return ReportMismatch(action->type, field, "integer");
|
return ReportMismatch(action->type, field, "integer");
|
||||||
if ((rtrn.ival < 0) || (rtrn.ival > 255))
|
if ((rtrn.ival < 0) || (rtrn.ival > 255)) {
|
||||||
{
|
|
||||||
ERROR("All data for a private action must be 0..255\n");
|
ERROR("All data for a private action must be 0..255\n");
|
||||||
ACTION("Illegal datum %d ignored\n", rtrn.ival);
|
ACTION("Illegal datum %d ignored\n", rtrn.ival);
|
||||||
return false;
|
return false;
|
||||||
|
@ -1072,14 +1014,12 @@ static const actionHandler handleAction[XkbSA_NumActions + 1] = {
|
||||||
static void
|
static void
|
||||||
ApplyActionFactoryDefaults(union xkb_action * action)
|
ApplyActionFactoryDefaults(union xkb_action * action)
|
||||||
{
|
{
|
||||||
if (action->type == XkbSA_SetPtrDflt)
|
if (action->type == XkbSA_SetPtrDflt) { /* increment default button */
|
||||||
{ /* increment default button */
|
|
||||||
action->dflt.affect = XkbSA_AffectDfltBtn;
|
action->dflt.affect = XkbSA_AffectDfltBtn;
|
||||||
action->dflt.flags = 0;
|
action->dflt.flags = 0;
|
||||||
action->dflt.value = 1;
|
action->dflt.value = 1;
|
||||||
}
|
}
|
||||||
else if (action->type == XkbSA_ISOLock)
|
else if (action->type == XkbSA_ISOLock) {
|
||||||
{
|
|
||||||
action->iso.real_mods = LockMask;
|
action->iso.real_mods = LockMask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1099,37 +1039,31 @@ HandleActionDef(ExprDef * def,
|
||||||
if (!actionsInitialized)
|
if (!actionsInitialized)
|
||||||
ActionsInit(keymap->ctx);
|
ActionsInit(keymap->ctx);
|
||||||
|
|
||||||
if (def->op != ExprActionDecl)
|
if (def->op != ExprActionDecl) {
|
||||||
{
|
|
||||||
ERROR("Expected an action definition, found %s\n",
|
ERROR("Expected an action definition, found %s\n",
|
||||||
exprOpText(def->op));
|
exprOpText(def->op));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
str = xkb_atom_text(keymap->ctx, def->value.action.name);
|
str = xkb_atom_text(keymap->ctx, def->value.action.name);
|
||||||
if (!str)
|
if (!str) {
|
||||||
{
|
|
||||||
WSGO("Missing name in action definition!!\n");
|
WSGO("Missing name in action definition!!\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!stringToAction(str, &tmp))
|
if (!stringToAction(str, &tmp)) {
|
||||||
{
|
|
||||||
ERROR("Unknown action %s\n", str);
|
ERROR("Unknown action %s\n", str);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
action->type = hndlrType = tmp;
|
action->type = hndlrType = tmp;
|
||||||
if (action->type != XkbSA_NoAction)
|
if (action->type != XkbSA_NoAction) {
|
||||||
{
|
|
||||||
ApplyActionFactoryDefaults((union xkb_action *) action);
|
ApplyActionFactoryDefaults((union xkb_action *) action);
|
||||||
while (info)
|
while (info)
|
||||||
{
|
{
|
||||||
if ((info->action == XkbSA_NoAction)
|
if ((info->action == XkbSA_NoAction)
|
||||||
|| (info->action == hndlrType))
|
|| (info->action == hndlrType)) {
|
||||||
{
|
|
||||||
if (!(*handleAction[hndlrType])(keymap, action,
|
if (!(*handleAction[hndlrType])(keymap, action,
|
||||||
info->field,
|
info->field,
|
||||||
info->array_ndx,
|
info->array_ndx,
|
||||||
info->value))
|
info->value)) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1137,27 +1071,22 @@ HandleActionDef(ExprDef * def,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (arg = def->value.action.args; arg != NULL;
|
for (arg = def->value.action.args; arg != NULL;
|
||||||
arg = (ExprDef *) arg->common.next)
|
arg = (ExprDef *) arg->common.next) {
|
||||||
{
|
|
||||||
ExprDef *field, *value, *arrayRtrn;
|
ExprDef *field, *value, *arrayRtrn;
|
||||||
ExprResult elemRtrn, fieldRtrn;
|
ExprResult elemRtrn, fieldRtrn;
|
||||||
unsigned fieldNdx;
|
unsigned fieldNdx;
|
||||||
|
|
||||||
if (arg->op == OpAssign)
|
if (arg->op == OpAssign) {
|
||||||
{
|
|
||||||
field = arg->value.binary.left;
|
field = arg->value.binary.left;
|
||||||
value = arg->value.binary.right;
|
value = arg->value.binary.right;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
if ((arg->op == OpNot) || (arg->op == OpInvert)) {
|
||||||
if ((arg->op == OpNot) || (arg->op == OpInvert))
|
|
||||||
{
|
|
||||||
field = arg->value.child;
|
field = arg->value.child;
|
||||||
constFalse.value.str = xkb_atom_intern(keymap->ctx, "false");
|
constFalse.value.str = xkb_atom_intern(keymap->ctx, "false");
|
||||||
value = &constFalse;
|
value = &constFalse;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
field = arg;
|
field = arg;
|
||||||
constTrue.value.str = xkb_atom_intern(keymap->ctx, "true");
|
constTrue.value.str = xkb_atom_intern(keymap->ctx, "true");
|
||||||
value = &constTrue;
|
value = &constTrue;
|
||||||
|
@ -1166,8 +1095,7 @@ HandleActionDef(ExprDef * def,
|
||||||
if (!ExprResolveLhs(keymap, field, &elemRtrn, &fieldRtrn, &arrayRtrn))
|
if (!ExprResolveLhs(keymap, field, &elemRtrn, &fieldRtrn, &arrayRtrn))
|
||||||
return false; /* internal error -- already reported */
|
return false; /* internal error -- already reported */
|
||||||
|
|
||||||
if (elemRtrn.str != NULL)
|
if (elemRtrn.str != NULL) {
|
||||||
{
|
|
||||||
ERROR("Cannot change defaults in an action definition\n");
|
ERROR("Cannot change defaults in an action definition\n");
|
||||||
ACTION("Ignoring attempt to change %s.%s\n", elemRtrn.str,
|
ACTION("Ignoring attempt to change %s.%s\n", elemRtrn.str,
|
||||||
fieldRtrn.str);
|
fieldRtrn.str);
|
||||||
|
@ -1175,8 +1103,7 @@ HandleActionDef(ExprDef * def,
|
||||||
free(fieldRtrn.str);
|
free(fieldRtrn.str);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!stringToField(fieldRtrn.str, &fieldNdx))
|
if (!stringToField(fieldRtrn.str, &fieldNdx)) {
|
||||||
{
|
|
||||||
ERROR("Unknown field name %s\n", uStringText(fieldRtrn.str));
|
ERROR("Unknown field name %s\n", uStringText(fieldRtrn.str));
|
||||||
free(elemRtrn.str);
|
free(elemRtrn.str);
|
||||||
free(fieldRtrn.str);
|
free(fieldRtrn.str);
|
||||||
|
@ -1205,30 +1132,25 @@ SetActionField(struct xkb_keymap *keymap,
|
||||||
ActionsInit(keymap->ctx);
|
ActionsInit(keymap->ctx);
|
||||||
|
|
||||||
new = uTypedAlloc(ActionInfo);
|
new = uTypedAlloc(ActionInfo);
|
||||||
if (new == NULL)
|
if (new == NULL) {
|
||||||
{
|
|
||||||
WSGO("Couldn't allocate space for action default\n");
|
WSGO("Couldn't allocate space for action default\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (strcasecmp(elem, "action") == 0)
|
if (strcasecmp(elem, "action") == 0)
|
||||||
new->action = XkbSA_NoAction;
|
new->action = XkbSA_NoAction;
|
||||||
else
|
else {
|
||||||
{
|
if (!stringToAction(elem, &new->action)) {
|
||||||
if (!stringToAction(elem, &new->action))
|
|
||||||
{
|
|
||||||
free(new);
|
free(new);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (new->action == XkbSA_NoAction)
|
if (new->action == XkbSA_NoAction) {
|
||||||
{
|
|
||||||
ERROR("\"%s\" is not a valid field in a NoAction action\n",
|
ERROR("\"%s\" is not a valid field in a NoAction action\n",
|
||||||
field);
|
field);
|
||||||
free(new);
|
free(new);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!stringToField(field, &new->field))
|
if (!stringToField(field, &new->field)) {
|
||||||
{
|
|
||||||
ERROR("\"%s\" is not a legal field name\n", field);
|
ERROR("\"%s\" is not a legal field name\n", field);
|
||||||
free(new);
|
free(new);
|
||||||
return false;
|
return false;
|
||||||
|
@ -1251,8 +1173,7 @@ SetActionField(struct xkb_keymap *keymap,
|
||||||
static void
|
static void
|
||||||
ActionsInit(struct xkb_context *ctx)
|
ActionsInit(struct xkb_context *ctx)
|
||||||
{
|
{
|
||||||
if (!actionsInitialized)
|
if (!actionsInitialized) {
|
||||||
{
|
|
||||||
memset(&constTrue, 0, sizeof(constTrue));
|
memset(&constTrue, 0, sizeof(constTrue));
|
||||||
memset(&constFalse, 0, sizeof(constFalse));
|
memset(&constFalse, 0, sizeof(constFalse));
|
||||||
constTrue.common.stmtType = StmtExpr;
|
constTrue.common.stmtType = StmtExpr;
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
/************************************************************
|
/************************************************************
|
||||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||||
|
*
|
||||||
Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
software and its documentation for any purpose and without
|
* software and its documentation for any purpose and without
|
||||||
fee is hereby granted, provided that the above copyright
|
* fee is hereby granted, provided that the above copyright
|
||||||
notice appear in all copies and that both that copyright
|
* notice appear in all copies and that both that copyright
|
||||||
notice and this permission notice appear in supporting
|
* notice and this permission notice appear in supporting
|
||||||
documentation, and that the name of Silicon Graphics not be
|
* documentation, and that the name of Silicon Graphics not be
|
||||||
used in advertising or publicity pertaining to distribution
|
* used in advertising or publicity pertaining to distribution
|
||||||
of the software without specific prior written permission.
|
* of the software without specific prior written permission.
|
||||||
Silicon Graphics makes no representation about the suitability
|
* Silicon Graphics makes no representation about the suitability
|
||||||
of this software for any purpose. It is provided "as is"
|
* of this software for any purpose. It is provided "as is"
|
||||||
without any express or implied warranty.
|
* without any express or implied warranty.
|
||||||
|
*
|
||||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
||||||
#ifndef ACTION_H
|
#ifndef ACTION_H
|
||||||
|
@ -58,8 +58,7 @@
|
||||||
|
|
||||||
#define PrivateAction (XkbSA_LastAction + 1)
|
#define PrivateAction (XkbSA_LastAction + 1)
|
||||||
|
|
||||||
typedef struct _ActionInfo
|
typedef struct _ActionInfo {
|
||||||
{
|
|
||||||
unsigned action;
|
unsigned action;
|
||||||
unsigned field;
|
unsigned field;
|
||||||
ExprDef *array_ndx;
|
ExprDef *array_ndx;
|
||||||
|
@ -69,11 +68,13 @@ typedef struct _ActionInfo
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
HandleActionDef(ExprDef *def, struct xkb_keymap *keymap,
|
HandleActionDef(ExprDef *def, struct xkb_keymap *keymap,
|
||||||
struct xkb_any_action *action, ActionInfo *info);
|
struct xkb_any_action *action,
|
||||||
|
ActionInfo *info);
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
SetActionField(struct xkb_keymap *keymap, char *elem, char *field,
|
SetActionField(struct xkb_keymap *keymap, char *elem, char *field,
|
||||||
ExprDef *index, ExprDef *value, ActionInfo **info_rtrn);
|
ExprDef *index, ExprDef *value,
|
||||||
|
ActionInfo **info_rtrn);
|
||||||
|
|
||||||
extern const LookupEntry ctrlNames[];
|
extern const LookupEntry ctrlNames[];
|
||||||
|
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
/************************************************************
|
/************************************************************
|
||||||
Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc.
|
* Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc.
|
||||||
|
*
|
||||||
Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
software and its documentation for any purpose and without
|
* software and its documentation for any purpose and without
|
||||||
fee is hereby granted, provided that the above copyright
|
* fee is hereby granted, provided that the above copyright
|
||||||
notice appear in all copies and that both that copyright
|
* notice appear in all copies and that both that copyright
|
||||||
notice and this permission notice appear in supporting
|
* notice and this permission notice appear in supporting
|
||||||
documentation, and that the name of Silicon Graphics not be
|
* documentation, and that the name of Silicon Graphics not be
|
||||||
used in advertising or publicity pertaining to distribution
|
* used in advertising or publicity pertaining to distribution
|
||||||
of the software without specific prior written permission.
|
* of the software without specific prior written permission.
|
||||||
Silicon Graphics makes no representation about the suitability
|
* Silicon Graphics makes no representation about the suitability
|
||||||
of this software for any purpose. It is provided "as is"
|
* of this software for any purpose. It is provided "as is"
|
||||||
without any express or implied warranty.
|
* without any express or implied warranty.
|
||||||
|
*
|
||||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
||||||
#include "alias.h"
|
#include "alias.h"
|
||||||
|
@ -30,32 +30,26 @@
|
||||||
static void
|
static void
|
||||||
HandleCollision(AliasInfo * old, AliasInfo * new)
|
HandleCollision(AliasInfo * old, AliasInfo * new)
|
||||||
{
|
{
|
||||||
if (strncmp(new->real, old->real, XkbKeyNameLength) == 0)
|
if (strncmp(new->real, old->real, XkbKeyNameLength) == 0) {
|
||||||
{
|
|
||||||
if (((new->def.file_id == old->def.file_id) && (warningLevel > 0)) ||
|
if (((new->def.file_id == old->def.file_id) && (warningLevel > 0)) ||
|
||||||
(warningLevel > 9))
|
(warningLevel > 9)) {
|
||||||
{
|
|
||||||
WARN("Alias of %s for %s declared more than once\n",
|
WARN("Alias of %s for %s declared more than once\n",
|
||||||
XkbcKeyNameText(new->alias), XkbcKeyNameText(new->real));
|
XkbcKeyNameText(new->alias), XkbcKeyNameText(new->real));
|
||||||
ACTION("First definition ignored\n");
|
ACTION("First definition ignored\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
char *use, *ignore;
|
char *use, *ignore;
|
||||||
if (new->def.merge == MERGE_AUGMENT)
|
if (new->def.merge == MERGE_AUGMENT) {
|
||||||
{
|
|
||||||
use = old->real;
|
use = old->real;
|
||||||
ignore = new->real;
|
ignore = new->real;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
use = new->real;
|
use = new->real;
|
||||||
ignore = old->real;
|
ignore = old->real;
|
||||||
}
|
}
|
||||||
if (((old->def.file_id == new->def.file_id) && (warningLevel > 0)) ||
|
if (((old->def.file_id == new->def.file_id) && (warningLevel > 0)) ||
|
||||||
(warningLevel > 9))
|
(warningLevel > 9)) {
|
||||||
{
|
|
||||||
WARN("Multiple definitions for alias %s\n",
|
WARN("Multiple definitions for alias %s\n",
|
||||||
XkbcKeyNameText(old->alias));
|
XkbcKeyNameText(old->alias));
|
||||||
ACTION("Using %s, ignoring %s\n",
|
ACTION("Using %s, ignoring %s\n",
|
||||||
|
@ -70,7 +64,8 @@ HandleCollision(AliasInfo * old, AliasInfo * new)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
InitAliasInfo(AliasInfo * info,
|
InitAliasInfo(AliasInfo * info,
|
||||||
enum merge_mode merge, unsigned file_id, char *alias, char *real)
|
enum merge_mode merge, unsigned file_id, char *alias,
|
||||||
|
char *real)
|
||||||
{
|
{
|
||||||
memset(info, 0, sizeof(AliasInfo));
|
memset(info, 0, sizeof(AliasInfo));
|
||||||
info->def.merge = merge;
|
info->def.merge = merge;
|
||||||
|
@ -85,10 +80,9 @@ HandleAliasDef(KeyAliasDef * def,
|
||||||
{
|
{
|
||||||
AliasInfo *info;
|
AliasInfo *info;
|
||||||
|
|
||||||
for (info = *info_in; info != NULL; info = (AliasInfo *) info->def.next)
|
for (info = *info_in; info != NULL; info =
|
||||||
{
|
(AliasInfo *) info->def.next) {
|
||||||
if (strncmp(info->alias, def->alias, XkbKeyNameLength) == 0)
|
if (strncmp(info->alias, def->alias, XkbKeyNameLength) == 0) {
|
||||||
{
|
|
||||||
AliasInfo new;
|
AliasInfo new;
|
||||||
InitAliasInfo(&new, merge, file_id, def->alias, def->real);
|
InitAliasInfo(&new, merge, file_id, def->alias, def->real);
|
||||||
HandleCollision(info, &new);
|
HandleCollision(info, &new);
|
||||||
|
@ -96,8 +90,7 @@ HandleAliasDef(KeyAliasDef * def,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
info = uTypedCalloc(1, AliasInfo);
|
info = uTypedCalloc(1, AliasInfo);
|
||||||
if (info == NULL)
|
if (info == NULL) {
|
||||||
{
|
|
||||||
WSGO("Allocation failure in HandleAliasDef\n");
|
WSGO("Allocation failure in HandleAliasDef\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -126,15 +119,13 @@ MergeAliases(AliasInfo ** into, AliasInfo ** merge,
|
||||||
|
|
||||||
if ((*merge) == NULL)
|
if ((*merge) == NULL)
|
||||||
return true;
|
return true;
|
||||||
if ((*into) == NULL)
|
if ((*into) == NULL) {
|
||||||
{
|
|
||||||
*into = *merge;
|
*into = *merge;
|
||||||
*merge = NULL;
|
*merge = NULL;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
memset(&def, 0, sizeof(KeyAliasDef));
|
memset(&def, 0, sizeof(KeyAliasDef));
|
||||||
for (tmp = *merge; tmp != NULL; tmp = (AliasInfo *) tmp->def.next)
|
for (tmp = *merge; tmp != NULL; tmp = (AliasInfo *) tmp->def.next) {
|
||||||
{
|
|
||||||
if (how_merge == MERGE_DEFAULT)
|
if (how_merge == MERGE_DEFAULT)
|
||||||
def.merge = tmp->def.merge;
|
def.merge = tmp->def.merge;
|
||||||
else
|
else
|
||||||
|
@ -161,16 +152,14 @@ ApplyAliases(struct xkb_keymap *keymap, AliasInfo ** info_in)
|
||||||
nOld = (keymap->names ? darray_size(keymap->names->key_aliases) : 0);
|
nOld = (keymap->names ? darray_size(keymap->names->key_aliases) : 0);
|
||||||
old = (keymap->names ? &darray_item(keymap->names->key_aliases, 0) : NULL);
|
old = (keymap->names ? &darray_item(keymap->names->key_aliases, 0) : NULL);
|
||||||
for (nNew = 0, info = *info_in; info != NULL;
|
for (nNew = 0, info = *info_in; info != NULL;
|
||||||
info = (AliasInfo *) info->def.next)
|
info = (AliasInfo *) info->def.next) {
|
||||||
{
|
|
||||||
unsigned long lname;
|
unsigned long lname;
|
||||||
xkb_keycode_t kc;
|
xkb_keycode_t kc;
|
||||||
|
|
||||||
lname = KeyNameToLong(info->real);
|
lname = KeyNameToLong(info->real);
|
||||||
if (!FindNamedKey(keymap, lname, &kc, false, CreateKeyNames(keymap), 0))
|
if (!FindNamedKey(keymap, lname, &kc, false, CreateKeyNames(keymap),
|
||||||
{
|
0)) {
|
||||||
if (warningLevel > 4)
|
if (warningLevel > 4) {
|
||||||
{
|
|
||||||
WARN("Attempt to alias %s to non-existent key %s\n",
|
WARN("Attempt to alias %s to non-existent key %s\n",
|
||||||
XkbcKeyNameText(info->alias), XkbcKeyNameText(info->real));
|
XkbcKeyNameText(info->alias), XkbcKeyNameText(info->real));
|
||||||
ACTION("Ignored\n");
|
ACTION("Ignored\n");
|
||||||
|
@ -179,10 +168,8 @@ ApplyAliases(struct xkb_keymap *keymap, AliasInfo ** info_in)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
lname = KeyNameToLong(info->alias);
|
lname = KeyNameToLong(info->alias);
|
||||||
if (FindNamedKey(keymap, lname, &kc, false, false, 0))
|
if (FindNamedKey(keymap, lname, &kc, false, false, 0)) {
|
||||||
{
|
if (warningLevel > 4) {
|
||||||
if (warningLevel > 4)
|
|
||||||
{
|
|
||||||
WARN("Attempt to create alias with the name of a real key\n");
|
WARN("Attempt to create alias with the name of a real key\n");
|
||||||
ACTION("Alias \"%s = %s\" ignored\n",
|
ACTION("Alias \"%s = %s\" ignored\n",
|
||||||
XkbcKeyNameText(info->alias),
|
XkbcKeyNameText(info->alias),
|
||||||
|
@ -192,14 +179,12 @@ ApplyAliases(struct xkb_keymap *keymap, AliasInfo ** info_in)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
nNew++;
|
nNew++;
|
||||||
if (old)
|
if (old) {
|
||||||
{
|
for (i = 0, a = old; i < nOld; i++, a++) {
|
||||||
for (i = 0, a = old; i < nOld; i++, a++)
|
if (strncmp(a->alias, info->alias, XkbKeyNameLength) == 0) {
|
||||||
{
|
|
||||||
if (strncmp(a->alias, info->alias, XkbKeyNameLength) == 0)
|
|
||||||
{
|
|
||||||
AliasInfo old_info;
|
AliasInfo old_info;
|
||||||
InitAliasInfo(&old_info, MERGE_AUGMENT, 0, a->alias, a->real);
|
InitAliasInfo(&old_info, MERGE_AUGMENT, 0, a->alias,
|
||||||
|
a->real);
|
||||||
HandleCollision(&old_info, info);
|
HandleCollision(&old_info, info);
|
||||||
memcpy(old_info.real, a->real, XkbKeyNameLength);
|
memcpy(old_info.real, a->real, XkbKeyNameLength);
|
||||||
info->alias[0] = '\0';
|
info->alias[0] = '\0';
|
||||||
|
@ -209,32 +194,28 @@ ApplyAliases(struct xkb_keymap *keymap, AliasInfo ** info_in)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (nNew == 0)
|
if (nNew == 0) {
|
||||||
{
|
|
||||||
ClearCommonInfo(&(*info_in)->def);
|
ClearCommonInfo(&(*info_in)->def);
|
||||||
*info_in = NULL;
|
*info_in = NULL;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = XkbcAllocNames(keymap, XkbKeyAliasesMask, nOld + nNew);
|
status = XkbcAllocNames(keymap, XkbKeyAliasesMask, nOld + nNew);
|
||||||
if (status != Success)
|
if (status != Success) {
|
||||||
{
|
|
||||||
WSGO("Allocation failure in ApplyAliases\n");
|
WSGO("Allocation failure in ApplyAliases\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
a = keymap->names ? &darray_item(keymap->names->key_aliases, nOld) : NULL;
|
a = keymap->names ? &darray_item(keymap->names->key_aliases, nOld) : NULL;
|
||||||
for (info = *info_in; info != NULL; info = (AliasInfo *) info->def.next)
|
for (info = *info_in; info != NULL; info =
|
||||||
{
|
(AliasInfo *) info->def.next) {
|
||||||
if (info->alias[0] != '\0')
|
if (info->alias[0] != '\0') {
|
||||||
{
|
|
||||||
strncpy(a->alias, info->alias, XkbKeyNameLength);
|
strncpy(a->alias, info->alias, XkbKeyNameLength);
|
||||||
strncpy(a->real, info->real, XkbKeyNameLength);
|
strncpy(a->real, info->real, XkbKeyNameLength);
|
||||||
a++;
|
a++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if ((a - old) != (nOld + nNew))
|
if ((a - old) != (nOld + nNew)) {
|
||||||
{
|
|
||||||
WSGO("Expected %d aliases total but created %d\n", nOld + nNew,
|
WSGO("Expected %d aliases total but created %d\n", nOld + nNew,
|
||||||
a - old);
|
a - old);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
/************************************************************
|
/************************************************************
|
||||||
Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc.
|
* Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc.
|
||||||
|
*
|
||||||
Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
software and its documentation for any purpose and without
|
* software and its documentation for any purpose and without
|
||||||
fee is hereby granted, provided that the above copyright
|
* fee is hereby granted, provided that the above copyright
|
||||||
notice appear in all copies and that both that copyright
|
* notice appear in all copies and that both that copyright
|
||||||
notice and this permission notice appear in supporting
|
* notice and this permission notice appear in supporting
|
||||||
documentation, and that the name of Silicon Graphics not be
|
* documentation, and that the name of Silicon Graphics not be
|
||||||
used in advertising or publicity pertaining to distribution
|
* used in advertising or publicity pertaining to distribution
|
||||||
of the software without specific prior written permission.
|
* of the software without specific prior written permission.
|
||||||
Silicon Graphics makes no representation about the suitability
|
* Silicon Graphics makes no representation about the suitability
|
||||||
of this software for any purpose. It is provided "as is"
|
* of this software for any purpose. It is provided "as is"
|
||||||
without any express or implied warranty.
|
* without any express or implied warranty.
|
||||||
|
*
|
||||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
||||||
#ifndef ALIAS_H
|
#ifndef ALIAS_H
|
||||||
|
@ -29,8 +29,7 @@
|
||||||
|
|
||||||
#include "xkbcomp-priv.h"
|
#include "xkbcomp-priv.h"
|
||||||
|
|
||||||
typedef struct _AliasInfo
|
typedef struct _AliasInfo {
|
||||||
{
|
|
||||||
CommonInfo def;
|
CommonInfo def;
|
||||||
char alias[XkbKeyNameLength + 1];
|
char alias[XkbKeyNameLength + 1];
|
||||||
char real[XkbKeyNameLength + 1];
|
char real[XkbKeyNameLength + 1];
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
/************************************************************
|
/************************************************************
|
||||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||||
|
*
|
||||||
Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
software and its documentation for any purpose and without
|
* software and its documentation for any purpose and without
|
||||||
fee is hereby granted, provided that the above copyright
|
* fee is hereby granted, provided that the above copyright
|
||||||
notice appear in all copies and that both that copyright
|
* notice appear in all copies and that both that copyright
|
||||||
notice and this permission notice appear in supporting
|
* notice and this permission notice appear in supporting
|
||||||
documentation, and that the name of Silicon Graphics not be
|
* documentation, and that the name of Silicon Graphics not be
|
||||||
used in advertising or publicity pertaining to distribution
|
* used in advertising or publicity pertaining to distribution
|
||||||
of the software without specific prior written permission.
|
* of the software without specific prior written permission.
|
||||||
Silicon Graphics makes no representation about the suitability
|
* Silicon Graphics makes no representation about the suitability
|
||||||
of this software for any purpose. It is provided "as is"
|
* of this software for any purpose. It is provided "as is"
|
||||||
without any express or implied warranty.
|
* without any express or implied warranty.
|
||||||
|
*
|
||||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
||||||
#include "xkbcomp-priv.h"
|
#include "xkbcomp-priv.h"
|
||||||
|
@ -30,8 +30,7 @@
|
||||||
#include "indicators.h"
|
#include "indicators.h"
|
||||||
#include "vmod.h"
|
#include "vmod.h"
|
||||||
|
|
||||||
typedef struct _SymInterpInfo
|
typedef struct _SymInterpInfo {
|
||||||
{
|
|
||||||
CommonInfo defs;
|
CommonInfo defs;
|
||||||
struct xkb_sym_interpret interp;
|
struct xkb_sym_interpret interp;
|
||||||
} SymInterpInfo;
|
} SymInterpInfo;
|
||||||
|
@ -42,8 +41,7 @@ typedef struct _SymInterpInfo
|
||||||
#define _SI_LockingKey (1 << 3)
|
#define _SI_LockingKey (1 << 3)
|
||||||
#define _SI_LevelOneOnly (1 << 4)
|
#define _SI_LevelOneOnly (1 << 4)
|
||||||
|
|
||||||
typedef struct _GroupCompatInfo
|
typedef struct _GroupCompatInfo {
|
||||||
{
|
|
||||||
unsigned file_id;
|
unsigned file_id;
|
||||||
enum merge_mode merge;
|
enum merge_mode merge;
|
||||||
bool defined;
|
bool defined;
|
||||||
|
@ -51,8 +49,7 @@ typedef struct _GroupCompatInfo
|
||||||
xkb_atom_t vmods;
|
xkb_atom_t vmods;
|
||||||
} GroupCompatInfo;
|
} GroupCompatInfo;
|
||||||
|
|
||||||
typedef struct _CompatInfo
|
typedef struct _CompatInfo {
|
||||||
{
|
|
||||||
char *name;
|
char *name;
|
||||||
unsigned file_id;
|
unsigned file_id;
|
||||||
int errorCount;
|
int errorCount;
|
||||||
|
@ -81,12 +78,10 @@ siText(SymInterpInfo * si, CompatInfo * info)
|
||||||
{
|
{
|
||||||
static char buf[128];
|
static char buf[128];
|
||||||
|
|
||||||
if (si == &info->dflt)
|
if (si == &info->dflt) {
|
||||||
{
|
|
||||||
snprintf(buf, sizeof(buf), "default");
|
snprintf(buf, sizeof(buf), "default");
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
snprintf(buf, sizeof(buf), "%s+%s(%s)",
|
snprintf(buf, sizeof(buf), "%s+%s(%s)",
|
||||||
XkbcKeysymText(si->interp.sym),
|
XkbcKeysymText(si->interp.sym),
|
||||||
XkbcSIMatchText(si->interp.match),
|
XkbcSIMatchText(si->interp.match),
|
||||||
|
@ -160,8 +155,7 @@ NextInterp(CompatInfo * info)
|
||||||
SymInterpInfo *si;
|
SymInterpInfo *si;
|
||||||
|
|
||||||
si = uTypedAlloc(SymInterpInfo);
|
si = uTypedAlloc(SymInterpInfo);
|
||||||
if (si)
|
if (si) {
|
||||||
{
|
|
||||||
memset(si, 0, sizeof(SymInterpInfo));
|
memset(si, 0, sizeof(SymInterpInfo));
|
||||||
info->interps = AddCommonInfo(&info->interps->defs, &si->defs);
|
info->interps = AddCommonInfo(&info->interps->defs, &si->defs);
|
||||||
info->nInterps++;
|
info->nInterps++;
|
||||||
|
@ -175,12 +169,10 @@ FindMatchingInterp(CompatInfo * info, SymInterpInfo * new)
|
||||||
SymInterpInfo *old;
|
SymInterpInfo *old;
|
||||||
|
|
||||||
for (old = info->interps; old != NULL;
|
for (old = info->interps; old != NULL;
|
||||||
old = (SymInterpInfo *) old->defs.next)
|
old = (SymInterpInfo *) old->defs.next) {
|
||||||
{
|
|
||||||
if ((old->interp.sym == new->interp.sym) &&
|
if ((old->interp.sym == new->interp.sym) &&
|
||||||
(old->interp.mods == new->interp.mods) &&
|
(old->interp.mods == new->interp.mods) &&
|
||||||
(old->interp.match == new->interp.match))
|
(old->interp.match == new->interp.match)) {
|
||||||
{
|
|
||||||
return old;
|
return old;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -195,14 +187,11 @@ AddInterp(CompatInfo * info, SymInterpInfo * new)
|
||||||
|
|
||||||
collide = 0;
|
collide = 0;
|
||||||
old = FindMatchingInterp(info, new);
|
old = FindMatchingInterp(info, new);
|
||||||
if (old != NULL)
|
if (old != NULL) {
|
||||||
{
|
if (new->defs.merge == MERGE_REPLACE) {
|
||||||
if (new->defs.merge == MERGE_REPLACE)
|
|
||||||
{
|
|
||||||
SymInterpInfo *next = (SymInterpInfo *) old->defs.next;
|
SymInterpInfo *next = (SymInterpInfo *) old->defs.next;
|
||||||
if (((old->defs.file_id == new->defs.file_id)
|
if (((old->defs.file_id == new->defs.file_id)
|
||||||
&& (warningLevel > 0)) || (warningLevel > 9))
|
&& (warningLevel > 0)) || (warningLevel > 9)) {
|
||||||
{
|
|
||||||
WARN("Multiple definitions for \"%s\"\n", siText(new, info));
|
WARN("Multiple definitions for \"%s\"\n", siText(new, info));
|
||||||
ACTION("Earlier interpretation ignored\n");
|
ACTION("Earlier interpretation ignored\n");
|
||||||
}
|
}
|
||||||
|
@ -210,36 +199,31 @@ AddInterp(CompatInfo * info, SymInterpInfo * new)
|
||||||
old->defs.next = &next->defs;
|
old->defs.next = &next->defs;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (UseNewField(_SI_VirtualMod, &old->defs, &new->defs, &collide))
|
if (UseNewField(_SI_VirtualMod, &old->defs, &new->defs, &collide)) {
|
||||||
{
|
|
||||||
old->interp.virtual_mod = new->interp.virtual_mod;
|
old->interp.virtual_mod = new->interp.virtual_mod;
|
||||||
old->defs.defined |= _SI_VirtualMod;
|
old->defs.defined |= _SI_VirtualMod;
|
||||||
}
|
}
|
||||||
if (UseNewField(_SI_Action, &old->defs, &new->defs, &collide))
|
if (UseNewField(_SI_Action, &old->defs, &new->defs, &collide)) {
|
||||||
{
|
|
||||||
old->interp.act = new->interp.act;
|
old->interp.act = new->interp.act;
|
||||||
old->defs.defined |= _SI_Action;
|
old->defs.defined |= _SI_Action;
|
||||||
}
|
}
|
||||||
if (UseNewField(_SI_AutoRepeat, &old->defs, &new->defs, &collide))
|
if (UseNewField(_SI_AutoRepeat, &old->defs, &new->defs, &collide)) {
|
||||||
{
|
|
||||||
old->interp.flags &= ~XkbSI_AutoRepeat;
|
old->interp.flags &= ~XkbSI_AutoRepeat;
|
||||||
old->interp.flags |= (new->interp.flags & XkbSI_AutoRepeat);
|
old->interp.flags |= (new->interp.flags & XkbSI_AutoRepeat);
|
||||||
old->defs.defined |= _SI_AutoRepeat;
|
old->defs.defined |= _SI_AutoRepeat;
|
||||||
}
|
}
|
||||||
if (UseNewField(_SI_LockingKey, &old->defs, &new->defs, &collide))
|
if (UseNewField(_SI_LockingKey, &old->defs, &new->defs, &collide)) {
|
||||||
{
|
|
||||||
old->interp.flags &= ~XkbSI_LockingKey;
|
old->interp.flags &= ~XkbSI_LockingKey;
|
||||||
old->interp.flags |= (new->interp.flags & XkbSI_LockingKey);
|
old->interp.flags |= (new->interp.flags & XkbSI_LockingKey);
|
||||||
old->defs.defined |= _SI_LockingKey;
|
old->defs.defined |= _SI_LockingKey;
|
||||||
}
|
}
|
||||||
if (UseNewField(_SI_LevelOneOnly, &old->defs, &new->defs, &collide))
|
if (UseNewField(_SI_LevelOneOnly, &old->defs, &new->defs,
|
||||||
{
|
&collide)) {
|
||||||
old->interp.match &= ~XkbSI_LevelOneOnly;
|
old->interp.match &= ~XkbSI_LevelOneOnly;
|
||||||
old->interp.match |= (new->interp.match & XkbSI_LevelOneOnly);
|
old->interp.match |= (new->interp.match & XkbSI_LevelOneOnly);
|
||||||
old->defs.defined |= _SI_LevelOneOnly;
|
old->defs.defined |= _SI_LevelOneOnly;
|
||||||
}
|
}
|
||||||
if (collide)
|
if (collide) {
|
||||||
{
|
|
||||||
WARN("Multiple interpretations of \"%s\"\n", siText(new, info));
|
WARN("Multiple interpretations of \"%s\"\n", siText(new, info));
|
||||||
ACTION("Using %s definition for duplicate fields\n",
|
ACTION("Using %s definition for duplicate fields\n",
|
||||||
(new->defs.merge != MERGE_AUGMENT ? "last" : "first"));
|
(new->defs.merge != MERGE_AUGMENT ? "last" : "first"));
|
||||||
|
@ -262,13 +246,12 @@ AddGroupCompat(CompatInfo * info, unsigned group, GroupCompatInfo * newGC)
|
||||||
|
|
||||||
merge = newGC->merge;
|
merge = newGC->merge;
|
||||||
gc = &info->groupCompat[group];
|
gc = &info->groupCompat[group];
|
||||||
if (((gc->real_mods == newGC->real_mods) && (gc->vmods == newGC->vmods)))
|
if (((gc->real_mods == newGC->real_mods) &&
|
||||||
{
|
(gc->vmods == newGC->vmods))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (((gc->file_id == newGC->file_id) && (warningLevel > 0))
|
if (((gc->file_id == newGC->file_id) && (warningLevel > 0))
|
||||||
|| (warningLevel > 9))
|
|| (warningLevel > 9)) {
|
||||||
{
|
|
||||||
WARN("Compat map for group %d redefined\n", group + 1);
|
WARN("Compat map for group %d redefined\n", group + 1);
|
||||||
ACTION("Using %s definition\n",
|
ACTION("Using %s definition\n",
|
||||||
(merge == MERGE_AUGMENT ? "old" : "new"));
|
(merge == MERGE_AUGMENT ? "old" : "new"));
|
||||||
|
@ -287,16 +270,14 @@ ResolveStateAndPredicate(ExprDef * expr,
|
||||||
{
|
{
|
||||||
ExprResult result;
|
ExprResult result;
|
||||||
|
|
||||||
if (expr == NULL)
|
if (expr == NULL) {
|
||||||
{
|
|
||||||
*pred_rtrn = XkbSI_AnyOfOrNone;
|
*pred_rtrn = XkbSI_AnyOfOrNone;
|
||||||
*mods_rtrn = ~0;
|
*mods_rtrn = ~0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
*pred_rtrn = XkbSI_Exactly;
|
*pred_rtrn = XkbSI_Exactly;
|
||||||
if (expr->op == ExprActionDecl)
|
if (expr->op == ExprActionDecl) {
|
||||||
{
|
|
||||||
const char *pred_txt = xkb_atom_text(info->keymap->ctx,
|
const char *pred_txt = xkb_atom_text(info->keymap->ctx,
|
||||||
expr->value.action.name);
|
expr->value.action.name);
|
||||||
if (strcasecmp(pred_txt, "noneof") == 0)
|
if (strcasecmp(pred_txt, "noneof") == 0)
|
||||||
|
@ -309,28 +290,24 @@ ResolveStateAndPredicate(ExprDef * expr,
|
||||||
*pred_rtrn = XkbSI_AllOf;
|
*pred_rtrn = XkbSI_AllOf;
|
||||||
else if (strcasecmp(pred_txt, "exactly") == 0)
|
else if (strcasecmp(pred_txt, "exactly") == 0)
|
||||||
*pred_rtrn = XkbSI_Exactly;
|
*pred_rtrn = XkbSI_Exactly;
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
ERROR("Illegal modifier predicate \"%s\"\n", pred_txt);
|
ERROR("Illegal modifier predicate \"%s\"\n", pred_txt);
|
||||||
ACTION("Ignored\n");
|
ACTION("Ignored\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
expr = expr->value.action.args;
|
expr = expr->value.action.args;
|
||||||
}
|
}
|
||||||
else if (expr->op == ExprIdent)
|
else if (expr->op == ExprIdent) {
|
||||||
{
|
|
||||||
const char *pred_txt = xkb_atom_text(info->keymap->ctx,
|
const char *pred_txt = xkb_atom_text(info->keymap->ctx,
|
||||||
expr->value.str);
|
expr->value.str);
|
||||||
if ((pred_txt) && (strcasecmp(pred_txt, "any") == 0))
|
if ((pred_txt) && (strcasecmp(pred_txt, "any") == 0)) {
|
||||||
{
|
|
||||||
*pred_rtrn = XkbSI_AnyOf;
|
*pred_rtrn = XkbSI_AnyOf;
|
||||||
*mods_rtrn = 0xff;
|
*mods_rtrn = 0xff;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ExprResolveModMask(info->keymap->ctx, expr, &result))
|
if (ExprResolveModMask(info->keymap->ctx, expr, &result)) {
|
||||||
{
|
|
||||||
*mods_rtrn = result.uval;
|
*mods_rtrn = result.uval;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -340,39 +317,36 @@ ResolveStateAndPredicate(ExprDef * expr,
|
||||||
/***====================================================================***/
|
/***====================================================================***/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
MergeIncludedCompatMaps(CompatInfo * into, CompatInfo * from, enum merge_mode merge)
|
MergeIncludedCompatMaps(CompatInfo * into, CompatInfo * from,
|
||||||
|
enum merge_mode merge)
|
||||||
{
|
{
|
||||||
SymInterpInfo *si;
|
SymInterpInfo *si;
|
||||||
LEDInfo *led, *rtrn, *next;
|
LEDInfo *led, *rtrn, *next;
|
||||||
GroupCompatInfo *gcm;
|
GroupCompatInfo *gcm;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (from->errorCount > 0)
|
if (from->errorCount > 0) {
|
||||||
{
|
|
||||||
into->errorCount += from->errorCount;
|
into->errorCount += from->errorCount;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (into->name == NULL)
|
if (into->name == NULL) {
|
||||||
{
|
|
||||||
into->name = from->name;
|
into->name = from->name;
|
||||||
from->name = NULL;
|
from->name = NULL;
|
||||||
}
|
}
|
||||||
for (si = from->interps; si; si = (SymInterpInfo *) si->defs.next)
|
for (si = from->interps; si; si = (SymInterpInfo *) si->defs.next) {
|
||||||
{
|
|
||||||
if (merge != MERGE_DEFAULT)
|
if (merge != MERGE_DEFAULT)
|
||||||
si->defs.merge = merge;
|
si->defs.merge = merge;
|
||||||
if (!AddInterp(into, si))
|
if (!AddInterp(into, si))
|
||||||
into->errorCount++;
|
into->errorCount++;
|
||||||
}
|
}
|
||||||
for (i = 0, gcm = &from->groupCompat[0]; i < XkbNumKbdGroups; i++, gcm++)
|
for (i = 0, gcm = &from->groupCompat[0]; i < XkbNumKbdGroups; i++,
|
||||||
{
|
gcm++) {
|
||||||
if (merge != MERGE_DEFAULT)
|
if (merge != MERGE_DEFAULT)
|
||||||
gcm->merge = merge;
|
gcm->merge = merge;
|
||||||
if (!AddGroupCompat(into, i, gcm))
|
if (!AddGroupCompat(into, i, gcm))
|
||||||
into->errorCount++;
|
into->errorCount++;
|
||||||
}
|
}
|
||||||
for (led = from->leds; led != NULL; led = next)
|
for (led = from->leds; led != NULL; led = next) {
|
||||||
{
|
|
||||||
next = (LEDInfo *) led->defs.next;
|
next = (LEDInfo *) led->defs.next;
|
||||||
if (merge != MERGE_DEFAULT)
|
if (merge != MERGE_DEFAULT)
|
||||||
led->defs.merge = merge;
|
led->defs.merge = merge;
|
||||||
|
@ -385,7 +359,8 @@ MergeIncludedCompatMaps(CompatInfo * into, CompatInfo * from, enum merge_mode me
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
HandleCompatMapFile(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge,
|
HandleCompatMapFile(XkbFile *file, struct xkb_keymap *keymap,
|
||||||
|
enum merge_mode merge,
|
||||||
CompatInfo *info);
|
CompatInfo *info);
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
@ -398,23 +373,20 @@ HandleIncludeCompatMap(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
||||||
bool haveSelf;
|
bool haveSelf;
|
||||||
|
|
||||||
haveSelf = false;
|
haveSelf = false;
|
||||||
if ((stmt->file == NULL) && (stmt->map == NULL))
|
if ((stmt->file == NULL) && (stmt->map == NULL)) {
|
||||||
{
|
|
||||||
haveSelf = true;
|
haveSelf = true;
|
||||||
included = *info;
|
included = *info;
|
||||||
memset(info, 0, sizeof(CompatInfo));
|
memset(info, 0, sizeof(CompatInfo));
|
||||||
}
|
}
|
||||||
else if (ProcessIncludeFile(keymap->ctx, stmt, FILE_TYPE_COMPAT, &rtrn,
|
else if (ProcessIncludeFile(keymap->ctx, stmt, FILE_TYPE_COMPAT, &rtrn,
|
||||||
&newMerge))
|
&newMerge)) {
|
||||||
{
|
|
||||||
InitCompatInfo(&included, keymap, rtrn->id);
|
InitCompatInfo(&included, keymap, rtrn->id);
|
||||||
included.dflt = info->dflt;
|
included.dflt = info->dflt;
|
||||||
included.dflt.defs.merge = newMerge;
|
included.dflt.defs.merge = newMerge;
|
||||||
included.ledDflt.defs.merge = newMerge;
|
included.ledDflt.defs.merge = newMerge;
|
||||||
included.act = info->act;
|
included.act = info->act;
|
||||||
HandleCompatMapFile(rtrn, keymap, MERGE_OVERRIDE, &included);
|
HandleCompatMapFile(rtrn, keymap, MERGE_OVERRIDE, &included);
|
||||||
if (stmt->stmt != NULL)
|
if (stmt->stmt != NULL) {
|
||||||
{
|
|
||||||
free(included.name);
|
free(included.name);
|
||||||
included.name = stmt->stmt;
|
included.name = stmt->stmt;
|
||||||
stmt->stmt = NULL;
|
stmt->stmt = NULL;
|
||||||
|
@ -423,28 +395,23 @@ HandleIncludeCompatMap(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
||||||
included.act = NULL;
|
included.act = NULL;
|
||||||
FreeXKBFile(rtrn);
|
FreeXKBFile(rtrn);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
info->errorCount += 10;
|
info->errorCount += 10;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((stmt->next != NULL) && (included.errorCount < 1))
|
if ((stmt->next != NULL) && (included.errorCount < 1)) {
|
||||||
{
|
|
||||||
IncludeStmt *next;
|
IncludeStmt *next;
|
||||||
unsigned op;
|
unsigned op;
|
||||||
CompatInfo next_incl;
|
CompatInfo next_incl;
|
||||||
|
|
||||||
for (next = stmt->next; next != NULL; next = next->next)
|
for (next = stmt->next; next != NULL; next = next->next) {
|
||||||
{
|
if ((next->file == NULL) && (next->map == NULL)) {
|
||||||
if ((next->file == NULL) && (next->map == NULL))
|
|
||||||
{
|
|
||||||
haveSelf = true;
|
haveSelf = true;
|
||||||
MergeIncludedCompatMaps(&included, info, next->merge);
|
MergeIncludedCompatMaps(&included, info, next->merge);
|
||||||
ClearCompatInfo(info, keymap);
|
ClearCompatInfo(info, keymap);
|
||||||
}
|
}
|
||||||
else if (ProcessIncludeFile(keymap->ctx, next, FILE_TYPE_COMPAT,
|
else if (ProcessIncludeFile(keymap->ctx, next, FILE_TYPE_COMPAT,
|
||||||
&rtrn, &op))
|
&rtrn, &op)) {
|
||||||
{
|
|
||||||
InitCompatInfo(&next_incl, keymap, rtrn->id);
|
InitCompatInfo(&next_incl, keymap, rtrn->id);
|
||||||
next_incl.file_id = rtrn->id;
|
next_incl.file_id = rtrn->id;
|
||||||
next_incl.dflt = info->dflt;
|
next_incl.dflt = info->dflt;
|
||||||
|
@ -460,8 +427,7 @@ HandleIncludeCompatMap(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
||||||
ClearCompatInfo(&next_incl, keymap);
|
ClearCompatInfo(&next_incl, keymap);
|
||||||
FreeXKBFile(rtrn);
|
FreeXKBFile(rtrn);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
info->errorCount += 10;
|
info->errorCount += 10;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -469,8 +435,7 @@ HandleIncludeCompatMap(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
||||||
}
|
}
|
||||||
if (haveSelf)
|
if (haveSelf)
|
||||||
*info = included;
|
*info = included;
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
MergeIncludedCompatMaps(info, &included, newMerge);
|
MergeIncludedCompatMaps(info, &included, newMerge);
|
||||||
ClearCompatInfo(&included, keymap);
|
ClearCompatInfo(&included, keymap);
|
||||||
}
|
}
|
||||||
|
@ -492,8 +457,7 @@ SetInterpField(SymInterpInfo *si, struct xkb_keymap *keymap, char *field,
|
||||||
int ok = 1;
|
int ok = 1;
|
||||||
ExprResult tmp;
|
ExprResult tmp;
|
||||||
|
|
||||||
if (strcasecmp(field, "action") == 0)
|
if (strcasecmp(field, "action") == 0) {
|
||||||
{
|
|
||||||
if (arrayNdx != NULL)
|
if (arrayNdx != NULL)
|
||||||
return ReportSINotArray(si, field, info);
|
return ReportSINotArray(si, field, info);
|
||||||
ok = HandleActionDef(value, keymap, &si->interp.act.any, info->act);
|
ok = HandleActionDef(value, keymap, &si->interp.act.any, info->act);
|
||||||
|
@ -501,26 +465,22 @@ SetInterpField(SymInterpInfo *si, struct xkb_keymap *keymap, char *field,
|
||||||
si->defs.defined |= _SI_Action;
|
si->defs.defined |= _SI_Action;
|
||||||
}
|
}
|
||||||
else if ((strcasecmp(field, "virtualmodifier") == 0) ||
|
else if ((strcasecmp(field, "virtualmodifier") == 0) ||
|
||||||
(strcasecmp(field, "virtualmod") == 0))
|
(strcasecmp(field, "virtualmod") == 0)) {
|
||||||
{
|
|
||||||
if (arrayNdx != NULL)
|
if (arrayNdx != NULL)
|
||||||
return ReportSINotArray(si, field, info);
|
return ReportSINotArray(si, field, info);
|
||||||
ok = ResolveVirtualModifier(value, keymap, &tmp, &info->vmods);
|
ok = ResolveVirtualModifier(value, keymap, &tmp, &info->vmods);
|
||||||
if (ok)
|
if (ok) {
|
||||||
{
|
|
||||||
si->interp.virtual_mod = tmp.uval;
|
si->interp.virtual_mod = tmp.uval;
|
||||||
si->defs.defined |= _SI_VirtualMod;
|
si->defs.defined |= _SI_VirtualMod;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return ReportSIBadType(si, field, "virtual modifier", info);
|
return ReportSIBadType(si, field, "virtual modifier", info);
|
||||||
}
|
}
|
||||||
else if (strcasecmp(field, "repeat") == 0)
|
else if (strcasecmp(field, "repeat") == 0) {
|
||||||
{
|
|
||||||
if (arrayNdx != NULL)
|
if (arrayNdx != NULL)
|
||||||
return ReportSINotArray(si, field, info);
|
return ReportSINotArray(si, field, info);
|
||||||
ok = ExprResolveBoolean(keymap->ctx, value, &tmp);
|
ok = ExprResolveBoolean(keymap->ctx, value, &tmp);
|
||||||
if (ok)
|
if (ok) {
|
||||||
{
|
|
||||||
if (tmp.uval)
|
if (tmp.uval)
|
||||||
si->interp.flags |= XkbSI_AutoRepeat;
|
si->interp.flags |= XkbSI_AutoRepeat;
|
||||||
else
|
else
|
||||||
|
@ -530,13 +490,11 @@ SetInterpField(SymInterpInfo *si, struct xkb_keymap *keymap, char *field,
|
||||||
else
|
else
|
||||||
return ReportSIBadType(si, field, "boolean", info);
|
return ReportSIBadType(si, field, "boolean", info);
|
||||||
}
|
}
|
||||||
else if (strcasecmp(field, "locking") == 0)
|
else if (strcasecmp(field, "locking") == 0) {
|
||||||
{
|
|
||||||
if (arrayNdx != NULL)
|
if (arrayNdx != NULL)
|
||||||
return ReportSINotArray(si, field, info);
|
return ReportSINotArray(si, field, info);
|
||||||
ok = ExprResolveBoolean(keymap->ctx, value, &tmp);
|
ok = ExprResolveBoolean(keymap->ctx, value, &tmp);
|
||||||
if (ok)
|
if (ok) {
|
||||||
{
|
|
||||||
if (tmp.uval)
|
if (tmp.uval)
|
||||||
si->interp.flags |= XkbSI_LockingKey;
|
si->interp.flags |= XkbSI_LockingKey;
|
||||||
else
|
else
|
||||||
|
@ -547,13 +505,11 @@ SetInterpField(SymInterpInfo *si, struct xkb_keymap *keymap, char *field,
|
||||||
return ReportSIBadType(si, field, "boolean", info);
|
return ReportSIBadType(si, field, "boolean", info);
|
||||||
}
|
}
|
||||||
else if ((strcasecmp(field, "usemodmap") == 0) ||
|
else if ((strcasecmp(field, "usemodmap") == 0) ||
|
||||||
(strcasecmp(field, "usemodmapmods") == 0))
|
(strcasecmp(field, "usemodmapmods") == 0)) {
|
||||||
{
|
|
||||||
if (arrayNdx != NULL)
|
if (arrayNdx != NULL)
|
||||||
return ReportSINotArray(si, field, info);
|
return ReportSINotArray(si, field, info);
|
||||||
ok = ExprResolveEnum(keymap->ctx, value, &tmp, useModMapValues);
|
ok = ExprResolveEnum(keymap->ctx, value, &tmp, useModMapValues);
|
||||||
if (ok)
|
if (ok) {
|
||||||
{
|
|
||||||
if (tmp.uval)
|
if (tmp.uval)
|
||||||
si->interp.match |= XkbSI_LevelOneOnly;
|
si->interp.match |= XkbSI_LevelOneOnly;
|
||||||
else
|
else
|
||||||
|
@ -563,8 +519,7 @@ SetInterpField(SymInterpInfo *si, struct xkb_keymap *keymap, char *field,
|
||||||
else
|
else
|
||||||
return ReportSIBadType(si, field, "level specification", info);
|
return ReportSIBadType(si, field, "level specification", info);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
ok = ReportBadField("symbol interpretation", field, siText(si, info));
|
ok = ReportBadField("symbol interpretation", field, siText(si, info));
|
||||||
}
|
}
|
||||||
return ok;
|
return ok;
|
||||||
|
@ -601,10 +556,8 @@ HandleInterpBody(VarDef *def, struct xkb_keymap *keymap, SymInterpInfo *si,
|
||||||
ExprResult tmp, field;
|
ExprResult tmp, field;
|
||||||
ExprDef *arrayNdx;
|
ExprDef *arrayNdx;
|
||||||
|
|
||||||
for (; def != NULL; def = (VarDef *) def->common.next)
|
for (; def != NULL; def = (VarDef *) def->common.next) {
|
||||||
{
|
if ((def->name) && (def->name->type == ExprFieldRef)) {
|
||||||
if ((def->name) && (def->name->type == ExprFieldRef))
|
|
||||||
{
|
|
||||||
ok = HandleInterpVar(def, keymap, info);
|
ok = HandleInterpVar(def, keymap, info);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -619,14 +572,14 @@ HandleInterpBody(VarDef *def, struct xkb_keymap *keymap, SymInterpInfo *si,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
HandleInterpDef(InterpDef *def, struct xkb_keymap *keymap, enum merge_mode merge,
|
HandleInterpDef(InterpDef *def, struct xkb_keymap *keymap,
|
||||||
|
enum merge_mode merge,
|
||||||
CompatInfo *info)
|
CompatInfo *info)
|
||||||
{
|
{
|
||||||
unsigned pred, mods;
|
unsigned pred, mods;
|
||||||
SymInterpInfo si;
|
SymInterpInfo si;
|
||||||
|
|
||||||
if (!ResolveStateAndPredicate(def->match, &pred, &mods, info))
|
if (!ResolveStateAndPredicate(def->match, &pred, &mods, info)) {
|
||||||
{
|
|
||||||
ERROR("Couldn't determine matching modifiers\n");
|
ERROR("Couldn't determine matching modifiers\n");
|
||||||
ACTION("Symbol interpretation ignored\n");
|
ACTION("Symbol interpretation ignored\n");
|
||||||
return false;
|
return false;
|
||||||
|
@ -636,22 +589,19 @@ HandleInterpDef(InterpDef *def, struct xkb_keymap *keymap, enum merge_mode merge
|
||||||
|
|
||||||
si = info->dflt;
|
si = info->dflt;
|
||||||
si.defs.merge = merge;
|
si.defs.merge = merge;
|
||||||
if (!LookupKeysym(def->sym, &si.interp.sym))
|
if (!LookupKeysym(def->sym, &si.interp.sym)) {
|
||||||
{
|
|
||||||
ERROR("Could not resolve keysym %s\n", def->sym);
|
ERROR("Could not resolve keysym %s\n", def->sym);
|
||||||
ACTION("Symbol interpretation ignored\n");
|
ACTION("Symbol interpretation ignored\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
si.interp.match = pred & XkbSI_OpMask;
|
si.interp.match = pred & XkbSI_OpMask;
|
||||||
si.interp.mods = mods;
|
si.interp.mods = mods;
|
||||||
if (!HandleInterpBody(def->def, keymap, &si, info))
|
if (!HandleInterpBody(def->def, keymap, &si, info)) {
|
||||||
{
|
|
||||||
info->errorCount++;
|
info->errorCount++;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!AddInterp(info, &si))
|
if (!AddInterp(info, &si)) {
|
||||||
{
|
|
||||||
info->errorCount++;
|
info->errorCount++;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -667,8 +617,7 @@ HandleGroupCompatDef(GroupCompatDef *def, struct xkb_keymap *keymap,
|
||||||
|
|
||||||
if (def->merge != MERGE_DEFAULT)
|
if (def->merge != MERGE_DEFAULT)
|
||||||
merge = def->merge;
|
merge = def->merge;
|
||||||
if (!XkbIsLegalGroup(def->group - 1))
|
if (!XkbIsLegalGroup(def->group - 1)) {
|
||||||
{
|
|
||||||
ERROR("Keyboard group must be in the range 1..%d\n",
|
ERROR("Keyboard group must be in the range 1..%d\n",
|
||||||
XkbNumKbdGroups + 1);
|
XkbNumKbdGroups + 1);
|
||||||
ACTION("Compatibility map for illegal group %d ignored\n",
|
ACTION("Compatibility map for illegal group %d ignored\n",
|
||||||
|
@ -677,8 +626,7 @@ HandleGroupCompatDef(GroupCompatDef *def, struct xkb_keymap *keymap,
|
||||||
}
|
}
|
||||||
tmp.file_id = info->file_id;
|
tmp.file_id = info->file_id;
|
||||||
tmp.merge = merge;
|
tmp.merge = merge;
|
||||||
if (!ExprResolveVModMask(def->def, &val, keymap))
|
if (!ExprResolveVModMask(def->def, &val, keymap)) {
|
||||||
{
|
|
||||||
ERROR("Expected a modifier mask in group compatibility definition\n");
|
ERROR("Expected a modifier mask in group compatibility definition\n");
|
||||||
ACTION("Ignoring illegal compatibility map for group %d\n",
|
ACTION("Ignoring illegal compatibility map for group %d\n",
|
||||||
def->group);
|
def->group);
|
||||||
|
@ -691,10 +639,12 @@ HandleGroupCompatDef(GroupCompatDef *def, struct xkb_keymap *keymap,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
HandleCompatMapFile(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge,
|
HandleCompatMapFile(XkbFile *file, struct xkb_keymap *keymap,
|
||||||
|
enum merge_mode merge,
|
||||||
CompatInfo *info)
|
CompatInfo *info)
|
||||||
{
|
{
|
||||||
ParseCommon *stmt;
|
ParseCommon *stmt;
|
||||||
|
LEDInfo *leds;
|
||||||
|
|
||||||
if (merge == MERGE_DEFAULT)
|
if (merge == MERGE_DEFAULT)
|
||||||
merge = MERGE_AUGMENT;
|
merge = MERGE_AUGMENT;
|
||||||
|
@ -703,8 +653,7 @@ HandleCompatMapFile(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode me
|
||||||
stmt = file->defs;
|
stmt = file->defs;
|
||||||
while (stmt)
|
while (stmt)
|
||||||
{
|
{
|
||||||
switch (stmt->stmtType)
|
switch (stmt->stmtType) {
|
||||||
{
|
|
||||||
case StmtInclude:
|
case StmtInclude:
|
||||||
if (!HandleIncludeCompatMap((IncludeStmt *) stmt, keymap, info))
|
if (!HandleIncludeCompatMap((IncludeStmt *) stmt, keymap, info))
|
||||||
info->errorCount++;
|
info->errorCount++;
|
||||||
|
@ -719,15 +668,12 @@ HandleCompatMapFile(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode me
|
||||||
info->errorCount++;
|
info->errorCount++;
|
||||||
break;
|
break;
|
||||||
case StmtIndicatorMapDef:
|
case StmtIndicatorMapDef:
|
||||||
{
|
leds = HandleIndicatorMapDef((IndicatorMapDef *) stmt, keymap,
|
||||||
LEDInfo *rtrn;
|
|
||||||
rtrn = HandleIndicatorMapDef((IndicatorMapDef *) stmt, keymap,
|
|
||||||
&info->ledDflt, info->leds, merge);
|
&info->ledDflt, info->leds, merge);
|
||||||
if (rtrn != NULL)
|
if (leds != NULL)
|
||||||
info->leds = rtrn;
|
info->leds = leds;
|
||||||
else
|
else
|
||||||
info->errorCount++;
|
info->errorCount++;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case StmtVarDef:
|
case StmtVarDef:
|
||||||
if (!HandleInterpVar((VarDef *) stmt, keymap, info))
|
if (!HandleInterpVar((VarDef *) stmt, keymap, info))
|
||||||
|
@ -748,8 +694,7 @@ HandleCompatMapFile(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode me
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
stmt = stmt->next;
|
stmt = stmt->next;
|
||||||
if (info->errorCount > 10)
|
if (info->errorCount > 10) {
|
||||||
{
|
|
||||||
#ifdef NOISY
|
#ifdef NOISY
|
||||||
ERROR("Too many errors\n");
|
ERROR("Too many errors\n");
|
||||||
#endif
|
#endif
|
||||||
|
@ -765,8 +710,7 @@ CopyInterps(CompatInfo * info,
|
||||||
{
|
{
|
||||||
SymInterpInfo *si;
|
SymInterpInfo *si;
|
||||||
|
|
||||||
for (si = info->interps; si; si = (SymInterpInfo *) si->defs.next)
|
for (si = info->interps; si; si = (SymInterpInfo *) si->defs.next) {
|
||||||
{
|
|
||||||
if (((si->interp.match & XkbSI_OpMask) != pred) ||
|
if (((si->interp.match & XkbSI_OpMask) != pred) ||
|
||||||
(needSymbol && (si->interp.sym == XKB_KEY_NoSymbol)) ||
|
(needSymbol && (si->interp.sym == XKB_KEY_NoSymbol)) ||
|
||||||
((!needSymbol) && (si->interp.sym != XKB_KEY_NoSymbol)))
|
((!needSymbol) && (si->interp.sym != XKB_KEY_NoSymbol)))
|
||||||
|
@ -776,7 +720,8 @@ CopyInterps(CompatInfo * info,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CompileCompatMap(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge)
|
CompileCompatMap(XkbFile *file, struct xkb_keymap *keymap,
|
||||||
|
enum merge_mode merge)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
CompatInfo info;
|
CompatInfo info;
|
||||||
|
@ -813,8 +758,10 @@ CompileCompatMap(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge
|
||||||
CopyInterps(&info, keymap->compat, false, XkbSI_AnyOfOrNone);
|
CopyInterps(&info, keymap->compat, false, XkbSI_AnyOfOrNone);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0, gcm = &info.groupCompat[0]; i < XkbNumKbdGroups; i++, gcm++) {
|
for (i = 0, gcm = &info.groupCompat[0]; i < XkbNumKbdGroups; i++,
|
||||||
if ((gcm->file_id != 0) || (gcm->real_mods != 0) || (gcm->vmods != 0)) {
|
gcm++) {
|
||||||
|
if ((gcm->file_id != 0) || (gcm->real_mods != 0) ||
|
||||||
|
(gcm->vmods != 0)) {
|
||||||
keymap->compat->groups[i].mask = gcm->real_mods;
|
keymap->compat->groups[i].mask = gcm->real_mods;
|
||||||
keymap->compat->groups[i].real_mods = gcm->real_mods;
|
keymap->compat->groups[i].real_mods = gcm->real_mods;
|
||||||
keymap->compat->groups[i].vmods = gcm->vmods;
|
keymap->compat->groups[i].vmods = gcm->vmods;
|
||||||
|
@ -866,12 +813,14 @@ UpdateActionMods(struct xkb_keymap *keymap, union xkb_action *act,
|
||||||
act->mods.mask = act->mods.real_mods;
|
act->mods.mask = act->mods.real_mods;
|
||||||
act->mods.mask |= VModsToReal(keymap, act->mods.vmods);
|
act->mods.mask |= VModsToReal(keymap, act->mods.vmods);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XkbSA_ISOLock:
|
case XkbSA_ISOLock:
|
||||||
if (act->iso.flags & XkbSA_UseModMapMods)
|
if (act->iso.flags & XkbSA_UseModMapMods)
|
||||||
act->iso.real_mods = rmodmask;
|
act->iso.real_mods = rmodmask;
|
||||||
act->iso.mask = act->iso.real_mods;
|
act->iso.mask = act->iso.real_mods;
|
||||||
act->iso.mask |= VModsToReal(keymap, act->iso.vmods);
|
act->iso.mask |= VModsToReal(keymap, act->iso.vmods);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -960,7 +909,8 @@ ApplyInterpsToKey(struct xkb_keymap *keymap, xkb_keycode_t key)
|
||||||
interps[i] = NULL;
|
interps[i] = NULL;
|
||||||
|
|
||||||
for (group = 0; group < XkbKeyNumGroups(keymap, key); group++) {
|
for (group = 0; group < XkbKeyNumGroups(keymap, key); group++) {
|
||||||
for (level = 0; level < XkbKeyGroupWidth(keymap, key, group); level++) {
|
for (level = 0; level < XkbKeyGroupWidth(keymap, key, group);
|
||||||
|
level++) {
|
||||||
i = (group * width) + level;
|
i = (group * width) + level;
|
||||||
if (i >= INTERP_SIZE) /* XXX FIXME */
|
if (i >= INTERP_SIZE) /* XXX FIXME */
|
||||||
return false;
|
return false;
|
||||||
|
@ -977,7 +927,8 @@ ApplyInterpsToKey(struct xkb_keymap *keymap, xkb_keycode_t key)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (group = 0; group < XkbKeyNumGroups(keymap, key); group++) {
|
for (group = 0; group < XkbKeyNumGroups(keymap, key); group++) {
|
||||||
for (level = 0; level < XkbKeyGroupWidth(keymap, key, group); level++) {
|
for (level = 0; level < XkbKeyGroupWidth(keymap, key, group);
|
||||||
|
level++) {
|
||||||
struct xkb_sym_interpret *interp;
|
struct xkb_sym_interpret *interp;
|
||||||
|
|
||||||
i = (group * width) + level;
|
i = (group * width) + level;
|
||||||
|
@ -985,10 +936,12 @@ ApplyInterpsToKey(struct xkb_keymap *keymap, xkb_keycode_t key)
|
||||||
|
|
||||||
/* Infer default key behaviours from the base level. */
|
/* Infer default key behaviours from the base level. */
|
||||||
if (group == 0 && level == 0) {
|
if (group == 0 && level == 0) {
|
||||||
if (!(keymap->server->explicit[key] & XkbExplicitAutoRepeatMask) &&
|
if (!(keymap->server->explicit[key] &
|
||||||
|
XkbExplicitAutoRepeatMask) &&
|
||||||
(!interp || interp->flags & XkbSI_AutoRepeat))
|
(!interp || interp->flags & XkbSI_AutoRepeat))
|
||||||
keymap->ctrls->per_key_repeat[key / 8] |= (1 << (key % 8));
|
keymap->ctrls->per_key_repeat[key / 8] |= (1 << (key % 8));
|
||||||
if (!(keymap->server->explicit[key] & XkbExplicitBehaviorMask) &&
|
if (!(keymap->server->explicit[key] &
|
||||||
|
XkbExplicitBehaviorMask) &&
|
||||||
interp && (interp->flags & XkbSI_LockingKey))
|
interp && (interp->flags & XkbSI_LockingKey))
|
||||||
keymap->server->behaviors[key].type = XkbKB_Lock;
|
keymap->server->behaviors[key].type = XkbKB_Lock;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
/************************************************************
|
/************************************************************
|
||||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||||
|
*
|
||||||
Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
software and its documentation for any purpose and without
|
* software and its documentation for any purpose and without
|
||||||
fee is hereby granted, provided that the above copyright
|
* fee is hereby granted, provided that the above copyright
|
||||||
notice appear in all copies and that both that copyright
|
* notice appear in all copies and that both that copyright
|
||||||
notice and this permission notice appear in supporting
|
* notice and this permission notice appear in supporting
|
||||||
documentation, and that the name of Silicon Graphics not be
|
* documentation, and that the name of Silicon Graphics not be
|
||||||
used in advertising or publicity pertaining to distribution
|
* used in advertising or publicity pertaining to distribution
|
||||||
of the software without specific prior written permission.
|
* of the software without specific prior written permission.
|
||||||
Silicon Graphics makes no representation about the suitability
|
* Silicon Graphics makes no representation about the suitability
|
||||||
of this software for any purpose. It is provided "as is"
|
* of this software for any purpose. It is provided "as is"
|
||||||
without any express or implied warranty.
|
* without any express or implied warranty.
|
||||||
|
*
|
||||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
||||||
#include "expr.h"
|
#include "expr.h"
|
||||||
|
@ -39,8 +39,7 @@ exprOpText(unsigned type)
|
||||||
{
|
{
|
||||||
static char buf[32];
|
static char buf[32];
|
||||||
|
|
||||||
switch (type)
|
switch (type) {
|
||||||
{
|
|
||||||
case ExprValue:
|
case ExprValue:
|
||||||
strcpy(buf, "literal");
|
strcpy(buf, "literal");
|
||||||
break;
|
break;
|
||||||
|
@ -101,8 +100,7 @@ exprTypeText(unsigned type)
|
||||||
{
|
{
|
||||||
static char buf[20];
|
static char buf[20];
|
||||||
|
|
||||||
switch (type)
|
switch (type) {
|
||||||
{
|
|
||||||
case TypeUnknown:
|
case TypeUnknown:
|
||||||
strcpy(buf, "unknown");
|
strcpy(buf, "unknown");
|
||||||
break;
|
break;
|
||||||
|
@ -133,8 +131,7 @@ ExprResolveLhs(struct xkb_keymap *keymap, ExprDef *expr,
|
||||||
ExprResult *elem_rtrn, ExprResult *field_rtrn,
|
ExprResult *elem_rtrn, ExprResult *field_rtrn,
|
||||||
ExprDef **index_rtrn)
|
ExprDef **index_rtrn)
|
||||||
{
|
{
|
||||||
switch (expr->op)
|
switch (expr->op) {
|
||||||
{
|
|
||||||
case ExprIdent:
|
case ExprIdent:
|
||||||
elem_rtrn->str = NULL;
|
elem_rtrn->str = NULL;
|
||||||
field_rtrn->str = xkb_atom_strdup(keymap->ctx,
|
field_rtrn->str = xkb_atom_strdup(keymap->ctx,
|
||||||
|
@ -168,18 +165,16 @@ SimpleLookup(struct xkb_context *ctx, const void *priv,
|
||||||
const char *str;
|
const char *str;
|
||||||
|
|
||||||
if ((priv == NULL) || (field == XKB_ATOM_NONE) || (type != TypeInt))
|
if ((priv == NULL) || (field == XKB_ATOM_NONE) || (type != TypeInt))
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
str = xkb_atom_text(ctx, field);
|
str = xkb_atom_text(ctx, field);
|
||||||
for (entry = priv; (entry != NULL) && (entry->name != NULL); entry++)
|
for (entry = priv; (entry != NULL) && (entry->name != NULL); entry++) {
|
||||||
{
|
if (strcasecmp(str, entry->name) == 0) {
|
||||||
if (strcasecmp(str, entry->name) == 0)
|
|
||||||
{
|
|
||||||
val_rtrn->uval = entry->result;
|
val_rtrn->uval = entry->result;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,11 +228,9 @@ ExprResolveBoolean(struct xkb_context *ctx, ExprDef *expr,
|
||||||
int ok = 0;
|
int ok = 0;
|
||||||
const char *bogus = NULL;
|
const char *bogus = NULL;
|
||||||
|
|
||||||
switch (expr->op)
|
switch (expr->op) {
|
||||||
{
|
|
||||||
case ExprValue:
|
case ExprValue:
|
||||||
if (expr->type != TypeBoolean)
|
if (expr->type != TypeBoolean) {
|
||||||
{
|
|
||||||
ERROR
|
ERROR
|
||||||
("Found constant of type %s where boolean was expected\n",
|
("Found constant of type %s where boolean was expected\n",
|
||||||
exprTypeText(expr->type));
|
exprTypeText(expr->type));
|
||||||
|
@ -245,21 +238,19 @@ ExprResolveBoolean(struct xkb_context *ctx, ExprDef *expr,
|
||||||
}
|
}
|
||||||
val_rtrn->ival = expr->value.ival;
|
val_rtrn->ival = expr->value.ival;
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case ExprIdent:
|
case ExprIdent:
|
||||||
bogus = xkb_atom_text(ctx, expr->value.str);
|
bogus = xkb_atom_text(ctx, expr->value.str);
|
||||||
if (bogus)
|
if (bogus) {
|
||||||
{
|
|
||||||
if ((strcasecmp(bogus, "true") == 0) ||
|
if ((strcasecmp(bogus, "true") == 0) ||
|
||||||
(strcasecmp(bogus, "yes") == 0) ||
|
(strcasecmp(bogus, "yes") == 0) ||
|
||||||
(strcasecmp(bogus, "on") == 0))
|
(strcasecmp(bogus, "on") == 0)) {
|
||||||
{
|
|
||||||
val_rtrn->uval = 1;
|
val_rtrn->uval = 1;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if ((strcasecmp(bogus, "false") == 0) ||
|
else if ((strcasecmp(bogus, "false") == 0) ||
|
||||||
(strcasecmp(bogus, "no") == 0) ||
|
(strcasecmp(bogus, "no") == 0) ||
|
||||||
(strcasecmp(bogus, "off") == 0))
|
(strcasecmp(bogus, "off") == 0)) {
|
||||||
{
|
|
||||||
val_rtrn->uval = 0;
|
val_rtrn->uval = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -267,11 +258,13 @@ ExprResolveBoolean(struct xkb_context *ctx, ExprDef *expr,
|
||||||
ERROR("Identifier \"%s\" of type int is unknown\n",
|
ERROR("Identifier \"%s\" of type int is unknown\n",
|
||||||
xkb_atom_text(ctx, expr->value.str));
|
xkb_atom_text(ctx, expr->value.str));
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case ExprFieldRef:
|
case ExprFieldRef:
|
||||||
ERROR("Default \"%s.%s\" of type boolean is unknown\n",
|
ERROR("Default \"%s.%s\" of type boolean is unknown\n",
|
||||||
xkb_atom_text(ctx, expr->value.field.element),
|
xkb_atom_text(ctx, expr->value.field.element),
|
||||||
xkb_atom_text(ctx, expr->value.field.field));
|
xkb_atom_text(ctx, expr->value.field.field));
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case OpInvert:
|
case OpInvert:
|
||||||
case OpNot:
|
case OpNot:
|
||||||
ok = ExprResolveBoolean(ctx, expr, val_rtrn);
|
ok = ExprResolveBoolean(ctx, expr, val_rtrn);
|
||||||
|
@ -298,9 +291,11 @@ ExprResolveBoolean(struct xkb_context *ctx, ExprDef *expr,
|
||||||
bogus = "Negation";
|
bogus = "Negation";
|
||||||
ERROR("%s of boolean values not permitted\n", bogus);
|
ERROR("%s of boolean values not permitted\n", bogus);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OpUnaryPlus:
|
case OpUnaryPlus:
|
||||||
ERROR("Unary \"+\" operator not permitted for boolean values\n");
|
ERROR("Unary \"+\" operator not permitted for boolean values\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
WSGO("Unknown operator %d in ResolveBoolean\n", expr->op);
|
WSGO("Unknown operator %d in ResolveBoolean\n", expr->op);
|
||||||
break;
|
break;
|
||||||
|
@ -316,21 +311,17 @@ ExprResolveFloat(struct xkb_context *ctx, ExprDef *expr,
|
||||||
ExprResult leftRtrn, rightRtrn;
|
ExprResult leftRtrn, rightRtrn;
|
||||||
ExprDef *left, *right;
|
ExprDef *left, *right;
|
||||||
|
|
||||||
switch (expr->op)
|
switch (expr->op) {
|
||||||
{
|
|
||||||
case ExprValue:
|
case ExprValue:
|
||||||
if (expr->type == TypeString)
|
if (expr->type == TypeString) {
|
||||||
{
|
|
||||||
const char *str;
|
const char *str;
|
||||||
str = xkb_atom_text(ctx, expr->value.str);
|
str = xkb_atom_text(ctx, expr->value.str);
|
||||||
if ((str != NULL) && (strlen(str) == 1))
|
if ((str != NULL) && (strlen(str) == 1)) {
|
||||||
{
|
|
||||||
val_rtrn->uval = str[0] * XkbGeomPtsPerMM;
|
val_rtrn->uval = str[0] * XkbGeomPtsPerMM;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (expr->type != TypeInt)
|
if (expr->type != TypeInt) {
|
||||||
{
|
|
||||||
ERROR("Found constant of type %s, expected a number\n",
|
ERROR("Found constant of type %s, expected a number\n",
|
||||||
exprTypeText(expr->type));
|
exprTypeText(expr->type));
|
||||||
return false;
|
return false;
|
||||||
|
@ -339,15 +330,18 @@ ExprResolveFloat(struct xkb_context *ctx, ExprDef *expr,
|
||||||
if (expr->type == TypeInt)
|
if (expr->type == TypeInt)
|
||||||
val_rtrn->ival *= XkbGeomPtsPerMM;
|
val_rtrn->ival *= XkbGeomPtsPerMM;
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case ExprIdent:
|
case ExprIdent:
|
||||||
ERROR("Numeric identifier \"%s\" unknown\n",
|
ERROR("Numeric identifier \"%s\" unknown\n",
|
||||||
xkb_atom_text(ctx, expr->value.str));
|
xkb_atom_text(ctx, expr->value.str));
|
||||||
return ok;
|
return ok;
|
||||||
|
|
||||||
case ExprFieldRef:
|
case ExprFieldRef:
|
||||||
ERROR("Numeric default \"%s.%s\" unknown\n",
|
ERROR("Numeric default \"%s.%s\" unknown\n",
|
||||||
xkb_atom_text(ctx, expr->value.field.element),
|
xkb_atom_text(ctx, expr->value.field.element),
|
||||||
xkb_atom_text(ctx, expr->value.field.field));
|
xkb_atom_text(ctx, expr->value.field.field));
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case OpAdd:
|
case OpAdd:
|
||||||
case OpSubtract:
|
case OpSubtract:
|
||||||
case OpMultiply:
|
case OpMultiply:
|
||||||
|
@ -355,19 +349,20 @@ ExprResolveFloat(struct xkb_context *ctx, ExprDef *expr,
|
||||||
left = expr->value.binary.left;
|
left = expr->value.binary.left;
|
||||||
right = expr->value.binary.right;
|
right = expr->value.binary.right;
|
||||||
if (ExprResolveFloat(ctx, left, &leftRtrn) &&
|
if (ExprResolveFloat(ctx, left, &leftRtrn) &&
|
||||||
ExprResolveFloat(ctx, right, &rightRtrn))
|
ExprResolveFloat(ctx, right, &rightRtrn)) {
|
||||||
{
|
switch (expr->op) {
|
||||||
switch (expr->op)
|
|
||||||
{
|
|
||||||
case OpAdd:
|
case OpAdd:
|
||||||
val_rtrn->ival = leftRtrn.ival + rightRtrn.ival;
|
val_rtrn->ival = leftRtrn.ival + rightRtrn.ival;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OpSubtract:
|
case OpSubtract:
|
||||||
val_rtrn->ival = leftRtrn.ival - rightRtrn.ival;
|
val_rtrn->ival = leftRtrn.ival - rightRtrn.ival;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OpMultiply:
|
case OpMultiply:
|
||||||
val_rtrn->ival = leftRtrn.ival * rightRtrn.ival;
|
val_rtrn->ival = leftRtrn.ival * rightRtrn.ival;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OpDivide:
|
case OpDivide:
|
||||||
val_rtrn->ival = leftRtrn.ival / rightRtrn.ival;
|
val_rtrn->ival = leftRtrn.ival / rightRtrn.ival;
|
||||||
break;
|
break;
|
||||||
|
@ -375,17 +370,19 @@ ExprResolveFloat(struct xkb_context *ctx, ExprDef *expr,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case OpAssign:
|
case OpAssign:
|
||||||
WSGO("Assignment operator not implemented yet\n");
|
WSGO("Assignment operator not implemented yet\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OpNot:
|
case OpNot:
|
||||||
ERROR("The ! operator cannot be applied to a number\n");
|
ERROR("The ! operator cannot be applied to a number\n");
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case OpInvert:
|
case OpInvert:
|
||||||
case OpNegate:
|
case OpNegate:
|
||||||
left = expr->value.child;
|
left = expr->value.child;
|
||||||
if (ExprResolveFloat(ctx, left, &leftRtrn))
|
if (ExprResolveFloat(ctx, left, &leftRtrn)) {
|
||||||
{
|
|
||||||
if (expr->op == OpNegate)
|
if (expr->op == OpNegate)
|
||||||
val_rtrn->ival = -leftRtrn.ival;
|
val_rtrn->ival = -leftRtrn.ival;
|
||||||
else
|
else
|
||||||
|
@ -393,9 +390,11 @@ ExprResolveFloat(struct xkb_context *ctx, ExprDef *expr,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case OpUnaryPlus:
|
case OpUnaryPlus:
|
||||||
left = expr->value.child;
|
left = expr->value.child;
|
||||||
return ExprResolveFloat(ctx, left, val_rtrn);
|
return ExprResolveFloat(ctx, left, val_rtrn);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
WSGO("Unknown operator %d in ResolveFloat\n", expr->op);
|
WSGO("Unknown operator %d in ResolveFloat\n", expr->op);
|
||||||
break;
|
break;
|
||||||
|
@ -410,11 +409,9 @@ ExprResolveKeyCode(struct xkb_context *ctx, ExprDef *expr,
|
||||||
ExprResult leftRtrn, rightRtrn;
|
ExprResult leftRtrn, rightRtrn;
|
||||||
ExprDef *left, *right;
|
ExprDef *left, *right;
|
||||||
|
|
||||||
switch (expr->op)
|
switch (expr->op) {
|
||||||
{
|
|
||||||
case ExprValue:
|
case ExprValue:
|
||||||
if (expr->type != TypeInt)
|
if (expr->type != TypeInt) {
|
||||||
{
|
|
||||||
ERROR
|
ERROR
|
||||||
("Found constant of type %s where an int was expected\n",
|
("Found constant of type %s where an int was expected\n",
|
||||||
exprTypeText(expr->type));
|
exprTypeText(expr->type));
|
||||||
|
@ -422,6 +419,7 @@ ExprResolveKeyCode(struct xkb_context *ctx, ExprDef *expr,
|
||||||
}
|
}
|
||||||
val_rtrn->uval = expr->value.uval;
|
val_rtrn->uval = expr->value.uval;
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case OpAdd:
|
case OpAdd:
|
||||||
case OpSubtract:
|
case OpSubtract:
|
||||||
case OpMultiply:
|
case OpMultiply:
|
||||||
|
@ -429,10 +427,8 @@ ExprResolveKeyCode(struct xkb_context *ctx, ExprDef *expr,
|
||||||
left = expr->value.binary.left;
|
left = expr->value.binary.left;
|
||||||
right = expr->value.binary.right;
|
right = expr->value.binary.right;
|
||||||
if (ExprResolveKeyCode(ctx, left, &leftRtrn) &&
|
if (ExprResolveKeyCode(ctx, left, &leftRtrn) &&
|
||||||
ExprResolveKeyCode(ctx, right, &rightRtrn))
|
ExprResolveKeyCode(ctx, right, &rightRtrn)) {
|
||||||
{
|
switch (expr->op) {
|
||||||
switch (expr->op)
|
|
||||||
{
|
|
||||||
case OpAdd:
|
case OpAdd:
|
||||||
val_rtrn->uval = leftRtrn.uval + rightRtrn.uval;
|
val_rtrn->uval = leftRtrn.uval + rightRtrn.uval;
|
||||||
break;
|
break;
|
||||||
|
@ -449,17 +445,19 @@ ExprResolveKeyCode(struct xkb_context *ctx, ExprDef *expr,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case OpNegate:
|
case OpNegate:
|
||||||
left = expr->value.child;
|
left = expr->value.child;
|
||||||
if (ExprResolveKeyCode(ctx, left, &leftRtrn))
|
if (ExprResolveKeyCode(ctx, left, &leftRtrn)) {
|
||||||
{
|
|
||||||
val_rtrn->uval = ~leftRtrn.uval;
|
val_rtrn->uval = ~leftRtrn.uval;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case OpUnaryPlus:
|
case OpUnaryPlus:
|
||||||
left = expr->value.child;
|
left = expr->value.child;
|
||||||
return ExprResolveKeyCode(ctx, left, val_rtrn);
|
return ExprResolveKeyCode(ctx, left, val_rtrn);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
WSGO("Unknown operator %d in ResolveKeyCode\n", expr->op);
|
WSGO("Unknown operator %d in ResolveKeyCode\n", expr->op);
|
||||||
break;
|
break;
|
||||||
|
@ -490,16 +488,13 @@ ExprResolveIntegerLookup(struct xkb_context *ctx, ExprDef *expr,
|
||||||
ExprResult leftRtrn, rightRtrn;
|
ExprResult leftRtrn, rightRtrn;
|
||||||
ExprDef *left, *right;
|
ExprDef *left, *right;
|
||||||
|
|
||||||
switch (expr->op)
|
switch (expr->op) {
|
||||||
{
|
|
||||||
case ExprValue:
|
case ExprValue:
|
||||||
if (expr->type == TypeString)
|
if (expr->type == TypeString) {
|
||||||
{
|
|
||||||
const char *str;
|
const char *str;
|
||||||
str = xkb_atom_text(ctx, expr->value.str);
|
str = xkb_atom_text(ctx, expr->value.str);
|
||||||
if (str != NULL)
|
if (str != NULL)
|
||||||
switch (strlen(str))
|
switch (strlen(str)) {
|
||||||
{
|
|
||||||
case 0:
|
case 0:
|
||||||
val_rtrn->uval = 0;
|
val_rtrn->uval = 0;
|
||||||
return true;
|
return true;
|
||||||
|
@ -510,8 +505,7 @@ ExprResolveIntegerLookup(struct xkb_context *ctx, ExprDef *expr,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (expr->type != TypeInt)
|
if (expr->type != TypeInt) {
|
||||||
{
|
|
||||||
ERROR
|
ERROR
|
||||||
("Found constant of type %s where an int was expected\n",
|
("Found constant of type %s where an int was expected\n",
|
||||||
exprTypeText(expr->type));
|
exprTypeText(expr->type));
|
||||||
|
@ -519,6 +513,7 @@ ExprResolveIntegerLookup(struct xkb_context *ctx, ExprDef *expr,
|
||||||
}
|
}
|
||||||
val_rtrn->ival = expr->value.ival;
|
val_rtrn->ival = expr->value.ival;
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case ExprIdent:
|
case ExprIdent:
|
||||||
if (lookup)
|
if (lookup)
|
||||||
ok = lookup(ctx, lookupPriv, expr->value.str,
|
ok = lookup(ctx, lookupPriv, expr->value.str,
|
||||||
|
@ -527,22 +522,24 @@ ExprResolveIntegerLookup(struct xkb_context *ctx, ExprDef *expr,
|
||||||
ERROR("Identifier \"%s\" of type int is unknown\n",
|
ERROR("Identifier \"%s\" of type int is unknown\n",
|
||||||
xkb_atom_text(ctx, expr->value.str));
|
xkb_atom_text(ctx, expr->value.str));
|
||||||
return ok;
|
return ok;
|
||||||
|
|
||||||
case ExprFieldRef:
|
case ExprFieldRef:
|
||||||
ERROR("Default \"%s.%s\" of type int is unknown\n",
|
ERROR("Default \"%s.%s\" of type int is unknown\n",
|
||||||
xkb_atom_text(ctx, expr->value.field.element),
|
xkb_atom_text(ctx, expr->value.field.element),
|
||||||
xkb_atom_text(ctx, expr->value.field.field));
|
xkb_atom_text(ctx, expr->value.field.field));
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case OpAdd:
|
case OpAdd:
|
||||||
case OpSubtract:
|
case OpSubtract:
|
||||||
case OpMultiply:
|
case OpMultiply:
|
||||||
case OpDivide:
|
case OpDivide:
|
||||||
left = expr->value.binary.left;
|
left = expr->value.binary.left;
|
||||||
right = expr->value.binary.right;
|
right = expr->value.binary.right;
|
||||||
if (ExprResolveIntegerLookup(ctx, left, &leftRtrn, lookup, lookupPriv) &&
|
if (ExprResolveIntegerLookup(ctx, left, &leftRtrn, lookup,
|
||||||
ExprResolveIntegerLookup(ctx, right, &rightRtrn, lookup, lookupPriv))
|
lookupPriv) &&
|
||||||
{
|
ExprResolveIntegerLookup(ctx, right, &rightRtrn, lookup,
|
||||||
switch (expr->op)
|
lookupPriv)) {
|
||||||
{
|
switch (expr->op) {
|
||||||
case OpAdd:
|
case OpAdd:
|
||||||
val_rtrn->ival = leftRtrn.ival + rightRtrn.ival;
|
val_rtrn->ival = leftRtrn.ival + rightRtrn.ival;
|
||||||
break;
|
break;
|
||||||
|
@ -559,18 +556,20 @@ ExprResolveIntegerLookup(struct xkb_context *ctx, ExprDef *expr,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case OpAssign:
|
case OpAssign:
|
||||||
WSGO("Assignment operator not implemented yet\n");
|
WSGO("Assignment operator not implemented yet\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OpNot:
|
case OpNot:
|
||||||
ERROR("The ! operator cannot be applied to an integer\n");
|
ERROR("The ! operator cannot be applied to an integer\n");
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case OpInvert:
|
case OpInvert:
|
||||||
case OpNegate:
|
case OpNegate:
|
||||||
left = expr->value.child;
|
left = expr->value.child;
|
||||||
if (ExprResolveIntegerLookup(ctx, left, &leftRtrn, lookup,
|
if (ExprResolveIntegerLookup(ctx, left, &leftRtrn, lookup,
|
||||||
lookupPriv))
|
lookupPriv)) {
|
||||||
{
|
|
||||||
if (expr->op == OpNegate)
|
if (expr->op == OpNegate)
|
||||||
val_rtrn->ival = -leftRtrn.ival;
|
val_rtrn->ival = -leftRtrn.ival;
|
||||||
else
|
else
|
||||||
|
@ -578,10 +577,12 @@ ExprResolveIntegerLookup(struct xkb_context *ctx, ExprDef *expr,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case OpUnaryPlus:
|
case OpUnaryPlus:
|
||||||
left = expr->value.child;
|
left = expr->value.child;
|
||||||
return ExprResolveIntegerLookup(ctx, left, val_rtrn, lookup,
|
return ExprResolveIntegerLookup(ctx, left, val_rtrn, lookup,
|
||||||
lookupPriv);
|
lookupPriv);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
WSGO("Unknown operator %d in ResolveInteger\n", expr->op);
|
WSGO("Unknown operator %d in ResolveInteger\n", expr->op);
|
||||||
break;
|
break;
|
||||||
|
@ -685,11 +686,9 @@ ExprResolveString(struct xkb_context *ctx, ExprDef *expr,
|
||||||
ExprDef *right;
|
ExprDef *right;
|
||||||
const char *bogus = NULL;
|
const char *bogus = NULL;
|
||||||
|
|
||||||
switch (expr->op)
|
switch (expr->op) {
|
||||||
{
|
|
||||||
case ExprValue:
|
case ExprValue:
|
||||||
if (expr->type != TypeString)
|
if (expr->type != TypeString) {
|
||||||
{
|
|
||||||
ERROR("Found constant of type %s, expected a string\n",
|
ERROR("Found constant of type %s, expected a string\n",
|
||||||
exprTypeText(expr->type));
|
exprTypeText(expr->type));
|
||||||
return false;
|
return false;
|
||||||
|
@ -698,21 +697,23 @@ ExprResolveString(struct xkb_context *ctx, ExprDef *expr,
|
||||||
if (val_rtrn->str == NULL)
|
if (val_rtrn->str == NULL)
|
||||||
val_rtrn->str = strdup("");
|
val_rtrn->str = strdup("");
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case ExprIdent:
|
case ExprIdent:
|
||||||
ERROR("Identifier \"%s\" of type string not found\n",
|
ERROR("Identifier \"%s\" of type string not found\n",
|
||||||
xkb_atom_text(ctx, expr->value.str));
|
xkb_atom_text(ctx, expr->value.str));
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case ExprFieldRef:
|
case ExprFieldRef:
|
||||||
ERROR("Default \"%s.%s\" of type string not found\n",
|
ERROR("Default \"%s.%s\" of type string not found\n",
|
||||||
xkb_atom_text(ctx, expr->value.field.element),
|
xkb_atom_text(ctx, expr->value.field.element),
|
||||||
xkb_atom_text(ctx, expr->value.field.field));
|
xkb_atom_text(ctx, expr->value.field.field));
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case OpAdd:
|
case OpAdd:
|
||||||
left = expr->value.binary.left;
|
left = expr->value.binary.left;
|
||||||
right = expr->value.binary.right;
|
right = expr->value.binary.right;
|
||||||
if (ExprResolveString(ctx, left, &leftRtrn) &&
|
if (ExprResolveString(ctx, left, &leftRtrn) &&
|
||||||
ExprResolveString(ctx, right, &rightRtrn))
|
ExprResolveString(ctx, right, &rightRtrn)) {
|
||||||
{
|
|
||||||
int len;
|
int len;
|
||||||
char *new;
|
char *new;
|
||||||
len = strlen(leftRtrn.str) + strlen(rightRtrn.str) + 1;
|
len = strlen(leftRtrn.str) + strlen(rightRtrn.str) + 1;
|
||||||
|
@ -728,6 +729,7 @@ ExprResolveString(struct xkb_context *ctx, ExprDef *expr,
|
||||||
free(rightRtrn.str);
|
free(rightRtrn.str);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case OpSubtract:
|
case OpSubtract:
|
||||||
if (bogus == NULL)
|
if (bogus == NULL)
|
||||||
bogus = "Subtraction";
|
bogus = "Subtraction";
|
||||||
|
@ -748,12 +750,15 @@ ExprResolveString(struct xkb_context *ctx, ExprDef *expr,
|
||||||
bogus = "Bitwise complement";
|
bogus = "Bitwise complement";
|
||||||
ERROR("%s of string values not permitted\n", bogus);
|
ERROR("%s of string values not permitted\n", bogus);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case OpNot:
|
case OpNot:
|
||||||
ERROR("The ! operator cannot be applied to a string\n");
|
ERROR("The ! operator cannot be applied to a string\n");
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case OpUnaryPlus:
|
case OpUnaryPlus:
|
||||||
ERROR("The + operator cannot be applied to a string\n");
|
ERROR("The + operator cannot be applied to a string\n");
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
WSGO("Unknown operator %d in ResolveString\n", expr->op);
|
WSGO("Unknown operator %d in ResolveString\n", expr->op);
|
||||||
break;
|
break;
|
||||||
|
@ -767,26 +772,27 @@ ExprResolveKeyName(struct xkb_context *ctx, ExprDef *expr,
|
||||||
{
|
{
|
||||||
const char *bogus = NULL;
|
const char *bogus = NULL;
|
||||||
|
|
||||||
switch (expr->op)
|
switch (expr->op) {
|
||||||
{
|
|
||||||
case ExprValue:
|
case ExprValue:
|
||||||
if (expr->type != TypeKeyName)
|
if (expr->type != TypeKeyName) {
|
||||||
{
|
|
||||||
ERROR("Found constant of type %s, expected a key name\n",
|
ERROR("Found constant of type %s, expected a key name\n",
|
||||||
exprTypeText(expr->type));
|
exprTypeText(expr->type));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
memcpy(val_rtrn->keyName.name, expr->value.keyName, XkbKeyNameLength);
|
memcpy(val_rtrn->keyName.name, expr->value.keyName, XkbKeyNameLength);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case ExprIdent:
|
case ExprIdent:
|
||||||
ERROR("Identifier \"%s\" of type string not found\n",
|
ERROR("Identifier \"%s\" of type string not found\n",
|
||||||
xkb_atom_text(ctx, expr->value.str));
|
xkb_atom_text(ctx, expr->value.str));
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case ExprFieldRef:
|
case ExprFieldRef:
|
||||||
ERROR("Default \"%s.%s\" of type key name not found\n",
|
ERROR("Default \"%s.%s\" of type key name not found\n",
|
||||||
xkb_atom_text(ctx, expr->value.field.element),
|
xkb_atom_text(ctx, expr->value.field.element),
|
||||||
xkb_atom_text(ctx, expr->value.field.field));
|
xkb_atom_text(ctx, expr->value.field.field));
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case OpAdd:
|
case OpAdd:
|
||||||
if (bogus == NULL)
|
if (bogus == NULL)
|
||||||
bogus = "Addition";
|
bogus = "Addition";
|
||||||
|
@ -810,12 +816,15 @@ ExprResolveKeyName(struct xkb_context *ctx, ExprDef *expr,
|
||||||
bogus = "Bitwise complement";
|
bogus = "Bitwise complement";
|
||||||
ERROR("%s of key name values not permitted\n", bogus);
|
ERROR("%s of key name values not permitted\n", bogus);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case OpNot:
|
case OpNot:
|
||||||
ERROR("The ! operator cannot be applied to a key name\n");
|
ERROR("The ! operator cannot be applied to a key name\n");
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case OpUnaryPlus:
|
case OpUnaryPlus:
|
||||||
ERROR("The + operator cannot be applied to a key name\n");
|
ERROR("The + operator cannot be applied to a key name\n");
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
WSGO("Unknown operator %d in ResolveKeyName\n", expr->op);
|
WSGO("Unknown operator %d in ResolveKeyName\n", expr->op);
|
||||||
break;
|
break;
|
||||||
|
@ -829,14 +838,12 @@ int
|
||||||
ExprResolveEnum(struct xkb_context *ctx, ExprDef *expr,
|
ExprResolveEnum(struct xkb_context *ctx, ExprDef *expr,
|
||||||
ExprResult *val_rtrn, const LookupEntry *values)
|
ExprResult *val_rtrn, const LookupEntry *values)
|
||||||
{
|
{
|
||||||
if (expr->op != ExprIdent)
|
if (expr->op != ExprIdent) {
|
||||||
{
|
|
||||||
ERROR("Found a %s where an enumerated value was expected\n",
|
ERROR("Found a %s where an enumerated value was expected\n",
|
||||||
exprOpText(expr->op));
|
exprOpText(expr->op));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!SimpleLookup(ctx, values, expr->value.str, TypeInt, val_rtrn))
|
if (!SimpleLookup(ctx, values, expr->value.str, TypeInt, val_rtrn)) {
|
||||||
{
|
|
||||||
int nOut = 0;
|
int nOut = 0;
|
||||||
ERROR("Illegal identifier %s (expected one of: ",
|
ERROR("Illegal identifier %s (expected one of: ",
|
||||||
xkb_atom_text(ctx, expr->value.str));
|
xkb_atom_text(ctx, expr->value.str));
|
||||||
|
@ -865,11 +872,9 @@ ExprResolveMaskLookup(struct xkb_context *ctx, ExprDef *expr,
|
||||||
ExprDef *left, *right;
|
ExprDef *left, *right;
|
||||||
const char *bogus = NULL;
|
const char *bogus = NULL;
|
||||||
|
|
||||||
switch (expr->op)
|
switch (expr->op) {
|
||||||
{
|
|
||||||
case ExprValue:
|
case ExprValue:
|
||||||
if (expr->type != TypeInt)
|
if (expr->type != TypeInt) {
|
||||||
{
|
|
||||||
ERROR
|
ERROR
|
||||||
("Found constant of type %s where a mask was expected\n",
|
("Found constant of type %s where a mask was expected\n",
|
||||||
exprTypeText(expr->type));
|
exprTypeText(expr->type));
|
||||||
|
@ -877,36 +882,41 @@ ExprResolveMaskLookup(struct xkb_context *ctx, ExprDef *expr,
|
||||||
}
|
}
|
||||||
val_rtrn->ival = expr->value.ival;
|
val_rtrn->ival = expr->value.ival;
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case ExprIdent:
|
case ExprIdent:
|
||||||
ok = lookup(ctx, lookupPriv, expr->value.str, TypeInt, val_rtrn);
|
ok = lookup(ctx, lookupPriv, expr->value.str, TypeInt, val_rtrn);
|
||||||
if (!ok)
|
if (!ok)
|
||||||
ERROR("Identifier \"%s\" of type int is unknown\n",
|
ERROR("Identifier \"%s\" of type int is unknown\n",
|
||||||
xkb_atom_text(ctx, expr->value.str));
|
xkb_atom_text(ctx, expr->value.str));
|
||||||
return ok;
|
return ok;
|
||||||
|
|
||||||
case ExprFieldRef:
|
case ExprFieldRef:
|
||||||
ERROR("Default \"%s.%s\" of type int is unknown\n",
|
ERROR("Default \"%s.%s\" of type int is unknown\n",
|
||||||
xkb_atom_text(ctx, expr->value.field.element),
|
xkb_atom_text(ctx, expr->value.field.element),
|
||||||
xkb_atom_text(ctx, expr->value.field.field));
|
xkb_atom_text(ctx, expr->value.field.field));
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case ExprArrayRef:
|
case ExprArrayRef:
|
||||||
bogus = "array reference";
|
bogus = "array reference";
|
||||||
|
|
||||||
case ExprActionDecl:
|
case ExprActionDecl:
|
||||||
if (bogus == NULL)
|
if (bogus == NULL)
|
||||||
bogus = "function use";
|
bogus = "function use";
|
||||||
ERROR("Unexpected %s in mask expression\n", bogus);
|
ERROR("Unexpected %s in mask expression\n", bogus);
|
||||||
ACTION("Expression ignored\n");
|
ACTION("Expression ignored\n");
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case OpAdd:
|
case OpAdd:
|
||||||
case OpSubtract:
|
case OpSubtract:
|
||||||
case OpMultiply:
|
case OpMultiply:
|
||||||
case OpDivide:
|
case OpDivide:
|
||||||
left = expr->value.binary.left;
|
left = expr->value.binary.left;
|
||||||
right = expr->value.binary.right;
|
right = expr->value.binary.right;
|
||||||
if (ExprResolveMaskLookup(ctx, left, &leftRtrn, lookup, lookupPriv) &&
|
if (ExprResolveMaskLookup(ctx, left, &leftRtrn, lookup,
|
||||||
ExprResolveMaskLookup(ctx, right, &rightRtrn, lookup, lookupPriv))
|
lookupPriv) &&
|
||||||
{
|
ExprResolveMaskLookup(ctx, right, &rightRtrn, lookup,
|
||||||
switch (expr->op)
|
lookupPriv)) {
|
||||||
{
|
switch (expr->op) {
|
||||||
case OpAdd:
|
case OpAdd:
|
||||||
val_rtrn->ival = leftRtrn.ival | rightRtrn.ival;
|
val_rtrn->ival = leftRtrn.ival | rightRtrn.ival;
|
||||||
break;
|
break;
|
||||||
|
@ -923,29 +933,31 @@ ExprResolveMaskLookup(struct xkb_context *ctx, ExprDef *expr,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case OpAssign:
|
case OpAssign:
|
||||||
WSGO("Assignment operator not implemented yet\n");
|
WSGO("Assignment operator not implemented yet\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OpInvert:
|
case OpInvert:
|
||||||
left = expr->value.child;
|
left = expr->value.child;
|
||||||
if (ExprResolveIntegerLookup(ctx, left, &leftRtrn, lookup,
|
if (ExprResolveIntegerLookup(ctx, left, &leftRtrn, lookup,
|
||||||
lookupPriv))
|
lookupPriv)) {
|
||||||
{
|
|
||||||
val_rtrn->ival = ~leftRtrn.ival;
|
val_rtrn->ival = ~leftRtrn.ival;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case OpUnaryPlus:
|
case OpUnaryPlus:
|
||||||
case OpNegate:
|
case OpNegate:
|
||||||
case OpNot:
|
case OpNot:
|
||||||
left = expr->value.child;
|
left = expr->value.child;
|
||||||
if (ExprResolveIntegerLookup(ctx, left, &leftRtrn, lookup,
|
if (ExprResolveIntegerLookup(ctx, left, &leftRtrn, lookup,
|
||||||
lookupPriv))
|
lookupPriv)) {
|
||||||
{
|
|
||||||
ERROR("The %s operator cannot be used with a mask\n",
|
ERROR("The %s operator cannot be used with a mask\n",
|
||||||
(expr->op == OpNegate ? "-" : "!"));
|
(expr->op == OpNegate ? "-" : "!"));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
WSGO("Unknown operator %d in ResolveMask\n", expr->op);
|
WSGO("Unknown operator %d in ResolveMask\n", expr->op);
|
||||||
break;
|
break;
|
||||||
|
@ -982,8 +994,7 @@ ExprResolveKeySym(struct xkb_context *ctx, ExprDef *expr,
|
||||||
int ok = 0;
|
int ok = 0;
|
||||||
xkb_keysym_t sym;
|
xkb_keysym_t sym;
|
||||||
|
|
||||||
if (expr->op == ExprIdent)
|
if (expr->op == ExprIdent) {
|
||||||
{
|
|
||||||
const char *str;
|
const char *str;
|
||||||
str = xkb_atom_text(ctx, expr->value.str);
|
str = xkb_atom_text(ctx, expr->value.str);
|
||||||
if (str) {
|
if (str) {
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
/************************************************************
|
/************************************************************
|
||||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||||
|
*
|
||||||
Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
software and its documentation for any purpose and without
|
* software and its documentation for any purpose and without
|
||||||
fee is hereby granted, provided that the above copyright
|
* fee is hereby granted, provided that the above copyright
|
||||||
notice appear in all copies and that both that copyright
|
* notice appear in all copies and that both that copyright
|
||||||
notice and this permission notice appear in supporting
|
* notice and this permission notice appear in supporting
|
||||||
documentation, and that the name of Silicon Graphics not be
|
* documentation, and that the name of Silicon Graphics not be
|
||||||
used in advertising or publicity pertaining to distribution
|
* used in advertising or publicity pertaining to distribution
|
||||||
of the software without specific prior written permission.
|
* of the software without specific prior written permission.
|
||||||
Silicon Graphics makes no representation about the suitability
|
* Silicon Graphics makes no representation about the suitability
|
||||||
of this software for any purpose. It is provided "as is"
|
* of this software for any purpose. It is provided "as is"
|
||||||
without any express or implied warranty.
|
* without any express or implied warranty.
|
||||||
|
*
|
||||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
||||||
#ifndef EXPR_H
|
#ifndef EXPR_H
|
||||||
|
@ -29,8 +29,7 @@
|
||||||
|
|
||||||
#include "xkbcomp-priv.h"
|
#include "xkbcomp-priv.h"
|
||||||
|
|
||||||
typedef union _ExprResult
|
typedef union _ExprResult {
|
||||||
{
|
|
||||||
char *str;
|
char *str;
|
||||||
int ival;
|
int ival;
|
||||||
unsigned uval;
|
unsigned uval;
|
||||||
|
@ -42,27 +41,28 @@ ExprResolveLhs(struct xkb_keymap *keymap, ExprDef *expr,
|
||||||
ExprResult *elem_rtrn, ExprResult *field_rtrn,
|
ExprResult *elem_rtrn, ExprResult *field_rtrn,
|
||||||
ExprDef **index_rtrn);
|
ExprDef **index_rtrn);
|
||||||
|
|
||||||
typedef struct _LookupEntry
|
typedef struct _LookupEntry {
|
||||||
{
|
|
||||||
const char *name;
|
const char *name;
|
||||||
unsigned result;
|
unsigned result;
|
||||||
} LookupEntry;
|
} LookupEntry;
|
||||||
|
|
||||||
|
|
||||||
extern const char *
|
extern const char *
|
||||||
exprOpText(unsigned type);
|
exprOpText(unsigned type);
|
||||||
|
|
||||||
extern bool
|
extern bool
|
||||||
LookupModMask(struct xkb_context *ctx, const void *priv, xkb_atom_t field,
|
LookupModMask(struct xkb_context *ctx, const void *priv, xkb_atom_t field,
|
||||||
unsigned type, ExprResult *val_rtrn);
|
unsigned type,
|
||||||
|
ExprResult *val_rtrn);
|
||||||
|
|
||||||
extern bool
|
extern bool
|
||||||
LookupVModMask(struct xkb_context *ctx, const void *priv, xkb_atom_t field,
|
LookupVModMask(struct xkb_context *ctx, const void *priv, xkb_atom_t field,
|
||||||
unsigned type, ExprResult *val_rtrn);
|
unsigned type,
|
||||||
|
ExprResult *val_rtrn);
|
||||||
|
|
||||||
extern bool
|
extern bool
|
||||||
LookupModIndex(struct xkb_context *ctx, const void *priv, xkb_atom_t field,
|
LookupModIndex(struct xkb_context *ctx, const void *priv, xkb_atom_t field,
|
||||||
unsigned type, ExprResult *val_rtrn);
|
unsigned type,
|
||||||
|
ExprResult *val_rtrn);
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
ExprResolveModMask(struct xkb_context *ctx, ExprDef *expr,
|
ExprResolveModMask(struct xkb_context *ctx, ExprDef *expr,
|
||||||
|
@ -85,20 +85,17 @@ ExprResolveInteger(struct xkb_context *ctx, ExprDef *expr,
|
||||||
ExprResult *val_rtrn);
|
ExprResult *val_rtrn);
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
ExprResolveLevel(struct xkb_context *ctx, ExprDef *expr,
|
ExprResolveLevel(struct xkb_context *ctx, ExprDef *expr, ExprResult *val_rtrn);
|
||||||
ExprResult *val_rtrn);
|
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
ExprResolveGroup(struct xkb_context *ctx, ExprDef *expr,
|
ExprResolveGroup(struct xkb_context *ctx, ExprDef *expr, ExprResult *val_rtrn);
|
||||||
ExprResult *val_rtrn);
|
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
ExprResolveButton(struct xkb_context *ctx, ExprDef *expr,
|
ExprResolveButton(struct xkb_context *ctx, ExprDef *expr,
|
||||||
ExprResult *val_rtrn);
|
ExprResult *val_rtrn);
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
ExprResolveFloat(struct xkb_context *ctx, ExprDef *expr,
|
ExprResolveFloat(struct xkb_context *ctx, ExprDef *expr, ExprResult *val_rtrn);
|
||||||
ExprResult *val_rtrn);
|
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
ExprResolveString(struct xkb_context *ctx, ExprDef *expr,
|
ExprResolveString(struct xkb_context *ctx, ExprDef *expr,
|
||||||
|
@ -109,12 +106,12 @@ ExprResolveKeyName(struct xkb_context *ctx, ExprDef *expr,
|
||||||
ExprResult *val_rtrn);
|
ExprResult *val_rtrn);
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
ExprResolveEnum(struct xkb_context *ctx, ExprDef *expr,
|
ExprResolveEnum(struct xkb_context *ctx, ExprDef *expr, ExprResult *val_rtrn,
|
||||||
ExprResult *val_rtrn, const LookupEntry *values);
|
const LookupEntry *values);
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
ExprResolveMask(struct xkb_context *ctx, ExprDef *expr,
|
ExprResolveMask(struct xkb_context *ctx, ExprDef *expr, ExprResult *val_rtrn,
|
||||||
ExprResult *val_rtrn, const LookupEntry *values);
|
const LookupEntry *values);
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
ExprResolveKeySym(struct xkb_context *ctx, ExprDef *expr,
|
ExprResolveKeySym(struct xkb_context *ctx, ExprDef *expr,
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
/************************************************************
|
/************************************************************
|
||||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||||
|
*
|
||||||
Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
software and its documentation for any purpose and without
|
* software and its documentation for any purpose and without
|
||||||
fee is hereby granted, provided that the above copyright
|
* fee is hereby granted, provided that the above copyright
|
||||||
notice appear in all copies and that both that copyright
|
* notice appear in all copies and that both that copyright
|
||||||
notice and this permission notice appear in supporting
|
* notice and this permission notice appear in supporting
|
||||||
documentation, and that the name of Silicon Graphics not be
|
* documentation, and that the name of Silicon Graphics not be
|
||||||
used in advertising or publicity pertaining to distribution
|
* used in advertising or publicity pertaining to distribution
|
||||||
of the software without specific prior written permission.
|
* of the software without specific prior written permission.
|
||||||
Silicon Graphics makes no representation about the suitability
|
* Silicon Graphics makes no representation about the suitability
|
||||||
of this software for any purpose. It is provided "as is"
|
* of this software for any purpose. It is provided "as is"
|
||||||
without any express or implied warranty.
|
* without any express or implied warranty.
|
||||||
|
*
|
||||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
||||||
#include "indicators.h"
|
#include "indicators.h"
|
||||||
|
@ -57,26 +57,21 @@ AddIndicatorMap(struct xkb_keymap *keymap, LEDInfo *oldLEDs, LEDInfo *new)
|
||||||
unsigned collide;
|
unsigned collide;
|
||||||
|
|
||||||
last = NULL;
|
last = NULL;
|
||||||
for (old = oldLEDs; old != NULL; old = (LEDInfo *) old->defs.next)
|
for (old = oldLEDs; old != NULL; old = (LEDInfo *) old->defs.next) {
|
||||||
{
|
if (old->name == new->name) {
|
||||||
if (old->name == new->name)
|
|
||||||
{
|
|
||||||
if ((old->real_mods == new->real_mods) &&
|
if ((old->real_mods == new->real_mods) &&
|
||||||
(old->vmods == new->vmods) &&
|
(old->vmods == new->vmods) &&
|
||||||
(old->groups == new->groups) &&
|
(old->groups == new->groups) &&
|
||||||
(old->ctrls == new->ctrls) &&
|
(old->ctrls == new->ctrls) &&
|
||||||
(old->which_mods == new->which_mods) &&
|
(old->which_mods == new->which_mods) &&
|
||||||
(old->which_groups == new->which_groups))
|
(old->which_groups == new->which_groups)) {
|
||||||
{
|
|
||||||
old->defs.defined |= new->defs.defined;
|
old->defs.defined |= new->defs.defined;
|
||||||
return oldLEDs;
|
return oldLEDs;
|
||||||
}
|
}
|
||||||
if (new->defs.merge == MERGE_REPLACE)
|
if (new->defs.merge == MERGE_REPLACE) {
|
||||||
{
|
|
||||||
CommonInfo *next = old->defs.next;
|
CommonInfo *next = old->defs.next;
|
||||||
if (((old->defs.file_id == new->defs.file_id)
|
if (((old->defs.file_id == new->defs.file_id)
|
||||||
&& (warningLevel > 0)) || (warningLevel > 9))
|
&& (warningLevel > 0)) || (warningLevel > 9)) {
|
||||||
{
|
|
||||||
WARN("Map for indicator %s redefined\n",
|
WARN("Map for indicator %s redefined\n",
|
||||||
xkb_atom_text(keymap->ctx, old->name));
|
xkb_atom_text(keymap->ctx, old->name));
|
||||||
ACTION("Earlier definition ignored\n");
|
ACTION("Earlier definition ignored\n");
|
||||||
|
@ -86,49 +81,44 @@ AddIndicatorMap(struct xkb_keymap *keymap, LEDInfo *oldLEDs, LEDInfo *new)
|
||||||
return oldLEDs;
|
return oldLEDs;
|
||||||
}
|
}
|
||||||
collide = 0;
|
collide = 0;
|
||||||
if (UseNewField(_LED_Index, &old->defs, &new->defs, &collide))
|
if (UseNewField(_LED_Index, &old->defs, &new->defs, &collide)) {
|
||||||
{
|
|
||||||
old->indicator = new->indicator;
|
old->indicator = new->indicator;
|
||||||
old->defs.defined |= _LED_Index;
|
old->defs.defined |= _LED_Index;
|
||||||
}
|
}
|
||||||
if (UseNewField(_LED_Mods, &old->defs, &new->defs, &collide))
|
if (UseNewField(_LED_Mods, &old->defs, &new->defs, &collide)) {
|
||||||
{
|
|
||||||
old->which_mods = new->which_mods;
|
old->which_mods = new->which_mods;
|
||||||
old->real_mods = new->real_mods;
|
old->real_mods = new->real_mods;
|
||||||
old->vmods = new->vmods;
|
old->vmods = new->vmods;
|
||||||
old->defs.defined |= _LED_Mods;
|
old->defs.defined |= _LED_Mods;
|
||||||
}
|
}
|
||||||
if (UseNewField(_LED_Groups, &old->defs, &new->defs, &collide))
|
if (UseNewField(_LED_Groups, &old->defs, &new->defs, &collide)) {
|
||||||
{
|
|
||||||
old->which_groups = new->which_groups;
|
old->which_groups = new->which_groups;
|
||||||
old->groups = new->groups;
|
old->groups = new->groups;
|
||||||
old->defs.defined |= _LED_Groups;
|
old->defs.defined |= _LED_Groups;
|
||||||
}
|
}
|
||||||
if (UseNewField(_LED_Ctrls, &old->defs, &new->defs, &collide))
|
if (UseNewField(_LED_Ctrls, &old->defs, &new->defs, &collide)) {
|
||||||
{
|
|
||||||
old->ctrls = new->ctrls;
|
old->ctrls = new->ctrls;
|
||||||
old->defs.defined |= _LED_Ctrls;
|
old->defs.defined |= _LED_Ctrls;
|
||||||
}
|
}
|
||||||
if (UseNewField(_LED_Explicit, &old->defs, &new->defs, &collide))
|
if (UseNewField(_LED_Explicit, &old->defs, &new->defs,
|
||||||
{
|
&collide)) {
|
||||||
old->flags &= ~XkbIM_NoExplicit;
|
old->flags &= ~XkbIM_NoExplicit;
|
||||||
old->flags |= (new->flags & XkbIM_NoExplicit);
|
old->flags |= (new->flags & XkbIM_NoExplicit);
|
||||||
old->defs.defined |= _LED_Explicit;
|
old->defs.defined |= _LED_Explicit;
|
||||||
}
|
}
|
||||||
if (UseNewField(_LED_Automatic, &old->defs, &new->defs, &collide))
|
if (UseNewField(_LED_Automatic, &old->defs, &new->defs,
|
||||||
{
|
&collide)) {
|
||||||
old->flags &= ~XkbIM_NoAutomatic;
|
old->flags &= ~XkbIM_NoAutomatic;
|
||||||
old->flags |= (new->flags & XkbIM_NoAutomatic);
|
old->flags |= (new->flags & XkbIM_NoAutomatic);
|
||||||
old->defs.defined |= _LED_Automatic;
|
old->defs.defined |= _LED_Automatic;
|
||||||
}
|
}
|
||||||
if (UseNewField(_LED_DrivesKbd, &old->defs, &new->defs, &collide))
|
if (UseNewField(_LED_DrivesKbd, &old->defs, &new->defs,
|
||||||
{
|
&collide)) {
|
||||||
old->flags &= ~XkbIM_LEDDrivesKB;
|
old->flags &= ~XkbIM_LEDDrivesKB;
|
||||||
old->flags |= (new->flags & XkbIM_LEDDrivesKB);
|
old->flags |= (new->flags & XkbIM_LEDDrivesKB);
|
||||||
old->defs.defined |= _LED_DrivesKbd;
|
old->defs.defined |= _LED_DrivesKbd;
|
||||||
}
|
}
|
||||||
if (collide)
|
if (collide) {
|
||||||
{
|
|
||||||
WARN("Map for indicator %s redefined\n",
|
WARN("Map for indicator %s redefined\n",
|
||||||
xkb_atom_text(keymap->ctx, old->name));
|
xkb_atom_text(keymap->ctx, old->name));
|
||||||
ACTION("Using %s definition for duplicate fields\n",
|
ACTION("Using %s definition for duplicate fields\n",
|
||||||
|
@ -141,8 +131,7 @@ AddIndicatorMap(struct xkb_keymap *keymap, LEDInfo *oldLEDs, LEDInfo *new)
|
||||||
}
|
}
|
||||||
/* new definition */
|
/* new definition */
|
||||||
old = uTypedAlloc(LEDInfo);
|
old = uTypedAlloc(LEDInfo);
|
||||||
if (!old)
|
if (!old) {
|
||||||
{
|
|
||||||
WSGO("Couldn't allocate indicator map\n");
|
WSGO("Couldn't allocate indicator map\n");
|
||||||
ACTION("Map for indicator %s not compiled\n",
|
ACTION("Map for indicator %s not compiled\n",
|
||||||
xkb_atom_text(keymap->ctx, new->name));
|
xkb_atom_text(keymap->ctx, new->name));
|
||||||
|
@ -150,8 +139,7 @@ AddIndicatorMap(struct xkb_keymap *keymap, LEDInfo *oldLEDs, LEDInfo *new)
|
||||||
}
|
}
|
||||||
*old = *new;
|
*old = *new;
|
||||||
old->defs.next = NULL;
|
old->defs.next = NULL;
|
||||||
if (last)
|
if (last) {
|
||||||
{
|
|
||||||
last->defs.next = &old->defs;
|
last->defs.next = &old->defs;
|
||||||
return oldLEDs;
|
return oldLEDs;
|
||||||
}
|
}
|
||||||
|
@ -201,8 +189,7 @@ SetIndicatorMapField(LEDInfo *led, struct xkb_keymap *keymap,
|
||||||
|
|
||||||
ok = true;
|
ok = true;
|
||||||
if ((strcasecmp(field, "modifiers") == 0) ||
|
if ((strcasecmp(field, "modifiers") == 0) ||
|
||||||
(strcasecmp(field, "mods") == 0))
|
(strcasecmp(field, "mods") == 0)) {
|
||||||
{
|
|
||||||
if (arrayNdx != NULL)
|
if (arrayNdx != NULL)
|
||||||
return ReportIndicatorNotArray(keymap, led, field);
|
return ReportIndicatorNotArray(keymap, led, field);
|
||||||
if (!ExprResolveVModMask(value, &rtrn, keymap))
|
if (!ExprResolveVModMask(value, &rtrn, keymap))
|
||||||
|
@ -211,8 +198,7 @@ SetIndicatorMapField(LEDInfo *led, struct xkb_keymap *keymap,
|
||||||
led->vmods = (rtrn.uval >> 8) & 0xff;
|
led->vmods = (rtrn.uval >> 8) & 0xff;
|
||||||
led->defs.defined |= _LED_Mods;
|
led->defs.defined |= _LED_Mods;
|
||||||
}
|
}
|
||||||
else if (strcasecmp(field, "groups") == 0)
|
else if (strcasecmp(field, "groups") == 0) {
|
||||||
{
|
|
||||||
if (arrayNdx != NULL)
|
if (arrayNdx != NULL)
|
||||||
return ReportIndicatorNotArray(keymap, led, field);
|
return ReportIndicatorNotArray(keymap, led, field);
|
||||||
if (!ExprResolveMask(keymap->ctx, value, &rtrn, groupNames))
|
if (!ExprResolveMask(keymap->ctx, value, &rtrn, groupNames))
|
||||||
|
@ -221,8 +207,7 @@ SetIndicatorMapField(LEDInfo *led, struct xkb_keymap *keymap,
|
||||||
led->defs.defined |= _LED_Groups;
|
led->defs.defined |= _LED_Groups;
|
||||||
}
|
}
|
||||||
else if ((strcasecmp(field, "controls") == 0) ||
|
else if ((strcasecmp(field, "controls") == 0) ||
|
||||||
(strcasecmp(field, "ctrls") == 0))
|
(strcasecmp(field, "ctrls") == 0)) {
|
||||||
{
|
|
||||||
if (arrayNdx != NULL)
|
if (arrayNdx != NULL)
|
||||||
return ReportIndicatorNotArray(keymap, led, field);
|
return ReportIndicatorNotArray(keymap, led, field);
|
||||||
if (!ExprResolveMask(keymap->ctx, value, &rtrn, ctrlNames))
|
if (!ExprResolveMask(keymap->ctx, value, &rtrn, ctrlNames))
|
||||||
|
@ -231,8 +216,7 @@ SetIndicatorMapField(LEDInfo *led, struct xkb_keymap *keymap,
|
||||||
led->ctrls = rtrn.uval;
|
led->ctrls = rtrn.uval;
|
||||||
led->defs.defined |= _LED_Ctrls;
|
led->defs.defined |= _LED_Ctrls;
|
||||||
}
|
}
|
||||||
else if (strcasecmp(field, "allowexplicit") == 0)
|
else if (strcasecmp(field, "allowexplicit") == 0) {
|
||||||
{
|
|
||||||
if (arrayNdx != NULL)
|
if (arrayNdx != NULL)
|
||||||
return ReportIndicatorNotArray(keymap, led, field);
|
return ReportIndicatorNotArray(keymap, led, field);
|
||||||
if (!ExprResolveBoolean(keymap->ctx, value, &rtrn))
|
if (!ExprResolveBoolean(keymap->ctx, value, &rtrn))
|
||||||
|
@ -244,23 +228,20 @@ SetIndicatorMapField(LEDInfo *led, struct xkb_keymap *keymap,
|
||||||
led->defs.defined |= _LED_Explicit;
|
led->defs.defined |= _LED_Explicit;
|
||||||
}
|
}
|
||||||
else if ((strcasecmp(field, "whichmodstate") == 0) ||
|
else if ((strcasecmp(field, "whichmodstate") == 0) ||
|
||||||
(strcasecmp(field, "whichmodifierstate") == 0))
|
(strcasecmp(field, "whichmodifierstate") == 0)) {
|
||||||
{
|
|
||||||
if (arrayNdx != NULL)
|
if (arrayNdx != NULL)
|
||||||
return ReportIndicatorNotArray(keymap, led, field);
|
return ReportIndicatorNotArray(keymap, led, field);
|
||||||
if (!ExprResolveMask(keymap->ctx, value, &rtrn, modComponentNames))
|
if (!ExprResolveMask(keymap->ctx, value, &rtrn, modComponentNames)) {
|
||||||
{
|
|
||||||
return ReportIndicatorBadType(keymap, led, field,
|
return ReportIndicatorBadType(keymap, led, field,
|
||||||
"mask of modifier state components");
|
"mask of modifier state components");
|
||||||
}
|
}
|
||||||
led->which_mods = rtrn.uval;
|
led->which_mods = rtrn.uval;
|
||||||
}
|
}
|
||||||
else if (strcasecmp(field, "whichgroupstate") == 0)
|
else if (strcasecmp(field, "whichgroupstate") == 0) {
|
||||||
{
|
|
||||||
if (arrayNdx != NULL)
|
if (arrayNdx != NULL)
|
||||||
return ReportIndicatorNotArray(keymap, led, field);
|
return ReportIndicatorNotArray(keymap, led, field);
|
||||||
if (!ExprResolveMask(keymap->ctx, value, &rtrn, groupComponentNames))
|
if (!ExprResolveMask(keymap->ctx, value, &rtrn,
|
||||||
{
|
groupComponentNames)) {
|
||||||
return ReportIndicatorBadType(keymap, led, field,
|
return ReportIndicatorBadType(keymap, led, field,
|
||||||
"mask of group state components");
|
"mask of group state components");
|
||||||
}
|
}
|
||||||
|
@ -271,8 +252,7 @@ SetIndicatorMapField(LEDInfo *led, struct xkb_keymap *keymap,
|
||||||
(strcasecmp(field, "leddriveskbd") == 0) ||
|
(strcasecmp(field, "leddriveskbd") == 0) ||
|
||||||
(strcasecmp(field, "leddriveskeyboard") == 0) ||
|
(strcasecmp(field, "leddriveskeyboard") == 0) ||
|
||||||
(strcasecmp(field, "indicatordriveskbd") == 0) ||
|
(strcasecmp(field, "indicatordriveskbd") == 0) ||
|
||||||
(strcasecmp(field, "indicatordriveskeyboard") == 0))
|
(strcasecmp(field, "indicatordriveskeyboard") == 0)) {
|
||||||
{
|
|
||||||
if (arrayNdx != NULL)
|
if (arrayNdx != NULL)
|
||||||
return ReportIndicatorNotArray(keymap, led, field);
|
return ReportIndicatorNotArray(keymap, led, field);
|
||||||
if (!ExprResolveBoolean(keymap->ctx, value, &rtrn))
|
if (!ExprResolveBoolean(keymap->ctx, value, &rtrn))
|
||||||
|
@ -283,15 +263,13 @@ SetIndicatorMapField(LEDInfo *led, struct xkb_keymap *keymap,
|
||||||
led->flags &= ~XkbIM_LEDDrivesKB;
|
led->flags &= ~XkbIM_LEDDrivesKB;
|
||||||
led->defs.defined |= _LED_DrivesKbd;
|
led->defs.defined |= _LED_DrivesKbd;
|
||||||
}
|
}
|
||||||
else if (strcasecmp(field, "index") == 0)
|
else if (strcasecmp(field, "index") == 0) {
|
||||||
{
|
|
||||||
if (arrayNdx != NULL)
|
if (arrayNdx != NULL)
|
||||||
return ReportIndicatorNotArray(keymap, led, field);
|
return ReportIndicatorNotArray(keymap, led, field);
|
||||||
if (!ExprResolveInteger(keymap->ctx, value, &rtrn))
|
if (!ExprResolveInteger(keymap->ctx, value, &rtrn))
|
||||||
return ReportIndicatorBadType(keymap, led, field,
|
return ReportIndicatorBadType(keymap, led, field,
|
||||||
"indicator index");
|
"indicator index");
|
||||||
if ((rtrn.uval < 1) || (rtrn.uval > 32))
|
if ((rtrn.uval < 1) || (rtrn.uval > 32)) {
|
||||||
{
|
|
||||||
ERROR("Illegal indicator index %d (range 1..%d)\n",
|
ERROR("Illegal indicator index %d (range 1..%d)\n",
|
||||||
rtrn.uval, XkbNumIndicators);
|
rtrn.uval, XkbNumIndicators);
|
||||||
ACTION("Index definition for %s indicator ignored\n",
|
ACTION("Index definition for %s indicator ignored\n",
|
||||||
|
@ -301,8 +279,7 @@ SetIndicatorMapField(LEDInfo *led, struct xkb_keymap *keymap,
|
||||||
led->indicator = rtrn.uval;
|
led->indicator = rtrn.uval;
|
||||||
led->defs.defined |= _LED_Index;
|
led->defs.defined |= _LED_Index;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
ERROR("Unknown field %s in map for %s indicator\n", field,
|
ERROR("Unknown field %s in map for %s indicator\n", field,
|
||||||
xkb_atom_text(keymap->ctx, led->name));
|
xkb_atom_text(keymap->ctx, led->name));
|
||||||
ACTION("Definition ignored\n");
|
ACTION("Definition ignored\n");
|
||||||
|
@ -327,33 +304,28 @@ HandleIndicatorMapDef(IndicatorMapDef *def, struct xkb_keymap *keymap,
|
||||||
led.name = def->name;
|
led.name = def->name;
|
||||||
|
|
||||||
ok = true;
|
ok = true;
|
||||||
for (var = def->body; var != NULL; var = (VarDef *) var->common.next)
|
for (var = def->body; var != NULL; var = (VarDef *) var->common.next) {
|
||||||
{
|
|
||||||
ExprResult elem, field;
|
ExprResult elem, field;
|
||||||
ExprDef *arrayNdx;
|
ExprDef *arrayNdx;
|
||||||
if (!ExprResolveLhs(keymap, var->name, &elem, &field, &arrayNdx))
|
if (!ExprResolveLhs(keymap, var->name, &elem, &field, &arrayNdx)) {
|
||||||
{
|
|
||||||
ok = false;
|
ok = false;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (elem.str != NULL)
|
if (elem.str != NULL) {
|
||||||
{
|
|
||||||
ERROR
|
ERROR
|
||||||
("Cannot set defaults for \"%s\" element in indicator map\n",
|
("Cannot set defaults for \"%s\" element in indicator map\n",
|
||||||
elem.str);
|
elem.str);
|
||||||
ACTION("Assignment to %s.%s ignored\n", elem.str, field.str);
|
ACTION("Assignment to %s.%s ignored\n", elem.str, field.str);
|
||||||
ok = false;
|
ok = false;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
ok = SetIndicatorMapField(&led, keymap, field.str, arrayNdx,
|
ok = SetIndicatorMapField(&led, keymap, field.str, arrayNdx,
|
||||||
var->value) && ok;
|
var->value) && ok;
|
||||||
}
|
}
|
||||||
free(elem.str);
|
free(elem.str);
|
||||||
free(field.str);
|
free(field.str);
|
||||||
}
|
}
|
||||||
if (ok)
|
if (ok) {
|
||||||
{
|
|
||||||
rtrn = AddIndicatorMap(keymap, oldLEDs, &led);
|
rtrn = AddIndicatorMap(keymap, oldLEDs, &led);
|
||||||
return rtrn;
|
return rtrn;
|
||||||
}
|
}
|
||||||
|
@ -366,40 +338,30 @@ BindIndicators(struct xkb_keymap *keymap, LEDInfo *unbound)
|
||||||
int i;
|
int i;
|
||||||
LEDInfo *led, *next, *last;
|
LEDInfo *led, *next, *last;
|
||||||
|
|
||||||
if (keymap->names != NULL)
|
if (keymap->names != NULL) {
|
||||||
{
|
for (led = unbound; led != NULL; led = (LEDInfo *) led->defs.next) {
|
||||||
for (led = unbound; led != NULL; led = (LEDInfo *) led->defs.next)
|
if (led->indicator == _LED_NotBound) {
|
||||||
{
|
for (i = 0; i < XkbNumIndicators; i++) {
|
||||||
if (led->indicator == _LED_NotBound)
|
|
||||||
{
|
|
||||||
for (i = 0; i < XkbNumIndicators; i++)
|
|
||||||
{
|
|
||||||
if (keymap->names->indicators[i] &&
|
if (keymap->names->indicators[i] &&
|
||||||
strcmp(keymap->names->indicators[i],
|
strcmp(keymap->names->indicators[i],
|
||||||
xkb_atom_text(keymap->ctx, led->name)) == 0)
|
xkb_atom_text(keymap->ctx, led->name)) == 0) {
|
||||||
{
|
|
||||||
led->indicator = i + 1;
|
led->indicator = i + 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (led = unbound; led != NULL; led = (LEDInfo *) led->defs.next)
|
for (led = unbound; led != NULL; led = (LEDInfo *) led->defs.next) {
|
||||||
{
|
if (led->indicator == _LED_NotBound) {
|
||||||
if (led->indicator == _LED_NotBound)
|
for (i = 0; i < XkbNumIndicators; i++) {
|
||||||
{
|
if (keymap->names->indicators[i] == NULL) {
|
||||||
for (i = 0; i < XkbNumIndicators; i++)
|
|
||||||
{
|
|
||||||
if (keymap->names->indicators[i] == NULL)
|
|
||||||
{
|
|
||||||
keymap->names->indicators[i] =
|
keymap->names->indicators[i] =
|
||||||
xkb_atom_strdup(keymap->ctx, led->name);
|
xkb_atom_strdup(keymap->ctx, led->name);
|
||||||
led->indicator = i + 1;
|
led->indicator = i + 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (led->indicator == _LED_NotBound)
|
if (led->indicator == _LED_NotBound) {
|
||||||
{
|
|
||||||
ERROR("No unnamed indicators found\n");
|
ERROR("No unnamed indicators found\n");
|
||||||
ACTION
|
ACTION
|
||||||
("Virtual indicator map \"%s\" not bound\n",
|
("Virtual indicator map \"%s\" not bound\n",
|
||||||
|
@ -409,21 +371,18 @@ BindIndicators(struct xkb_keymap *keymap, LEDInfo *unbound)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (last = NULL, led = unbound; led != NULL; led = next)
|
for (last = NULL, led = unbound; led != NULL; led = next) {
|
||||||
{
|
|
||||||
next = (LEDInfo *) led->defs.next;
|
next = (LEDInfo *) led->defs.next;
|
||||||
if (led->indicator == _LED_NotBound)
|
if (led->indicator == _LED_NotBound) {
|
||||||
{
|
|
||||||
unbound = next;
|
unbound = next;
|
||||||
free(led);
|
free(led);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
if ((keymap->names != NULL) &&
|
if ((keymap->names != NULL) &&
|
||||||
(strcmp(keymap->names->indicators[led->indicator - 1],
|
(strcmp(keymap->names->indicators[led->indicator - 1],
|
||||||
xkb_atom_text(keymap->ctx, led->name)) != 0))
|
xkb_atom_text(keymap->ctx, led->name)) != 0)) {
|
||||||
{
|
const char *old =
|
||||||
const char *old = keymap->names->indicators[led->indicator - 1];
|
keymap->names->indicators[led->indicator - 1];
|
||||||
ERROR("Multiple names bound to indicator %d\n",
|
ERROR("Multiple names bound to indicator %d\n",
|
||||||
(unsigned int) led->indicator);
|
(unsigned int) led->indicator);
|
||||||
ACTION("Using %s, ignoring %s\n", old,
|
ACTION("Using %s, ignoring %s\n", old,
|
||||||
|
@ -432,8 +391,7 @@ BindIndicators(struct xkb_keymap *keymap, LEDInfo *unbound)
|
||||||
unbound = next;
|
unbound = next;
|
||||||
free(led);
|
free(led);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
struct xkb_indicator_map * map;
|
struct xkb_indicator_map * map;
|
||||||
map = &keymap->indicators->maps[led->indicator - 1];
|
map = &keymap->indicators->maps[led->indicator - 1];
|
||||||
map->flags = led->flags;
|
map->flags = led->flags;
|
||||||
|
@ -454,8 +412,7 @@ BindIndicators(struct xkb_keymap *keymap, LEDInfo *unbound)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (led = unbound; led != NULL; led = next)
|
for (led = unbound; led != NULL; led = next) {
|
||||||
{
|
|
||||||
next = led ? (LEDInfo *) led->defs.next : NULL;
|
next = led ? (LEDInfo *) led->defs.next : NULL;
|
||||||
free(led);
|
free(led);
|
||||||
}
|
}
|
||||||
|
@ -467,26 +424,22 @@ CopyIndicatorMapDefs(struct xkb_keymap *keymap, LEDInfo *leds)
|
||||||
LEDInfo *led, *next;
|
LEDInfo *led, *next;
|
||||||
LEDInfo *unbound = NULL, *last = NULL;
|
LEDInfo *unbound = NULL, *last = NULL;
|
||||||
|
|
||||||
if (XkbcAllocNames(keymap, XkbIndicatorNamesMask, 0) != Success)
|
if (XkbcAllocNames(keymap, XkbIndicatorNamesMask, 0) != Success) {
|
||||||
{
|
|
||||||
WSGO("Couldn't allocate names\n");
|
WSGO("Couldn't allocate names\n");
|
||||||
ACTION("Indicator names may be incorrect\n");
|
ACTION("Indicator names may be incorrect\n");
|
||||||
}
|
}
|
||||||
if (XkbcAllocIndicatorMaps(keymap) != Success)
|
if (XkbcAllocIndicatorMaps(keymap) != Success) {
|
||||||
{
|
|
||||||
WSGO("Can't allocate indicator maps\n");
|
WSGO("Can't allocate indicator maps\n");
|
||||||
ACTION("Indicator map definitions may be lost\n");
|
ACTION("Indicator map definitions may be lost\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (led = leds; led != NULL; led = next)
|
for (led = leds; led != NULL; led = next) {
|
||||||
{
|
|
||||||
next = (LEDInfo *) led->defs.next;
|
next = (LEDInfo *) led->defs.next;
|
||||||
if ((led->groups != 0) && (led->which_groups == 0))
|
if ((led->groups != 0) && (led->which_groups == 0))
|
||||||
led->which_groups = XkbIM_UseEffective;
|
led->which_groups = XkbIM_UseEffective;
|
||||||
if ((led->which_mods == 0) && ((led->real_mods) || (led->vmods)))
|
if ((led->which_mods == 0) && ((led->real_mods) || (led->vmods)))
|
||||||
led->which_mods = XkbIM_UseEffective;
|
led->which_mods = XkbIM_UseEffective;
|
||||||
if ((led->indicator == _LED_NotBound) || (!keymap->indicators))
|
if ((led->indicator == _LED_NotBound) || (!keymap->indicators)) {
|
||||||
{
|
|
||||||
led->defs.next = NULL;
|
led->defs.next = NULL;
|
||||||
if (last != NULL)
|
if (last != NULL)
|
||||||
last->defs.next = (CommonInfo *) led;
|
last->defs.next = (CommonInfo *) led;
|
||||||
|
@ -494,8 +447,7 @@ CopyIndicatorMapDefs(struct xkb_keymap *keymap, LEDInfo *leds)
|
||||||
unbound = led;
|
unbound = led;
|
||||||
last = led;
|
last = led;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
struct xkb_indicator_map * im;
|
struct xkb_indicator_map * im;
|
||||||
im = &keymap->indicators->maps[led->indicator - 1];
|
im = &keymap->indicators->maps[led->indicator - 1];
|
||||||
im->flags = led->flags;
|
im->flags = led->flags;
|
||||||
|
@ -506,8 +458,7 @@ CopyIndicatorMapDefs(struct xkb_keymap *keymap, LEDInfo *leds)
|
||||||
im->mods.real_mods = led->real_mods;
|
im->mods.real_mods = led->real_mods;
|
||||||
im->mods.vmods = led->vmods;
|
im->mods.vmods = led->vmods;
|
||||||
im->ctrls = led->ctrls;
|
im->ctrls = led->ctrls;
|
||||||
if (keymap->names != NULL)
|
if (keymap->names != NULL) {
|
||||||
{
|
|
||||||
free(keymap->names->indicators[led->indicator - 1]);
|
free(keymap->names->indicators[led->indicator - 1]);
|
||||||
keymap->names->indicators[led->indicator - 1] =
|
keymap->names->indicators[led->indicator - 1] =
|
||||||
xkb_atom_strdup(keymap->ctx, led->name);
|
xkb_atom_strdup(keymap->ctx, led->name);
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
/************************************************************
|
/************************************************************
|
||||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||||
|
*
|
||||||
Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
software and its documentation for any purpose and without
|
* software and its documentation for any purpose and without
|
||||||
fee is hereby granted, provided that the above copyright
|
* fee is hereby granted, provided that the above copyright
|
||||||
notice appear in all copies and that both that copyright
|
* notice appear in all copies and that both that copyright
|
||||||
notice and this permission notice appear in supporting
|
* notice and this permission notice appear in supporting
|
||||||
documentation, and that the name of Silicon Graphics not be
|
* documentation, and that the name of Silicon Graphics not be
|
||||||
used in advertising or publicity pertaining to distribution
|
* used in advertising or publicity pertaining to distribution
|
||||||
of the software without specific prior written permission.
|
* of the software without specific prior written permission.
|
||||||
Silicon Graphics makes no representation about the suitability
|
* Silicon Graphics makes no representation about the suitability
|
||||||
of this software for any purpose. It is provided "as is"
|
* of this software for any purpose. It is provided "as is"
|
||||||
without any express or implied warranty.
|
* without any express or implied warranty.
|
||||||
|
*
|
||||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
||||||
#ifndef INDICATORS_H
|
#ifndef INDICATORS_H
|
||||||
|
@ -39,8 +39,7 @@
|
||||||
|
|
||||||
#define _LED_NotBound 255
|
#define _LED_NotBound 255
|
||||||
|
|
||||||
typedef struct _LEDInfo
|
typedef struct _LEDInfo {
|
||||||
{
|
|
||||||
CommonInfo defs;
|
CommonInfo defs;
|
||||||
xkb_atom_t name;
|
xkb_atom_t name;
|
||||||
unsigned char indicator;
|
unsigned char indicator;
|
||||||
|
@ -56,17 +55,18 @@ typedef struct _LEDInfo
|
||||||
extern void
|
extern void
|
||||||
ClearIndicatorMapInfo(struct xkb_context *ctx, LEDInfo *info);
|
ClearIndicatorMapInfo(struct xkb_context *ctx, LEDInfo *info);
|
||||||
|
|
||||||
|
|
||||||
extern LEDInfo *
|
extern LEDInfo *
|
||||||
AddIndicatorMap(struct xkb_keymap *keymap, LEDInfo *oldLEDs, LEDInfo *newLED);
|
AddIndicatorMap(struct xkb_keymap *keymap, LEDInfo *oldLEDs, LEDInfo *newLED);
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
SetIndicatorMapField(LEDInfo *led, struct xkb_keymap *keymap, char *field,
|
SetIndicatorMapField(LEDInfo *led, struct xkb_keymap *keymap, char *field,
|
||||||
ExprDef *arrayNdx, ExprDef *value);
|
ExprDef *arrayNdx,
|
||||||
|
ExprDef *value);
|
||||||
|
|
||||||
extern LEDInfo *
|
extern LEDInfo *
|
||||||
HandleIndicatorMapDef(IndicatorMapDef *stmt, struct xkb_keymap *keymap,
|
HandleIndicatorMapDef(IndicatorMapDef *stmt, struct xkb_keymap *keymap,
|
||||||
LEDInfo *dflt, LEDInfo *oldLEDs, enum merge_mode mergeMode);
|
LEDInfo *dflt, LEDInfo *oldLEDs,
|
||||||
|
enum merge_mode mergeMode);
|
||||||
|
|
||||||
extern bool
|
extern bool
|
||||||
CopyIndicatorMapDefs(struct xkb_keymap *keymap, LEDInfo *leds);
|
CopyIndicatorMapDefs(struct xkb_keymap *keymap, LEDInfo *leds);
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
/************************************************************
|
/************************************************************
|
||||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||||
|
*
|
||||||
Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
software and its documentation for any purpose and without
|
* software and its documentation for any purpose and without
|
||||||
fee is hereby granted, provided that the above copyright
|
* fee is hereby granted, provided that the above copyright
|
||||||
notice appear in all copies and that both that copyright
|
* notice appear in all copies and that both that copyright
|
||||||
notice and this permission notice appear in supporting
|
* notice and this permission notice appear in supporting
|
||||||
documentation, and that the name of Silicon Graphics not be
|
* documentation, and that the name of Silicon Graphics not be
|
||||||
used in advertising or publicity pertaining to distribution
|
* used in advertising or publicity pertaining to distribution
|
||||||
of the software without specific prior written permission.
|
* of the software without specific prior written permission.
|
||||||
Silicon Graphics makes no representation about the suitability
|
* Silicon Graphics makes no representation about the suitability
|
||||||
of this software for any purpose. It is provided "as is"
|
* of this software for any purpose. It is provided "as is"
|
||||||
without any express or implied warranty.
|
* without any express or implied warranty.
|
||||||
|
*
|
||||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
||||||
#include "keycodes.h"
|
#include "keycodes.h"
|
||||||
|
@ -51,16 +51,14 @@ LongToKeyName(unsigned long val, char *name)
|
||||||
|
|
||||||
/***====================================================================***/
|
/***====================================================================***/
|
||||||
|
|
||||||
typedef struct _IndicatorNameInfo
|
typedef struct _IndicatorNameInfo {
|
||||||
{
|
|
||||||
CommonInfo defs;
|
CommonInfo defs;
|
||||||
int ndx;
|
int ndx;
|
||||||
xkb_atom_t name;
|
xkb_atom_t name;
|
||||||
bool virtual;
|
bool virtual;
|
||||||
} IndicatorNameInfo;
|
} IndicatorNameInfo;
|
||||||
|
|
||||||
typedef struct _KeyNamesInfo
|
typedef struct _KeyNamesInfo {
|
||||||
{
|
|
||||||
char *name; /* e.g. evdev+aliases(qwerty) */
|
char *name; /* e.g. evdev+aliases(qwerty) */
|
||||||
int errorCount;
|
int errorCount;
|
||||||
unsigned file_id;
|
unsigned file_id;
|
||||||
|
@ -75,8 +73,10 @@ typedef struct _KeyNamesInfo
|
||||||
AliasInfo *aliases;
|
AliasInfo *aliases;
|
||||||
} KeyNamesInfo;
|
} KeyNamesInfo;
|
||||||
|
|
||||||
static void HandleKeycodesFile(XkbFile *file, struct xkb_keymap *keymap,
|
static void
|
||||||
enum merge_mode merge, KeyNamesInfo *info);
|
HandleKeycodesFile(XkbFile *file, struct xkb_keymap *keymap,
|
||||||
|
enum merge_mode merge,
|
||||||
|
KeyNamesInfo *info);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ResizeKeyNameArrays(KeyNamesInfo *info, int newMax)
|
ResizeKeyNameArrays(KeyNamesInfo *info, int newMax)
|
||||||
|
@ -103,8 +103,7 @@ InitIndicatorNameInfo(IndicatorNameInfo * ii, KeyNamesInfo * info)
|
||||||
static void
|
static void
|
||||||
ClearIndicatorNameInfo(IndicatorNameInfo * ii, KeyNamesInfo * info)
|
ClearIndicatorNameInfo(IndicatorNameInfo * ii, KeyNamesInfo * info)
|
||||||
{
|
{
|
||||||
if (ii == info->leds)
|
if (ii == info->leds) {
|
||||||
{
|
|
||||||
ClearCommonInfo(&ii->defs);
|
ClearCommonInfo(&ii->defs);
|
||||||
info->leds = NULL;
|
info->leds = NULL;
|
||||||
}
|
}
|
||||||
|
@ -116,8 +115,7 @@ NextIndicatorName(KeyNamesInfo * info)
|
||||||
IndicatorNameInfo *ii;
|
IndicatorNameInfo *ii;
|
||||||
|
|
||||||
ii = uTypedAlloc(IndicatorNameInfo);
|
ii = uTypedAlloc(IndicatorNameInfo);
|
||||||
if (ii)
|
if (ii) {
|
||||||
{
|
|
||||||
InitIndicatorNameInfo(ii, info);
|
InitIndicatorNameInfo(ii, info);
|
||||||
info->leds = AddCommonInfo(&info->leds->defs, &ii->defs);
|
info->leds = AddCommonInfo(&info->leds->defs, &ii->defs);
|
||||||
}
|
}
|
||||||
|
@ -130,8 +128,7 @@ FindIndicatorByIndex(KeyNamesInfo * info, int ndx)
|
||||||
IndicatorNameInfo *old;
|
IndicatorNameInfo *old;
|
||||||
|
|
||||||
for (old = info->leds; old != NULL;
|
for (old = info->leds; old != NULL;
|
||||||
old = (IndicatorNameInfo *) old->defs.next)
|
old = (IndicatorNameInfo *) old->defs.next) {
|
||||||
{
|
|
||||||
if (old->ndx == ndx)
|
if (old->ndx == ndx)
|
||||||
return old;
|
return old;
|
||||||
}
|
}
|
||||||
|
@ -144,8 +141,7 @@ FindIndicatorByName(KeyNamesInfo * info, xkb_atom_t name)
|
||||||
IndicatorNameInfo *old;
|
IndicatorNameInfo *old;
|
||||||
|
|
||||||
for (old = info->leds; old != NULL;
|
for (old = info->leds; old != NULL;
|
||||||
old = (IndicatorNameInfo *) old->defs.next)
|
old = (IndicatorNameInfo *) old->defs.next) {
|
||||||
{
|
|
||||||
if (old->name == name)
|
if (old->name == name)
|
||||||
return old;
|
return old;
|
||||||
}
|
}
|
||||||
|
@ -153,7 +149,8 @@ FindIndicatorByName(KeyNamesInfo * info, xkb_atom_t name)
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
AddIndicatorName(KeyNamesInfo *info, struct xkb_keymap *keymap, enum merge_mode merge,
|
AddIndicatorName(KeyNamesInfo *info, struct xkb_keymap *keymap,
|
||||||
|
enum merge_mode merge,
|
||||||
IndicatorNameInfo *new)
|
IndicatorNameInfo *new)
|
||||||
{
|
{
|
||||||
IndicatorNameInfo *old;
|
IndicatorNameInfo *old;
|
||||||
|
@ -161,49 +158,39 @@ AddIndicatorName(KeyNamesInfo *info, struct xkb_keymap *keymap, enum merge_mode
|
||||||
|
|
||||||
replace = (merge == MERGE_REPLACE) || (merge == MERGE_OVERRIDE);
|
replace = (merge == MERGE_REPLACE) || (merge == MERGE_OVERRIDE);
|
||||||
old = FindIndicatorByName(info, new->name);
|
old = FindIndicatorByName(info, new->name);
|
||||||
if (old)
|
if (old) {
|
||||||
{
|
|
||||||
if (((old->defs.file_id == new->defs.file_id) && (warningLevel > 0))
|
if (((old->defs.file_id == new->defs.file_id) && (warningLevel > 0))
|
||||||
|| (warningLevel > 9))
|
|| (warningLevel > 9)) {
|
||||||
{
|
|
||||||
WARN("Multiple indicators named %s\n",
|
WARN("Multiple indicators named %s\n",
|
||||||
xkb_atom_text(keymap->ctx, new->name));
|
xkb_atom_text(keymap->ctx, new->name));
|
||||||
if (old->ndx == new->ndx)
|
if (old->ndx == new->ndx) {
|
||||||
{
|
if (old->virtual != new->virtual) {
|
||||||
if (old->virtual != new->virtual)
|
|
||||||
{
|
|
||||||
if (replace)
|
if (replace)
|
||||||
old->virtual = new->virtual;
|
old->virtual = new->virtual;
|
||||||
ACTION("Using %s instead of %s\n",
|
ACTION("Using %s instead of %s\n",
|
||||||
(old->virtual ? "virtual" : "real"),
|
(old->virtual ? "virtual" : "real"),
|
||||||
(old->virtual ? "real" : "virtual"));
|
(old->virtual ? "real" : "virtual"));
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
ACTION("Identical definitions ignored\n");
|
ACTION("Identical definitions ignored\n");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
if (replace)
|
if (replace)
|
||||||
ACTION("Ignoring %d, using %d\n", old->ndx, new->ndx);
|
ACTION("Ignoring %d, using %d\n", old->ndx, new->ndx);
|
||||||
else
|
else
|
||||||
ACTION("Using %d, ignoring %d\n", old->ndx, new->ndx);
|
ACTION("Using %d, ignoring %d\n", old->ndx, new->ndx);
|
||||||
}
|
}
|
||||||
if (replace)
|
if (replace) {
|
||||||
{
|
|
||||||
if (info->leds == old)
|
if (info->leds == old)
|
||||||
info->leds = (IndicatorNameInfo *) old->defs.next;
|
info->leds = (IndicatorNameInfo *) old->defs.next;
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
IndicatorNameInfo *tmp;
|
IndicatorNameInfo *tmp;
|
||||||
tmp = info->leds;
|
tmp = info->leds;
|
||||||
for (; tmp != NULL;
|
for (; tmp != NULL;
|
||||||
tmp = (IndicatorNameInfo *) tmp->defs.next)
|
tmp = (IndicatorNameInfo *) tmp->defs.next) {
|
||||||
{
|
if (tmp->defs.next == (CommonInfo *) old) {
|
||||||
if (tmp->defs.next == (CommonInfo *) old)
|
|
||||||
{
|
|
||||||
tmp->defs.next = old->defs.next;
|
tmp->defs.next = old->defs.next;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -214,16 +201,13 @@ AddIndicatorName(KeyNamesInfo *info, struct xkb_keymap *keymap, enum merge_mode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
old = FindIndicatorByIndex(info, new->ndx);
|
old = FindIndicatorByIndex(info, new->ndx);
|
||||||
if (old)
|
if (old) {
|
||||||
{
|
|
||||||
if (((old->defs.file_id == new->defs.file_id) && (warningLevel > 0))
|
if (((old->defs.file_id == new->defs.file_id) && (warningLevel > 0))
|
||||||
|| (warningLevel > 9))
|
|| (warningLevel > 9)) {
|
||||||
{
|
|
||||||
WARN("Multiple names for indicator %d\n", new->ndx);
|
WARN("Multiple names for indicator %d\n", new->ndx);
|
||||||
if ((old->name == new->name) && (old->virtual == new->virtual))
|
if ((old->name == new->name) && (old->virtual == new->virtual))
|
||||||
ACTION("Identical definitions ignored\n");
|
ACTION("Identical definitions ignored\n");
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
const char *oldType, *newType;
|
const char *oldType, *newType;
|
||||||
xkb_atom_t using, ignoring;
|
xkb_atom_t using, ignoring;
|
||||||
if (old->virtual)
|
if (old->virtual)
|
||||||
|
@ -234,13 +218,11 @@ AddIndicatorName(KeyNamesInfo *info, struct xkb_keymap *keymap, enum merge_mode
|
||||||
newType = "virtual indicator";
|
newType = "virtual indicator";
|
||||||
else
|
else
|
||||||
newType = "real indicator";
|
newType = "real indicator";
|
||||||
if (replace)
|
if (replace) {
|
||||||
{
|
|
||||||
using = new->name;
|
using = new->name;
|
||||||
ignoring = old->name;
|
ignoring = old->name;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
using = old->name;
|
using = old->name;
|
||||||
ignoring = new->name;
|
ignoring = new->name;
|
||||||
}
|
}
|
||||||
|
@ -249,8 +231,7 @@ AddIndicatorName(KeyNamesInfo *info, struct xkb_keymap *keymap, enum merge_mode
|
||||||
newType, xkb_atom_text(keymap->ctx, ignoring));
|
newType, xkb_atom_text(keymap->ctx, ignoring));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (replace)
|
if (replace) {
|
||||||
{
|
|
||||||
old->name = new->name;
|
old->name = new->name;
|
||||||
old->virtual = new->virtual;
|
old->virtual = new->virtual;
|
||||||
}
|
}
|
||||||
|
@ -258,8 +239,7 @@ AddIndicatorName(KeyNamesInfo *info, struct xkb_keymap *keymap, enum merge_mode
|
||||||
}
|
}
|
||||||
old = new;
|
old = new;
|
||||||
new = NextIndicatorName(info);
|
new = NextIndicatorName(info);
|
||||||
if (!new)
|
if (!new) {
|
||||||
{
|
|
||||||
WSGO("Couldn't allocate name for indicator %d\n", old->ndx);
|
WSGO("Couldn't allocate name for indicator %d\n", old->ndx);
|
||||||
ACTION("Ignored\n");
|
ACTION("Ignored\n");
|
||||||
return false;
|
return false;
|
||||||
|
@ -331,39 +311,32 @@ AddKeyName(KeyNamesInfo * info,
|
||||||
info->computedMax = kc;
|
info->computedMax = kc;
|
||||||
lval = KeyNameToLong(name);
|
lval = KeyNameToLong(name);
|
||||||
|
|
||||||
if (reportCollisions)
|
if (reportCollisions) {
|
||||||
{
|
|
||||||
reportCollisions = (warningLevel > 7 ||
|
reportCollisions = (warningLevel > 7 ||
|
||||||
(warningLevel > 0 &&
|
(warningLevel > 0 &&
|
||||||
file_id == darray_item(info->files, kc)));
|
file_id == darray_item(info->files, kc)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (darray_item(info->names, kc) != 0)
|
if (darray_item(info->names, kc) != 0) {
|
||||||
{
|
|
||||||
char buf[6];
|
char buf[6];
|
||||||
|
|
||||||
LongToKeyName(darray_item(info->names, kc), buf);
|
LongToKeyName(darray_item(info->names, kc), buf);
|
||||||
buf[4] = '\0';
|
buf[4] = '\0';
|
||||||
if (darray_item(info->names, kc) == lval && reportCollisions)
|
if (darray_item(info->names, kc) == lval && reportCollisions) {
|
||||||
{
|
|
||||||
WARN("Multiple identical key name definitions\n");
|
WARN("Multiple identical key name definitions\n");
|
||||||
ACTION("Later occurences of \"<%s> = %d\" ignored\n",
|
ACTION("Later occurences of \"<%s> = %d\" ignored\n",
|
||||||
buf, kc);
|
buf, kc);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (merge == MERGE_AUGMENT)
|
if (merge == MERGE_AUGMENT) {
|
||||||
{
|
if (reportCollisions) {
|
||||||
if (reportCollisions)
|
|
||||||
{
|
|
||||||
WARN("Multiple names for keycode %d\n", kc);
|
WARN("Multiple names for keycode %d\n", kc);
|
||||||
ACTION("Using <%s>, ignoring <%s>\n", buf, name);
|
ACTION("Using <%s>, ignoring <%s>\n", buf, name);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
if (reportCollisions) {
|
||||||
if (reportCollisions)
|
|
||||||
{
|
|
||||||
WARN("Multiple names for keycode %d\n", kc);
|
WARN("Multiple names for keycode %d\n", kc);
|
||||||
ACTION("Using <%s>, ignoring <%s>\n", name, buf);
|
ACTION("Using <%s>, ignoring <%s>\n", name, buf);
|
||||||
}
|
}
|
||||||
|
@ -372,22 +345,17 @@ AddKeyName(KeyNamesInfo * info,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
old = FindKeyByLong(info, lval);
|
old = FindKeyByLong(info, lval);
|
||||||
if ((old != 0) && (old != kc))
|
if ((old != 0) && (old != kc)) {
|
||||||
{
|
if (merge == MERGE_OVERRIDE) {
|
||||||
if (merge == MERGE_OVERRIDE)
|
|
||||||
{
|
|
||||||
darray_item(info->names, old) = 0;
|
darray_item(info->names, old) = 0;
|
||||||
darray_item(info->files, old) = 0;
|
darray_item(info->files, old) = 0;
|
||||||
if (reportCollisions)
|
if (reportCollisions) {
|
||||||
{
|
|
||||||
WARN("Key name <%s> assigned to multiple keys\n", name);
|
WARN("Key name <%s> assigned to multiple keys\n", name);
|
||||||
ACTION("Using %d, ignoring %d\n", kc, old);
|
ACTION("Using %d, ignoring %d\n", kc, old);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
if ((reportCollisions) && (warningLevel > 3)) {
|
||||||
if ((reportCollisions) && (warningLevel > 3))
|
|
||||||
{
|
|
||||||
WARN("Key name <%s> assigned to multiple keys\n", name);
|
WARN("Key name <%s> assigned to multiple keys\n", name);
|
||||||
ACTION("Using %d, ignoring %d\n", old, kc);
|
ACTION("Using %d, ignoring %d\n", old, kc);
|
||||||
}
|
}
|
||||||
|
@ -408,21 +376,18 @@ MergeIncludedKeycodes(KeyNamesInfo *into, struct xkb_keymap *keymap,
|
||||||
uint64_t i;
|
uint64_t i;
|
||||||
char buf[5];
|
char buf[5];
|
||||||
|
|
||||||
if (from->errorCount > 0)
|
if (from->errorCount > 0) {
|
||||||
{
|
|
||||||
into->errorCount += from->errorCount;
|
into->errorCount += from->errorCount;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (into->name == NULL)
|
if (into->name == NULL) {
|
||||||
{
|
|
||||||
into->name = from->name;
|
into->name = from->name;
|
||||||
from->name = NULL;
|
from->name = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResizeKeyNameArrays(into, from->computedMax);
|
ResizeKeyNameArrays(into, from->computedMax);
|
||||||
|
|
||||||
for (i = from->computedMin; i <= from->computedMax; i++)
|
for (i = from->computedMin; i <= from->computedMax; i++) {
|
||||||
{
|
|
||||||
if (darray_item(from->names, i) == 0)
|
if (darray_item(from->names, i) == 0)
|
||||||
continue;
|
continue;
|
||||||
LongToKeyName(darray_item(from->names, i), buf);
|
LongToKeyName(darray_item(from->names, i), buf);
|
||||||
|
@ -430,11 +395,9 @@ MergeIncludedKeycodes(KeyNamesInfo *into, struct xkb_keymap *keymap,
|
||||||
if (!AddKeyName(into, i, buf, merge, from->file_id, false))
|
if (!AddKeyName(into, i, buf, merge, from->file_id, false))
|
||||||
into->errorCount++;
|
into->errorCount++;
|
||||||
}
|
}
|
||||||
if (from->leds)
|
if (from->leds) {
|
||||||
{
|
|
||||||
IndicatorNameInfo *led, *next;
|
IndicatorNameInfo *led, *next;
|
||||||
for (led = from->leds; led != NULL; led = next)
|
for (led = from->leds; led != NULL; led = next) {
|
||||||
{
|
|
||||||
if (merge != MERGE_DEFAULT)
|
if (merge != MERGE_DEFAULT)
|
||||||
led->defs.merge = merge;
|
led->defs.merge = merge;
|
||||||
if (!AddIndicatorName(into, keymap, led->defs.merge, led))
|
if (!AddIndicatorName(into, keymap, led->defs.merge, led))
|
||||||
|
@ -444,14 +407,12 @@ MergeIncludedKeycodes(KeyNamesInfo *into, struct xkb_keymap *keymap,
|
||||||
}
|
}
|
||||||
if (!MergeAliases(&into->aliases, &from->aliases, merge))
|
if (!MergeAliases(&into->aliases, &from->aliases, merge))
|
||||||
into->errorCount++;
|
into->errorCount++;
|
||||||
if (from->explicitMin != 0)
|
if (from->explicitMin != 0) {
|
||||||
{
|
|
||||||
if ((into->explicitMin == 0)
|
if ((into->explicitMin == 0)
|
||||||
|| (into->explicitMin > from->explicitMin))
|
|| (into->explicitMin > from->explicitMin))
|
||||||
into->explicitMin = from->explicitMin;
|
into->explicitMin = from->explicitMin;
|
||||||
}
|
}
|
||||||
if (from->explicitMax > 0)
|
if (from->explicitMax > 0) {
|
||||||
{
|
|
||||||
if ((into->explicitMax == 0)
|
if ((into->explicitMax == 0)
|
||||||
|| (into->explicitMax < from->explicitMax))
|
|| (into->explicitMax < from->explicitMax))
|
||||||
into->explicitMax = from->explicitMax;
|
into->explicitMax = from->explicitMax;
|
||||||
|
@ -477,63 +438,53 @@ HandleIncludeKeycodes(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
||||||
memset(&included, 0, sizeof(included));
|
memset(&included, 0, sizeof(included));
|
||||||
|
|
||||||
haveSelf = false;
|
haveSelf = false;
|
||||||
if ((stmt->file == NULL) && (stmt->map == NULL))
|
if ((stmt->file == NULL) && (stmt->map == NULL)) {
|
||||||
{
|
|
||||||
haveSelf = true;
|
haveSelf = true;
|
||||||
included = *info;
|
included = *info;
|
||||||
memset(info, 0, sizeof(KeyNamesInfo));
|
memset(info, 0, sizeof(KeyNamesInfo));
|
||||||
}
|
}
|
||||||
else if (stmt->file && strcmp(stmt->file, "computed") == 0)
|
else if (stmt->file && strcmp(stmt->file, "computed") == 0) {
|
||||||
{
|
|
||||||
keymap->flags |= AutoKeyNames;
|
keymap->flags |= AutoKeyNames;
|
||||||
info->explicitMin = 0;
|
info->explicitMin = 0;
|
||||||
info->explicitMax = XKB_KEYCODE_MAX;
|
info->explicitMax = XKB_KEYCODE_MAX;
|
||||||
return (info->errorCount == 0);
|
return (info->errorCount == 0);
|
||||||
} /* parse file, store returned info in the xkb struct */
|
} /* parse file, store returned info in the xkb struct */
|
||||||
else if (ProcessIncludeFile(keymap->ctx, stmt, FILE_TYPE_KEYCODES, &rtrn,
|
else if (ProcessIncludeFile(keymap->ctx, stmt, FILE_TYPE_KEYCODES, &rtrn,
|
||||||
&newMerge))
|
&newMerge)) {
|
||||||
{
|
|
||||||
InitKeyNamesInfo(&included, rtrn->id);
|
InitKeyNamesInfo(&included, rtrn->id);
|
||||||
HandleKeycodesFile(rtrn, keymap, MERGE_OVERRIDE, &included);
|
HandleKeycodesFile(rtrn, keymap, MERGE_OVERRIDE, &included);
|
||||||
if (stmt->stmt != NULL)
|
if (stmt->stmt != NULL) {
|
||||||
{
|
|
||||||
free(included.name);
|
free(included.name);
|
||||||
included.name = stmt->stmt;
|
included.name = stmt->stmt;
|
||||||
stmt->stmt = NULL;
|
stmt->stmt = NULL;
|
||||||
}
|
}
|
||||||
FreeXKBFile(rtrn);
|
FreeXKBFile(rtrn);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
info->errorCount += 10; /* XXX: why 10?? */
|
info->errorCount += 10; /* XXX: why 10?? */
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
/* Do we have more than one include statement? */
|
/* Do we have more than one include statement? */
|
||||||
if ((stmt->next != NULL) && (included.errorCount < 1))
|
if ((stmt->next != NULL) && (included.errorCount < 1)) {
|
||||||
{
|
|
||||||
IncludeStmt *next;
|
IncludeStmt *next;
|
||||||
unsigned op;
|
unsigned op;
|
||||||
KeyNamesInfo next_incl;
|
KeyNamesInfo next_incl;
|
||||||
|
|
||||||
for (next = stmt->next; next != NULL; next = next->next)
|
for (next = stmt->next; next != NULL; next = next->next) {
|
||||||
{
|
if ((next->file == NULL) && (next->map == NULL)) {
|
||||||
if ((next->file == NULL) && (next->map == NULL))
|
|
||||||
{
|
|
||||||
haveSelf = true;
|
haveSelf = true;
|
||||||
MergeIncludedKeycodes(&included, keymap, info, next->merge);
|
MergeIncludedKeycodes(&included, keymap, info, next->merge);
|
||||||
ClearKeyNamesInfo(info);
|
ClearKeyNamesInfo(info);
|
||||||
}
|
}
|
||||||
else if (ProcessIncludeFile(keymap->ctx, next, FILE_TYPE_KEYCODES,
|
else if (ProcessIncludeFile(keymap->ctx, next, FILE_TYPE_KEYCODES,
|
||||||
&rtrn, &op))
|
&rtrn, &op)) {
|
||||||
{
|
|
||||||
InitKeyNamesInfo(&next_incl, rtrn->id);
|
InitKeyNamesInfo(&next_incl, rtrn->id);
|
||||||
HandleKeycodesFile(rtrn, keymap, MERGE_OVERRIDE, &next_incl);
|
HandleKeycodesFile(rtrn, keymap, MERGE_OVERRIDE, &next_incl);
|
||||||
MergeIncludedKeycodes(&included, keymap, &next_incl, op);
|
MergeIncludedKeycodes(&included, keymap, &next_incl, op);
|
||||||
ClearKeyNamesInfo(&next_incl);
|
ClearKeyNamesInfo(&next_incl);
|
||||||
FreeXKBFile(rtrn);
|
FreeXKBFile(rtrn);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
info->errorCount += 10; /* XXX: Why 10?? */
|
info->errorCount += 10; /* XXX: Why 10?? */
|
||||||
ClearKeyNamesInfo(&included);
|
ClearKeyNamesInfo(&included);
|
||||||
return false;
|
return false;
|
||||||
|
@ -542,8 +493,7 @@ HandleIncludeKeycodes(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
||||||
}
|
}
|
||||||
if (haveSelf)
|
if (haveSelf)
|
||||||
*info = included;
|
*info = included;
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
MergeIncludedKeycodes(info, keymap, &included, newMerge);
|
MergeIncludedKeycodes(info, keymap, &included, newMerge);
|
||||||
ClearKeyNamesInfo(&included);
|
ClearKeyNamesInfo(&included);
|
||||||
}
|
}
|
||||||
|
@ -558,16 +508,14 @@ static int
|
||||||
HandleKeycodeDef(KeycodeDef *stmt, enum merge_mode merge, KeyNamesInfo *info)
|
HandleKeycodeDef(KeycodeDef *stmt, enum merge_mode merge, KeyNamesInfo *info)
|
||||||
{
|
{
|
||||||
if ((info->explicitMin != 0 && stmt->value < info->explicitMin) ||
|
if ((info->explicitMin != 0 && stmt->value < info->explicitMin) ||
|
||||||
(info->explicitMax != 0 && stmt->value > info->explicitMax))
|
(info->explicitMax != 0 && stmt->value > info->explicitMax)) {
|
||||||
{
|
|
||||||
ERROR("Illegal keycode %lu for name <%s>\n", stmt->value, stmt->name);
|
ERROR("Illegal keycode %lu for name <%s>\n", stmt->value, stmt->name);
|
||||||
ACTION("Must be in the range %d-%d inclusive\n",
|
ACTION("Must be in the range %d-%d inclusive\n",
|
||||||
info->explicitMin,
|
info->explicitMin,
|
||||||
info->explicitMax ? info->explicitMax : XKB_KEYCODE_MAX);
|
info->explicitMax ? info->explicitMax : XKB_KEYCODE_MAX);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (stmt->merge != MERGE_DEFAULT)
|
if (stmt->merge != MERGE_DEFAULT) {
|
||||||
{
|
|
||||||
if (stmt->merge == MERGE_REPLACE)
|
if (stmt->merge == MERGE_REPLACE)
|
||||||
merge = MERGE_OVERRIDE;
|
merge = MERGE_OVERRIDE;
|
||||||
else
|
else
|
||||||
|
@ -596,8 +544,7 @@ HandleKeyNameVar(VarDef *stmt, struct xkb_keymap *keymap, KeyNamesInfo *info)
|
||||||
if (ExprResolveLhs(keymap, stmt->name, &tmp, &field, &arrayNdx) == 0)
|
if (ExprResolveLhs(keymap, stmt->name, &tmp, &field, &arrayNdx) == 0)
|
||||||
return 0; /* internal error, already reported */
|
return 0; /* internal error, already reported */
|
||||||
|
|
||||||
if (tmp.str != NULL)
|
if (tmp.str != NULL) {
|
||||||
{
|
|
||||||
ERROR("Unknown element %s encountered\n", tmp.str);
|
ERROR("Unknown element %s encountered\n", tmp.str);
|
||||||
ACTION("Default for field %s ignored\n", field.str);
|
ACTION("Default for field %s ignored\n", field.str);
|
||||||
goto err_out;
|
goto err_out;
|
||||||
|
@ -606,44 +553,37 @@ HandleKeyNameVar(VarDef *stmt, struct xkb_keymap *keymap, KeyNamesInfo *info)
|
||||||
which = MIN_KEYCODE_DEF;
|
which = MIN_KEYCODE_DEF;
|
||||||
else if (strcasecmp(field.str, "maximum") == 0)
|
else if (strcasecmp(field.str, "maximum") == 0)
|
||||||
which = MAX_KEYCODE_DEF;
|
which = MAX_KEYCODE_DEF;
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
ERROR("Unknown field encountered\n");
|
ERROR("Unknown field encountered\n");
|
||||||
ACTION("Assigment to field %s ignored\n", field.str);
|
ACTION("Assigment to field %s ignored\n", field.str);
|
||||||
goto err_out;
|
goto err_out;
|
||||||
}
|
}
|
||||||
if (arrayNdx != NULL)
|
if (arrayNdx != NULL) {
|
||||||
{
|
|
||||||
ERROR("The %s setting is not an array\n", field.str);
|
ERROR("The %s setting is not an array\n", field.str);
|
||||||
ACTION("Illegal array reference ignored\n");
|
ACTION("Illegal array reference ignored\n");
|
||||||
goto err_out;
|
goto err_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ExprResolveKeyCode(keymap->ctx, stmt->value, &tmp) == 0)
|
if (ExprResolveKeyCode(keymap->ctx, stmt->value, &tmp) == 0) {
|
||||||
{
|
|
||||||
ACTION("Assignment to field %s ignored\n", field.str);
|
ACTION("Assignment to field %s ignored\n", field.str);
|
||||||
goto err_out;
|
goto err_out;
|
||||||
}
|
}
|
||||||
if (tmp.uval > XKB_KEYCODE_MAX)
|
if (tmp.uval > XKB_KEYCODE_MAX) {
|
||||||
{
|
|
||||||
ERROR
|
ERROR
|
||||||
("Illegal keycode %d (must be in the range %d-%d inclusive)\n",
|
("Illegal keycode %d (must be in the range %d-%d inclusive)\n",
|
||||||
tmp.uval, 0, XKB_KEYCODE_MAX);
|
tmp.uval, 0, XKB_KEYCODE_MAX);
|
||||||
ACTION("Value of \"%s\" not changed\n", field.str);
|
ACTION("Value of \"%s\" not changed\n", field.str);
|
||||||
goto err_out;
|
goto err_out;
|
||||||
}
|
}
|
||||||
if (which == MIN_KEYCODE_DEF)
|
if (which == MIN_KEYCODE_DEF) {
|
||||||
{
|
if ((info->explicitMax > 0) && (info->explicitMax < tmp.uval)) {
|
||||||
if ((info->explicitMax > 0) && (info->explicitMax < tmp.uval))
|
|
||||||
{
|
|
||||||
ERROR
|
ERROR
|
||||||
("Minimum key code (%d) must be <= maximum key code (%d)\n",
|
("Minimum key code (%d) must be <= maximum key code (%d)\n",
|
||||||
tmp.uval, info->explicitMax);
|
tmp.uval, info->explicitMax);
|
||||||
ACTION("Minimum key code value not changed\n");
|
ACTION("Minimum key code value not changed\n");
|
||||||
goto err_out;
|
goto err_out;
|
||||||
}
|
}
|
||||||
if ((info->computedMax > 0) && (info->computedMin < tmp.uval))
|
if ((info->computedMax > 0) && (info->computedMin < tmp.uval)) {
|
||||||
{
|
|
||||||
ERROR
|
ERROR
|
||||||
("Minimum key code (%d) must be <= lowest defined key (%d)\n",
|
("Minimum key code (%d) must be <= lowest defined key (%d)\n",
|
||||||
tmp.uval, info->computedMin);
|
tmp.uval, info->computedMin);
|
||||||
|
@ -652,17 +592,14 @@ HandleKeyNameVar(VarDef *stmt, struct xkb_keymap *keymap, KeyNamesInfo *info)
|
||||||
}
|
}
|
||||||
info->explicitMin = tmp.uval;
|
info->explicitMin = tmp.uval;
|
||||||
}
|
}
|
||||||
if (which == MAX_KEYCODE_DEF)
|
if (which == MAX_KEYCODE_DEF) {
|
||||||
{
|
if ((info->explicitMin > 0) && (info->explicitMin > tmp.uval)) {
|
||||||
if ((info->explicitMin > 0) && (info->explicitMin > tmp.uval))
|
|
||||||
{
|
|
||||||
ERROR("Maximum code (%d) must be >= minimum key code (%d)\n",
|
ERROR("Maximum code (%d) must be >= minimum key code (%d)\n",
|
||||||
tmp.uval, info->explicitMin);
|
tmp.uval, info->explicitMin);
|
||||||
ACTION("Maximum code value not changed\n");
|
ACTION("Maximum code value not changed\n");
|
||||||
goto err_out;
|
goto err_out;
|
||||||
}
|
}
|
||||||
if ((info->computedMax > 0) && (info->computedMax > tmp.uval))
|
if ((info->computedMax > 0) && (info->computedMax > tmp.uval)) {
|
||||||
{
|
|
||||||
ERROR
|
ERROR
|
||||||
("Maximum code (%d) must be >= highest defined key (%d)\n",
|
("Maximum code (%d) must be >= highest defined key (%d)\n",
|
||||||
tmp.uval, info->computedMax);
|
tmp.uval, info->computedMax);
|
||||||
|
@ -687,8 +624,7 @@ HandleIndicatorNameDef(IndicatorNameDef *def, struct xkb_keymap *keymap,
|
||||||
IndicatorNameInfo ii;
|
IndicatorNameInfo ii;
|
||||||
ExprResult tmp;
|
ExprResult tmp;
|
||||||
|
|
||||||
if ((def->ndx < 1) || (def->ndx > XkbNumIndicators))
|
if ((def->ndx < 1) || (def->ndx > XkbNumIndicators)) {
|
||||||
{
|
|
||||||
info->errorCount++;
|
info->errorCount++;
|
||||||
ERROR("Name specified for illegal indicator index %d\n", def->ndx);
|
ERROR("Name specified for illegal indicator index %d\n", def->ndx);
|
||||||
ACTION("Ignored\n");
|
ACTION("Ignored\n");
|
||||||
|
@ -696,8 +632,7 @@ HandleIndicatorNameDef(IndicatorNameDef *def, struct xkb_keymap *keymap,
|
||||||
}
|
}
|
||||||
InitIndicatorNameInfo(&ii, info);
|
InitIndicatorNameInfo(&ii, info);
|
||||||
ii.ndx = def->ndx;
|
ii.ndx = def->ndx;
|
||||||
if (!ExprResolveString(keymap->ctx, def->name, &tmp))
|
if (!ExprResolveString(keymap->ctx, def->name, &tmp)) {
|
||||||
{
|
|
||||||
char buf[20];
|
char buf[20];
|
||||||
snprintf(buf, sizeof(buf), "%d", def->ndx);
|
snprintf(buf, sizeof(buf), "%d", def->ndx);
|
||||||
info->errorCount++;
|
info->errorCount++;
|
||||||
|
@ -735,8 +670,7 @@ HandleKeycodesFile(XkbFile *file, struct xkb_keymap *keymap,
|
||||||
stmt = file->defs;
|
stmt = file->defs;
|
||||||
while (stmt)
|
while (stmt)
|
||||||
{
|
{
|
||||||
switch (stmt->stmtType)
|
switch (stmt->stmtType) {
|
||||||
{
|
|
||||||
case StmtInclude: /* e.g. include "evdev+aliases(qwerty)" */
|
case StmtInclude: /* e.g. include "evdev+aliases(qwerty)" */
|
||||||
if (!HandleIncludeKeycodes((IncludeStmt *) stmt, keymap, info))
|
if (!HandleIncludeKeycodes((IncludeStmt *) stmt, keymap, info))
|
||||||
info->errorCount++;
|
info->errorCount++;
|
||||||
|
@ -774,8 +708,7 @@ HandleKeycodesFile(XkbFile *file, struct xkb_keymap *keymap,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
stmt = stmt->next;
|
stmt = stmt->next;
|
||||||
if (info->errorCount > 10)
|
if (info->errorCount > 10) {
|
||||||
{
|
|
||||||
#ifdef NOISY
|
#ifdef NOISY
|
||||||
ERROR("Too many errors\n");
|
ERROR("Too many errors\n");
|
||||||
#endif
|
#endif
|
||||||
|
@ -796,7 +729,8 @@ HandleKeycodesFile(XkbFile *file, struct xkb_keymap *keymap,
|
||||||
* @return true on success, false otherwise.
|
* @return true on success, false otherwise.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
CompileKeycodes(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge)
|
CompileKeycodes(XkbFile *file, struct xkb_keymap *keymap,
|
||||||
|
enum merge_mode merge)
|
||||||
{
|
{
|
||||||
KeyNamesInfo info; /* contains all the info after parsing */
|
KeyNamesInfo info; /* contains all the info after parsing */
|
||||||
|
|
||||||
|
@ -827,7 +761,8 @@ CompileKeycodes(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge)
|
||||||
darray_item(keymap->names->keys, i).name);
|
darray_item(keymap->names->keys, i).name);
|
||||||
if (info.name)
|
if (info.name)
|
||||||
keymap->names->keycodes = strdup(info.name);
|
keymap->names->keycodes = strdup(info.name);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
WSGO("Cannot create struct xkb_names in CompileKeycodes\n");
|
WSGO("Cannot create struct xkb_names in CompileKeycodes\n");
|
||||||
goto err_info;
|
goto err_info;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
/************************************************************
|
/************************************************************
|
||||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||||
|
*
|
||||||
Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
software and its documentation for any purpose and without
|
* software and its documentation for any purpose and without
|
||||||
fee is hereby granted, provided that the above copyright
|
* fee is hereby granted, provided that the above copyright
|
||||||
notice appear in all copies and that both that copyright
|
* notice appear in all copies and that both that copyright
|
||||||
notice and this permission notice appear in supporting
|
* notice and this permission notice appear in supporting
|
||||||
documentation, and that the name of Silicon Graphics not be
|
* documentation, and that the name of Silicon Graphics not be
|
||||||
used in advertising or publicity pertaining to distribution
|
* used in advertising or publicity pertaining to distribution
|
||||||
of the software without specific prior written permission.
|
* of the software without specific prior written permission.
|
||||||
Silicon Graphics makes no representation about the suitability
|
* Silicon Graphics makes no representation about the suitability
|
||||||
of this software for any purpose. It is provided "as is"
|
* of this software for any purpose. It is provided "as is"
|
||||||
without any express or implied warranty.
|
* without any express or implied warranty.
|
||||||
|
*
|
||||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
||||||
#ifndef KEYCODES_H
|
#ifndef KEYCODES_H
|
||||||
|
@ -36,7 +36,8 @@
|
||||||
(((unsigned long) n[3]) << 0))
|
(((unsigned long) n[3]) << 0))
|
||||||
|
|
||||||
extern const
|
extern const
|
||||||
char *longText(unsigned long val);
|
char *
|
||||||
|
longText(unsigned long val);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
LongToKeyName(unsigned long val, char *name_rtrn);
|
LongToKeyName(unsigned long val, char *name_rtrn);
|
||||||
|
|
|
@ -1,35 +1,34 @@
|
||||||
/************************************************************
|
/************************************************************
|
||||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||||
|
*
|
||||||
Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
software and its documentation for any purpose and without
|
* software and its documentation for any purpose and without
|
||||||
fee is hereby granted, provided that the above copyright
|
* fee is hereby granted, provided that the above copyright
|
||||||
notice appear in all copies and that both that copyright
|
* notice appear in all copies and that both that copyright
|
||||||
notice and this permission notice appear in supporting
|
* notice and this permission notice appear in supporting
|
||||||
documentation, and that the name of Silicon Graphics not be
|
* documentation, and that the name of Silicon Graphics not be
|
||||||
used in advertising or publicity pertaining to distribution
|
* used in advertising or publicity pertaining to distribution
|
||||||
of the software without specific prior written permission.
|
* of the software without specific prior written permission.
|
||||||
Silicon Graphics makes no representation about the suitability
|
* Silicon Graphics makes no representation about the suitability
|
||||||
of this software for any purpose. It is provided "as is"
|
* of this software for any purpose. It is provided "as is"
|
||||||
without any express or implied warranty.
|
* without any express or implied warranty.
|
||||||
|
*
|
||||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
||||||
#include "xkbcomp-priv.h"
|
#include "xkbcomp-priv.h"
|
||||||
#include "parseutils.h"
|
#include "parseutils.h"
|
||||||
#include "vmod.h"
|
#include "vmod.h"
|
||||||
|
|
||||||
typedef struct _PreserveInfo
|
typedef struct _PreserveInfo {
|
||||||
{
|
|
||||||
CommonInfo defs;
|
CommonInfo defs;
|
||||||
short matchingMapIndex;
|
short matchingMapIndex;
|
||||||
unsigned char indexMods;
|
unsigned char indexMods;
|
||||||
|
@ -44,8 +43,7 @@ typedef struct _PreserveInfo
|
||||||
#define _KT_Preserve (1 << 3)
|
#define _KT_Preserve (1 << 3)
|
||||||
#define _KT_LevelNames (1 << 4)
|
#define _KT_LevelNames (1 << 4)
|
||||||
|
|
||||||
typedef struct _KeyTypeInfo
|
typedef struct _KeyTypeInfo {
|
||||||
{
|
|
||||||
CommonInfo defs;
|
CommonInfo defs;
|
||||||
xkb_atom_t name;
|
xkb_atom_t name;
|
||||||
unsigned file_id;
|
unsigned file_id;
|
||||||
|
@ -58,8 +56,7 @@ typedef struct _KeyTypeInfo
|
||||||
darray(xkb_atom_t) lvlNames;
|
darray(xkb_atom_t) lvlNames;
|
||||||
} KeyTypeInfo;
|
} KeyTypeInfo;
|
||||||
|
|
||||||
typedef struct _KeyTypesInfo
|
typedef struct _KeyTypesInfo {
|
||||||
{
|
|
||||||
char *name;
|
char *name;
|
||||||
int errorCount;
|
int errorCount;
|
||||||
unsigned file_id;
|
unsigned file_id;
|
||||||
|
@ -124,20 +121,17 @@ InitKeyTypesInfo(KeyTypesInfo *info, struct xkb_keymap *keymap,
|
||||||
darray_init(info->dflt.lvlNames);
|
darray_init(info->dflt.lvlNames);
|
||||||
info->dflt.preserve = NULL;
|
info->dflt.preserve = NULL;
|
||||||
InitVModInfo(&info->vmods, keymap);
|
InitVModInfo(&info->vmods, keymap);
|
||||||
if (from != NULL)
|
if (from != NULL) {
|
||||||
{
|
|
||||||
info->dflt = from->dflt;
|
info->dflt = from->dflt;
|
||||||
|
|
||||||
darray_copy(info->dflt.entries, from->dflt.entries);
|
darray_copy(info->dflt.entries, from->dflt.entries);
|
||||||
darray_copy(info->dflt.lvlNames, from->dflt.lvlNames);
|
darray_copy(info->dflt.lvlNames, from->dflt.lvlNames);
|
||||||
|
|
||||||
if (from->dflt.preserve)
|
if (from->dflt.preserve) {
|
||||||
{
|
|
||||||
PreserveInfo *old, *new, *last;
|
PreserveInfo *old, *new, *last;
|
||||||
last = NULL;
|
last = NULL;
|
||||||
old = from->dflt.preserve;
|
old = from->dflt.preserve;
|
||||||
for (; old; old = (PreserveInfo *) old->defs.next)
|
for (; old; old = (PreserveInfo *) old->defs.next) {
|
||||||
{
|
|
||||||
new = uTypedAlloc(PreserveInfo);
|
new = uTypedAlloc(PreserveInfo);
|
||||||
if (!new)
|
if (!new)
|
||||||
return;
|
return;
|
||||||
|
@ -158,8 +152,7 @@ FreeKeyTypeInfo(KeyTypeInfo * type)
|
||||||
{
|
{
|
||||||
darray_free(type->entries);
|
darray_free(type->entries);
|
||||||
darray_free(type->lvlNames);
|
darray_free(type->lvlNames);
|
||||||
if (type->preserve != NULL)
|
if (type->preserve != NULL) {
|
||||||
{
|
|
||||||
ClearCommonInfo(&type->preserve->defs);
|
ClearCommonInfo(&type->preserve->defs);
|
||||||
type->preserve = NULL;
|
type->preserve = NULL;
|
||||||
}
|
}
|
||||||
|
@ -170,11 +163,10 @@ FreeKeyTypesInfo(KeyTypesInfo * info)
|
||||||
{
|
{
|
||||||
free(info->name);
|
free(info->name);
|
||||||
info->name = NULL;
|
info->name = NULL;
|
||||||
if (info->types)
|
if (info->types) {
|
||||||
{
|
|
||||||
KeyTypeInfo *type;
|
KeyTypeInfo *type;
|
||||||
for (type = info->types; type; type = (KeyTypeInfo *) type->defs.next)
|
for (type = info->types; type; type =
|
||||||
{
|
(KeyTypeInfo *) type->defs.next) {
|
||||||
FreeKeyTypeInfo(type);
|
FreeKeyTypeInfo(type);
|
||||||
}
|
}
|
||||||
info->types = ClearCommonInfo(&info->types->defs);
|
info->types = ClearCommonInfo(&info->types->defs);
|
||||||
|
@ -188,8 +180,7 @@ NextKeyType(KeyTypesInfo * info)
|
||||||
KeyTypeInfo *type;
|
KeyTypeInfo *type;
|
||||||
|
|
||||||
type = uTypedAlloc(KeyTypeInfo);
|
type = uTypedAlloc(KeyTypeInfo);
|
||||||
if (type != NULL)
|
if (type != NULL) {
|
||||||
{
|
|
||||||
memset(type, 0, sizeof(KeyTypeInfo));
|
memset(type, 0, sizeof(KeyTypeInfo));
|
||||||
type->defs.file_id = info->file_id;
|
type->defs.file_id = info->file_id;
|
||||||
info->types = AddCommonInfo(&info->types->defs, &type->defs);
|
info->types = AddCommonInfo(&info->types->defs, &type->defs);
|
||||||
|
@ -203,8 +194,7 @@ FindMatchingKeyType(KeyTypesInfo * info, KeyTypeInfo * new)
|
||||||
{
|
{
|
||||||
KeyTypeInfo *old;
|
KeyTypeInfo *old;
|
||||||
|
|
||||||
for (old = info->types; old; old = (KeyTypeInfo *) old->defs.next)
|
for (old = info->types; old; old = (KeyTypeInfo *) old->defs.next) {
|
||||||
{
|
|
||||||
if (old->name == new->name)
|
if (old->name == new->name)
|
||||||
return old;
|
return old;
|
||||||
}
|
}
|
||||||
|
@ -224,30 +214,26 @@ AddKeyType(struct xkb_keymap *keymap, KeyTypesInfo *info, KeyTypeInfo *new)
|
||||||
{
|
{
|
||||||
KeyTypeInfo *old;
|
KeyTypeInfo *old;
|
||||||
|
|
||||||
if (new->name == tok_ONE_LEVEL)
|
if (new->name == tok_ONE_LEVEL) {
|
||||||
{
|
|
||||||
if (new->numLevels > 1)
|
if (new->numLevels > 1)
|
||||||
return ReportTypeBadWidth("ONE_LEVEL", new->numLevels, 1);
|
return ReportTypeBadWidth("ONE_LEVEL", new->numLevels, 1);
|
||||||
info->stdPresent |= XkbOneLevelMask;
|
info->stdPresent |= XkbOneLevelMask;
|
||||||
}
|
}
|
||||||
else if (new->name == tok_TWO_LEVEL)
|
else if (new->name == tok_TWO_LEVEL) {
|
||||||
{
|
|
||||||
if (new->numLevels > 2)
|
if (new->numLevels > 2)
|
||||||
return ReportTypeBadWidth("TWO_LEVEL", new->numLevels, 2);
|
return ReportTypeBadWidth("TWO_LEVEL", new->numLevels, 2);
|
||||||
else if (new->numLevels < 2)
|
else if (new->numLevels < 2)
|
||||||
new->numLevels = 2;
|
new->numLevels = 2;
|
||||||
info->stdPresent |= XkbTwoLevelMask;
|
info->stdPresent |= XkbTwoLevelMask;
|
||||||
}
|
}
|
||||||
else if (new->name == tok_ALPHABETIC)
|
else if (new->name == tok_ALPHABETIC) {
|
||||||
{
|
|
||||||
if (new->numLevels > 2)
|
if (new->numLevels > 2)
|
||||||
return ReportTypeBadWidth("ALPHABETIC", new->numLevels, 2);
|
return ReportTypeBadWidth("ALPHABETIC", new->numLevels, 2);
|
||||||
else if (new->numLevels < 2)
|
else if (new->numLevels < 2)
|
||||||
new->numLevels = 2;
|
new->numLevels = 2;
|
||||||
info->stdPresent |= XkbAlphabeticMask;
|
info->stdPresent |= XkbAlphabeticMask;
|
||||||
}
|
}
|
||||||
else if (new->name == tok_KEYPAD)
|
else if (new->name == tok_KEYPAD) {
|
||||||
{
|
|
||||||
if (new->numLevels > 2)
|
if (new->numLevels > 2)
|
||||||
return ReportTypeBadWidth("KEYPAD", new->numLevels, 2);
|
return ReportTypeBadWidth("KEYPAD", new->numLevels, 2);
|
||||||
else if (new->numLevels < 2)
|
else if (new->numLevels < 2)
|
||||||
|
@ -256,16 +242,13 @@ AddKeyType(struct xkb_keymap *keymap, KeyTypesInfo *info, KeyTypeInfo *new)
|
||||||
}
|
}
|
||||||
|
|
||||||
old = FindMatchingKeyType(info, new);
|
old = FindMatchingKeyType(info, new);
|
||||||
if (old != NULL)
|
if (old != NULL) {
|
||||||
{
|
|
||||||
bool report;
|
bool report;
|
||||||
if ((new->defs.merge == MERGE_REPLACE)
|
if ((new->defs.merge == MERGE_REPLACE)
|
||||||
|| (new->defs.merge == MERGE_OVERRIDE))
|
|| (new->defs.merge == MERGE_OVERRIDE)) {
|
||||||
{
|
|
||||||
KeyTypeInfo *next = (KeyTypeInfo *) old->defs.next;
|
KeyTypeInfo *next = (KeyTypeInfo *) old->defs.next;
|
||||||
if (((old->defs.file_id == new->defs.file_id)
|
if (((old->defs.file_id == new->defs.file_id)
|
||||||
&& (warningLevel > 0)) || (warningLevel > 9))
|
&& (warningLevel > 0)) || (warningLevel > 9)) {
|
||||||
{
|
|
||||||
WARN("Multiple definitions of the %s key type\n",
|
WARN("Multiple definitions of the %s key type\n",
|
||||||
xkb_atom_text(keymap->ctx, new->name));
|
xkb_atom_text(keymap->ctx, new->name));
|
||||||
ACTION("Earlier definition ignored\n");
|
ACTION("Earlier definition ignored\n");
|
||||||
|
@ -278,9 +261,9 @@ AddKeyType(struct xkb_keymap *keymap, KeyTypesInfo *info, KeyTypeInfo *new)
|
||||||
old->defs.next = &next->defs;
|
old->defs.next = &next->defs;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
report = (old->defs.file_id == new->defs.file_id) && (warningLevel > 0);
|
report = (old->defs.file_id == new->defs.file_id) &&
|
||||||
if (report)
|
(warningLevel > 0);
|
||||||
{
|
if (report) {
|
||||||
WARN("Multiple definitions of the %s key type\n",
|
WARN("Multiple definitions of the %s key type\n",
|
||||||
xkb_atom_text(keymap->ctx, new->name));
|
xkb_atom_text(keymap->ctx, new->name));
|
||||||
ACTION("Later definition ignored\n");
|
ACTION("Later definition ignored\n");
|
||||||
|
@ -307,18 +290,15 @@ MergeIncludedKeyTypes(KeyTypesInfo *into, KeyTypesInfo *from,
|
||||||
{
|
{
|
||||||
KeyTypeInfo *type;
|
KeyTypeInfo *type;
|
||||||
|
|
||||||
if (from->errorCount > 0)
|
if (from->errorCount > 0) {
|
||||||
{
|
|
||||||
into->errorCount += from->errorCount;
|
into->errorCount += from->errorCount;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (into->name == NULL)
|
if (into->name == NULL) {
|
||||||
{
|
|
||||||
into->name = from->name;
|
into->name = from->name;
|
||||||
from->name = NULL;
|
from->name = NULL;
|
||||||
}
|
}
|
||||||
for (type = from->types; type; type = (KeyTypeInfo *) type->defs.next)
|
for (type = from->types; type; type = (KeyTypeInfo *) type->defs.next) {
|
||||||
{
|
|
||||||
if (merge != MERGE_DEFAULT)
|
if (merge != MERGE_DEFAULT)
|
||||||
type->defs.merge = merge;
|
type->defs.merge = merge;
|
||||||
if (!AddKeyType(keymap, into, type))
|
if (!AddKeyType(keymap, into, type))
|
||||||
|
@ -329,7 +309,8 @@ MergeIncludedKeyTypes(KeyTypesInfo *into, KeyTypesInfo *from,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
HandleKeyTypesFile(XkbFile *file, struct xkb_keymap *keymap,
|
HandleKeyTypesFile(XkbFile *file, struct xkb_keymap *keymap,
|
||||||
enum merge_mode merge, KeyTypesInfo *info);
|
enum merge_mode merge,
|
||||||
|
KeyTypesInfo *info);
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
HandleIncludeKeyTypes(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
HandleIncludeKeyTypes(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
||||||
|
@ -341,49 +322,41 @@ HandleIncludeKeyTypes(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
||||||
bool haveSelf;
|
bool haveSelf;
|
||||||
|
|
||||||
haveSelf = false;
|
haveSelf = false;
|
||||||
if ((stmt->file == NULL) && (stmt->map == NULL))
|
if ((stmt->file == NULL) && (stmt->map == NULL)) {
|
||||||
{
|
|
||||||
haveSelf = true;
|
haveSelf = true;
|
||||||
included = *info;
|
included = *info;
|
||||||
memset(info, 0, sizeof(KeyTypesInfo));
|
memset(info, 0, sizeof(KeyTypesInfo));
|
||||||
}
|
}
|
||||||
else if (ProcessIncludeFile(keymap->ctx, stmt, FILE_TYPE_TYPES, &rtrn,
|
else if (ProcessIncludeFile(keymap->ctx, stmt, FILE_TYPE_TYPES, &rtrn,
|
||||||
&newMerge))
|
&newMerge)) {
|
||||||
{
|
|
||||||
InitKeyTypesInfo(&included, keymap, info, rtrn->id);
|
InitKeyTypesInfo(&included, keymap, info, rtrn->id);
|
||||||
included.dflt.defs.merge = newMerge;
|
included.dflt.defs.merge = newMerge;
|
||||||
|
|
||||||
HandleKeyTypesFile(rtrn, keymap, newMerge, &included);
|
HandleKeyTypesFile(rtrn, keymap, newMerge, &included);
|
||||||
if (stmt->stmt != NULL)
|
if (stmt->stmt != NULL) {
|
||||||
{
|
|
||||||
free(included.name);
|
free(included.name);
|
||||||
included.name = stmt->stmt;
|
included.name = stmt->stmt;
|
||||||
stmt->stmt = NULL;
|
stmt->stmt = NULL;
|
||||||
}
|
}
|
||||||
FreeXKBFile(rtrn);
|
FreeXKBFile(rtrn);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
info->errorCount += 10;
|
info->errorCount += 10;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((stmt->next != NULL) && (included.errorCount < 1))
|
if ((stmt->next != NULL) && (included.errorCount < 1)) {
|
||||||
{
|
|
||||||
IncludeStmt *next;
|
IncludeStmt *next;
|
||||||
unsigned op;
|
unsigned op;
|
||||||
KeyTypesInfo next_incl;
|
KeyTypesInfo next_incl;
|
||||||
|
|
||||||
for (next = stmt->next; next != NULL; next = next->next)
|
for (next = stmt->next; next != NULL; next = next->next) {
|
||||||
{
|
if ((next->file == NULL) && (next->map == NULL)) {
|
||||||
if ((next->file == NULL) && (next->map == NULL))
|
|
||||||
{
|
|
||||||
haveSelf = true;
|
haveSelf = true;
|
||||||
MergeIncludedKeyTypes(&included, info, next->merge, keymap);
|
MergeIncludedKeyTypes(&included, info, next->merge, keymap);
|
||||||
FreeKeyTypesInfo(info);
|
FreeKeyTypesInfo(info);
|
||||||
}
|
}
|
||||||
else if (ProcessIncludeFile(keymap->ctx, next, FILE_TYPE_TYPES,
|
else if (ProcessIncludeFile(keymap->ctx, next, FILE_TYPE_TYPES,
|
||||||
&rtrn, &op))
|
&rtrn, &op)) {
|
||||||
{
|
|
||||||
InitKeyTypesInfo(&next_incl, keymap, &included, rtrn->id);
|
InitKeyTypesInfo(&next_incl, keymap, &included, rtrn->id);
|
||||||
next_incl.dflt.defs.merge = op;
|
next_incl.dflt.defs.merge = op;
|
||||||
HandleKeyTypesFile(rtrn, keymap, op, &next_incl);
|
HandleKeyTypesFile(rtrn, keymap, op, &next_incl);
|
||||||
|
@ -391,8 +364,7 @@ HandleIncludeKeyTypes(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
||||||
FreeKeyTypesInfo(&next_incl);
|
FreeKeyTypesInfo(&next_incl);
|
||||||
FreeXKBFile(rtrn);
|
FreeXKBFile(rtrn);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
info->errorCount += 10;
|
info->errorCount += 10;
|
||||||
FreeKeyTypesInfo(&included);
|
FreeKeyTypesInfo(&included);
|
||||||
return false;
|
return false;
|
||||||
|
@ -401,8 +373,7 @@ HandleIncludeKeyTypes(IncludeStmt *stmt, struct xkb_keymap *keymap,
|
||||||
}
|
}
|
||||||
if (haveSelf)
|
if (haveSelf)
|
||||||
*info = included;
|
*info = included;
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
MergeIncludedKeyTypes(info, &included, newMerge, keymap);
|
MergeIncludedKeyTypes(info, &included, newMerge, keymap);
|
||||||
FreeKeyTypesInfo(&included);
|
FreeKeyTypesInfo(&included);
|
||||||
}
|
}
|
||||||
|
@ -456,24 +427,20 @@ AddPreserve(struct xkb_keymap *keymap, KeyTypeInfo *type,
|
||||||
while (old != NULL)
|
while (old != NULL)
|
||||||
{
|
{
|
||||||
if ((old->indexMods != new->indexMods) ||
|
if ((old->indexMods != new->indexMods) ||
|
||||||
(old->indexVMods != new->indexVMods))
|
(old->indexVMods != new->indexVMods)) {
|
||||||
{
|
|
||||||
old = (PreserveInfo *) old->defs.next;
|
old = (PreserveInfo *) old->defs.next;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ((old->preMods == new->preMods)
|
if ((old->preMods == new->preMods)
|
||||||
&& (old->preVMods == new->preVMods))
|
&& (old->preVMods == new->preVMods)) {
|
||||||
{
|
if (warningLevel > 9) {
|
||||||
if (warningLevel > 9)
|
|
||||||
{
|
|
||||||
WARN("Identical definitions for preserve[%s] in %s\n",
|
WARN("Identical definitions for preserve[%s] in %s\n",
|
||||||
PreserveIndexTxt(keymap, old), TypeTxt(keymap, type));
|
PreserveIndexTxt(keymap, old), TypeTxt(keymap, type));
|
||||||
ACTION("Ignored\n");
|
ACTION("Ignored\n");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (report && (warningLevel > 0))
|
if (report && (warningLevel > 0)) {
|
||||||
{
|
|
||||||
const char *str;
|
const char *str;
|
||||||
WARN("Multiple definitions for preserve[%s] in %s\n",
|
WARN("Multiple definitions for preserve[%s] in %s\n",
|
||||||
PreserveIndexTxt(keymap, old), TypeTxt(keymap, type));
|
PreserveIndexTxt(keymap, old), TypeTxt(keymap, type));
|
||||||
|
@ -489,16 +456,14 @@ AddPreserve(struct xkb_keymap *keymap, KeyTypeInfo *type,
|
||||||
str = PreserveTxt(keymap, new);
|
str = PreserveTxt(keymap, new);
|
||||||
INFO("ignoring %s\n", str);
|
INFO("ignoring %s\n", str);
|
||||||
}
|
}
|
||||||
if (clobber)
|
if (clobber) {
|
||||||
{
|
|
||||||
old->preMods = new->preMods;
|
old->preMods = new->preMods;
|
||||||
old->preVMods = new->preVMods;
|
old->preVMods = new->preVMods;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
old = uTypedAlloc(PreserveInfo);
|
old = uTypedAlloc(PreserveInfo);
|
||||||
if (!old)
|
if (!old) {
|
||||||
{
|
|
||||||
WSGO("Couldn't allocate preserve in %s\n", TypeTxt(keymap, type));
|
WSGO("Couldn't allocate preserve in %s\n", TypeTxt(keymap, type));
|
||||||
ACTION("Preserve[%s] lost\n", PreserveIndexTxt(keymap, new));
|
ACTION("Preserve[%s] lost\n", PreserveIndexTxt(keymap, new));
|
||||||
return false;
|
return false;
|
||||||
|
@ -524,18 +489,15 @@ AddMapEntry(struct xkb_keymap *keymap, KeyTypeInfo *type,
|
||||||
struct xkb_kt_map_entry * old;
|
struct xkb_kt_map_entry * old;
|
||||||
|
|
||||||
if ((old =
|
if ((old =
|
||||||
FindMatchingMapEntry(type, new->mods.real_mods, new->mods.vmods)))
|
FindMatchingMapEntry(type, new->mods.real_mods,
|
||||||
{
|
new->mods.vmods))) {
|
||||||
if (report && (old->level != new->level))
|
if (report && (old->level != new->level)) {
|
||||||
{
|
|
||||||
unsigned use, ignore;
|
unsigned use, ignore;
|
||||||
if (clobber)
|
if (clobber) {
|
||||||
{
|
|
||||||
use = new->level + 1;
|
use = new->level + 1;
|
||||||
ignore = old->level + 1;
|
ignore = old->level + 1;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
use = old->level + 1;
|
use = old->level + 1;
|
||||||
ignore = new->level + 1;
|
ignore = new->level + 1;
|
||||||
}
|
}
|
||||||
|
@ -543,8 +505,7 @@ AddMapEntry(struct xkb_keymap *keymap, KeyTypeInfo *type,
|
||||||
MapEntryTxt(keymap, new), TypeTxt(keymap, type));
|
MapEntryTxt(keymap, new), TypeTxt(keymap, type));
|
||||||
ACTION("Using %d, ignoring %d\n", use, ignore);
|
ACTION("Using %d, ignoring %d\n", use, ignore);
|
||||||
}
|
}
|
||||||
else if (warningLevel > 9)
|
else if (warningLevel > 9) {
|
||||||
{
|
|
||||||
WARN("Multiple occurences of map[%s]= %d in %s\n",
|
WARN("Multiple occurences of map[%s]= %d in %s\n",
|
||||||
MapEntryTxt(keymap, new), new->level + 1,
|
MapEntryTxt(keymap, new), new->level + 1,
|
||||||
TypeTxt(keymap, type));
|
TypeTxt(keymap, type));
|
||||||
|
@ -580,11 +541,10 @@ SetMapEntry(KeyTypeInfo *type, struct xkb_keymap *keymap, ExprDef *arrayNdx,
|
||||||
entry.mods.real_mods = rtrn.uval & 0xff; /* modifiers < 512 */
|
entry.mods.real_mods = rtrn.uval & 0xff; /* modifiers < 512 */
|
||||||
entry.mods.vmods = (rtrn.uval >> 8) & 0xffff; /* modifiers > 512 */
|
entry.mods.vmods = (rtrn.uval >> 8) & 0xffff; /* modifiers > 512 */
|
||||||
if ((entry.mods.real_mods & (~type->mask)) ||
|
if ((entry.mods.real_mods & (~type->mask)) ||
|
||||||
((entry.mods.vmods & (~type->vmask)) != 0))
|
((entry.mods.vmods & (~type->vmask)) != 0)) {
|
||||||
{
|
if (warningLevel > 0) {
|
||||||
if (warningLevel > 0)
|
WARN("Map entry for unused modifiers in %s\n",
|
||||||
{
|
TypeTxt(keymap, type));
|
||||||
WARN("Map entry for unused modifiers in %s\n", TypeTxt(keymap, type));
|
|
||||||
ACTION("Using %s instead of ",
|
ACTION("Using %s instead of ",
|
||||||
XkbcVModMaskText(keymap,
|
XkbcVModMaskText(keymap,
|
||||||
entry.mods.real_mods & type->mask,
|
entry.mods.real_mods & type->mask,
|
||||||
|
@ -594,8 +554,7 @@ SetMapEntry(KeyTypeInfo *type, struct xkb_keymap *keymap, ExprDef *arrayNdx,
|
||||||
entry.mods.real_mods &= type->mask;
|
entry.mods.real_mods &= type->mask;
|
||||||
entry.mods.vmods &= type->vmask;
|
entry.mods.vmods &= type->vmask;
|
||||||
}
|
}
|
||||||
if (!ExprResolveLevel(keymap->ctx, value, &rtrn))
|
if (!ExprResolveLevel(keymap->ctx, value, &rtrn)) {
|
||||||
{
|
|
||||||
ERROR("Level specifications in a key type must be integer\n");
|
ERROR("Level specifications in a key type must be integer\n");
|
||||||
ACTION("Ignoring malformed level specification\n");
|
ACTION("Ignoring malformed level specification\n");
|
||||||
return false;
|
return false;
|
||||||
|
@ -620,10 +579,9 @@ SetPreserve(KeyTypeInfo *type, struct xkb_keymap *keymap,
|
||||||
new.defs.next = NULL;
|
new.defs.next = NULL;
|
||||||
new.indexMods = rtrn.uval & 0xff;
|
new.indexMods = rtrn.uval & 0xff;
|
||||||
new.indexVMods = (rtrn.uval >> 8) & 0xffff;
|
new.indexVMods = (rtrn.uval >> 8) & 0xffff;
|
||||||
if ((new.indexMods & (~type->mask)) || (new.indexVMods & (~type->vmask)))
|
if ((new.indexMods & (~type->mask)) ||
|
||||||
{
|
(new.indexVMods & (~type->vmask))) {
|
||||||
if (warningLevel > 0)
|
if (warningLevel > 0) {
|
||||||
{
|
|
||||||
WARN("Preserve for modifiers not used by the %s type\n",
|
WARN("Preserve for modifiers not used by the %s type\n",
|
||||||
TypeTxt(keymap, type));
|
TypeTxt(keymap, type));
|
||||||
ACTION("Index %s converted to ", PreserveIndexTxt(keymap, &new));
|
ACTION("Index %s converted to ", PreserveIndexTxt(keymap, &new));
|
||||||
|
@ -633,8 +591,7 @@ SetPreserve(KeyTypeInfo *type, struct xkb_keymap *keymap,
|
||||||
if (warningLevel > 0)
|
if (warningLevel > 0)
|
||||||
INFO("%s\n", PreserveIndexTxt(keymap, &new));
|
INFO("%s\n", PreserveIndexTxt(keymap, &new));
|
||||||
}
|
}
|
||||||
if (!ExprResolveVModMask(value, &rtrn, keymap))
|
if (!ExprResolveVModMask(value, &rtrn, keymap)) {
|
||||||
{
|
|
||||||
ERROR("Preserve value in a key type is not a modifier mask\n");
|
ERROR("Preserve value in a key type is not a modifier mask\n");
|
||||||
ACTION("Ignoring preserve[%s] in type %s\n",
|
ACTION("Ignoring preserve[%s] in type %s\n",
|
||||||
PreserveIndexTxt(keymap, &new), TypeTxt(keymap, type));
|
PreserveIndexTxt(keymap, &new), TypeTxt(keymap, type));
|
||||||
|
@ -643,18 +600,15 @@ SetPreserve(KeyTypeInfo *type, struct xkb_keymap *keymap,
|
||||||
new.preMods = rtrn.uval & 0xff;
|
new.preMods = rtrn.uval & 0xff;
|
||||||
new.preVMods = (rtrn.uval >> 16) & 0xffff;
|
new.preVMods = (rtrn.uval >> 16) & 0xffff;
|
||||||
if ((new.preMods & (~new.indexMods))
|
if ((new.preMods & (~new.indexMods))
|
||||||
|| (new.preVMods & (~new.indexVMods)))
|
|| (new.preVMods & (~new.indexVMods))) {
|
||||||
{
|
if (warningLevel > 0) {
|
||||||
if (warningLevel > 0)
|
|
||||||
{
|
|
||||||
WARN("Illegal value for preserve[%s] in type %s\n",
|
WARN("Illegal value for preserve[%s] in type %s\n",
|
||||||
PreserveTxt(keymap, &new), TypeTxt(keymap, type));
|
PreserveTxt(keymap, &new), TypeTxt(keymap, type));
|
||||||
ACTION("Converted %s to ", PreserveIndexTxt(keymap, &new));
|
ACTION("Converted %s to ", PreserveIndexTxt(keymap, &new));
|
||||||
}
|
}
|
||||||
new.preMods &= new.indexMods;
|
new.preMods &= new.indexMods;
|
||||||
new.preVMods &= new.indexVMods;
|
new.preVMods &= new.indexVMods;
|
||||||
if (warningLevel > 0)
|
if (warningLevel > 0) {
|
||||||
{
|
|
||||||
INFO("%s\n", PreserveIndexTxt(keymap, &new));
|
INFO("%s\n", PreserveIndexTxt(keymap, &new));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -713,8 +667,7 @@ SetLevelName(KeyTypeInfo *type, struct xkb_keymap *keymap, ExprDef *arrayNdx,
|
||||||
if (!ExprResolveLevel(keymap->ctx, arrayNdx, &rtrn))
|
if (!ExprResolveLevel(keymap->ctx, arrayNdx, &rtrn))
|
||||||
return ReportTypeBadType(keymap, type, "level name", "integer");
|
return ReportTypeBadType(keymap, type, "level name", "integer");
|
||||||
level = rtrn.ival - 1;
|
level = rtrn.ival - 1;
|
||||||
if (!ExprResolveString(keymap->ctx, value, &rtrn))
|
if (!ExprResolveString(keymap->ctx, value, &rtrn)) {
|
||||||
{
|
|
||||||
ERROR("Non-string name for level %d in key type %s\n", level + 1,
|
ERROR("Non-string name for level %d in key type %s\n", level + 1,
|
||||||
xkb_atom_text(keymap->ctx, type->name));
|
xkb_atom_text(keymap->ctx, type->name));
|
||||||
ACTION("Ignoring illegal level name definition\n");
|
ACTION("Ignoring illegal level name definition\n");
|
||||||
|
@ -739,25 +692,21 @@ SetKeyTypeField(KeyTypeInfo *type, struct xkb_keymap *keymap,
|
||||||
{
|
{
|
||||||
ExprResult tmp;
|
ExprResult tmp;
|
||||||
|
|
||||||
if (strcasecmp(field, "modifiers") == 0)
|
if (strcasecmp(field, "modifiers") == 0) {
|
||||||
{
|
|
||||||
unsigned mods, vmods;
|
unsigned mods, vmods;
|
||||||
if (arrayNdx != NULL)
|
if (arrayNdx != NULL) {
|
||||||
{
|
|
||||||
WARN("The modifiers field of a key type is not an array\n");
|
WARN("The modifiers field of a key type is not an array\n");
|
||||||
ACTION("Illegal array subscript ignored\n");
|
ACTION("Illegal array subscript ignored\n");
|
||||||
}
|
}
|
||||||
/* get modifier mask for current type */
|
/* get modifier mask for current type */
|
||||||
if (!ExprResolveVModMask(value, &tmp, keymap))
|
if (!ExprResolveVModMask(value, &tmp, keymap)) {
|
||||||
{
|
|
||||||
ERROR("Key type mask field must be a modifier mask\n");
|
ERROR("Key type mask field must be a modifier mask\n");
|
||||||
ACTION("Key type definition ignored\n");
|
ACTION("Key type definition ignored\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
mods = tmp.uval & 0xff; /* core mods */
|
mods = tmp.uval & 0xff; /* core mods */
|
||||||
vmods = (tmp.uval >> 8) & 0xffff; /* xkb virtual mods */
|
vmods = (tmp.uval >> 8) & 0xffff; /* xkb virtual mods */
|
||||||
if (type->defs.defined & _KT_Mask)
|
if (type->defs.defined & _KT_Mask) {
|
||||||
{
|
|
||||||
WARN("Multiple modifier mask definitions for key type %s\n",
|
WARN("Multiple modifier mask definitions for key type %s\n",
|
||||||
xkb_atom_text(keymap->ctx, type->name));
|
xkb_atom_text(keymap->ctx, type->name));
|
||||||
ACTION("Using %s, ", TypeMaskTxt(type, keymap));
|
ACTION("Using %s, ", TypeMaskTxt(type, keymap));
|
||||||
|
@ -769,19 +718,16 @@ SetKeyTypeField(KeyTypeInfo *type, struct xkb_keymap *keymap,
|
||||||
type->defs.defined |= _KT_Mask;
|
type->defs.defined |= _KT_Mask;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (strcasecmp(field, "map") == 0)
|
else if (strcasecmp(field, "map") == 0) {
|
||||||
{
|
|
||||||
type->defs.defined |= _KT_Map;
|
type->defs.defined |= _KT_Map;
|
||||||
return SetMapEntry(type, keymap, arrayNdx, value);
|
return SetMapEntry(type, keymap, arrayNdx, value);
|
||||||
}
|
}
|
||||||
else if (strcasecmp(field, "preserve") == 0)
|
else if (strcasecmp(field, "preserve") == 0) {
|
||||||
{
|
|
||||||
type->defs.defined |= _KT_Preserve;
|
type->defs.defined |= _KT_Preserve;
|
||||||
return SetPreserve(type, keymap, arrayNdx, value);
|
return SetPreserve(type, keymap, arrayNdx, value);
|
||||||
}
|
}
|
||||||
else if ((strcasecmp(field, "levelname") == 0) ||
|
else if ((strcasecmp(field, "levelname") == 0) ||
|
||||||
(strcasecmp(field, "level_name") == 0))
|
(strcasecmp(field, "level_name") == 0)) {
|
||||||
{
|
|
||||||
type->defs.defined |= _KT_LevelNames;
|
type->defs.defined |= _KT_LevelNames;
|
||||||
return SetLevelName(type, keymap, arrayNdx, value);
|
return SetLevelName(type, keymap, arrayNdx, value);
|
||||||
}
|
}
|
||||||
|
@ -801,13 +747,11 @@ HandleKeyTypeVar(VarDef *stmt, struct xkb_keymap *keymap, KeyTypesInfo *info)
|
||||||
if (elem.str && (strcasecmp(elem.str, "type") == 0))
|
if (elem.str && (strcasecmp(elem.str, "type") == 0))
|
||||||
return SetKeyTypeField(&info->dflt, keymap, field.str, arrayNdx,
|
return SetKeyTypeField(&info->dflt, keymap, field.str, arrayNdx,
|
||||||
stmt->value, info);
|
stmt->value, info);
|
||||||
if (elem.str != NULL)
|
if (elem.str != NULL) {
|
||||||
{
|
|
||||||
ERROR("Default for unknown element %s\n", uStringText(elem.str));
|
ERROR("Default for unknown element %s\n", uStringText(elem.str));
|
||||||
ACTION("Value for field %s ignored\n", uStringText(field.str));
|
ACTION("Value for field %s ignored\n", uStringText(field.str));
|
||||||
}
|
}
|
||||||
else if (field.str != NULL)
|
else if (field.str != NULL) {
|
||||||
{
|
|
||||||
ERROR("Default defined for unknown field %s\n",
|
ERROR("Default defined for unknown field %s\n",
|
||||||
uStringText(field.str));
|
uStringText(field.str));
|
||||||
ACTION("Ignored\n");
|
ACTION("Ignored\n");
|
||||||
|
@ -823,10 +767,8 @@ HandleKeyTypeBody(VarDef *def, struct xkb_keymap *keymap,
|
||||||
ExprResult tmp, field;
|
ExprResult tmp, field;
|
||||||
ExprDef *arrayNdx;
|
ExprDef *arrayNdx;
|
||||||
|
|
||||||
for (; def != NULL; def = (VarDef *) def->common.next)
|
for (; def != NULL; def = (VarDef *) def->common.next) {
|
||||||
{
|
if ((def->name) && (def->name->type == ExprFieldRef)) {
|
||||||
if ((def->name) && (def->name->type == ExprFieldRef))
|
|
||||||
{
|
|
||||||
ok = HandleKeyTypeVar(def, keymap, info);
|
ok = HandleKeyTypeVar(def, keymap, info);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -869,8 +811,7 @@ HandleKeyTypeDef(KeyTypeDef *def, struct xkb_keymap *keymap,
|
||||||
type.preserve = NULL;
|
type.preserve = NULL;
|
||||||
|
|
||||||
/* Parse the actual content. */
|
/* Parse the actual content. */
|
||||||
if (!HandleKeyTypeBody(def->body, keymap, &type, info))
|
if (!HandleKeyTypeBody(def->body, keymap, &type, info)) {
|
||||||
{
|
|
||||||
info->errorCount++;
|
info->errorCount++;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -882,14 +823,12 @@ HandleKeyTypeDef(KeyTypeDef *def, struct xkb_keymap *keymap,
|
||||||
(entry->mods.vmods & type.vmask) == entry->mods.vmods)
|
(entry->mods.vmods & type.vmask) == entry->mods.vmods)
|
||||||
AddMapEntry(keymap, &type, entry, false, false);
|
AddMapEntry(keymap, &type, entry, false, false);
|
||||||
}
|
}
|
||||||
if (info->dflt.preserve)
|
if (info->dflt.preserve) {
|
||||||
{
|
|
||||||
PreserveInfo *dflt = info->dflt.preserve;
|
PreserveInfo *dflt = info->dflt.preserve;
|
||||||
while (dflt)
|
while (dflt)
|
||||||
{
|
{
|
||||||
if (((dflt->indexMods & type.mask) == dflt->indexMods) &&
|
if (((dflt->indexMods & type.mask) == dflt->indexMods) &&
|
||||||
((dflt->indexVMods & type.vmask) == dflt->indexVMods))
|
((dflt->indexVMods & type.vmask) == dflt->indexVMods)) {
|
||||||
{
|
|
||||||
AddPreserve(keymap, &type, dflt, false, false);
|
AddPreserve(keymap, &type, dflt, false, false);
|
||||||
}
|
}
|
||||||
dflt = (PreserveInfo *) dflt->defs.next;
|
dflt = (PreserveInfo *) dflt->defs.next;
|
||||||
|
@ -898,16 +837,14 @@ HandleKeyTypeDef(KeyTypeDef *def, struct xkb_keymap *keymap,
|
||||||
|
|
||||||
for (i = 0; i < darray_size(info->dflt.lvlNames); i++) {
|
for (i = 0; i < darray_size(info->dflt.lvlNames); i++) {
|
||||||
if (i < type.numLevels &&
|
if (i < type.numLevels &&
|
||||||
darray_item(info->dflt.lvlNames, i) != XKB_ATOM_NONE)
|
darray_item(info->dflt.lvlNames, i) != XKB_ATOM_NONE) {
|
||||||
{
|
|
||||||
AddLevelName(keymap, &type, i,
|
AddLevelName(keymap, &type, i,
|
||||||
darray_item(info->dflt.lvlNames, i), false);
|
darray_item(info->dflt.lvlNames, i), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now add the new keytype to the info struct */
|
/* Now add the new keytype to the info struct */
|
||||||
if (!AddKeyType(keymap, info, &type))
|
if (!AddKeyType(keymap, info, &type)) {
|
||||||
{
|
|
||||||
info->errorCount++;
|
info->errorCount++;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -932,8 +869,7 @@ HandleKeyTypesFile(XkbFile *file, struct xkb_keymap *keymap,
|
||||||
stmt = file->defs;
|
stmt = file->defs;
|
||||||
while (stmt)
|
while (stmt)
|
||||||
{
|
{
|
||||||
switch (stmt->stmtType)
|
switch (stmt->stmtType) {
|
||||||
{
|
|
||||||
case StmtInclude:
|
case StmtInclude:
|
||||||
if (!HandleIncludeKeyTypes((IncludeStmt *) stmt, keymap, info))
|
if (!HandleIncludeKeyTypes((IncludeStmt *) stmt, keymap, info))
|
||||||
info->errorCount++;
|
info->errorCount++;
|
||||||
|
@ -971,8 +907,7 @@ HandleKeyTypesFile(XkbFile *file, struct xkb_keymap *keymap,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
stmt = stmt->next;
|
stmt = stmt->next;
|
||||||
if (info->errorCount > 10)
|
if (info->errorCount > 10) {
|
||||||
{
|
|
||||||
#ifdef NOISY
|
#ifdef NOISY
|
||||||
ERROR("Too many errors\n");
|
ERROR("Too many errors\n");
|
||||||
#endif
|
#endif
|
||||||
|
@ -998,7 +933,8 @@ ComputeEffectiveMap(struct xkb_keymap *keymap, struct xkb_key_type *type)
|
||||||
if (tmp == 0)
|
if (tmp == 0)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
entry->mods.mask = (entry->mods.real_mods | tmp) & type->mods.mask;
|
entry->mods.mask =
|
||||||
|
(entry->mods.real_mods | tmp) & type->mods.mask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1015,8 +951,7 @@ CopyDefToKeyType(struct xkb_keymap *keymap, struct xkb_key_type *type,
|
||||||
PreserveInfo *pre;
|
PreserveInfo *pre;
|
||||||
|
|
||||||
for (pre = def->preserve; pre != NULL;
|
for (pre = def->preserve; pre != NULL;
|
||||||
pre = (PreserveInfo *) pre->defs.next)
|
pre = (PreserveInfo *) pre->defs.next) {
|
||||||
{
|
|
||||||
struct xkb_kt_map_entry * match;
|
struct xkb_kt_map_entry * match;
|
||||||
struct xkb_kt_map_entry tmp;
|
struct xkb_kt_map_entry tmp;
|
||||||
tmp.mods.real_mods = pre->indexMods;
|
tmp.mods.real_mods = pre->indexMods;
|
||||||
|
@ -1024,8 +959,7 @@ CopyDefToKeyType(struct xkb_keymap *keymap, struct xkb_key_type *type,
|
||||||
tmp.level = 0;
|
tmp.level = 0;
|
||||||
AddMapEntry(keymap, def, &tmp, false, false);
|
AddMapEntry(keymap, def, &tmp, false, false);
|
||||||
match = FindMatchingMapEntry(def, pre->indexMods, pre->indexVMods);
|
match = FindMatchingMapEntry(def, pre->indexMods, pre->indexVMods);
|
||||||
if (!match)
|
if (!match) {
|
||||||
{
|
|
||||||
WSGO("Couldn't find matching entry for preserve\n");
|
WSGO("Couldn't find matching entry for preserve\n");
|
||||||
ACTION("Aborting\n");
|
ACTION("Aborting\n");
|
||||||
return false;
|
return false;
|
||||||
|
@ -1036,20 +970,16 @@ CopyDefToKeyType(struct xkb_keymap *keymap, struct xkb_key_type *type,
|
||||||
type->mods.vmods = def->vmask;
|
type->mods.vmods = def->vmask;
|
||||||
type->num_levels = def->numLevels;
|
type->num_levels = def->numLevels;
|
||||||
memcpy(&type->map, &def->entries, sizeof(def->entries));
|
memcpy(&type->map, &def->entries, sizeof(def->entries));
|
||||||
if (def->preserve)
|
if (def->preserve) {
|
||||||
{
|
|
||||||
type->preserve = uTypedCalloc(darray_size(type->map), struct xkb_mods);
|
type->preserve = uTypedCalloc(darray_size(type->map), struct xkb_mods);
|
||||||
if (!type->preserve)
|
if (!type->preserve) {
|
||||||
{
|
|
||||||
WARN("Couldn't allocate preserve array in CopyDefToKeyType\n");
|
WARN("Couldn't allocate preserve array in CopyDefToKeyType\n");
|
||||||
ACTION("Preserve setting for type %s lost\n",
|
ACTION("Preserve setting for type %s lost\n",
|
||||||
xkb_atom_text(keymap->ctx, def->name));
|
xkb_atom_text(keymap->ctx, def->name));
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
pre = def->preserve;
|
pre = def->preserve;
|
||||||
for (; pre != NULL; pre = (PreserveInfo *) pre->defs.next)
|
for (; pre != NULL; pre = (PreserveInfo *) pre->defs.next) {
|
||||||
{
|
|
||||||
int ndx = pre->matchingMapIndex;
|
int ndx = pre->matchingMapIndex;
|
||||||
type->preserve[ndx].mask = pre->preMods;
|
type->preserve[ndx].mask = pre->preMods;
|
||||||
type->preserve[ndx].real_mods = pre->preMods;
|
type->preserve[ndx].real_mods = pre->preMods;
|
||||||
|
@ -1151,7 +1081,8 @@ static const struct xkb_key_type canonicalTypes[XkbNumRequiredTypes] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
InitCanonicalKeyTypes(struct xkb_keymap *keymap, unsigned which, int keypadVMod)
|
InitCanonicalKeyTypes(struct xkb_keymap *keymap, unsigned which,
|
||||||
|
int keypadVMod)
|
||||||
{
|
{
|
||||||
struct xkb_client_map *map;
|
struct xkb_client_map *map;
|
||||||
const struct xkb_key_type *from;
|
const struct xkb_key_type *from;
|
||||||
|
@ -1210,7 +1141,8 @@ InitCanonicalKeyTypes(struct xkb_keymap *keymap, unsigned which, int keypadVMod)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CompileKeyTypes(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge)
|
CompileKeyTypes(XkbFile *file, struct xkb_keymap *keymap,
|
||||||
|
enum merge_mode merge)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
struct xkb_key_type *type, *next;
|
struct xkb_key_type *type, *next;
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
/************************************************************
|
/************************************************************
|
||||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||||
|
*
|
||||||
Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
software and its documentation for any purpose and without
|
* software and its documentation for any purpose and without
|
||||||
fee is hereby granted, provided that the above copyright
|
* fee is hereby granted, provided that the above copyright
|
||||||
notice appear in all copies and that both that copyright
|
* notice appear in all copies and that both that copyright
|
||||||
notice and this permission notice appear in supporting
|
* notice and this permission notice appear in supporting
|
||||||
documentation, and that the name of Silicon Graphics not be
|
* documentation, and that the name of Silicon Graphics not be
|
||||||
used in advertising or publicity pertaining to distribution
|
* used in advertising or publicity pertaining to distribution
|
||||||
of the software without specific prior written permission.
|
* of the software without specific prior written permission.
|
||||||
Silicon Graphics makes no representation about the suitability
|
* Silicon Graphics makes no representation about the suitability
|
||||||
of this software for any purpose. It is provided "as is"
|
* of this software for any purpose. It is provided "as is"
|
||||||
without any express or implied warranty.
|
* without any express or implied warranty.
|
||||||
|
*
|
||||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
||||||
#include "xkbcomp-priv.h"
|
#include "xkbcomp-priv.h"
|
||||||
|
@ -54,16 +54,13 @@ ProcessIncludeFile(struct xkb_context *ctx,
|
||||||
XkbFile *rtrn, *mapToUse, *next;
|
XkbFile *rtrn, *mapToUse, *next;
|
||||||
|
|
||||||
file = XkbFindFileInPath(ctx, stmt->file, file_type, &stmt->path);
|
file = XkbFindFileInPath(ctx, stmt->file, file_type, &stmt->path);
|
||||||
if (file == NULL)
|
if (file == NULL) {
|
||||||
{
|
|
||||||
ERROR("Can't find file \"%s\" for %s include\n", stmt->file,
|
ERROR("Can't find file \"%s\" for %s include\n", stmt->file,
|
||||||
XkbDirectoryForInclude(file_type));
|
XkbDirectoryForInclude(file_type));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!XKBParseFile(ctx, file, stmt->file, &rtrn)) {
|
||||||
if (!XKBParseFile(ctx, file, stmt->file, &rtrn))
|
|
||||||
{
|
|
||||||
ERROR("Error interpreting include file \"%s\"\n", stmt->file);
|
ERROR("Error interpreting include file \"%s\"\n", stmt->file);
|
||||||
fclose(file);
|
fclose(file);
|
||||||
return false;
|
return false;
|
||||||
|
@ -71,39 +68,33 @@ ProcessIncludeFile(struct xkb_context *ctx,
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
|
||||||
mapToUse = rtrn;
|
mapToUse = rtrn;
|
||||||
if (stmt->map != NULL)
|
if (stmt->map != NULL) {
|
||||||
{
|
|
||||||
while (mapToUse)
|
while (mapToUse)
|
||||||
{
|
{
|
||||||
next = (XkbFile *) mapToUse->common.next;
|
next = (XkbFile *) mapToUse->common.next;
|
||||||
mapToUse->common.next = NULL;
|
mapToUse->common.next = NULL;
|
||||||
if (strcmp(mapToUse->name, stmt->map) == 0 &&
|
if (strcmp(mapToUse->name, stmt->map) == 0 &&
|
||||||
mapToUse->type == file_type)
|
mapToUse->type == file_type) {
|
||||||
{
|
|
||||||
FreeXKBFile(next);
|
FreeXKBFile(next);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
FreeXKBFile(mapToUse);
|
FreeXKBFile(mapToUse);
|
||||||
}
|
}
|
||||||
mapToUse = next;
|
mapToUse = next;
|
||||||
}
|
}
|
||||||
if (!mapToUse)
|
if (!mapToUse) {
|
||||||
{
|
|
||||||
ERROR("No %s named \"%s\" in the include file \"%s\"\n",
|
ERROR("No %s named \"%s\" in the include file \"%s\"\n",
|
||||||
XkbcFileTypeText(file_type), stmt->map, stmt->file);
|
XkbcFileTypeText(file_type), stmt->map, stmt->file);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((rtrn->common.next != NULL) && (warningLevel > 5))
|
else if ((rtrn->common.next != NULL) && (warningLevel > 5)) {
|
||||||
{
|
|
||||||
WARN("No map in include statement, but \"%s\" contains several\n",
|
WARN("No map in include statement, but \"%s\" contains several\n",
|
||||||
stmt->file);
|
stmt->file);
|
||||||
ACTION("Using first defined map, \"%s\"\n", rtrn->name);
|
ACTION("Using first defined map, \"%s\"\n", rtrn->name);
|
||||||
}
|
}
|
||||||
if (mapToUse->type != file_type)
|
if (mapToUse->type != file_type) {
|
||||||
{
|
|
||||||
ERROR("Include file wrong type (expected %s, got %s)\n",
|
ERROR("Include file wrong type (expected %s, got %s)\n",
|
||||||
XkbcFileTypeText(file_type), XkbcFileTypeText(mapToUse->type));
|
XkbcFileTypeText(file_type), XkbcFileTypeText(mapToUse->type));
|
||||||
ACTION("Include file \"%s\" ignored\n", stmt->file);
|
ACTION("Include file \"%s\" ignored\n", stmt->file);
|
||||||
|
@ -160,13 +151,10 @@ UseNewField(unsigned field,
|
||||||
bool useNew;
|
bool useNew;
|
||||||
|
|
||||||
useNew = false;
|
useNew = false;
|
||||||
if (oldDefs->defined & field)
|
if (oldDefs->defined & field) {
|
||||||
{
|
if (newDefs->defined & field) {
|
||||||
if (newDefs->defined & field)
|
|
||||||
{
|
|
||||||
if (((oldDefs->file_id == newDefs->file_id)
|
if (((oldDefs->file_id == newDefs->file_id)
|
||||||
&& (warningLevel > 0)) || (warningLevel > 9))
|
&& (warningLevel > 0)) || (warningLevel > 9)) {
|
||||||
{
|
|
||||||
*pCollide |= field;
|
*pCollide |= field;
|
||||||
}
|
}
|
||||||
if (newDefs->merge != MERGE_AUGMENT)
|
if (newDefs->merge != MERGE_AUGMENT)
|
||||||
|
@ -181,11 +169,9 @@ UseNewField(unsigned field,
|
||||||
void *
|
void *
|
||||||
ClearCommonInfo(CommonInfo * cmn)
|
ClearCommonInfo(CommonInfo * cmn)
|
||||||
{
|
{
|
||||||
if (cmn != NULL)
|
if (cmn != NULL) {
|
||||||
{
|
|
||||||
CommonInfo *this, *next;
|
CommonInfo *this, *next;
|
||||||
for (this = cmn; this != NULL; this = next)
|
for (this = cmn; this != NULL; this = next) {
|
||||||
{
|
|
||||||
next = this->next;
|
next = this->next;
|
||||||
free(this);
|
free(this);
|
||||||
}
|
}
|
||||||
|
@ -204,8 +190,7 @@ AddCommonInfo(CommonInfo * old, CommonInfo * new)
|
||||||
old = old->next;
|
old = old->next;
|
||||||
}
|
}
|
||||||
new->next = NULL;
|
new->next = NULL;
|
||||||
if (old)
|
if (old) {
|
||||||
{
|
|
||||||
old->next = new;
|
old->next = new;
|
||||||
return first;
|
return first;
|
||||||
}
|
}
|
||||||
|
@ -234,44 +219,34 @@ FindNamedKey(struct xkb_keymap *keymap, unsigned long name,
|
||||||
{
|
{
|
||||||
unsigned n;
|
unsigned n;
|
||||||
|
|
||||||
if (start_from < keymap->min_key_code)
|
if (start_from < keymap->min_key_code) {
|
||||||
{
|
|
||||||
start_from = keymap->min_key_code;
|
start_from = keymap->min_key_code;
|
||||||
}
|
}
|
||||||
else if (start_from > keymap->max_key_code)
|
else if (start_from > keymap->max_key_code) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
*kc_rtrn = 0; /* some callers rely on this */
|
*kc_rtrn = 0; /* some callers rely on this */
|
||||||
if (keymap && keymap->names && !darray_empty(keymap->names->keys))
|
if (keymap && keymap->names && !darray_empty(keymap->names->keys)) {
|
||||||
{
|
for (n = start_from; n <= keymap->max_key_code; n++) {
|
||||||
for (n = start_from; n <= keymap->max_key_code; n++)
|
|
||||||
{
|
|
||||||
unsigned long tmp;
|
unsigned long tmp;
|
||||||
tmp = KeyNameToLong(darray_item(keymap->names->keys, n).name);
|
tmp = KeyNameToLong(darray_item(keymap->names->keys, n).name);
|
||||||
if (tmp == name)
|
if (tmp == name) {
|
||||||
{
|
|
||||||
*kc_rtrn = n;
|
*kc_rtrn = n;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (use_aliases)
|
if (use_aliases) {
|
||||||
{
|
|
||||||
unsigned long new_name;
|
unsigned long new_name;
|
||||||
if (FindKeyNameForAlias(keymap, name, &new_name))
|
if (FindKeyNameForAlias(keymap, name, &new_name))
|
||||||
return FindNamedKey(keymap, new_name, kc_rtrn, false,
|
return FindNamedKey(keymap, new_name, kc_rtrn, false,
|
||||||
create, 0);
|
create, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (create)
|
if (create) {
|
||||||
{
|
if ((!keymap->names) || darray_empty(keymap->names->keys)) {
|
||||||
if ((!keymap->names) || darray_empty(keymap->names->keys))
|
if (XkbcAllocNames(keymap, XkbKeyNamesMask, 0) != Success) {
|
||||||
{
|
if (warningLevel > 0) {
|
||||||
if (XkbcAllocNames(keymap, XkbKeyNamesMask, 0) != Success)
|
|
||||||
{
|
|
||||||
if (warningLevel > 0)
|
|
||||||
{
|
|
||||||
WARN("Couldn't allocate key names in FindNamedKey\n");
|
WARN("Couldn't allocate key names in FindNamedKey\n");
|
||||||
ACTION("Key \"%s\" not automatically created\n",
|
ACTION("Key \"%s\" not automatically created\n",
|
||||||
longText(name));
|
longText(name));
|
||||||
|
@ -280,10 +255,8 @@ FindNamedKey(struct xkb_keymap *keymap, unsigned long name,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Find first unused keycode and store our key here */
|
/* Find first unused keycode and store our key here */
|
||||||
for (n = keymap->min_key_code; n <= keymap->max_key_code; n++)
|
for (n = keymap->min_key_code; n <= keymap->max_key_code; n++) {
|
||||||
{
|
if (darray_item(keymap->names->keys, n).name[0] == '\0') {
|
||||||
if (darray_item(keymap->names->keys, n).name[0] == '\0')
|
|
||||||
{
|
|
||||||
char buf[XkbKeyNameLength + 1];
|
char buf[XkbKeyNameLength + 1];
|
||||||
LongToKeyName(name, buf);
|
LongToKeyName(name, buf);
|
||||||
memcpy(darray_item(keymap->names->keys, n).name, buf,
|
memcpy(darray_item(keymap->names->keys, n).name, buf,
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
/************************************************************
|
/************************************************************
|
||||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||||
|
*
|
||||||
Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
software and its documentation for any purpose and without
|
* software and its documentation for any purpose and without
|
||||||
fee is hereby granted, provided that the above copyright
|
* fee is hereby granted, provided that the above copyright
|
||||||
notice appear in all copies and that both that copyright
|
* notice appear in all copies and that both that copyright
|
||||||
notice and this permission notice appear in supporting
|
* notice and this permission notice appear in supporting
|
||||||
documentation, and that the name of Silicon Graphics not be
|
* documentation, and that the name of Silicon Graphics not be
|
||||||
used in advertising or publicity pertaining to distribution
|
* used in advertising or publicity pertaining to distribution
|
||||||
of the software without specific prior written permission.
|
* of the software without specific prior written permission.
|
||||||
Silicon Graphics makes no representation about the suitability
|
* Silicon Graphics makes no representation about the suitability
|
||||||
of this software for any purpose. It is provided "as is"
|
* of this software for any purpose. It is provided "as is"
|
||||||
without any express or implied warranty.
|
* without any express or implied warranty.
|
||||||
|
*
|
||||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
||||||
#include "parseutils.h"
|
#include "parseutils.h"
|
||||||
|
@ -38,8 +38,7 @@ AppendStmt(ParseCommon * to, ParseCommon * append)
|
||||||
{
|
{
|
||||||
to = to->next;
|
to = to->next;
|
||||||
}
|
}
|
||||||
if (to)
|
if (to) {
|
||||||
{
|
|
||||||
to->next = append;
|
to->next = append;
|
||||||
return start;
|
return start;
|
||||||
}
|
}
|
||||||
|
@ -51,15 +50,13 @@ ExprCreate(unsigned op, unsigned type)
|
||||||
{
|
{
|
||||||
ExprDef *expr;
|
ExprDef *expr;
|
||||||
expr = uTypedAlloc(ExprDef);
|
expr = uTypedAlloc(ExprDef);
|
||||||
if (expr)
|
if (expr) {
|
||||||
{
|
|
||||||
expr->common.stmtType = StmtExpr;
|
expr->common.stmtType = StmtExpr;
|
||||||
expr->common.next = NULL;
|
expr->common.next = NULL;
|
||||||
expr->op = op;
|
expr->op = op;
|
||||||
expr->type = type;
|
expr->type = type;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
FATAL("Couldn't allocate expression in parser\n");
|
FATAL("Couldn't allocate expression in parser\n");
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
|
@ -71,16 +68,14 @@ ExprCreateUnary(unsigned op, unsigned type, ExprDef * child)
|
||||||
{
|
{
|
||||||
ExprDef *expr;
|
ExprDef *expr;
|
||||||
expr = uTypedAlloc(ExprDef);
|
expr = uTypedAlloc(ExprDef);
|
||||||
if (expr)
|
if (expr) {
|
||||||
{
|
|
||||||
expr->common.stmtType = StmtExpr;
|
expr->common.stmtType = StmtExpr;
|
||||||
expr->common.next = NULL;
|
expr->common.next = NULL;
|
||||||
expr->op = op;
|
expr->op = op;
|
||||||
expr->type = type;
|
expr->type = type;
|
||||||
expr->value.child = child;
|
expr->value.child = child;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
FATAL("Couldn't allocate expression in parser\n");
|
FATAL("Couldn't allocate expression in parser\n");
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
|
@ -92,8 +87,7 @@ ExprCreateBinary(unsigned op, ExprDef * left, ExprDef * right)
|
||||||
{
|
{
|
||||||
ExprDef *expr;
|
ExprDef *expr;
|
||||||
expr = uTypedAlloc(ExprDef);
|
expr = uTypedAlloc(ExprDef);
|
||||||
if (expr)
|
if (expr) {
|
||||||
{
|
|
||||||
expr->common.stmtType = StmtExpr;
|
expr->common.stmtType = StmtExpr;
|
||||||
expr->common.next = NULL;
|
expr->common.next = NULL;
|
||||||
expr->op = op;
|
expr->op = op;
|
||||||
|
@ -106,8 +100,7 @@ ExprCreateBinary(unsigned op, ExprDef * left, ExprDef * right)
|
||||||
expr->value.binary.left = left;
|
expr->value.binary.left = left;
|
||||||
expr->value.binary.right = right;
|
expr->value.binary.right = right;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
FATAL("Couldn't allocate expression in parser\n");
|
FATAL("Couldn't allocate expression in parser\n");
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
|
@ -120,16 +113,14 @@ KeycodeCreate(const char *name, unsigned long value)
|
||||||
KeycodeDef *def;
|
KeycodeDef *def;
|
||||||
|
|
||||||
def = uTypedAlloc(KeycodeDef);
|
def = uTypedAlloc(KeycodeDef);
|
||||||
if (def)
|
if (def) {
|
||||||
{
|
|
||||||
def->common.stmtType = StmtKeycodeDef;
|
def->common.stmtType = StmtKeycodeDef;
|
||||||
def->common.next = NULL;
|
def->common.next = NULL;
|
||||||
strncpy(def->name, name, XkbKeyNameLength);
|
strncpy(def->name, name, XkbKeyNameLength);
|
||||||
def->name[XkbKeyNameLength] = '\0';
|
def->name[XkbKeyNameLength] = '\0';
|
||||||
def->value = value;
|
def->value = value;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
FATAL("Couldn't allocate key name definition in parser\n");
|
FATAL("Couldn't allocate key name definition in parser\n");
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
|
@ -142,8 +133,7 @@ KeyAliasCreate(const char *alias, const char *real)
|
||||||
KeyAliasDef *def;
|
KeyAliasDef *def;
|
||||||
|
|
||||||
def = uTypedAlloc(KeyAliasDef);
|
def = uTypedAlloc(KeyAliasDef);
|
||||||
if (def)
|
if (def) {
|
||||||
{
|
|
||||||
def->common.stmtType = StmtKeyAliasDef;
|
def->common.stmtType = StmtKeyAliasDef;
|
||||||
def->common.next = NULL;
|
def->common.next = NULL;
|
||||||
strncpy(def->alias, alias, XkbKeyNameLength);
|
strncpy(def->alias, alias, XkbKeyNameLength);
|
||||||
|
@ -151,8 +141,7 @@ KeyAliasCreate(const char *alias, const char *real)
|
||||||
strncpy(def->real, real, XkbKeyNameLength);
|
strncpy(def->real, real, XkbKeyNameLength);
|
||||||
def->real[XkbKeyNameLength] = '\0';
|
def->real[XkbKeyNameLength] = '\0';
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
FATAL("Couldn't allocate key alias definition in parser\n");
|
FATAL("Couldn't allocate key alias definition in parser\n");
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
|
@ -164,15 +153,13 @@ VModCreate(xkb_atom_t name, ExprDef * value)
|
||||||
{
|
{
|
||||||
VModDef *def;
|
VModDef *def;
|
||||||
def = uTypedAlloc(VModDef);
|
def = uTypedAlloc(VModDef);
|
||||||
if (def)
|
if (def) {
|
||||||
{
|
|
||||||
def->common.stmtType = StmtVModDef;
|
def->common.stmtType = StmtVModDef;
|
||||||
def->common.next = NULL;
|
def->common.next = NULL;
|
||||||
def->name = name;
|
def->name = name;
|
||||||
def->value = value;
|
def->value = value;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
FATAL("Couldn't allocate variable definition in parser\n");
|
FATAL("Couldn't allocate variable definition in parser\n");
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
|
@ -184,15 +171,13 @@ VarCreate(ExprDef * name, ExprDef * value)
|
||||||
{
|
{
|
||||||
VarDef *def;
|
VarDef *def;
|
||||||
def = uTypedAlloc(VarDef);
|
def = uTypedAlloc(VarDef);
|
||||||
if (def)
|
if (def) {
|
||||||
{
|
|
||||||
def->common.stmtType = StmtVarDef;
|
def->common.stmtType = StmtVarDef;
|
||||||
def->common.next = NULL;
|
def->common.next = NULL;
|
||||||
def->name = name;
|
def->name = name;
|
||||||
def->value = value;
|
def->value = value;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
FATAL("Couldn't allocate variable definition in parser\n");
|
FATAL("Couldn't allocate variable definition in parser\n");
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
|
@ -217,15 +202,13 @@ InterpCreate(char *sym, ExprDef * match)
|
||||||
InterpDef *def;
|
InterpDef *def;
|
||||||
|
|
||||||
def = uTypedAlloc(InterpDef);
|
def = uTypedAlloc(InterpDef);
|
||||||
if (def)
|
if (def) {
|
||||||
{
|
|
||||||
def->common.stmtType = StmtInterpDef;
|
def->common.stmtType = StmtInterpDef;
|
||||||
def->common.next = NULL;
|
def->common.next = NULL;
|
||||||
def->sym = sym;
|
def->sym = sym;
|
||||||
def->match = match;
|
def->match = match;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
FATAL("Couldn't allocate interp definition in parser\n");
|
FATAL("Couldn't allocate interp definition in parser\n");
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
|
@ -238,16 +221,14 @@ KeyTypeCreate(xkb_atom_t name, VarDef * body)
|
||||||
KeyTypeDef *def;
|
KeyTypeDef *def;
|
||||||
|
|
||||||
def = uTypedAlloc(KeyTypeDef);
|
def = uTypedAlloc(KeyTypeDef);
|
||||||
if (def)
|
if (def) {
|
||||||
{
|
|
||||||
def->common.stmtType = StmtKeyTypeDef;
|
def->common.stmtType = StmtKeyTypeDef;
|
||||||
def->common.next = NULL;
|
def->common.next = NULL;
|
||||||
def->merge = MERGE_DEFAULT;
|
def->merge = MERGE_DEFAULT;
|
||||||
def->name = name;
|
def->name = name;
|
||||||
def->body = body;
|
def->body = body;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
FATAL("Couldn't allocate key type definition in parser\n");
|
FATAL("Couldn't allocate key type definition in parser\n");
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
|
@ -260,8 +241,7 @@ SymbolsCreate(const char *keyName, ExprDef *symbols)
|
||||||
SymbolsDef *def;
|
SymbolsDef *def;
|
||||||
|
|
||||||
def = uTypedAlloc(SymbolsDef);
|
def = uTypedAlloc(SymbolsDef);
|
||||||
if (def)
|
if (def) {
|
||||||
{
|
|
||||||
def->common.stmtType = StmtSymbolsDef;
|
def->common.stmtType = StmtSymbolsDef;
|
||||||
def->common.next = NULL;
|
def->common.next = NULL;
|
||||||
def->merge = MERGE_DEFAULT;
|
def->merge = MERGE_DEFAULT;
|
||||||
|
@ -269,8 +249,7 @@ SymbolsCreate(const char *keyName, ExprDef *symbols)
|
||||||
strncpy(def->keyName, keyName, 4);
|
strncpy(def->keyName, keyName, 4);
|
||||||
def->symbols = symbols;
|
def->symbols = symbols;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
FATAL("Couldn't allocate symbols definition in parser\n");
|
FATAL("Couldn't allocate symbols definition in parser\n");
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
|
@ -283,16 +262,14 @@ GroupCompatCreate(int group, ExprDef * val)
|
||||||
GroupCompatDef *def;
|
GroupCompatDef *def;
|
||||||
|
|
||||||
def = uTypedAlloc(GroupCompatDef);
|
def = uTypedAlloc(GroupCompatDef);
|
||||||
if (def)
|
if (def) {
|
||||||
{
|
|
||||||
def->common.stmtType = StmtGroupCompatDef;
|
def->common.stmtType = StmtGroupCompatDef;
|
||||||
def->common.next = NULL;
|
def->common.next = NULL;
|
||||||
def->merge = MERGE_DEFAULT;
|
def->merge = MERGE_DEFAULT;
|
||||||
def->group = group;
|
def->group = group;
|
||||||
def->def = val;
|
def->def = val;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
FATAL("Couldn't allocate group compat definition in parser\n");
|
FATAL("Couldn't allocate group compat definition in parser\n");
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
|
@ -305,16 +282,14 @@ ModMapCreate(uint32_t modifier, ExprDef * keys)
|
||||||
ModMapDef *def;
|
ModMapDef *def;
|
||||||
|
|
||||||
def = uTypedAlloc(ModMapDef);
|
def = uTypedAlloc(ModMapDef);
|
||||||
if (def)
|
if (def) {
|
||||||
{
|
|
||||||
def->common.stmtType = StmtModMapDef;
|
def->common.stmtType = StmtModMapDef;
|
||||||
def->common.next = NULL;
|
def->common.next = NULL;
|
||||||
def->merge = MERGE_DEFAULT;
|
def->merge = MERGE_DEFAULT;
|
||||||
def->modifier = modifier;
|
def->modifier = modifier;
|
||||||
def->keys = keys;
|
def->keys = keys;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
FATAL("Couldn't allocate mod mask definition in parser\n");
|
FATAL("Couldn't allocate mod mask definition in parser\n");
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
|
@ -327,16 +302,14 @@ IndicatorMapCreate(xkb_atom_t name, VarDef * body)
|
||||||
IndicatorMapDef *def;
|
IndicatorMapDef *def;
|
||||||
|
|
||||||
def = uTypedAlloc(IndicatorMapDef);
|
def = uTypedAlloc(IndicatorMapDef);
|
||||||
if (def)
|
if (def) {
|
||||||
{
|
|
||||||
def->common.stmtType = StmtIndicatorMapDef;
|
def->common.stmtType = StmtIndicatorMapDef;
|
||||||
def->common.next = NULL;
|
def->common.next = NULL;
|
||||||
def->merge = MERGE_DEFAULT;
|
def->merge = MERGE_DEFAULT;
|
||||||
def->name = name;
|
def->name = name;
|
||||||
def->body = body;
|
def->body = body;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
FATAL("Couldn't allocate indicator map definition in parser\n");
|
FATAL("Couldn't allocate indicator map definition in parser\n");
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
|
@ -349,8 +322,7 @@ IndicatorNameCreate(int ndx, ExprDef * name, bool virtual)
|
||||||
IndicatorNameDef *def;
|
IndicatorNameDef *def;
|
||||||
|
|
||||||
def = uTypedAlloc(IndicatorNameDef);
|
def = uTypedAlloc(IndicatorNameDef);
|
||||||
if (def)
|
if (def) {
|
||||||
{
|
|
||||||
def->common.stmtType = StmtIndicatorNameDef;
|
def->common.stmtType = StmtIndicatorNameDef;
|
||||||
def->common.next = NULL;
|
def->common.next = NULL;
|
||||||
def->merge = MERGE_DEFAULT;
|
def->merge = MERGE_DEFAULT;
|
||||||
|
@ -358,8 +330,7 @@ IndicatorNameCreate(int ndx, ExprDef * name, bool virtual)
|
||||||
def->name = name;
|
def->name = name;
|
||||||
def->virtual = virtual;
|
def->virtual = virtual;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
FATAL("Couldn't allocate indicator index definition in parser\n");
|
FATAL("Couldn't allocate indicator index definition in parser\n");
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
|
@ -372,8 +343,7 @@ ActionCreate(xkb_atom_t name, ExprDef * args)
|
||||||
ExprDef *act;
|
ExprDef *act;
|
||||||
|
|
||||||
act = uTypedAlloc(ExprDef);
|
act = uTypedAlloc(ExprDef);
|
||||||
if (act)
|
if (act) {
|
||||||
{
|
|
||||||
act->common.stmtType = StmtExpr;
|
act->common.stmtType = StmtExpr;
|
||||||
act->common.next = NULL;
|
act->common.next = NULL;
|
||||||
act->op = ExprActionDecl;
|
act->op = ExprActionDecl;
|
||||||
|
@ -391,8 +361,7 @@ CreateKeysymList(char *sym)
|
||||||
ExprDef *def;
|
ExprDef *def;
|
||||||
|
|
||||||
def = ExprCreate(ExprKeysymList, TypeSymbols);
|
def = ExprCreate(ExprKeysymList, TypeSymbols);
|
||||||
if (!def)
|
if (!def) {
|
||||||
{
|
|
||||||
FATAL("Couldn't allocate expression for keysym list in parser\n");
|
FATAL("Couldn't allocate expression for keysym list in parser\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -457,20 +426,17 @@ LookupKeysym(const char *str, xkb_keysym_t *sym_rtrn)
|
||||||
xkb_keysym_t sym;
|
xkb_keysym_t sym;
|
||||||
|
|
||||||
if ((!str) || (strcasecmp(str, "any") == 0) ||
|
if ((!str) || (strcasecmp(str, "any") == 0) ||
|
||||||
(strcasecmp(str, "nosymbol") == 0))
|
(strcasecmp(str, "nosymbol") == 0)) {
|
||||||
{
|
|
||||||
*sym_rtrn = XKB_KEY_NoSymbol;
|
*sym_rtrn = XKB_KEY_NoSymbol;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if ((strcasecmp(str, "none") == 0) ||
|
else if ((strcasecmp(str, "none") == 0) ||
|
||||||
(strcasecmp(str, "voidsymbol") == 0))
|
(strcasecmp(str, "voidsymbol") == 0)) {
|
||||||
{
|
|
||||||
*sym_rtrn = XKB_KEY_VoidSymbol;
|
*sym_rtrn = XKB_KEY_VoidSymbol;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
sym = xkb_keysym_from_name(str);
|
sym = xkb_keysym_from_name(str);
|
||||||
if (sym != XKB_KEY_NoSymbol)
|
if (sym != XKB_KEY_NoSymbol) {
|
||||||
{
|
|
||||||
*sym_rtrn = sym;
|
*sym_rtrn = sym;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -495,23 +461,19 @@ IncludeCreate(char *str, enum merge_mode merge)
|
||||||
stmt = uDupString(str);
|
stmt = uDupString(str);
|
||||||
while ((tmp) && (*tmp))
|
while ((tmp) && (*tmp))
|
||||||
{
|
{
|
||||||
if (XkbParseIncludeMap(&tmp, &file, &map, &nextop, &extra_data))
|
if (XkbParseIncludeMap(&tmp, &file, &map, &nextop, &extra_data)) {
|
||||||
{
|
if ((file == NULL) && (map == NULL)) {
|
||||||
if ((file == NULL) && (map == NULL))
|
|
||||||
{
|
|
||||||
if (haveSelf)
|
if (haveSelf)
|
||||||
goto BAIL;
|
goto BAIL;
|
||||||
haveSelf = true;
|
haveSelf = true;
|
||||||
}
|
}
|
||||||
if (first == NULL)
|
if (first == NULL)
|
||||||
first = incl = uTypedAlloc(IncludeStmt);
|
first = incl = uTypedAlloc(IncludeStmt);
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
incl->next = uTypedAlloc(IncludeStmt);
|
incl->next = uTypedAlloc(IncludeStmt);
|
||||||
incl = incl->next;
|
incl = incl->next;
|
||||||
}
|
}
|
||||||
if (incl)
|
if (incl) {
|
||||||
{
|
|
||||||
incl->common.stmtType = StmtInclude;
|
incl->common.stmtType = StmtInclude;
|
||||||
incl->common.next = NULL;
|
incl->common.next = NULL;
|
||||||
incl->merge = merge;
|
incl->merge = merge;
|
||||||
|
@ -522,8 +484,7 @@ IncludeCreate(char *str, enum merge_mode merge)
|
||||||
incl->path = NULL;
|
incl->path = NULL;
|
||||||
incl->next = NULL;
|
incl->next = NULL;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
WSGO("Allocation failure in IncludeCreate\n");
|
WSGO("Allocation failure in IncludeCreate\n");
|
||||||
ACTION("Using only part of the include\n");
|
ACTION("Using only part of the include\n");
|
||||||
break;
|
break;
|
||||||
|
@ -533,8 +494,7 @@ IncludeCreate(char *str, enum merge_mode merge)
|
||||||
else
|
else
|
||||||
merge = MERGE_OVERRIDE;
|
merge = MERGE_OVERRIDE;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
goto BAIL;
|
goto BAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -559,16 +519,12 @@ CheckDefaultMap(XkbFile * maps, const char *fileName)
|
||||||
|
|
||||||
dflt = NULL;
|
dflt = NULL;
|
||||||
for (tmp = maps, dflt = NULL; tmp != NULL;
|
for (tmp = maps, dflt = NULL; tmp != NULL;
|
||||||
tmp = (XkbFile *) tmp->common.next)
|
tmp = (XkbFile *) tmp->common.next) {
|
||||||
{
|
if (tmp->flags & XkbLC_Default) {
|
||||||
if (tmp->flags & XkbLC_Default)
|
|
||||||
{
|
|
||||||
if (dflt == NULL)
|
if (dflt == NULL)
|
||||||
dflt = tmp;
|
dflt = tmp;
|
||||||
else
|
else {
|
||||||
{
|
if (warningLevel > 2) {
|
||||||
if (warningLevel > 2)
|
|
||||||
{
|
|
||||||
WARN("Multiple default components in %s\n",
|
WARN("Multiple default components in %s\n",
|
||||||
(fileName ? fileName : "(unknown)"));
|
(fileName ? fileName : "(unknown)"));
|
||||||
ACTION("Using %s, ignoring %s\n",
|
ACTION("Using %s, ignoring %s\n",
|
||||||
|
@ -612,8 +568,7 @@ CreateXKBFile(struct xkb_context *ctx, enum xkb_file_type type, char *name,
|
||||||
XkbFile *file;
|
XkbFile *file;
|
||||||
|
|
||||||
file = uTypedAlloc(XkbFile);
|
file = uTypedAlloc(XkbFile);
|
||||||
if (file)
|
if (file) {
|
||||||
{
|
|
||||||
EnsureSafeMapName(name);
|
EnsureSafeMapName(name);
|
||||||
memset(file, 0, sizeof(XkbFile));
|
memset(file, 0, sizeof(XkbFile));
|
||||||
file->type = type;
|
file->type = type;
|
||||||
|
@ -634,8 +589,7 @@ FreeExpr(ExprDef *expr)
|
||||||
if (!expr)
|
if (!expr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch (expr->op)
|
switch (expr->op) {
|
||||||
{
|
|
||||||
case ExprActionList:
|
case ExprActionList:
|
||||||
case OpNegate:
|
case OpNegate:
|
||||||
case OpUnaryPlus:
|
case OpUnaryPlus:
|
||||||
|
@ -643,6 +597,7 @@ FreeExpr(ExprDef *expr)
|
||||||
case OpInvert:
|
case OpInvert:
|
||||||
FreeStmt(&expr->value.child->common);
|
FreeStmt(&expr->value.child->common);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OpDivide:
|
case OpDivide:
|
||||||
case OpAdd:
|
case OpAdd:
|
||||||
case OpSubtract:
|
case OpSubtract:
|
||||||
|
@ -651,12 +606,15 @@ FreeExpr(ExprDef *expr)
|
||||||
FreeStmt(&expr->value.binary.left->common);
|
FreeStmt(&expr->value.binary.left->common);
|
||||||
FreeStmt(&expr->value.binary.right->common);
|
FreeStmt(&expr->value.binary.right->common);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ExprActionDecl:
|
case ExprActionDecl:
|
||||||
FreeStmt(&expr->value.action.args->common);
|
FreeStmt(&expr->value.action.args->common);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ExprArrayRef:
|
case ExprArrayRef:
|
||||||
FreeStmt(&expr->value.array.entry->common);
|
FreeStmt(&expr->value.array.entry->common);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ExprKeysymList:
|
case ExprKeysymList:
|
||||||
darray_foreach(sym, expr->value.list.syms)
|
darray_foreach(sym, expr->value.list.syms)
|
||||||
free(*sym);
|
free(*sym);
|
||||||
|
@ -664,6 +622,7 @@ FreeExpr(ExprDef *expr)
|
||||||
darray_free(expr->value.list.symsMapIndex);
|
darray_free(expr->value.list.symsMapIndex);
|
||||||
darray_free(expr->value.list.symsNumEntries);
|
darray_free(expr->value.list.symsNumEntries);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -700,8 +659,7 @@ FreeStmt(ParseCommon *stmt)
|
||||||
next = stmt->next;
|
next = stmt->next;
|
||||||
u.any = stmt;
|
u.any = stmt;
|
||||||
|
|
||||||
switch (stmt->stmtType)
|
switch (stmt->stmtType) {
|
||||||
{
|
|
||||||
case StmtInclude:
|
case StmtInclude:
|
||||||
FreeInclude((IncludeStmt *) stmt);
|
FreeInclude((IncludeStmt *) stmt);
|
||||||
/* stmt is already free'd here. */
|
/* stmt is already free'd here. */
|
||||||
|
@ -758,11 +716,11 @@ FreeXKBFile(XkbFile *file)
|
||||||
{
|
{
|
||||||
next = (XkbFile *) file->common.next;
|
next = (XkbFile *) file->common.next;
|
||||||
|
|
||||||
switch (file->type)
|
switch (file->type) {
|
||||||
{
|
|
||||||
case FILE_TYPE_KEYMAP:
|
case FILE_TYPE_KEYMAP:
|
||||||
FreeXKBFile((XkbFile *) file->defs);
|
FreeXKBFile((XkbFile *) file->defs);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FILE_TYPE_TYPES:
|
case FILE_TYPE_TYPES:
|
||||||
case FILE_TYPE_COMPAT:
|
case FILE_TYPE_COMPAT:
|
||||||
case FILE_TYPE_SYMBOLS:
|
case FILE_TYPE_SYMBOLS:
|
||||||
|
@ -770,6 +728,7 @@ FreeXKBFile(XkbFile *file)
|
||||||
case FILE_TYPE_GEOMETRY:
|
case FILE_TYPE_GEOMETRY:
|
||||||
FreeStmt(file->defs);
|
FreeStmt(file->defs);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
/************************************************************
|
/************************************************************
|
||||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||||
|
*
|
||||||
Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
software and its documentation for any purpose and without
|
* software and its documentation for any purpose and without
|
||||||
fee is hereby granted, provided that the above copyright
|
* fee is hereby granted, provided that the above copyright
|
||||||
notice appear in all copies and that both that copyright
|
* notice appear in all copies and that both that copyright
|
||||||
notice and this permission notice appear in supporting
|
* notice and this permission notice appear in supporting
|
||||||
documentation, and that the name of Silicon Graphics not be
|
* documentation, and that the name of Silicon Graphics not be
|
||||||
used in advertising or publicity pertaining to distribution
|
* used in advertising or publicity pertaining to distribution
|
||||||
of the software without specific prior written permission.
|
* of the software without specific prior written permission.
|
||||||
Silicon Graphics makes no representation about the suitability
|
* Silicon Graphics makes no representation about the suitability
|
||||||
of this software for any purpose. It is provided "as is"
|
* of this software for any purpose. It is provided "as is"
|
||||||
without any express or implied warranty.
|
* without any express or implied warranty.
|
||||||
|
*
|
||||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
||||||
#ifndef PARSEUTILS_H
|
#ifndef PARSEUTILS_H
|
||||||
|
@ -118,15 +118,17 @@ CheckDefaultMap(XkbFile *maps, const char *fileName);
|
||||||
|
|
||||||
extern XkbFile *
|
extern XkbFile *
|
||||||
CreateXKBFile(struct xkb_context *ctx, enum xkb_file_type type, char *name,
|
CreateXKBFile(struct xkb_context *ctx, enum xkb_file_type type, char *name,
|
||||||
ParseCommon *defs, unsigned flags);
|
ParseCommon *defs,
|
||||||
|
unsigned flags);
|
||||||
|
|
||||||
extern bool
|
extern bool
|
||||||
XKBParseFile(struct xkb_context *ctx, FILE *file,
|
XKBParseFile(struct xkb_context *ctx, FILE *file, const char *file_name,
|
||||||
const char *file_name, XkbFile **out);
|
XkbFile **out);
|
||||||
|
|
||||||
extern bool
|
extern bool
|
||||||
XKBParseString(struct xkb_context *context, const char *string,
|
XKBParseString(struct xkb_context *context, const char *string,
|
||||||
const char *file_name, XkbFile **out);
|
const char *file_name,
|
||||||
|
XkbFile **out);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
FreeXKBFile(XkbFile *file);
|
FreeXKBFile(XkbFile *file);
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
/************************************************************
|
/************************************************************
|
||||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||||
|
*
|
||||||
Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
software and its documentation for any purpose and without
|
* software and its documentation for any purpose and without
|
||||||
fee is hereby granted, provided that the above copyright
|
* fee is hereby granted, provided that the above copyright
|
||||||
notice appear in all copies and that both that copyright
|
* notice appear in all copies and that both that copyright
|
||||||
notice and this permission notice appear in supporting
|
* notice and this permission notice appear in supporting
|
||||||
documentation, and that the name of Silicon Graphics not be
|
* documentation, and that the name of Silicon Graphics not be
|
||||||
used in advertising or publicity pertaining to distribution
|
* used in advertising or publicity pertaining to distribution
|
||||||
of the software without specific prior written permission.
|
* of the software without specific prior written permission.
|
||||||
Silicon Graphics makes no representation about the suitability
|
* Silicon Graphics makes no representation about the suitability
|
||||||
of this software for any purpose. It is provided "as is"
|
* of this software for any purpose. It is provided "as is"
|
||||||
without any express or implied warranty.
|
* without any express or implied warranty.
|
||||||
|
*
|
||||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
@ -62,63 +62,52 @@ XkbParseIncludeMap(char **str_inout, char **file_rtrn, char **map_rtrn,
|
||||||
char *tmp, *str, *next;
|
char *tmp, *str, *next;
|
||||||
|
|
||||||
str = *str_inout;
|
str = *str_inout;
|
||||||
if ((*str == '+') || (*str == '|'))
|
if ((*str == '+') || (*str == '|')) {
|
||||||
{
|
|
||||||
*file_rtrn = *map_rtrn = NULL;
|
*file_rtrn = *map_rtrn = NULL;
|
||||||
*nextop_rtrn = *str;
|
*nextop_rtrn = *str;
|
||||||
next = str + 1;
|
next = str + 1;
|
||||||
}
|
}
|
||||||
else if (*str == '%')
|
else if (*str == '%') {
|
||||||
{
|
|
||||||
*file_rtrn = *map_rtrn = NULL;
|
*file_rtrn = *map_rtrn = NULL;
|
||||||
*nextop_rtrn = str[1];
|
*nextop_rtrn = str[1];
|
||||||
next = str + 2;
|
next = str + 2;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
/* search for tokens inside the string */
|
/* search for tokens inside the string */
|
||||||
next = strpbrk(str, "|+");
|
next = strpbrk(str, "|+");
|
||||||
if (next)
|
if (next) {
|
||||||
{
|
|
||||||
/* set nextop_rtrn to \0, next to next character */
|
/* set nextop_rtrn to \0, next to next character */
|
||||||
*nextop_rtrn = *next;
|
*nextop_rtrn = *next;
|
||||||
*next++ = '\0';
|
*next++ = '\0';
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
*nextop_rtrn = '\0';
|
*nextop_rtrn = '\0';
|
||||||
next = NULL;
|
next = NULL;
|
||||||
}
|
}
|
||||||
/* search for :, store result in extra_data */
|
/* search for :, store result in extra_data */
|
||||||
tmp = strchr(str, ':');
|
tmp = strchr(str, ':');
|
||||||
if (tmp != NULL)
|
if (tmp != NULL) {
|
||||||
{
|
|
||||||
*tmp++ = '\0';
|
*tmp++ = '\0';
|
||||||
*extra_data = uDupString(tmp);
|
*extra_data = uDupString(tmp);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
*extra_data = NULL;
|
*extra_data = NULL;
|
||||||
}
|
}
|
||||||
tmp = strchr(str, '(');
|
tmp = strchr(str, '(');
|
||||||
if (tmp == NULL)
|
if (tmp == NULL) {
|
||||||
{
|
|
||||||
*file_rtrn = uDupString(str);
|
*file_rtrn = uDupString(str);
|
||||||
*map_rtrn = NULL;
|
*map_rtrn = NULL;
|
||||||
}
|
}
|
||||||
else if (str[0] == '(')
|
else if (str[0] == '(') {
|
||||||
{
|
|
||||||
free(*extra_data);
|
free(*extra_data);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
*tmp++ = '\0';
|
*tmp++ = '\0';
|
||||||
*file_rtrn = uDupString(str);
|
*file_rtrn = uDupString(str);
|
||||||
str = tmp;
|
str = tmp;
|
||||||
tmp = strchr(str, ')');
|
tmp = strchr(str, ')');
|
||||||
if ((tmp == NULL) || (tmp[1] != '\0'))
|
if ((tmp == NULL) || (tmp[1] != '\0')) {
|
||||||
{
|
|
||||||
free(*file_rtrn);
|
free(*file_rtrn);
|
||||||
free(*extra_data);
|
free(*extra_data);
|
||||||
return false;
|
return false;
|
||||||
|
@ -144,22 +133,28 @@ XkbParseIncludeMap(char **str_inout, char **file_rtrn, char **map_rtrn,
|
||||||
const char *
|
const char *
|
||||||
XkbDirectoryForInclude(enum xkb_file_type type)
|
XkbDirectoryForInclude(enum xkb_file_type type)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type) {
|
||||||
{
|
|
||||||
case FILE_TYPE_KEYMAP:
|
case FILE_TYPE_KEYMAP:
|
||||||
return "keymap";
|
return "keymap";
|
||||||
|
|
||||||
case FILE_TYPE_KEYCODES:
|
case FILE_TYPE_KEYCODES:
|
||||||
return "keycodes";
|
return "keycodes";
|
||||||
|
|
||||||
case FILE_TYPE_TYPES:
|
case FILE_TYPE_TYPES:
|
||||||
return "types";
|
return "types";
|
||||||
|
|
||||||
case FILE_TYPE_SYMBOLS:
|
case FILE_TYPE_SYMBOLS:
|
||||||
return "symbols";
|
return "symbols";
|
||||||
|
|
||||||
case FILE_TYPE_COMPAT:
|
case FILE_TYPE_COMPAT:
|
||||||
return "compat";
|
return "compat";
|
||||||
|
|
||||||
case FILE_TYPE_GEOMETRY:
|
case FILE_TYPE_GEOMETRY:
|
||||||
return "geometry";
|
return "geometry";
|
||||||
|
|
||||||
case FILE_TYPE_RULES:
|
case FILE_TYPE_RULES:
|
||||||
return "rules";
|
return "rules";
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -189,12 +184,10 @@ XkbFindFileInPath(struct xkb_context *ctx,
|
||||||
const char *typeDir;
|
const char *typeDir;
|
||||||
|
|
||||||
typeDir = XkbDirectoryForInclude(type);
|
typeDir = XkbDirectoryForInclude(type);
|
||||||
for (i = 0; i < xkb_context_num_include_paths(ctx); i++)
|
for (i = 0; i < xkb_context_num_include_paths(ctx); i++) {
|
||||||
{
|
|
||||||
ret = snprintf(buf, sizeof(buf), "%s/%s/%s",
|
ret = snprintf(buf, sizeof(buf), "%s/%s/%s",
|
||||||
xkb_context_include_path_get(ctx, i), typeDir, name);
|
xkb_context_include_path_get(ctx, i), typeDir, name);
|
||||||
if (ret >= (ssize_t)sizeof(buf))
|
if (ret >= (ssize_t) sizeof(buf)) {
|
||||||
{
|
|
||||||
ERROR("File name (%s/%s/%s) too long\n",
|
ERROR("File name (%s/%s/%s) too long\n",
|
||||||
xkb_context_include_path_get(ctx, i), typeDir, name);
|
xkb_context_include_path_get(ctx, i), typeDir, name);
|
||||||
ACTION("Ignored\n");
|
ACTION("Ignored\n");
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
/************************************************************
|
/************************************************************
|
||||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||||
|
*
|
||||||
Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
software and its documentation for any purpose and without
|
* software and its documentation for any purpose and without
|
||||||
fee is hereby granted, provided that the above copyright
|
* fee is hereby granted, provided that the above copyright
|
||||||
notice appear in all copies and that both that copyright
|
* notice appear in all copies and that both that copyright
|
||||||
notice and this permission notice appear in supporting
|
* notice and this permission notice appear in supporting
|
||||||
documentation, and that the name of Silicon Graphics not be
|
* documentation, and that the name of Silicon Graphics not be
|
||||||
used in advertising or publicity pertaining to distribution
|
* used in advertising or publicity pertaining to distribution
|
||||||
of the software without specific prior written permission.
|
* of the software without specific prior written permission.
|
||||||
Silicon Graphics makes no representation about the suitability
|
* Silicon Graphics makes no representation about the suitability
|
||||||
of this software for any purpose. It is provided "as is"
|
* of this software for any purpose. It is provided "as is"
|
||||||
without any express or implied warranty.
|
* without any express or implied warranty.
|
||||||
|
*
|
||||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
||||||
#ifndef XKBCOMP_PATH_H
|
#ifndef XKBCOMP_PATH_H
|
||||||
|
@ -33,13 +33,14 @@
|
||||||
|
|
||||||
bool
|
bool
|
||||||
XkbParseIncludeMap(char **str_inout, char **file_rtrn, char **map_rtrn,
|
XkbParseIncludeMap(char **str_inout, char **file_rtrn, char **map_rtrn,
|
||||||
char *nextop_rtrn, char **extra_data);
|
char *nextop_rtrn,
|
||||||
|
char **extra_data);
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
XkbDirectoryForInclude(unsigned type);
|
XkbDirectoryForInclude(unsigned type);
|
||||||
|
|
||||||
FILE *
|
FILE *
|
||||||
XkbFindFileInPath(struct xkb_context *ctx,
|
XkbFindFileInPath(struct xkb_context *ctx, const char *name, unsigned type,
|
||||||
const char *name, unsigned type, char **pathRtrn);
|
char **pathRtrn);
|
||||||
|
|
||||||
#endif /* XKBCOMP_PATH_H */
|
#endif /* XKBCOMP_PATH_H */
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
/************************************************************
|
/************************************************************
|
||||||
Copyright (c) 1996 by Silicon Graphics Computer Systems, Inc.
|
* Copyright (c) 1996 by Silicon Graphics Computer Systems, Inc.
|
||||||
|
*
|
||||||
Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
software and its documentation for any purpose and without
|
* software and its documentation for any purpose and without
|
||||||
fee is hereby granted, provided that the above copyright
|
* fee is hereby granted, provided that the above copyright
|
||||||
notice appear in all copies and that both that copyright
|
* notice appear in all copies and that both that copyright
|
||||||
notice and this permission notice appear in supporting
|
* notice and this permission notice appear in supporting
|
||||||
documentation, and that the name of Silicon Graphics not be
|
* documentation, and that the name of Silicon Graphics not be
|
||||||
used in advertising or publicity pertaining to distribution
|
* used in advertising or publicity pertaining to distribution
|
||||||
of the software without specific prior written permission.
|
* of the software without specific prior written permission.
|
||||||
Silicon Graphics makes no representation about the suitability
|
* Silicon Graphics makes no representation about the suitability
|
||||||
of this software for any purpose. It is provided "as is"
|
* of this software for any purpose. It is provided "as is"
|
||||||
without any express or implied warranty.
|
* without any express or implied warranty.
|
||||||
|
*
|
||||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -236,9 +236,11 @@ get_index(char *str, int *ndx)
|
||||||
if (consumed > 0) {
|
if (consumed > 0) {
|
||||||
*ndx = num;
|
*ndx = num;
|
||||||
str += consumed;
|
str += consumed;
|
||||||
} else if (empty > 0) {
|
}
|
||||||
|
else if (empty > 0) {
|
||||||
*ndx = -1;
|
*ndx = -1;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
*ndx = 0;
|
*ndx = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,10 +301,12 @@ match_mapping_line(darray_char *line, struct mapping *mapping)
|
||||||
|
|
||||||
if (ndx < 1 || ndx > XkbNumKbdGroups) {
|
if (ndx < 1 || ndx > XkbNumKbdGroups) {
|
||||||
WARN("Illegal %s index: %d\n", cname[i], ndx);
|
WARN("Illegal %s index: %d\n", cname[i], ndx);
|
||||||
WARN("Index must be in range 1..%d\n", XkbNumKbdGroups);
|
WARN("Index must be in range 1..%d\n",
|
||||||
|
XkbNumKbdGroups);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
ndx = 0;
|
ndx = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -412,7 +416,8 @@ match_rule_line(darray_char *line, struct mapping *mapping,
|
||||||
|
|
||||||
str = darray_mem(*line, 0);
|
str = darray_mem(*line, 0);
|
||||||
|
|
||||||
for (nread = 0; (tok = strtok_r(str, " ", &strtok_buf)) != NULL; nread++) {
|
for (nread = 0; (tok = strtok_r(str, " ", &strtok_buf)) != NULL;
|
||||||
|
nread++) {
|
||||||
str = NULL;
|
str = NULL;
|
||||||
|
|
||||||
if (strcmp(tok, "=") == 0) {
|
if (strcmp(tok, "=") == 0) {
|
||||||
|
@ -577,7 +582,8 @@ make_multi_defs(struct multi_defs *mdefs, const struct xkb_rule_names *mlvo)
|
||||||
if ((p = strchr(p, ','))) {
|
if ((p = strchr(p, ','))) {
|
||||||
*p++ = '\0';
|
*p++ = '\0';
|
||||||
mdefs->variant[i] = p;
|
mdefs->variant[i] = p;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -747,7 +753,8 @@ apply_rule_if_matches(struct rules *rules, struct rule *rule,
|
||||||
|
|
||||||
if (strcmp(rule->variant, "*") == 0) {
|
if (strcmp(rule->variant, "*") == 0) {
|
||||||
pending = true;
|
pending = true;
|
||||||
} else if (rule->variant[0] == '$') {
|
}
|
||||||
|
else if (rule->variant[0] == '$') {
|
||||||
if (!match_group_member(rules, rule->variant,
|
if (!match_group_member(rules, rule->variant,
|
||||||
mdefs->variant[rule->variant_num]))
|
mdefs->variant[rule->variant_num]))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -760,7 +767,8 @@ apply_rule_if_matches(struct rules *rules, struct rule *rule,
|
||||||
|
|
||||||
if (pending) {
|
if (pending) {
|
||||||
rule->flags |= RULE_FLAG_PENDING_MATCH;
|
rule->flags |= RULE_FLAG_PENDING_MATCH;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
/* Exact match, apply it now. */
|
/* Exact match, apply it now. */
|
||||||
apply_rule(rule, kccgst);
|
apply_rule(rule, kccgst);
|
||||||
}
|
}
|
||||||
|
@ -904,7 +912,8 @@ substitute_vars(char *name, struct multi_defs *mdefs)
|
||||||
if (sfx)
|
if (sfx)
|
||||||
*outstr++ = sfx;
|
*outstr++ = sfx;
|
||||||
}
|
}
|
||||||
else if (*var == 'v' && mdefs->variant[ndx] && *mdefs->variant[ndx]) {
|
else if (*var == 'v' && mdefs->variant[ndx] &&
|
||||||
|
*mdefs->variant[ndx]) {
|
||||||
if (pfx)
|
if (pfx)
|
||||||
*outstr++ = pfx;
|
*outstr++ = pfx;
|
||||||
|
|
||||||
|
@ -959,8 +968,8 @@ get_components(struct rules *rules, const struct xkb_rule_names *mlvo,
|
||||||
|
|
||||||
free_multi_defs(&mdefs);
|
free_multi_defs(&mdefs);
|
||||||
|
|
||||||
return
|
return kccgst->keycodes && kccgst->symbols && kccgst->types &&
|
||||||
kccgst->keycodes && kccgst->symbols && kccgst->types && kccgst->compat;
|
kccgst->compat;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct rules *
|
static struct rules *
|
||||||
|
@ -988,7 +997,8 @@ load_rules(FILE *file)
|
||||||
if (tgroup.number) {
|
if (tgroup.number) {
|
||||||
darray_append(rules->groups, tgroup);
|
darray_append(rules->groups, tgroup);
|
||||||
memset(&tgroup, 0, sizeof(tgroup));
|
memset(&tgroup, 0, sizeof(tgroup));
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
darray_append(rules->rules, trule);
|
darray_append(rules->rules, trule);
|
||||||
memset(&trule, 0, sizeof(trule));
|
memset(&trule, 0, sizeof(trule));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
/*
|
/*
|
||||||
Copyright 2009 Dan Nicholson
|
* Copyright 2009 Dan Nicholson
|
||||||
|
*
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
to deal in the Software without restriction, including without limitation
|
* to deal in the Software without restriction, including without limitation
|
||||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
and/or sell copies of the Software, and to permit persons to whom the
|
* and/or sell copies of the Software, and to permit persons to whom the
|
||||||
Software is furnished to do so, subject to the following conditions:
|
* Software is furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
The above copyright notice and this permission notice shall be included in
|
* The above copyright notice and this permission notice shall be included in
|
||||||
all copies or substantial portions of the Software.
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
* AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
Except as contained in this notice, the names of the authors or their
|
* Except as contained in this notice, the names of the authors or their
|
||||||
institutions shall not be used in advertising or otherwise to promote the
|
* institutions shall not be used in advertising or otherwise to promote the
|
||||||
sale, use or other dealings in this Software without prior written
|
* sale, use or other dealings in this Software without prior written
|
||||||
authorization from the authors.
|
* authorization from the authors.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef RULES_H
|
#ifndef RULES_H
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,27 +1,27 @@
|
||||||
/************************************************************
|
/************************************************************
|
||||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||||
|
*
|
||||||
Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
software and its documentation for any purpose and without
|
* software and its documentation for any purpose and without
|
||||||
fee is hereby granted, provided that the above copyright
|
* fee is hereby granted, provided that the above copyright
|
||||||
notice appear in all copies and that both that copyright
|
* notice appear in all copies and that both that copyright
|
||||||
notice and this permission notice appear in supporting
|
* notice and this permission notice appear in supporting
|
||||||
documentation, and that the name of Silicon Graphics not be
|
* documentation, and that the name of Silicon Graphics not be
|
||||||
used in advertising or publicity pertaining to distribution
|
* used in advertising or publicity pertaining to distribution
|
||||||
of the software without specific prior written permission.
|
* of the software without specific prior written permission.
|
||||||
Silicon Graphics makes no representation about the suitability
|
* Silicon Graphics makes no representation about the suitability
|
||||||
of this software for any purpose. It is provided "as is"
|
* of this software for any purpose. It is provided "as is"
|
||||||
without any express or implied warranty.
|
* without any express or implied warranty.
|
||||||
|
*
|
||||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
||||||
#include "vmod.h"
|
#include "vmod.h"
|
||||||
|
@ -47,11 +47,9 @@ ClearVModInfo(VModInfo *info, struct xkb_keymap *keymap)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
info->keymap = keymap;
|
info->keymap = keymap;
|
||||||
if (keymap && keymap->names)
|
if (keymap && keymap->names) {
|
||||||
{
|
|
||||||
int bit;
|
int bit;
|
||||||
for (i = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1)
|
for (i = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) {
|
||||||
{
|
|
||||||
if (keymap->names->vmods[i] != NULL)
|
if (keymap->names->vmods[i] != NULL)
|
||||||
info->defined |= bit;
|
info->defined |= bit;
|
||||||
}
|
}
|
||||||
|
@ -69,7 +67,8 @@ ClearVModInfo(VModInfo *info, struct xkb_keymap *keymap)
|
||||||
* @param mergeMode Merge strategy (e.g. MERGE_OVERRIDE)
|
* @param mergeMode Merge strategy (e.g. MERGE_OVERRIDE)
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
HandleVModDef(VModDef *stmt, struct xkb_keymap *keymap, enum merge_mode mergeMode,
|
HandleVModDef(VModDef *stmt, struct xkb_keymap *keymap,
|
||||||
|
enum merge_mode mergeMode,
|
||||||
VModInfo *info)
|
VModInfo *info)
|
||||||
{
|
{
|
||||||
int i, bit, nextFree;
|
int i, bit, nextFree;
|
||||||
|
@ -77,23 +76,20 @@ HandleVModDef(VModDef *stmt, struct xkb_keymap *keymap, enum merge_mode mergeMod
|
||||||
struct xkb_server_map *srv = keymap->server;
|
struct xkb_server_map *srv = keymap->server;
|
||||||
struct xkb_names *names = keymap->names;
|
struct xkb_names *names = keymap->names;
|
||||||
|
|
||||||
for (i = 0, bit = 1, nextFree = -1; i < XkbNumVirtualMods; i++, bit <<= 1)
|
for (i = 0, bit = 1, nextFree = -1; i < XkbNumVirtualMods; i++, bit <<=
|
||||||
{
|
1) {
|
||||||
if (info->defined & bit)
|
if (info->defined & bit) {
|
||||||
{
|
|
||||||
if (names->vmods[i] &&
|
if (names->vmods[i] &&
|
||||||
strcmp(names->vmods[i],
|
strcmp(names->vmods[i],
|
||||||
xkb_atom_text(keymap->ctx, stmt->name)) == 0)
|
xkb_atom_text(keymap->ctx, stmt->name)) == 0) { /* already defined */
|
||||||
{ /* already defined */
|
|
||||||
info->available |= bit;
|
info->available |= bit;
|
||||||
if (stmt->value == NULL)
|
if (stmt->value == NULL)
|
||||||
return true;
|
return true;
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
const char *str1;
|
const char *str1;
|
||||||
const char *str2 = "";
|
const char *str2 = "";
|
||||||
if (!ExprResolveModMask(keymap->ctx, stmt->value, &mod))
|
if (!ExprResolveModMask(keymap->ctx, stmt->value,
|
||||||
{
|
&mod)) {
|
||||||
str1 = xkb_atom_text(keymap->ctx, stmt->name);
|
str1 = xkb_atom_text(keymap->ctx, stmt->name);
|
||||||
ACTION("Declaration of %s ignored\n", str1);
|
ACTION("Declaration of %s ignored\n", str1);
|
||||||
return false;
|
return false;
|
||||||
|
@ -104,8 +100,7 @@ HandleVModDef(VModDef *stmt, struct xkb_keymap *keymap, enum merge_mode mergeMod
|
||||||
str1 = xkb_atom_text(keymap->ctx, stmt->name);
|
str1 = xkb_atom_text(keymap->ctx, stmt->name);
|
||||||
WARN("Virtual modifier %s multiply defined\n", str1);
|
WARN("Virtual modifier %s multiply defined\n", str1);
|
||||||
str1 = XkbcModMaskText(srv->vmods[i], true);
|
str1 = XkbcModMaskText(srv->vmods[i], true);
|
||||||
if (mergeMode == MERGE_OVERRIDE)
|
if (mergeMode == MERGE_OVERRIDE) {
|
||||||
{
|
|
||||||
str2 = str1;
|
str2 = str1;
|
||||||
str1 = XkbcModMaskText(mod.uval, true);
|
str1 = XkbcModMaskText(mod.uval, true);
|
||||||
}
|
}
|
||||||
|
@ -119,8 +114,7 @@ HandleVModDef(VModDef *stmt, struct xkb_keymap *keymap, enum merge_mode mergeMod
|
||||||
else if (nextFree < 0)
|
else if (nextFree < 0)
|
||||||
nextFree = i;
|
nextFree = i;
|
||||||
}
|
}
|
||||||
if (nextFree < 0)
|
if (nextFree < 0) {
|
||||||
{
|
|
||||||
ERROR("Too many virtual modifiers defined (maximum %d)\n",
|
ERROR("Too many virtual modifiers defined (maximum %d)\n",
|
||||||
XkbNumVirtualMods);
|
XkbNumVirtualMods);
|
||||||
return false;
|
return false;
|
||||||
|
@ -131,12 +125,12 @@ HandleVModDef(VModDef *stmt, struct xkb_keymap *keymap, enum merge_mode mergeMod
|
||||||
names->vmods[nextFree] = xkb_atom_strdup(keymap->ctx, stmt->name);
|
names->vmods[nextFree] = xkb_atom_strdup(keymap->ctx, stmt->name);
|
||||||
if (stmt->value == NULL)
|
if (stmt->value == NULL)
|
||||||
return true;
|
return true;
|
||||||
if (ExprResolveModMask(keymap->ctx, stmt->value, &mod))
|
if (ExprResolveModMask(keymap->ctx, stmt->value, &mod)) {
|
||||||
{
|
|
||||||
srv->vmods[nextFree] = mod.uval;
|
srv->vmods[nextFree] = mod.uval;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
ACTION("Declaration of %s ignored\n", xkb_atom_text(keymap->ctx, stmt->name));
|
ACTION("Declaration of %s ignored\n",
|
||||||
|
xkb_atom_text(keymap->ctx, stmt->name));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,8 +152,7 @@ LookupVModIndex(const struct xkb_keymap *keymap, xkb_atom_t field,
|
||||||
int i;
|
int i;
|
||||||
const char *name = xkb_atom_text(keymap->ctx, field);
|
const char *name = xkb_atom_text(keymap->ctx, field);
|
||||||
|
|
||||||
if ((keymap == NULL) || (keymap->names == NULL) || (type != TypeInt))
|
if ((keymap == NULL) || (keymap->names == NULL) || (type != TypeInt)) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
/* For each named modifier, get the name and compare it to the one passed
|
/* For each named modifier, get the name and compare it to the one passed
|
||||||
|
@ -167,11 +160,9 @@ LookupVModIndex(const struct xkb_keymap *keymap, xkb_atom_t field,
|
||||||
* The order of modifiers is the same as in the virtual_modifiers line in
|
* The order of modifiers is the same as in the virtual_modifiers line in
|
||||||
* the xkb_types section.
|
* the xkb_types section.
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < XkbNumVirtualMods; i++)
|
for (i = 0; i < XkbNumVirtualMods; i++) {
|
||||||
{
|
|
||||||
if (keymap->names->vmods[i] &&
|
if (keymap->names->vmods[i] &&
|
||||||
strcmp(keymap->names->vmods[i], name) == 0)
|
strcmp(keymap->names->vmods[i], name) == 0) {
|
||||||
{
|
|
||||||
val_rtrn->uval = i;
|
val_rtrn->uval = i;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -193,12 +184,10 @@ bool
|
||||||
LookupVModMask(struct xkb_context *ctx, const void *priv, xkb_atom_t field,
|
LookupVModMask(struct xkb_context *ctx, const void *priv, xkb_atom_t field,
|
||||||
unsigned type, ExprResult *val_rtrn)
|
unsigned type, ExprResult *val_rtrn)
|
||||||
{
|
{
|
||||||
if (LookupModMask(ctx, NULL, field, type, val_rtrn))
|
if (LookupModMask(ctx, NULL, field, type, val_rtrn)) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (LookupVModIndex(priv, field, type, val_rtrn))
|
else if (LookupVModIndex(priv, field, type, val_rtrn)) {
|
||||||
{
|
|
||||||
unsigned ndx = val_rtrn->uval;
|
unsigned ndx = val_rtrn->uval;
|
||||||
val_rtrn->uval = (1 << (XkbNumModifiers + ndx));
|
val_rtrn->uval = (1 << (XkbNumModifiers + ndx));
|
||||||
return true;
|
return true;
|
||||||
|
@ -213,8 +202,7 @@ FindKeypadVMod(struct xkb_keymap *keymap)
|
||||||
ExprResult rtrn;
|
ExprResult rtrn;
|
||||||
|
|
||||||
name = xkb_atom_intern(keymap->ctx, "NumLock");
|
name = xkb_atom_intern(keymap->ctx, "NumLock");
|
||||||
if ((keymap) && LookupVModIndex(keymap, name, TypeInt, &rtrn))
|
if ((keymap) && LookupVModIndex(keymap, name, TypeInt, &rtrn)) {
|
||||||
{
|
|
||||||
return rtrn.ival;
|
return rtrn.ival;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -226,22 +214,18 @@ ResolveVirtualModifier(ExprDef *def, struct xkb_keymap *keymap,
|
||||||
{
|
{
|
||||||
struct xkb_names *names = keymap->names;
|
struct xkb_names *names = keymap->names;
|
||||||
|
|
||||||
if (def->op == ExprIdent)
|
if (def->op == ExprIdent) {
|
||||||
{
|
|
||||||
int i, bit;
|
int i, bit;
|
||||||
const char *name = xkb_atom_text(keymap->ctx, def->value.str);
|
const char *name = xkb_atom_text(keymap->ctx, def->value.str);
|
||||||
for (i = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1)
|
for (i = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) {
|
||||||
{
|
|
||||||
if ((info->available & bit) && names->vmods[i] &&
|
if ((info->available & bit) && names->vmods[i] &&
|
||||||
strcmp(names->vmods[i], name) == 0)
|
strcmp(names->vmods[i], name) == 0) {
|
||||||
{
|
|
||||||
val_rtrn->uval = i;
|
val_rtrn->uval = i;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ExprResolveInteger(keymap->ctx, def, val_rtrn))
|
if (ExprResolveInteger(keymap->ctx, def, val_rtrn)) {
|
||||||
{
|
|
||||||
if (val_rtrn->uval < XkbNumVirtualMods)
|
if (val_rtrn->uval < XkbNumVirtualMods)
|
||||||
return true;
|
return true;
|
||||||
ERROR("Illegal virtual modifier %d (must be 0..%d inclusive)\n",
|
ERROR("Illegal virtual modifier %d (must be 0..%d inclusive)\n",
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
/************************************************************
|
/************************************************************
|
||||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||||
|
*
|
||||||
Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
software and its documentation for any purpose and without
|
* software and its documentation for any purpose and without
|
||||||
fee is hereby granted, provided that the above copyright
|
* fee is hereby granted, provided that the above copyright
|
||||||
notice appear in all copies and that both that copyright
|
* notice appear in all copies and that both that copyright
|
||||||
notice and this permission notice appear in supporting
|
* notice and this permission notice appear in supporting
|
||||||
documentation, and that the name of Silicon Graphics not be
|
* documentation, and that the name of Silicon Graphics not be
|
||||||
used in advertising or publicity pertaining to distribution
|
* used in advertising or publicity pertaining to distribution
|
||||||
of the software without specific prior written permission.
|
* of the software without specific prior written permission.
|
||||||
Silicon Graphics makes no representation about the suitability
|
* Silicon Graphics makes no representation about the suitability
|
||||||
of this software for any purpose. It is provided "as is"
|
* of this software for any purpose. It is provided "as is"
|
||||||
without any express or implied warranty.
|
* without any express or implied warranty.
|
||||||
|
*
|
||||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
||||||
#ifndef VMOD_H
|
#ifndef VMOD_H
|
||||||
|
@ -30,8 +30,7 @@
|
||||||
#include "xkbcomp-priv.h"
|
#include "xkbcomp-priv.h"
|
||||||
#include "expr.h"
|
#include "expr.h"
|
||||||
|
|
||||||
typedef struct _VModInfo
|
typedef struct _VModInfo {
|
||||||
{
|
|
||||||
struct xkb_keymap *keymap;
|
struct xkb_keymap *keymap;
|
||||||
unsigned defined;
|
unsigned defined;
|
||||||
unsigned available;
|
unsigned available;
|
||||||
|
@ -46,7 +45,8 @@ extern void
|
||||||
ClearVModInfo(VModInfo *info, struct xkb_keymap *keymap);
|
ClearVModInfo(VModInfo *info, struct xkb_keymap *keymap);
|
||||||
|
|
||||||
extern bool
|
extern bool
|
||||||
HandleVModDef(VModDef *stmt, struct xkb_keymap *keymap, enum merge_mode mergeMode,
|
HandleVModDef(VModDef *stmt, struct xkb_keymap *keymap,
|
||||||
|
enum merge_mode mergeMode,
|
||||||
VModInfo *info);
|
VModInfo *info);
|
||||||
|
|
||||||
extern bool
|
extern bool
|
||||||
|
@ -57,6 +57,7 @@ FindKeypadVMod(struct xkb_keymap *keymap);
|
||||||
|
|
||||||
extern bool
|
extern bool
|
||||||
ResolveVirtualModifier(ExprDef *def, struct xkb_keymap *keymap,
|
ResolveVirtualModifier(ExprDef *def, struct xkb_keymap *keymap,
|
||||||
ExprResult *value_rtrn, VModInfo *info);
|
ExprResult *value_rtrn,
|
||||||
|
VModInfo *info);
|
||||||
|
|
||||||
#endif /* VMOD_H */
|
#endif /* VMOD_H */
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
/************************************************************
|
/************************************************************
|
||||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||||
|
*
|
||||||
Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
software and its documentation for any purpose and without
|
* software and its documentation for any purpose and without
|
||||||
fee is hereby granted, provided that the above copyright
|
* fee is hereby granted, provided that the above copyright
|
||||||
notice appear in all copies and that both that copyright
|
* notice appear in all copies and that both that copyright
|
||||||
notice and this permission notice appear in supporting
|
* notice and this permission notice appear in supporting
|
||||||
documentation, and that the name of Silicon Graphics not be
|
* documentation, and that the name of Silicon Graphics not be
|
||||||
used in advertising or publicity pertaining to distribution
|
* used in advertising or publicity pertaining to distribution
|
||||||
of the software without specific prior written permission.
|
* of the software without specific prior written permission.
|
||||||
Silicon Graphics makes no representation about the suitability
|
* Silicon Graphics makes no representation about the suitability
|
||||||
of this software for any purpose. It is provided "as is"
|
* of this software for any purpose. It is provided "as is"
|
||||||
without any express or implied warranty.
|
* without any express or implied warranty.
|
||||||
|
*
|
||||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
||||||
#ifndef XKBCOMP_PRIV_H
|
#ifndef XKBCOMP_PRIV_H
|
||||||
|
@ -32,8 +32,7 @@
|
||||||
#include "text.h"
|
#include "text.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
typedef struct _CommonInfo
|
typedef struct _CommonInfo {
|
||||||
{
|
|
||||||
unsigned short defined;
|
unsigned short defined;
|
||||||
unsigned file_id;
|
unsigned file_id;
|
||||||
enum merge_mode merge;
|
enum merge_mode merge;
|
||||||
|
@ -64,9 +63,9 @@ extern int
|
||||||
ReportBadField(const char *type, const char *field, const char *name);
|
ReportBadField(const char *type, const char *field, const char *name);
|
||||||
|
|
||||||
extern bool
|
extern bool
|
||||||
ProcessIncludeFile(struct xkb_context *ctx,
|
ProcessIncludeFile(struct xkb_context *ctx, IncludeStmt *stmt,
|
||||||
IncludeStmt *stmt, enum xkb_file_type file_type,
|
enum xkb_file_type file_type, XkbFile **file_rtrn,
|
||||||
XkbFile **file_rtrn, enum merge_mode *merge_rtrn);
|
enum merge_mode *merge_rtrn);
|
||||||
|
|
||||||
extern bool
|
extern bool
|
||||||
FindNamedKey(struct xkb_keymap *keymap, unsigned long name,
|
FindNamedKey(struct xkb_keymap *keymap, unsigned long name,
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
/*
|
/*
|
||||||
Copyright 2009 Dan Nicholson
|
* Copyright 2009 Dan Nicholson
|
||||||
|
*
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
to deal in the Software without restriction, including without limitation
|
* to deal in the Software without restriction, including without limitation
|
||||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
and/or sell copies of the Software, and to permit persons to whom the
|
* and/or sell copies of the Software, and to permit persons to whom the
|
||||||
Software is furnished to do so, subject to the following conditions:
|
* Software is furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
The above copyright notice and this permission notice shall be included in
|
* The above copyright notice and this permission notice shall be included in
|
||||||
all copies or substantial portions of the Software.
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
* AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
Except as contained in this notice, the names of the authors or their
|
* Except as contained in this notice, the names of the authors or their
|
||||||
institutions shall not be used in advertising or otherwise to promote the
|
* institutions shall not be used in advertising or otherwise to promote the
|
||||||
sale, use or other dealings in this Software without prior written
|
* sale, use or other dealings in this Software without prior written
|
||||||
authorization from the authors.
|
* authorization from the authors.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "xkbcomp-priv.h"
|
#include "xkbcomp-priv.h"
|
||||||
|
@ -110,15 +110,19 @@ compile_keymap(struct xkb_context *ctx, XkbFile *file)
|
||||||
case FILE_TYPE_KEYCODES:
|
case FILE_TYPE_KEYCODES:
|
||||||
keycodes = file;
|
keycodes = file;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FILE_TYPE_TYPES:
|
case FILE_TYPE_TYPES:
|
||||||
types = file;
|
types = file;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FILE_TYPE_SYMBOLS:
|
case FILE_TYPE_SYMBOLS:
|
||||||
symbols = file;
|
symbols = file;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FILE_TYPE_COMPAT:
|
case FILE_TYPE_COMPAT:
|
||||||
compat = file;
|
compat = file;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ERROR("Cannot define %s in a keymap file\n",
|
ERROR("Cannot define %s in a keymap file\n",
|
||||||
XkbcFileTypeText(file->type));
|
XkbcFileTypeText(file->type));
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
/************************************************************
|
/************************************************************
|
||||||
Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
|
||||||
|
*
|
||||||
Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
software and its documentation for any purpose and without
|
* software and its documentation for any purpose and without
|
||||||
fee is hereby granted, provided that the above copyright
|
* fee is hereby granted, provided that the above copyright
|
||||||
notice appear in all copies and that both that copyright
|
* notice appear in all copies and that both that copyright
|
||||||
notice and this permission notice appear in supporting
|
* notice and this permission notice appear in supporting
|
||||||
documentation, and that the name of Silicon Graphics not be
|
* documentation, and that the name of Silicon Graphics not be
|
||||||
used in advertising or publicity pertaining to distribution
|
* used in advertising or publicity pertaining to distribution
|
||||||
of the software without specific prior written permission.
|
* of the software without specific prior written permission.
|
||||||
Silicon Graphics makes no representation about the suitability
|
* Silicon Graphics makes no representation about the suitability
|
||||||
of this software for any purpose. It is provided "as is"
|
* of this software for any purpose. It is provided "as is"
|
||||||
without any express or implied warranty.
|
* without any express or implied warranty.
|
||||||
|
*
|
||||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
* SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||||
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
* GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
||||||
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
||||||
#ifndef XKBCOMP_H
|
#ifndef XKBCOMP_H
|
||||||
|
@ -54,8 +54,7 @@
|
||||||
|
|
||||||
#define FileSymInterp 100
|
#define FileSymInterp 100
|
||||||
|
|
||||||
typedef struct _ParseCommon
|
typedef struct _ParseCommon {
|
||||||
{
|
|
||||||
unsigned stmtType;
|
unsigned stmtType;
|
||||||
struct _ParseCommon *next;
|
struct _ParseCommon *next;
|
||||||
} ParseCommon;
|
} ParseCommon;
|
||||||
|
@ -90,8 +89,7 @@ enum merge_mode {
|
||||||
|
|
||||||
extern unsigned warningLevel;
|
extern unsigned warningLevel;
|
||||||
|
|
||||||
typedef struct _IncludeStmt
|
typedef struct _IncludeStmt {
|
||||||
{
|
|
||||||
ParseCommon common;
|
ParseCommon common;
|
||||||
enum merge_mode merge;
|
enum merge_mode merge;
|
||||||
char *stmt;
|
char *stmt;
|
||||||
|
@ -102,36 +100,29 @@ typedef struct _IncludeStmt
|
||||||
struct _IncludeStmt *next;
|
struct _IncludeStmt *next;
|
||||||
} IncludeStmt;
|
} IncludeStmt;
|
||||||
|
|
||||||
typedef struct _Expr
|
typedef struct _Expr {
|
||||||
{
|
|
||||||
ParseCommon common;
|
ParseCommon common;
|
||||||
unsigned op;
|
unsigned op;
|
||||||
unsigned type;
|
unsigned type;
|
||||||
union
|
union {
|
||||||
{
|
struct {
|
||||||
struct
|
|
||||||
{
|
|
||||||
struct _Expr *left;
|
struct _Expr *left;
|
||||||
struct _Expr *right;
|
struct _Expr *right;
|
||||||
} binary;
|
} binary;
|
||||||
struct
|
struct {
|
||||||
{
|
|
||||||
xkb_atom_t element;
|
xkb_atom_t element;
|
||||||
xkb_atom_t field;
|
xkb_atom_t field;
|
||||||
} field;
|
} field;
|
||||||
struct
|
struct {
|
||||||
{
|
|
||||||
xkb_atom_t element;
|
xkb_atom_t element;
|
||||||
xkb_atom_t field;
|
xkb_atom_t field;
|
||||||
struct _Expr *entry;
|
struct _Expr *entry;
|
||||||
} array;
|
} array;
|
||||||
struct
|
struct {
|
||||||
{
|
|
||||||
xkb_atom_t name;
|
xkb_atom_t name;
|
||||||
struct _Expr *args;
|
struct _Expr *args;
|
||||||
} action;
|
} action;
|
||||||
struct
|
struct {
|
||||||
{
|
|
||||||
darray(char *) syms;
|
darray(char *) syms;
|
||||||
darray(int) symsMapIndex;
|
darray(int) symsMapIndex;
|
||||||
darray(unsigned int) symsNumEntries;
|
darray(unsigned int) symsNumEntries;
|
||||||
|
@ -144,72 +135,63 @@ typedef struct _Expr
|
||||||
} value;
|
} value;
|
||||||
} ExprDef;
|
} ExprDef;
|
||||||
|
|
||||||
typedef struct _VarDef
|
typedef struct _VarDef {
|
||||||
{
|
|
||||||
ParseCommon common;
|
ParseCommon common;
|
||||||
enum merge_mode merge;
|
enum merge_mode merge;
|
||||||
ExprDef *name;
|
ExprDef *name;
|
||||||
ExprDef *value;
|
ExprDef *value;
|
||||||
} VarDef;
|
} VarDef;
|
||||||
|
|
||||||
typedef struct _VModDef
|
typedef struct _VModDef {
|
||||||
{
|
|
||||||
ParseCommon common;
|
ParseCommon common;
|
||||||
enum merge_mode merge;
|
enum merge_mode merge;
|
||||||
xkb_atom_t name;
|
xkb_atom_t name;
|
||||||
ExprDef *value;
|
ExprDef *value;
|
||||||
} VModDef;
|
} VModDef;
|
||||||
|
|
||||||
typedef struct _KeycodeDef
|
typedef struct _KeycodeDef {
|
||||||
{
|
|
||||||
ParseCommon common;
|
ParseCommon common;
|
||||||
enum merge_mode merge;
|
enum merge_mode merge;
|
||||||
char name[5];
|
char name[5];
|
||||||
unsigned long value;
|
unsigned long value;
|
||||||
} KeycodeDef;
|
} KeycodeDef;
|
||||||
|
|
||||||
typedef struct _KeyAliasDef
|
typedef struct _KeyAliasDef {
|
||||||
{
|
|
||||||
ParseCommon common;
|
ParseCommon common;
|
||||||
enum merge_mode merge;
|
enum merge_mode merge;
|
||||||
char alias[5];
|
char alias[5];
|
||||||
char real[5];
|
char real[5];
|
||||||
} KeyAliasDef;
|
} KeyAliasDef;
|
||||||
|
|
||||||
typedef struct _KeyTypeDef
|
typedef struct _KeyTypeDef {
|
||||||
{
|
|
||||||
ParseCommon common;
|
ParseCommon common;
|
||||||
enum merge_mode merge;
|
enum merge_mode merge;
|
||||||
xkb_atom_t name;
|
xkb_atom_t name;
|
||||||
VarDef *body;
|
VarDef *body;
|
||||||
} KeyTypeDef;
|
} KeyTypeDef;
|
||||||
|
|
||||||
typedef struct _SymbolsDef
|
typedef struct _SymbolsDef {
|
||||||
{
|
|
||||||
ParseCommon common;
|
ParseCommon common;
|
||||||
enum merge_mode merge;
|
enum merge_mode merge;
|
||||||
char keyName[5];
|
char keyName[5];
|
||||||
ExprDef *symbols;
|
ExprDef *symbols;
|
||||||
} SymbolsDef;
|
} SymbolsDef;
|
||||||
|
|
||||||
typedef struct _ModMapDef
|
typedef struct _ModMapDef {
|
||||||
{
|
|
||||||
ParseCommon common;
|
ParseCommon common;
|
||||||
enum merge_mode merge;
|
enum merge_mode merge;
|
||||||
xkb_atom_t modifier;
|
xkb_atom_t modifier;
|
||||||
ExprDef *keys;
|
ExprDef *keys;
|
||||||
} ModMapDef;
|
} ModMapDef;
|
||||||
|
|
||||||
typedef struct _GroupCompatDef
|
typedef struct _GroupCompatDef {
|
||||||
{
|
|
||||||
ParseCommon common;
|
ParseCommon common;
|
||||||
enum merge_mode merge;
|
enum merge_mode merge;
|
||||||
int group;
|
int group;
|
||||||
ExprDef *def;
|
ExprDef *def;
|
||||||
} GroupCompatDef;
|
} GroupCompatDef;
|
||||||
|
|
||||||
typedef struct _InterpDef
|
typedef struct _InterpDef {
|
||||||
{
|
|
||||||
ParseCommon common;
|
ParseCommon common;
|
||||||
enum merge_mode merge;
|
enum merge_mode merge;
|
||||||
char *sym;
|
char *sym;
|
||||||
|
@ -217,8 +199,7 @@ typedef struct _InterpDef
|
||||||
VarDef *def;
|
VarDef *def;
|
||||||
} InterpDef;
|
} InterpDef;
|
||||||
|
|
||||||
typedef struct _IndicatorNameDef
|
typedef struct _IndicatorNameDef {
|
||||||
{
|
|
||||||
ParseCommon common;
|
ParseCommon common;
|
||||||
enum merge_mode merge;
|
enum merge_mode merge;
|
||||||
int ndx;
|
int ndx;
|
||||||
|
@ -226,8 +207,7 @@ typedef struct _IndicatorNameDef
|
||||||
bool virtual;
|
bool virtual;
|
||||||
} IndicatorNameDef;
|
} IndicatorNameDef;
|
||||||
|
|
||||||
typedef struct _IndicatorMapDef
|
typedef struct _IndicatorMapDef {
|
||||||
{
|
|
||||||
ParseCommon common;
|
ParseCommon common;
|
||||||
enum merge_mode merge;
|
enum merge_mode merge;
|
||||||
unsigned type;
|
unsigned type;
|
||||||
|
@ -235,8 +215,7 @@ typedef struct _IndicatorMapDef
|
||||||
VarDef *body;
|
VarDef *body;
|
||||||
} IndicatorMapDef;
|
} IndicatorMapDef;
|
||||||
|
|
||||||
typedef struct _XkbFile
|
typedef struct _XkbFile {
|
||||||
{
|
|
||||||
ParseCommon common;
|
ParseCommon common;
|
||||||
enum xkb_file_type type;
|
enum xkb_file_type type;
|
||||||
char *topName;
|
char *topName;
|
||||||
|
|
|
@ -1,29 +1,29 @@
|
||||||
/*
|
/*
|
||||||
Copyright 2009 Dan Nicholson
|
* Copyright 2009 Dan Nicholson
|
||||||
Copyright © 2012 Daniel Stone
|
* Copyright © 2012 Daniel Stone
|
||||||
Copyright © 2012 Ran Benita
|
* Copyright © 2012 Ran Benita
|
||||||
|
*
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
to deal in the Software without restriction, including without limitation
|
* to deal in the Software without restriction, including without limitation
|
||||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
and/or sell copies of the Software, and to permit persons to whom the
|
* and/or sell copies of the Software, and to permit persons to whom the
|
||||||
Software is furnished to do so, subject to the following conditions:
|
* Software is furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
The above copyright notice and this permission notice shall be included in
|
* The above copyright notice and this permission notice shall be included in
|
||||||
all copies or substantial portions of the Software.
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
* AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
Except as contained in this notice, the names of the authors or their
|
* Except as contained in this notice, the names of the authors or their
|
||||||
institutions shall not be used in advertising or otherwise to promote the
|
* institutions shall not be used in advertising or otherwise to promote the
|
||||||
sale, use or other dealings in this Software without prior written
|
* sale, use or other dealings in this Software without prior written
|
||||||
authorization from the authors.
|
* authorization from the authors.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
49
test/dump.c
49
test/dump.c
|
@ -1,27 +1,27 @@
|
||||||
/*
|
/*
|
||||||
Copyright 2009 Dan Nicholson
|
* Copyright 2009 Dan Nicholson
|
||||||
|
*
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
to deal in the Software without restriction, including without limitation
|
* to deal in the Software without restriction, including without limitation
|
||||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
and/or sell copies of the Software, and to permit persons to whom the
|
* and/or sell copies of the Software, and to permit persons to whom the
|
||||||
Software is furnished to do so, subject to the following conditions:
|
* Software is furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
The above copyright notice and this permission notice shall be included in
|
* The above copyright notice and this permission notice shall be included in
|
||||||
all copies or substantial portions of the Software.
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
* AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
Except as contained in this notice, the names of the authors or their
|
* Except as contained in this notice, the names of the authors or their
|
||||||
institutions shall not be used in advertising or otherwise to promote the
|
* institutions shall not be used in advertising or otherwise to promote the
|
||||||
sale, use or other dealings in this Software without prior written
|
* sale, use or other dealings in this Software without prior written
|
||||||
authorization from the authors.
|
* authorization from the authors.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -36,7 +36,8 @@ authorization from the authors.
|
||||||
#include "xkbcommon/xkbcommon.h"
|
#include "xkbcommon/xkbcommon.h"
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int
|
||||||
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
struct xkb_context *ctx = test_get_context();
|
struct xkb_context *ctx = test_get_context();
|
||||||
struct xkb_keymap *keymap;
|
struct xkb_keymap *keymap;
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
/*
|
/*
|
||||||
Copyright 2009 Dan Nicholson
|
* Copyright 2009 Dan Nicholson
|
||||||
|
*
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
to deal in the Software without restriction, including without limitation
|
* to deal in the Software without restriction, including without limitation
|
||||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
and/or sell copies of the Software, and to permit persons to whom the
|
* and/or sell copies of the Software, and to permit persons to whom the
|
||||||
Software is furnished to do so, subject to the following conditions:
|
* Software is furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
The above copyright notice and this permission notice shall be included in
|
* The above copyright notice and this permission notice shall be included in
|
||||||
all copies or substantial portions of the Software.
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
* AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
Except as contained in this notice, the names of the authors or their
|
* Except as contained in this notice, the names of the authors or their
|
||||||
institutions shall not be used in advertising or otherwise to promote the
|
* institutions shall not be used in advertising or otherwise to promote the
|
||||||
sale, use or other dealings in this Software without prior written
|
* sale, use or other dealings in this Software without prior written
|
||||||
authorization from the authors.
|
* authorization from the authors.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
/*
|
/*
|
||||||
Copyright 2009 Dan Nicholson
|
* Copyright 2009 Dan Nicholson
|
||||||
|
*
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
to deal in the Software without restriction, including without limitation
|
* to deal in the Software without restriction, including without limitation
|
||||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
and/or sell copies of the Software, and to permit persons to whom the
|
* and/or sell copies of the Software, and to permit persons to whom the
|
||||||
Software is furnished to do so, subject to the following conditions:
|
* Software is furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
The above copyright notice and this permission notice shall be included in
|
* The above copyright notice and this permission notice shall be included in
|
||||||
all copies or substantial portions of the Software.
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
* AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
Except as contained in this notice, the names of the authors or their
|
* Except as contained in this notice, the names of the authors or their
|
||||||
institutions shall not be used in advertising or otherwise to promote the
|
* institutions shall not be used in advertising or otherwise to promote the
|
||||||
sale, use or other dealings in this Software without prior written
|
* sale, use or other dealings in this Software without prior written
|
||||||
authorization from the authors.
|
* authorization from the authors.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
/*
|
/*
|
||||||
Copyright 2009 Dan Nicholson
|
* Copyright 2009 Dan Nicholson
|
||||||
|
*
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
to deal in the Software without restriction, including without limitation
|
* to deal in the Software without restriction, including without limitation
|
||||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
and/or sell copies of the Software, and to permit persons to whom the
|
* and/or sell copies of the Software, and to permit persons to whom the
|
||||||
Software is furnished to do so, subject to the following conditions:
|
* Software is furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
The above copyright notice and this permission notice shall be included in
|
* The above copyright notice and this permission notice shall be included in
|
||||||
all copies or substantial portions of the Software.
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
* AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
Except as contained in this notice, the names of the authors or their
|
* Except as contained in this notice, the names of the authors or their
|
||||||
institutions shall not be used in advertising or otherwise to promote the
|
* institutions shall not be used in advertising or otherwise to promote the
|
||||||
sale, use or other dealings in this Software without prior written
|
* sale, use or other dealings in this Software without prior written
|
||||||
authorization from the authors.
|
* authorization from the authors.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
/* Copyright 2009 Dan Nicholson
|
/* Copyright 2009 Dan Nicholson
|
||||||
|
*
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
to deal in the Software without restriction, including without limitation
|
* to deal in the Software without restriction, including without limitation
|
||||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
and/or sell copies of the Software, and to permit persons to whom the
|
* and/or sell copies of the Software, and to permit persons to whom the
|
||||||
Software is furnished to do so, subject to the following conditions:
|
* Software is furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
The above copyright notice and this permission notice shall be included in
|
* The above copyright notice and this permission notice shall be included in
|
||||||
all copies or substantial portions of the Software.
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
* AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
Except as contained in this notice, the names of the authors or their
|
* Except as contained in this notice, the names of the authors or their
|
||||||
institutions shall not be used in advertising or otherwise to promote the
|
* institutions shall not be used in advertising or otherwise to promote the
|
||||||
sale, use or other dealings in this Software without prior written
|
* sale, use or other dealings in this Software without prior written
|
||||||
authorization from the authors.
|
* authorization from the authors.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
|
@ -42,5 +42,5 @@ test_compile_string(struct xkb_context *context, const char *string);
|
||||||
|
|
||||||
struct xkb_keymap *
|
struct xkb_keymap *
|
||||||
test_compile_rules(struct xkb_context *context, const char *rules,
|
test_compile_rules(struct xkb_context *context, const char *rules,
|
||||||
const char *model, const char *layout,
|
const char *model, const char *layout, const char *variant,
|
||||||
const char *variant, const char *options);
|
const char *options);
|
||||||
|
|
Loading…
Reference in New Issue