uint primary_modifiers =
KeybindingManager.get_primary_modifier(event.key.state);
- if (!KeybindingManager.primary_modifier_still_pressed(event,
- primary_modifiers)) {
- int i = revert ? m_engines.length - 1 : 1;
- switch_engine(i);
- } else {
+ bool pressed = KeybindingManager.primary_modifier_still_pressed(
+ event, primary_modifiers);
+ if (pressed) {
int i = revert ? m_engines.length - 1 : 1;
i = m_switcher.run(event, m_engines, i);
if (i < 0) {
assert(i < m_engines.length);
switch_engine(i);
}
+ } else {
+ int i = revert ? m_engines.length - 1 : 1;
+ switch_engine(i);
}
}
assert (m_loop == null);
assert (index < engines.length);
+ m_primary_modifier =
+ KeybindingManager.get_primary_modifier(
+ event.key.state & KeybindingManager.MODIFIER_FILTER);
+
update_engines(engines);
m_selected_engine = index;
m_buttons[index].grab_focus();
- show_all();
-
Gdk.Device device = event.get_device();
if (device == null) {
var display = get_display();
keyboard = device.get_associated_device();
}
+ show_all();
+
+ if (is_composited()) {
+ // Hide the window by set the opactiy to 0.0, because real hiden
+ // window can not grab keyboard and pointer.
+ get_window().set_opacity(0.0);
+
+ // Show window after 1/10 secound
+ GLib.Timeout.add(100, ()=> {
+ get_window().set_opacity(1.0);
+ return false;
+ });
+ }
+
+ Gdk.GrabStatus status;
// Grab all keyboard events
- keyboard.grab(get_window(),
- Gdk.GrabOwnership.NONE,
- true,
- Gdk.EventMask.KEY_PRESS_MASK |
- Gdk.EventMask.KEY_RELEASE_MASK,
- null,
- Gdk.CURRENT_TIME);
+ status = keyboard.grab(get_window(),
+ Gdk.GrabOwnership.NONE,
+ true,
+ Gdk.EventMask.KEY_PRESS_MASK |
+ Gdk.EventMask.KEY_RELEASE_MASK,
+ null,
+ Gdk.CURRENT_TIME);
+ if (status != Gdk.GrabStatus.SUCCESS)
+ warning("Grab keyboard failed! status = %d", status);
// Grab all pointer events
- pointer.grab(get_window(),
- Gdk.GrabOwnership.NONE,
- true,
- Gdk.EventMask.BUTTON_PRESS_MASK |
- Gdk.EventMask.BUTTON_RELEASE_MASK,
- null,
- Gdk.CURRENT_TIME);
+ status = pointer.grab(get_window(),
+ Gdk.GrabOwnership.NONE,
+ true,
+ Gdk.EventMask.BUTTON_PRESS_MASK |
+ Gdk.EventMask.BUTTON_RELEASE_MASK,
+ null,
+ Gdk.CURRENT_TIME);
+ if (status != Gdk.GrabStatus.SUCCESS)
+ warning("Grab pointer failed! status = %d", status);
- m_primary_modifier =
- KeybindingManager.get_primary_modifier(
- event.key.state & KeybindingManager.MODIFIER_FILTER);
m_loop = new GLib.MainLoop();
m_loop.run();