Compare commits
	
		
			4 Commits
		
	
	
		
			v1.11.1
			...
			eekboard-0
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 87a0540627 | |||
| 878a1c73fd | |||
| b465cbc5de | |||
| 2622e4eb59 | 
@ -20,7 +20,7 @@ AC_PREREQ(2.63)
 | 
			
		||||
dnl AC_CONFIG_SRCDIR([configure.ac])
 | 
			
		||||
AC_CONFIG_MACRO_DIR([m4])
 | 
			
		||||
 | 
			
		||||
AC_INIT([eekboard], [0.90.4], [ueno@unixuser.org])
 | 
			
		||||
AC_INIT([eekboard], [0.90.5], [ueno@unixuser.org])
 | 
			
		||||
 | 
			
		||||
dnl Init automake
 | 
			
		||||
AM_INIT_AUTOMAKE
 | 
			
		||||
 | 
			
		||||
@ -1,2 +1,6 @@
 | 
			
		||||
SUBDIRS = icons themes keyboards
 | 
			
		||||
EXTRA_DIST = eekboard.desktop
 | 
			
		||||
 | 
			
		||||
desktopdir = $(datadir)/applications
 | 
			
		||||
desktop_in_files = eekboard.desktop.in
 | 
			
		||||
dist_desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
 | 
			
		||||
@INTLTOOL_DESKTOP_RULE@
 | 
			
		||||
 | 
			
		||||
