From: billh Date: Mon, 10 Mar 2003 13:07:29 +0000 (+0000) Subject: Fix for 107988, tweak to deviceeventcontroller.c to be less aggressive X-Git-Tag: AT_SPI2_CORE_0_1_3~806 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=af0da6c1ba0a94d9e92301d1fad76d8e3c1664fb;p=platform%2Fupstream%2Fat-spi2-core.git Fix for 107988, tweak to deviceeventcontroller.c to be less aggressive about reverting Xkb unlatch notifications. git-svn-id: http://svn.gnome.org/svn/at-spi/trunk@410 e2bd861d-eb25-0410-b326-f6ed22b6b98c --- diff --git a/ChangeLog b/ChangeLog index 4db5b67..dde0b2d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,21 @@ 2003-03-07 Padraig O'Briain + [needed by GOK, to fix bugs 107985 and 107988] + * registryd/deviceeventcontroller.c: + (spi_dec_clear_unlatch_pending): + New method, unsets the 'unlatch' mask for XkbStateNotifyEvents. + (spi_dec_set_unlatch_pending):Revised DEBUG comment. + (spi_dec_init_mouse_listener):Emit warning if mouse button + passive grab fails. + (spi_device_event_controller_forward_mouse_event): + Removed unnecessary parens from a conditional. + (global_filter_fn):Added TODO comment. + (impl_generate_keyboard_event): + Cancel a pending relatch if a 'delatching' key was + synthesized. + +2003-03-07 Padraig O'Briain + * atk-bridge/bridge.c: Change atk_signal_child_changed to atk_signal_children_changed. Reorganize code in spi_atk_bridge_signal_listener(). diff --git a/registryd/deviceeventcontroller.c b/registryd/deviceeventcontroller.c index 8243448..3476234 100644 --- a/registryd/deviceeventcontroller.c +++ b/registryd/deviceeventcontroller.c @@ -186,11 +186,20 @@ spi_dec_set_unlatch_pending (SpiDEController *controller, unsigned mask) DEControllerPrivateData *priv = g_object_get_qdata (G_OBJECT (controller), spi_dec_private_quark); #ifdef SPI_XKB_DEBUG - if (priv->xkb_latch_mask) fprintf (stderr, "unlatch pending! %x\n", mask); + if (priv->xkb_latch_mask) fprintf (stderr, "unlatch pending! %x\n", + priv->xkb_latch_mask); #endif priv->pending_xkb_mod_relatch_mask |= priv->xkb_latch_mask; } +static void +spi_dec_clear_unlatch_pending (SpiDEController *controller) +{ + DEControllerPrivateData *priv = + g_object_get_qdata (G_OBJECT (controller), spi_dec_private_quark); + priv->xkb_latch_mask = 0; +} + static gboolean spi_dec_button_update_and_emit (SpiDEController *controller, guint mask_return) @@ -468,10 +477,11 @@ spi_dec_init_mouse_listener (SpiRegistry *registry) if (display) { - XGrabButton (display, AnyButton, AnyModifier, + if (XGrabButton (display, AnyButton, AnyModifier, gdk_x11_get_default_root_xwindow (), True, ButtonPressMask | ButtonReleaseMask, - GrabModeSync, GrabModeAsync, None, None); + GrabModeSync, GrabModeAsync, None, None) != Success) + fprintf (stderr, "WARNING: could not grab mouse buttons!\n"); XSync (display, False); #ifdef SPI_DEBUG fprintf (stderr, "mouse buttons grabbed\n"); @@ -811,7 +821,7 @@ spi_device_event_controller_forward_mouse_event (SpiDEController *controller, int button = xbutton_event->button; unsigned int mouse_button_state = xbutton_event->state; - + switch (button) { case 1: @@ -881,7 +891,7 @@ spi_device_event_controller_forward_mouse_event (SpiDEController *controller, /* if client wants to consume this event, and XKB latch state was * unset by this button event, we reset it */ - if (is_consumed && (xkb_mod_unlatch_occurred)) + if (is_consumed && xkb_mod_unlatch_occurred) spi_dec_set_unlatch_pending (controller, mouse_mask_state); XAllowEvents (spi_get_display (), @@ -950,6 +960,7 @@ global_filter_fn (GdkXEvent *gdk_xevent, GdkEvent *event, gpointer data) &= ~(XkbAX_StickyKeysFBMask); XkbChangeControls (display, priv->xkb_desc, &changes); } + /* TODO: account for lock as well as latch */ XkbLatchModifiers (display, XkbUseCoreKbd, priv->pending_xkb_mod_relatch_mask, @@ -1797,6 +1808,7 @@ impl_generate_keyboard_event (PortableServer_Servant servant, SpiDEController *controller = SPI_DEVICE_EVENT_CONTROLLER (bonobo_object (servant)); long key_synth_code; + KeySym keysym; #ifdef SPI_DEBUG fprintf (stderr, "synthesizing keystroke %ld, type %d\n", @@ -1839,6 +1851,16 @@ impl_generate_keyboard_event (PortableServer_Servant servant, { DBG (-1, g_warning ("Error emitting keystroke")); } + if (synth_type == Accessibility_KEY_SYM) { + keysym = keycode; + } + else { + keysym = XkbKeycodeToKeysym (spi_get_display (), keycode, 0, 0); + } + if (XkbKeysymToModifiers (spi_get_display (), keysym) == 0) + { + spi_dec_clear_unlatch_pending (controller); + } } /* Accessibility::DEController::generateMouseEvent */