re-enable activating the text input field for new popup dialog boxes,

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)
This commit is contained in:
Campbell Barton 2013-10-09 14:35:25 +00:00
parent 49bc310671
commit de3f6b3ec1
5 changed files with 26 additions and 11 deletions

@ -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)

@ -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)

@ -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
}
}
}

@ -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);

@ -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)