*** empty log message ***

This commit is contained in:
Matthias Clasen 2005-09-20 05:28:34 +00:00
parent 9b64ff7f38
commit cd63ed1eb4
6 changed files with 62 additions and 28 deletions

View File

@ -1,3 +1,17 @@
2005-09-20 Matthias Clasen <mclasen@redhat.com>
Avoid unnecessary XkbGetState() calls and XkbStateNotify
events. (#151555, Søren Sandmann)
* gdk/x11/gdkdisplay-x11.c (gdk_display_open): Use
XkbSelectEventDetails() to select XkbStateNotify events
for only the state we care about.
* gdk/x11/gdkprivate-x11.h:
* gdk/x11/gdkkeys-x11.c (_gdk_keymap_state_changed): Pass
the event into the function and update the keymap state from
the state information contained in the event. Adjust all callers.
2005-09-19 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkiconview.c: Use g_list_nth_data() instead of g_list_nth()->data

View File

@ -1,3 +1,17 @@
2005-09-20 Matthias Clasen <mclasen@redhat.com>
Avoid unnecessary XkbGetState() calls and XkbStateNotify
events. (#151555, Søren Sandmann)
* gdk/x11/gdkdisplay-x11.c (gdk_display_open): Use
XkbSelectEventDetails() to select XkbStateNotify events
for only the state we care about.
* gdk/x11/gdkprivate-x11.h:
* gdk/x11/gdkkeys-x11.c (_gdk_keymap_state_changed): Pass
the event into the function and update the keymap state from
the state information contained in the event. Adjust all callers.
2005-09-19 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkiconview.c: Use g_list_nth_data() instead of g_list_nth()->data

View File

@ -281,6 +281,11 @@ gdk_display_open (const gchar *display_name)
XkbNewKeyboardNotifyMask | XkbMapNotifyMask | XkbStateNotifyMask,
XkbNewKeyboardNotifyMask | XkbMapNotifyMask | XkbStateNotifyMask);
/* keep this in sync with _gdk_keymap_state_changed() */
XkbSelectEventDetails (display_x11->xdisplay,
XkbUseCoreKbd, XkbStateNotify,
XkbGroupLockMask, XkbGroupLockMask);
XkbSetDetectableAutoRepeat (display_x11->xdisplay,
True,
&detectable_autorepeat_supported);

View File

@ -2050,7 +2050,7 @@ gdk_event_translate (GdkDisplay *display,
break;
case XkbStateNotify:
_gdk_keymap_state_changed (display);
_gdk_keymap_state_changed (display, xevent);
break;
}
}

View File

@ -536,16 +536,12 @@ get_direction (XkbDescRec *xkb,
}
static void
update_direction (GdkKeymapX11 *keymap_x11)
update_direction (GdkKeymapX11 *keymap_x11,
gint group)
{
XkbDescRec *xkb = get_xkb (keymap_x11);
XkbStateRec state_rec;
GdkDisplay *display = GDK_KEYMAP (keymap_x11)->display;
gint group;
Atom group_atom;
XkbGetState (GDK_DISPLAY_XDISPLAY (display), XkbUseCoreKbd, &state_rec);
group = XkbGroupLock (&state_rec);
group_atom = xkb->names->groups[group];
/* a group change? */
@ -609,32 +605,29 @@ update_direction (GdkKeymapX11 *keymap_x11)
}
}
static void
_gdk_keymap_direction_changed (GdkKeymapX11 *keymap_x11)
{
gboolean had_direction;
PangoDirection direction;
had_direction = keymap_x11->have_direction;
direction = keymap_x11->current_direction;
update_direction (keymap_x11);
if (!had_direction || direction != keymap_x11->current_direction)
g_signal_emit_by_name (keymap_x11, "direction_changed");
}
/* keep this in sync with the XkbSelectEventDetails() call
* in gdk_display_open()
*/
void
_gdk_keymap_state_changed (GdkDisplay *display)
_gdk_keymap_state_changed (GdkDisplay *display,
XEvent *xevent)
{
GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (display);
XkbEvent *xkb_event = (XkbEvent *)xevent;
if (display_x11->keymap)
{
GdkKeymapX11 *keymap_x11 = GDK_KEYMAP_X11 (display_x11->keymap);
gboolean had_direction;
PangoDirection direction;
_gdk_keymap_direction_changed (keymap_x11);
had_direction = keymap_x11->have_direction;
direction = keymap_x11->current_direction;
update_direction (keymap_x11, xkb_event->state.locked_group);
if (!had_direction || direction != keymap_x11->current_direction)
g_signal_emit_by_name (keymap_x11, "direction_changed");
}
}
@ -660,9 +653,16 @@ gdk_keymap_get_direction (GdkKeymap *keymap)
if (KEYMAP_USE_XKB (keymap))
{
GdkKeymapX11 *keymap_x11 = GDK_KEYMAP_X11 (keymap);
if (!keymap_x11->have_direction)
update_direction (keymap_x11);
{
GdkDisplay *display = GDK_KEYMAP (keymap_x11)->display;
XkbStateRec state_rec;
XkbGetState (GDK_DISPLAY_XDISPLAY (display), XkbUseCoreKbd,
&state_rec);
update_direction (keymap_x11, XkbGroupLock (&state_rec));
}
return keymap_x11->current_direction;
}

View File

@ -139,7 +139,8 @@ gboolean _gdk_moveresize_handle_event (XEvent *event);
gboolean _gdk_moveresize_configure_done (GdkDisplay *display,
GdkWindow *window);
void _gdk_keymap_state_changed (GdkDisplay *display);
void _gdk_keymap_state_changed (GdkDisplay *display,
XEvent *event);
void _gdk_keymap_keys_changed (GdkDisplay *display);
gint _gdk_x11_get_group_for_state (GdkDisplay *display,
GdkModifierType state);