]> Dogcows Code - chaz/openbox/commitdiff
dont go to disabled menu entries with keyboard shortcuts
authorDana Jansens <danakj@orodu.net>
Wed, 25 Apr 2007 18:26:02 +0000 (18:26 +0000)
committerDana Jansens <danakj@orodu.net>
Wed, 25 Apr 2007 18:26:02 +0000 (18:26 +0000)
fix some rendering of shortcuts

openbox/event.c
openbox/menuframe.c
render/font.c

index 4a60194bb6cbdcd4d750983dfe4c0616c6094afb..10b7816c20bff71778edeb2ee5265ef21e3b177e 100644 (file)
@@ -1331,7 +1331,8 @@ static void event_handle_menu_shortcut(XEvent *ev)
         ObMenuEntryFrame *e = it->data;
         gunichar entrykey = 0;
 
-        if (e->entry->type == OB_MENU_ENTRY_TYPE_NORMAL)
+        if (e->entry->type == OB_MENU_ENTRY_TYPE_NORMAL &&
+            e->entry->data.normal.enabled)
             entrykey = e->entry->data.normal.shortcut;
         else if (e->entry->type == OB_MENU_ENTRY_TYPE_SUBMENU)
             entrykey = e->entry->data.submenu.submenu->shortcut;
index 9d635f95d7cf92b3a6098ce4c03e14971bc261ef..7ca2136ca1f13ab98947be969788331ffb36e147 100644 (file)
@@ -318,8 +318,9 @@ static void menu_entry_frame_render(ObMenuEntryFrame *self)
                    self->a_text_selected :
                    self->a_text_normal));
         text_a->texture[0].data.text.string = self->entry->data.normal.label;
-        if (self->frame->menu->show_all_shortcuts ||
-            self->entry->data.normal.shortcut > 0)
+        if (self->entry->data.normal.shortcut &&
+            (self->frame->menu->show_all_shortcuts ||
+             self->entry->data.normal.shortcut_position > 0))
         {
             text_a->texture[0].data.text.shortcut = TRUE;
             text_a->texture[0].data.text.shortcut_pos =
@@ -333,7 +334,9 @@ static void menu_entry_frame_render(ObMenuEntryFrame *self)
                   self->a_text_normal);
         sub = self->entry->data.submenu.submenu;
         text_a->texture[0].data.text.string = sub ? sub->title : "";
-        if (self->frame->menu->show_all_shortcuts || sub->shortcut > 0) {
+        if (sub->shortcut && (self->frame->menu->show_all_shortcuts ||
+                              sub->shortcut_position > 0))
+        {
             text_a->texture[0].data.text.shortcut = TRUE;
             text_a->texture[0].data.text.shortcut_pos = sub->shortcut_position;
         } else
index 1208e9ef687d38f9a6085a3072e067e16c9b27f3..8692a9d10dd195300d771e223d518a3ea3aba5c6 100644 (file)
@@ -221,6 +221,13 @@ void RrFontDraw(XftDraw *d, RrTextureText *t, RrRect *area)
 
     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);
 
     if (t->shadow_offset_x || t->shadow_offset_y) {
         c.color.red = t->shadow_color->r | t->shadow_color->r << 8;
@@ -229,14 +236,6 @@ void RrFontDraw(XftDraw *d, RrTextureText *t, RrRect *area)
         c.color.alpha = 0xffff * t->shadow_alpha / 255;
         c.pixel = t->shadow_color->pixel;
 
-        /* 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);
-
         /* see below... */
         pango_xft_render_layout_line
             (d, &c, pango_layout_get_line(t->font->layout, 0),
This page took 0.035657 seconds and 4 git commands to generate.