diff --git a/README.md b/README.md index eb8d421e8c..3f8cd7ab4d 100644 --- a/README.md +++ b/README.md @@ -40,5 +40,6 @@ Each platform maintains multiple types of releases: Copyright (c) 2018 SIL International. All rights reserved. Licensed under the [MIT](./windows/src/LICENSE.md) License. -[KMFL](./linux) is licensed under GNU General Public License as published by the Free Software Foundation; either [version 2](./linux/libkmfl/COPYING) of the License, or (at your option) any later version. + +[Keyman for Linux](./linux) is licensed under the [MIT](./windows/src/LICENSE.md) License apart from [ibus-kmfl](./linux/ibus-kmfl) which is licensed under the GNU General Public License as published by the Free Software Foundation; either [version 2](./linux/ibus-kmfl/COPYING) of the License, or (at your option) any later version. diff --git a/linux/LICENSE.md b/linux/LICENSE.md new file mode 100644 index 0000000000..ea1f81205f --- /dev/null +++ b/linux/LICENSE.md @@ -0,0 +1,4 @@ +The [kmflcomp](./kmflcomp) and [libkmfl](./libkmfl) projects are covered by the [MIT license](./libkmfl/COPYING) + +The [ibus-kmfl](./ibus-kmfl) project is licensed under GNU General Public License as published by the Free Software Foundation; either [version 2 of the License](./ibus-kmfl/COPYING), or (at your option) any later version. +2 files in ibus-kmfl, [kmflutil.c](./ibus-kmfl/src/kmflutil.c) and [kmflutil.h](./ibus-kmfl/src/kmflutil.h) are covered by the MIT license and may be used as such in other projects. diff --git a/linux/README.md b/linux/README.md index 38e54ed250..dc8232027d 100644 --- a/linux/README.md +++ b/linux/README.md @@ -2,11 +2,13 @@ ## Projects - * kmflcomp - KMFL keyboard compiler - * libkmfl - core library - * ibus-kmfl - IBUS integration to use KMFL + * [kmflcomp](./kmflcomp) - KMFL keyboard compiler + * [libkmfl](./libkmfl) - core library + * [ibus-kmfl](./ibus-kmfl) - IBUS integration to use KMFL * scim\_kmfl\_imengine - deprecated SCIM engine to use KMFL + See [license information](./LICENSE.md) about licensing. + ## Linux Requirements/Setup - It is helpful to be using the [packages.sil.org](http://packages.sil.org) repo @@ -134,4 +136,4 @@ Use `Win-space` to switch between keyboards. * Click `Add` to add a keyman keyboard. * Click the 3 dots expander then search for "Other" and click it * The Keyman keyboards should be listed here to choose - \ No newline at end of file + diff --git a/linux/ibus-kmfl/src/engine.c b/linux/ibus-kmfl/src/engine.c index b7e0275b69..5b825359d7 100644 --- a/linux/ibus-kmfl/src/engine.c +++ b/linux/ibus-kmfl/src/engine.c @@ -100,93 +100,6 @@ static IBusEngineClass *parent_class = NULL; static GHashTable *im_table = NULL; -void output_string(void *contrack, char *ptr) { - KInputContext * ic = (KInputContext *)contrack; - g_debug("DAR: output_string - ic->cmds=%p", ic->cmds); - if (ptr) { - Cmd * cmd = g_new(Cmd, 1); - cmd->opcode=OUTPUT_STRING; - cmd->cmdarg=g_strdup(ptr); - ic->cmds = g_list_append(ic->cmds, cmd); - } -} - -void erase_char(void *contrack) { - KInputContext * ic = (KInputContext *)contrack; - g_debug("DAR: erase_char - ic->cmds=%p", ic->cmds); - Cmd * cmd = g_new(Cmd, 1); - cmd->opcode = ERASE_CHAR; - cmd->cmdarg=NULL; - ic->cmds = g_list_append(ic->cmds, cmd); -} - -void output_char(void *contrack, unsigned char byte) { - if (byte == 8) { - erase_char(contrack); - } else { - char s[2]; - s[0] = byte; - s[1] = '\0'; - output_string(contrack, s); - } -} - -void forward_keyevent(void *contrack, unsigned int key, unsigned int state) -{ - -} - -void output_beep(void *contrack) { - KInputContext * ic = (KInputContext *)contrack; - Cmd * cmd = g_new(Cmd, 1); - cmd->opcode = OUTPUT_BEEP; - cmd->cmdarg=NULL; - ic->cmds = g_list_append(ic->cmds, cmd); -} - -/* - * Create an input context - */ -KInputContext * -kmfl_create_ic(KInputMethod *im) -{ - KInputContext * ic; - g_debug("DAR: kmfl_create_ic"); - ic = g_new(KInputContext, 1); - ic->cmds = NULL; - ic->p_kmsi=kmfl_make_keyboard_instance(ic); - kmfl_attach_keyboard(ic->p_kmsi, im->keyboard_number); - - return ic; -} - - -/* - * Destroy an input context - */ -void -kmfl_destroy_ic(KInputContext *ic) -{ - GList * p; - g_debug("DAR: kmfl_destroy_ic"); - kmfl_detach_keyboard(ic->p_kmsi); - kmfl_delete_keyboard_instance(ic->p_kmsi); - - if (ic->cmds) { - for (p=ic->cmds; p != NULL; p = p->next) { - Cmd * cmd = (Cmd *)p->data; - if (cmd) { - if (cmd->cmdarg) - g_free(cmd->cmdarg); - g_free(cmd); - } - } - g_list_free(ic->cmds); - ic->cmds=NULL; - } - -} - GType ibus_kmfl_engine_get_type (void) { diff --git a/linux/ibus-kmfl/src/kmflutil.c b/linux/ibus-kmfl/src/kmflutil.c index 516df2e3eb..297fef7e82 100644 --- a/linux/ibus-kmfl/src/kmflutil.c +++ b/linux/ibus-kmfl/src/kmflutil.c @@ -5,19 +5,23 @@ * * Copyright (C) 2009 SIL International * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, 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: * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 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 OTHER DEALINGS IN THE + * SOFTWARE. * */ @@ -280,6 +284,94 @@ void kinput_close_im(KInputMethod * im) g_free(im); } +void output_string(void *contrack, char *ptr) { + KInputContext * ic = (KInputContext *)contrack; + g_debug("DAR: output_string - ic->cmds=%p", ic->cmds); + if (ptr) { + Cmd * cmd = g_new(Cmd, 1); + cmd->opcode=OUTPUT_STRING; + cmd->cmdarg=g_strdup(ptr); + ic->cmds = g_list_append(ic->cmds, cmd); + } +} + +void erase_char(void *contrack) { + KInputContext * ic = (KInputContext *)contrack; + g_debug("DAR: erase_char - ic->cmds=%p", ic->cmds); + Cmd * cmd = g_new(Cmd, 1); + cmd->opcode = ERASE_CHAR; + cmd->cmdarg=NULL; + ic->cmds = g_list_append(ic->cmds, cmd); +} + +void output_char(void *contrack, unsigned char byte) { + if (byte == 8) { + erase_char(contrack); + } else { + char s[2]; + s[0] = byte; + s[1] = '\0'; + output_string(contrack, s); + } +} + +void forward_keyevent(void *contrack, unsigned int key, unsigned int state) +{ + +} + +void output_beep(void *contrack) { + KInputContext * ic = (KInputContext *)contrack; + Cmd * cmd = g_new(Cmd, 1); + cmd->opcode = OUTPUT_BEEP; + cmd->cmdarg=NULL; + ic->cmds = g_list_append(ic->cmds, cmd); +} + + +/* + * Create an input context + */ +KInputContext * +kmfl_create_ic(KInputMethod *im) +{ + KInputContext * ic; + g_debug("DAR: kmfl_create_ic"); + ic = g_new(KInputContext, 1); + ic->cmds = NULL; + ic->p_kmsi=kmfl_make_keyboard_instance(ic); + kmfl_attach_keyboard(ic->p_kmsi, im->keyboard_number); + + return ic; +} + + +/* + * Destroy an input context + */ +void +kmfl_destroy_ic(KInputContext *ic) +{ + GList * p; + g_debug("DAR: kmfl_destroy_ic"); + kmfl_detach_keyboard(ic->p_kmsi); + kmfl_delete_keyboard_instance(ic->p_kmsi); + + if (ic->cmds) { + for (p=ic->cmds; p != NULL; p = p->next) { + Cmd * cmd = (Cmd *)p->data; + if (cmd) { + if (cmd->cmdarg) + g_free(cmd->cmdarg); + g_free(cmd); + } + } + g_list_free(ic->cmds); + ic->cmds=NULL; + } + +} + #ifdef DEBUG #include diff --git a/linux/ibus-kmfl/src/kmflutil.h b/linux/ibus-kmfl/src/kmflutil.h index 3da445aeb9..b72996e5fc 100644 --- a/linux/ibus-kmfl/src/kmflutil.h +++ b/linux/ibus-kmfl/src/kmflutil.h @@ -5,19 +5,23 @@ * * Copyright (C) 2009 SIL International * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, 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: * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 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 OTHER DEALINGS IN THE + * SOFTWARE. * */ @@ -61,6 +65,8 @@ void ibus_kmfl_init (void); GList *ibus_kmfl_list_engines (void); IBusComponent *ibus_kmfl_get_component (void); KInputMethod *kinput_open_im (const gchar * keyboard_filename); +KInputContext *kmfl_create_ic (KInputMethod *im); +void kmfl_destroy_ic (KInputContext *ic); void kinput_close_im (KInputMethod * im); void kmfl_get_keyboard_info (KInputMethod * im); #endif