re-enable activating the text input field for new popup dialog boxes,
authorCampbell Barton <ideasman42@gmail.com>
Wed, 9 Oct 2013 14:35:25 +0000 (14:35 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 9 Oct 2013 14:35:25 +0000 (14:35 +0000)
I'd disabled this for 2.68 since it caused bug [#36109].

This fix now only enabled text activation for popups. (so the toolbar textboxes are skipped)

source/blender/editors/animation/anim_markers.c
source/blender/editors/armature/pose_lib.c
source/blender/editors/interface/interface_layout.c
source/blender/windowmanager/WM_api.h
source/blender/windowmanager/intern/wm_operators.c

index 3c8576be312626dfce1f58e4cb5d2aff869cbb1b..34246427b7eff2ccb57e3fe1f5a834a7564cc302 100644 (file)
@@ -1380,7 +1380,7 @@ static int ed_marker_rename_invoke_wrapper(bContext *C, wmOperator *op, const wm
                RNA_string_set(op->ptr, "name", marker->name);
        
        /* now see if the operator is usable */
-       return ed_markers_opwrap_invoke_custom(C, op, event, WM_operator_props_popup);
+       return ed_markers_opwrap_invoke_custom(C, op, event, WM_operator_props_popup_confirm);
 }
 
 static void MARKER_OT_rename(wmOperatorType *ot)
index cb7a699b522a57797c342062aacabfaec96f8832..182f94b369358cb5d31d3c28713f14b155e107f7 100644 (file)
@@ -638,7 +638,7 @@ static int poselib_rename_invoke(bContext *C, wmOperator *op, const wmEvent *eve
        }
        
        /* part to sync with other similar operators... */
-       return WM_operator_props_popup(C, op, event);
+       return WM_operator_props_popup_confirm(C, op, event);
 }
 
 static int poselib_rename_exec(bContext *C, wmOperator *op)
index 424d2231a03c2f59aca5f3f33bf8570da6521187..4e498476f5dc5bfd478ab19978e47ca15e316557 100644 (file)
@@ -3091,20 +3091,25 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op,
 
        /* set various special settings for buttons */
        {
+               uiBlock *block = uiLayoutGetBlock(layout);
+               const bool is_popup = (block->flag & UI_BLOCK_KEEP_OPEN) != 0;
                uiBut *but;
+
                
-               for (but = uiLayoutGetBlock(layout)->buttons.first; but; but = but->next) {
+               for (but = block->buttons.first; but; but = but->next) {
                        /* no undo for buttons for operator redo panels */
                        uiButClearFlag(but, UI_BUT_UNDO);
                        
-#if 0          /* broken, causes freedback loop, see [#36109] */
+                       /* only for popups, see [#36109] */
+
                        /* if button is operator's default property, and a text-field, enable focus for it
                         *      - this is used for allowing operators with popups to rename stuff with fewer clicks
                         */
-                       if ((but->rnaprop == op->type->prop) && (but->type == TEX)) {
-                               uiButSetFocusOnEnter(CTX_wm_window(C), but);
+                       if (is_popup) {
+                               if ((but->rnaprop == op->type->prop) && (but->type == TEX)) {
+                                       uiButSetFocusOnEnter(CTX_wm_window(C), but);
+                               }
                        }
-#endif
                }
        }
 }
index 84b376edcd84c71f4d60f58346211a400f896657..c338d49fe174fbec50d51f262a78afd7c717c29a 100644 (file)
@@ -198,6 +198,7 @@ bool        WM_operator_filesel_ensure_ext_imtype(wmOperator *op, const struct I
                        /* poll callback, context checks */
 int                    WM_operator_winactive   (struct bContext *C);
                        /* invoke callback, exec + redo popup */
+int                    WM_operator_props_popup_confirm(struct bContext *C, struct wmOperator *op, const struct wmEvent *event);
 int                    WM_operator_props_popup_call(struct bContext *C, struct wmOperator *op, const struct wmEvent *event);
 int                    WM_operator_props_popup (struct bContext *C, struct wmOperator *op, const struct wmEvent *event);
 int            WM_operator_props_dialog_popup(struct bContext *C, struct wmOperator *op, int width, int height);
index 5e1e5890c6b127d61b301c522b062122003ca397..17c7d915b6461cd60622e19fce7833506e82daff 100644 (file)
@@ -1433,7 +1433,8 @@ int WM_operator_ui_popup(bContext *C, wmOperator *op, int width, int height)
  * For use by #WM_operator_props_popup_call, #WM_operator_props_popup only.
  *
  * \note operator menu needs undo flag enabled , for redo callback */
-static int wm_operator_props_popup_ex(bContext *C, wmOperator *op, const int do_call)
+static int wm_operator_props_popup_ex(bContext *C, wmOperator *op,
+                                      const bool do_call, const bool do_redo)
 {
        if ((op->type->flag & OPTYPE_REGISTER) == 0) {
                BKE_reportf(op->reports, RPT_ERROR,
@@ -1443,7 +1444,7 @@ static int wm_operator_props_popup_ex(bContext *C, wmOperator *op, const int do_
 
        /* if we don't have global undo, we can't do undo push for automatic redo,
         * so we require manual OK clicking in this popup */
-       if (!(U.uiflag & USER_GLOBALUNDO))
+       if (!do_redo || !(U.uiflag & USER_GLOBALUNDO))
                return WM_operator_props_dialog_popup(C, op, 15 * UI_UNIT_X, UI_UNIT_Y);
 
        uiPupBlockEx(C, wm_block_create_redo, NULL, wm_block_redo_cancel_cb, op);
@@ -1454,18 +1455,26 @@ static int wm_operator_props_popup_ex(bContext *C, wmOperator *op, const int do_
        return OPERATOR_RUNNING_MODAL;
 }
 
+/* Same as WM_operator_props_popup but don't use operator redo.
+ * just wraps WM_operator_props_dialog_popup.
+ */
+int WM_operator_props_popup_confirm(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
+{
+       return wm_operator_props_popup_ex(C, op, false, false);
+}
+
 /* Same as WM_operator_props_popup but call the operator first,
  * This way - the button values correspond to the result of the operator.
  * Without this, first access to a button will make the result jump,
  * see [#32452] */
 int WM_operator_props_popup_call(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
 {
-       return wm_operator_props_popup_ex(C, op, TRUE);
+       return wm_operator_props_popup_ex(C, op, true, true);
 }
 
 int WM_operator_props_popup(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
 {
-       return wm_operator_props_popup_ex(C, op, FALSE);
+       return wm_operator_props_popup_ex(C, op, false, true);
 }
 
 int WM_operator_props_dialog_popup(bContext *C, wmOperator *op, int width, int height)