-
Notifications
You must be signed in to change notification settings - Fork 51
Description
Yo, I am a total noob, so I don't know what I am doing, just cloned and opened openbox code base for the first time.
I got frustrated by two issues.
The NextWindow not working if the keybinding is pressed too quickly and the shortcut letter not being underlined in menu items.
Here are two probably bad fixes, they do work perfectly for me though after a brief testing, so hopefully this provides a clue to someone who knows what would be a proper way to address this.
This at least points out exactly where the issues are.
To fix the menu items, we have to correctly reset layout, I added in "openbox/obrender/font.c" file, "void RrFontDraw(XftDraw *d, RrTextureText *t, RrRect *area)" function,
after "PangoEllipsizeMode ell;" line
if (t->shortcut) {
const gchar *s = t->string + t->shortcut_pos;
t->font->shortcut_underline->start_index = t->shortcut_pos;
t->font->shortcut_underline->end_index = t->shortcut_pos +
(g_utf8_next_char(s) - s);
attrlist = pango_layout_get_attributes(t->font->layout);
pango_attr_list_ref(attrlist);
pango_layout_set_attributes(t->font->layout, attrlist);
pango_attr_list_unref(attrlist);
} else {
t->font->shortcut_underline->start_index = 0;
t->font->shortcut_underline->end_index = 0;
attrlist = pango_layout_get_attributes(t->font->layout);
pango_attr_list_ref(attrlist);
pango_layout_set_attributes(t->font->layout, attrlist);
pango_attr_list_unref(attrlist);
}
and removed at the bottom of the function
if (t->shortcut) {
t->font->shortcut_underline->start_index = 0;
t->font->shortcut_underline->end_index = 0;
/* the attributes are owned by the layout.
re-add the attributes to the layout after changing the
start and end index */
attrlist = pango_layout_get_attributes(t->font->layout);
pango_attr_list_ref(attrlist);
pango_layout_set_attributes(t->font->layout, attrlist);
pango_attr_list_unref(attrlist);
}
And for the keyboard events, to detect the window cycling on rapid key presses, the issue is that the key repetition is detected, so I replaced in
"openbox/keyboard.c" file, "gboolean keyboard_event(ObClient *client, const XEvent *e)" function.
This
if (repeat_key == e->xkey.keycode)
repeating = TRUE;
else
repeat_key = e->xkey.keycode;
With this
repeat_key = e->xkey.keycode;
I hope this helps. :)