@ -33,6 +33,36 @@ KEYCODE_TABLE = {
 | 
			
		||||
MARK_UPPER = '~!@#$%^&*()_+{}|:"<>?'
 | 
			
		||||
MARK_LOWER = '`1234567890-=[]\\;\',./'
 | 
			
		||||
 | 
			
		||||
INSCRIPT_MAPS = (
 | 
			
		||||
    "as-inscript",
 | 
			
		||||
    "bn-inscript",
 | 
			
		||||
    "gu-inscript",
 | 
			
		||||
    "hi-inscript",
 | 
			
		||||
    "kn-inscript",
 | 
			
		||||
    "ml-inscript",
 | 
			
		||||
    "mr-inscript",
 | 
			
		||||
    "or-inscript",
 | 
			
		||||
    "pa-inscript",
 | 
			
		||||
    "sd-inscript",
 | 
			
		||||
    "ta-inscript",
 | 
			
		||||
    "te-inscript",
 | 
			
		||||
    "kn-inscript2",
 | 
			
		||||
    "kok-inscript2-deva",
 | 
			
		||||
    "mai-inscript2",
 | 
			
		||||
    "ml-inscript2",
 | 
			
		||||
    "mni-inscript2-beng",
 | 
			
		||||
    "mni-inscript2-mtei",
 | 
			
		||||
    "mr-inscript2",
 | 
			
		||||
    "ne-inscript2-deva",
 | 
			
		||||
    "or-inscript2",
 | 
			
		||||
    "pa-inscript2-guru",
 | 
			
		||||
    "sa-inscript2",
 | 
			
		||||
    "sat-inscript2-deva",
 | 
			
		||||
    "sat-inscript2-olck",
 | 
			
		||||
    "sd-inscript2-deva",
 | 
			
		||||
    "ta-inscript2",
 | 
			
		||||
    "te-inscript2")
 | 
			
		||||
 | 
			
		||||
class MapFile(object):
 | 
			
		||||
    MAPENTRY_PATTERN = re.compile(r'\A\s*\((?:\((.*?)\)|"(.*?)")\s*"(.*?)"\)')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -19,14 +19,25 @@
 | 
			
		||||
import inscript
 | 
			
		||||
import gtk
 | 
			
		||||
from optparse import OptionParser
 | 
			
		||||
import sys, os
 | 
			
		||||
import sys, os, os.path, glob
 | 
			
		||||
 | 
			
		||||
parser = OptionParser()
 | 
			
		||||
parser.add_option("-n", "--name=LANGCODE", dest="langcode",
 | 
			
		||||
                  help="Specify language code to LANGCODE",
 | 
			
		||||
                  metavar="LANGCODE")
 | 
			
		||||
parser.add_option("-l", "--list", dest="list", default=False,
 | 
			
		||||
                  action="store_true",
 | 
			
		||||
                  help="List available language codes")
 | 
			
		||||
(options, args) = parser.parse_args()
 | 
			
		||||
 | 
			
		||||
if options.list:
 | 
			
		||||
    pat = os.path.join(os.getenv("M17N_DIR"), "*.mim")
 | 
			
		||||
    for fname in sorted(glob.glob(pat)):
 | 
			
		||||
        mname = os.path.basename(fname[:-4])
 | 
			
		||||
        if mname in inscript.INSCRIPT_MAPS:
 | 
			
		||||
            print mname
 | 
			
		||||
    exit(0)
 | 
			
		||||
 | 
			
		||||
if options.langcode is None:
 | 
			
		||||
    print >> sys.stderr, "Specify language code with -n"
 | 
			
		||||
    exit(1)
 | 
			
		||||
 | 
			
		||||
@ -36,6 +36,8 @@ static gboolean opt_focus = FALSE;
 | 
			
		||||
static gboolean opt_keystroke = FALSE;
 | 
			
		||||
#endif  /* HAVE_CSPI */
 | 
			
		||||
 | 
			
		||||
static gchar *opt_keyboard = NULL;
 | 
			
		||||
 | 
			
		||||
static gchar *opt_model = NULL;
 | 
			
		||||
static gchar *opt_layouts = NULL;
 | 
			
		||||
static gchar *opt_options = NULL;
 | 
			
		||||
@ -55,6 +57,8 @@ static const GOptionEntry options[] = {
 | 
			
		||||
    {"listen-keystroke", 's', 0, G_OPTION_ARG_NONE, &opt_keystroke,
 | 
			
		||||
     N_("Listen keystroke events with AT-SPI")},
 | 
			
		||||
#endif  /* HAVE_CSPI */
 | 
			
		||||
    {"keyboard", 'k', 0, G_OPTION_ARG_STRING, &opt_keyboard,
 | 
			
		||||
     N_("Specify keyboard file")},
 | 
			
		||||
    {"model", '\0', 0, G_OPTION_ARG_STRING, &opt_model,
 | 
			
		||||
     N_("Specify model")},
 | 
			
		||||
    {"layouts", '\0', 0, G_OPTION_ARG_STRING, &opt_layouts,
 | 
			
		||||
@ -198,7 +202,17 @@ main (int argc, char **argv)
 | 
			
		||||
    }
 | 
			
		||||
#endif  /* HAVE_CSPI */
 | 
			
		||||
 | 
			
		||||
    if (opt_model || opt_layouts || opt_options) {
 | 
			
		||||
    if (opt_keyboard && (opt_model || opt_layouts || opt_options)) {
 | 
			
		||||
        g_printerr ("Can't use --keyboard option with xklavier options\n");
 | 
			
		||||
        exit (1);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (opt_keyboard) {
 | 
			
		||||
        if (!eekboard_client_load_keyboard_from_file (client, opt_keyboard)) {
 | 
			
		||||
            g_printerr ("Can't load keyboard\n");
 | 
			
		||||
            exit (1);
 | 
			
		||||
        }
 | 
			
		||||
    } else if (opt_model || opt_layouts || opt_options) {
 | 
			
		||||
        if (!eekboard_client_set_xkl_config (client,
 | 
			
		||||
                                             opt_model,
 | 
			
		||||
                                             opt_layouts,
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										94
									
								
								src/client.c
									
									
									
									
									
								
							
							
						
						
									
										94
									
								
								src/client.c
									
									
									
									
									
								
							@ -107,6 +107,9 @@ static SPIBoolean      keystroke_listener_cb
 | 
			
		||||
                                          void                      *user_data);
 | 
			
		||||
#endif  /* HAVE_CSPI */
 | 
			
		||||
static gboolean        set_keyboard      (EekboardClient            *client,
 | 
			
		||||
                                          gboolean                   show,
 | 
			
		||||
                                          EekLayout                 *layout);
 | 
			
		||||
static gboolean        set_xkl_keyboard  (EekboardClient            *client,
 | 
			
		||||
                                          gboolean                   show,
 | 
			
		||||
                                          const gchar               *model,
 | 
			
		||||
                                          const gchar               *layouts,
 | 
			
		||||
@ -287,13 +290,13 @@ eekboard_client_set_xkl_config (EekboardClient *client,
 | 
			
		||||
                                        const gchar *options)
 | 
			
		||||
{
 | 
			
		||||
#ifdef HAVE_CSPI
 | 
			
		||||
    return set_keyboard (client,
 | 
			
		||||
    return set_xkl_keyboard (client,
 | 
			
		||||
                             client->focus_listener ? FALSE : TRUE,
 | 
			
		||||
                             model,
 | 
			
		||||
                             layouts,
 | 
			
		||||
                             options);
 | 
			
		||||
#else
 | 
			
		||||
    return set_keyboard (client,
 | 
			
		||||
    return set_xkl_keyboard (client,
 | 
			
		||||
                             TRUE,
 | 
			
		||||
                             model,
 | 
			
		||||
                             layouts,
 | 
			
		||||
@ -338,10 +341,13 @@ eekboard_client_enable_xkl (EekboardClient *client)
 | 
			
		||||
    xkl_engine_start_listen (client->xkl_engine, XKLL_TRACK_KEYBOARD_STATE);
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_CSPI
 | 
			
		||||
    return set_keyboard (client, client->focus_listener ? FALSE : TRUE,
 | 
			
		||||
                         NULL, NULL, NULL);
 | 
			
		||||
    return set_xkl_keyboard (client,
 | 
			
		||||
                             client->focus_listener ? FALSE : TRUE,
 | 
			
		||||
                             NULL,
 | 
			
		||||
                             NULL,
 | 
			
		||||
                             NULL);
 | 
			
		||||
#else
 | 
			
		||||
    return set_keyboard (client, TRUE, NULL, NULL, NULL);
 | 
			
		||||
    return set_xkl_keyboard (client, TRUE, NULL, NULL, NULL);
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -519,7 +525,7 @@ on_xkl_config_changed (XklEngine *xklengine,
 | 
			
		||||
    EekboardClient *client = user_data;
 | 
			
		||||
    gboolean retval;
 | 
			
		||||
 | 
			
		||||
    retval = set_keyboard (client, FALSE, NULL, NULL, NULL);
 | 
			
		||||
    retval = set_xkl_keyboard (client, FALSE, NULL, NULL, NULL);
 | 
			
		||||
    g_return_if_fail (retval);
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_FAKEKEY
 | 
			
		||||
@ -530,15 +536,39 @@ on_xkl_config_changed (XklEngine *xklengine,
 | 
			
		||||
 | 
			
		||||
static gboolean
 | 
			
		||||
set_keyboard (EekboardClient *client,
 | 
			
		||||
              gboolean        show,
 | 
			
		||||
              EekLayout      *layout)
 | 
			
		||||
{
 | 
			
		||||
    gchar *keyboard_name;
 | 
			
		||||
    static gint keyboard_serial = 0;
 | 
			
		||||
    guint keyboard_id;
 | 
			
		||||
 | 
			
		||||
    client->keyboard = eek_keyboard_new (layout, CSW, CSH);
 | 
			
		||||
    eek_keyboard_set_modifier_behavior (client->keyboard,
 | 
			
		||||
                                        EEK_MODIFIER_BEHAVIOR_LATCH);
 | 
			
		||||
 | 
			
		||||
    keyboard_name = g_strdup_printf ("keyboard%d", keyboard_serial++);
 | 
			
		||||
    eek_element_set_name (EEK_ELEMENT(client->keyboard), keyboard_name);
 | 
			
		||||
    g_free (keyboard_name);
 | 
			
		||||
 | 
			
		||||
    keyboard_id = eekboard_context_add_keyboard (client->context,
 | 
			
		||||
                                                 client->keyboard,
 | 
			
		||||
                                                 NULL);
 | 
			
		||||
    eekboard_context_set_keyboard (client->context, keyboard_id, NULL);
 | 
			
		||||
    if (show)
 | 
			
		||||
        eekboard_context_show_keyboard (client->context, NULL);
 | 
			
		||||
    return TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static gboolean
 | 
			
		||||
set_xkl_keyboard (EekboardClient *client,
 | 
			
		||||
                  gboolean        show,
 | 
			
		||||
                  const gchar    *model,
 | 
			
		||||
                  const gchar    *layouts,
 | 
			
		||||
                  const gchar    *options)
 | 
			
		||||
{
 | 
			
		||||
    EekLayout *layout;
 | 
			
		||||
    gchar *keyboard_name;
 | 
			
		||||
    static gint keyboard_serial = 0;
 | 
			
		||||
    guint keyboard_id;
 | 
			
		||||
    gboolean retval;
 | 
			
		||||
 | 
			
		||||
    if (client->keyboard)
 | 
			
		||||
        g_object_unref (client->keyboard);
 | 
			
		||||
@ -583,22 +613,9 @@ set_keyboard (EekboardClient *client,
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    client->keyboard = eek_keyboard_new (layout, CSW, CSH);
 | 
			
		||||
    eek_keyboard_set_modifier_behavior (client->keyboard,
 | 
			
		||||
                                        EEK_MODIFIER_BEHAVIOR_LATCH);
 | 
			
		||||
 | 
			
		||||
    keyboard_name = g_strdup_printf ("keyboard%d", keyboard_serial++);
 | 
			
		||||
    eek_element_set_name (EEK_ELEMENT(client->keyboard), keyboard_name);
 | 
			
		||||
    g_free (keyboard_name);
 | 
			
		||||
 | 
			
		||||
    keyboard_id = eekboard_context_add_keyboard (client->context,
 | 
			
		||||
                                                 client->keyboard,
 | 
			
		||||
                                                 NULL);
 | 
			
		||||
    eekboard_context_set_keyboard (client->context, keyboard_id, NULL);
 | 
			
		||||
    if (show)
 | 
			
		||||
        eekboard_context_show_keyboard (client->context, NULL);
 | 
			
		||||
 | 
			
		||||
    return TRUE;
 | 
			
		||||
    retval = set_keyboard (client, show, layout);
 | 
			
		||||
    g_object_unref (layout);
 | 
			
		||||
    return retval;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
@ -715,4 +732,31 @@ eekboard_client_disable_fakekey (EekboardClient *client)
 | 
			
		||||
        g_signal_handler_disconnect (client->keyboard,
 | 
			
		||||
                                     client->key_released_handler);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
gboolean
 | 
			
		||||
eekboard_client_load_keyboard_from_file (EekboardClient *client,
 | 
			
		||||
                                         const gchar    *keyboard_file)
 | 
			
		||||
{
 | 
			
		||||
    GFile *file;
 | 
			
		||||
    GFileInputStream *input;
 | 
			
		||||
    GError *error;
 | 
			
		||||
    EekLayout *layout;
 | 
			
		||||
    EekKeyboard *keyboard;
 | 
			
		||||
    guint keyboard_id;
 | 
			
		||||
    gboolean retval;
 | 
			
		||||
 | 
			
		||||
    file = g_file_new_for_path (keyboard_file);
 | 
			
		||||
 | 
			
		||||
    error = NULL;
 | 
			
		||||
    input = g_file_read (file, NULL, &error);
 | 
			
		||||
    if (input == NULL)
 | 
			
		||||
        return FALSE;
 | 
			
		||||
 | 
			
		||||
    layout = eek_xml_layout_new (G_INPUT_STREAM(input));
 | 
			
		||||
    g_object_unref (input);
 | 
			
		||||
    retval = set_keyboard (client, TRUE, layout);
 | 
			
		||||
    g_object_unref (layout);
 | 
			
		||||
    return retval;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif  /* HAVE_FAKEKEY */
 | 
			
		||||
 | 
			
		||||
@ -33,6 +33,9 @@ typedef struct _EekboardClient EekboardClient;
 | 
			
		||||
 | 
			
		||||
EekboardClient * eekboard_client_new             (GDBusConnection *connection);
 | 
			
		||||
 | 
			
		||||
gboolean         eekboard_client_load_keyboard_from_file
 | 
			
		||||
                                                 (EekboardClient  *client,
 | 
			
		||||
                                                  const gchar     *file);
 | 
			
		||||
gboolean         eekboard_client_set_xkl_config  (EekboardClient  *client,
 | 
			
		||||
                                                  const gchar     *model,
 | 
			
		||||
                                                  const gchar     *layouts,
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user