Prompt should not always use the currently focused button as its result (Fix bug...
[mikachu/openbox.git] / openbox / prompt.c
index ebefe0a..88c74b6 100644 (file)
@@ -58,7 +58,7 @@ void prompt_startup(gboolean reconfig)
 
     prompt_a_button = RrAppearanceCopy(ob_rr_theme->osd_unpressed_button);
     prompt_a_focus = RrAppearanceCopy(ob_rr_theme->osd_focused_button);
-    prompt_a_press = RrAppearanceCopy(ob_rr_theme->osd_pressed_button);
+    prompt_a_press = RrAppearanceCopy(ob_rr_theme->osd_pressed_button);    
 
     prompt_a_msg = RrAppearanceCopy(ob_rr_theme->osd_hilite_label);
     prompt_a_msg->texture[0].data.text.flow = TRUE;
@@ -75,11 +75,12 @@ void prompt_startup(gboolean reconfig)
 
 void prompt_shutdown(gboolean reconfig)
 {
-    GList *it;
+    GList *it, *next;
 
     if (!reconfig) {
-        for (it = prompt_list; it; it = g_list_next(it)) {
+        for (it = prompt_list; it; it = next) {
             ObPrompt *p = it->data;
+            next = it->next;
             if (p->cleanup) p->cleanup(p, p->data);
         }
 
@@ -362,7 +363,7 @@ static void render_button(ObPrompt *self, ObPromptElement *e)
 {
     RrAppearance *a;
 
-    if (e->pressed && e->hover)       a = prompt_a_press;
+    if (e->hover && e->pressed)       a = prompt_a_press;
     else if (self->focus == e)        a = prompt_a_focus;
     else                              a = prompt_a_button;
 
@@ -594,7 +595,7 @@ static void prompt_run_callback(ObPrompt *self, gint result)
 {
     prompt_ref(self);
     if (self->func) {
-        gboolean clean = self->func(self, self->focus->result, self->data);
+        gboolean clean = self->func(self, result, self->data);
         if (clean && self->cleanup)
             self->cleanup(self, self->data);
     }