static void popup_menu_set_group (GtkMenuItem * item, gpointer param) { gint group_number = GPOINTER_TO_INT (param); XklEngine *engine = gkbd_status_get_xkl_engine (); XklState st; Window cur; st.group = group_number; xkl_engine_allow_one_switch_to_secondary_group (engine); cur = xkl_engine_get_current_window (engine); if (cur != (Window) NULL) { xkl_debug (150, "Enforcing the state %d for window %lx\n", st.group, cur); xkl_engine_save_state (engine, xkl_engine_get_current_window (engine), &st); /* XSetInputFocus( GDK_DISPLAY(), cur, RevertToNone, CurrentTime );*/ } else { xkl_debug (150, "??? Enforcing the state %d for unknown window\n", st.group); /* strange situation - bad things can happen */ } xkl_engine_lock_group (engine, st.group); }
// A scroll on the icon void cd_xkbd_set_prev_next_group (int iDelta) { XklState *state = xkl_engine_get_current_state (myData.pEngine); cd_debug ("keyboard current state : %d;%d +%d", state->group, state->indicators, iDelta); int i = 0, n = xkl_engine_get_num_groups (myData.pEngine); g_return_if_fail (n > 0); int iCurrentGroup = MAX (0, MIN (n-1, state->group)); // on blinde car libxklavier peut bugger en 64bits. const gchar **pGroupNames = xkl_engine_get_groups_names (myData.pEngine); do // on passe au groupe suivant/precedent en sautant les faux (-). { i ++; iCurrentGroup += iDelta; // xkl_engine_get_next_group ne marche pas. if (iCurrentGroup == n) iCurrentGroup = 0; else if (iCurrentGroup < 0) iCurrentGroup = n - 1; } while (i < n && (pGroupNames[iCurrentGroup] == NULL || *pGroupNames[iCurrentGroup] == '-')); state->group = iCurrentGroup; cd_debug ("keyboard new state : %d", state->group); xkl_engine_allow_one_switch_to_secondary_group (myData.pEngine); // sert a quoi ?? Window Xid = xkl_engine_get_current_window (myData.pEngine); xkl_engine_save_state (myData.pEngine, Xid, state); xkl_engine_lock_group (myData.pEngine, state->group); // sert a quoi ?? }
static void popup_menu_set_group (gint group_number, gboolean only_menu) { XklEngine *engine = gkbd_status_get_xkl_engine (); XklState *st = xkl_engine_get_current_state(engine); Window cur; st->group = group_number; xkl_engine_allow_one_switch_to_secondary_group (engine); cur = xkl_engine_get_current_window (engine); if (cur != (Window) NULL) { xkl_debug (150, "Enforcing the state %d for window %lx\n", st->group, cur); xkl_engine_save_state (engine, xkl_engine_get_current_window (engine), st); /* XSetInputFocus( GDK_DISPLAY(), cur, RevertToNone, CurrentTime );*/ } else { xkl_debug (150, "??? Enforcing the state %d for unknown window\n", st->group); /* strange situation - bad things can happen */ } if (!only_menu) xkl_engine_lock_group (engine, st->group); }
// Select the layout from the menu void cd_xkbd_set_group (int iNumGroup) { XklState *state = xkl_engine_get_current_state (myData.pEngine); cd_debug ("keyboard current state : %d;%d", state->group, state->indicators); state->group = iNumGroup; Window Xid = xkl_engine_get_current_window (myData.pEngine); xkl_engine_allow_one_switch_to_secondary_group (myData.pEngine); // sert a quoi ?? xkl_engine_save_state (myData.pEngine, Xid, state); xkl_engine_lock_group (myData.pEngine, state->group); // sert a quoi ?? }