diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-03-26 15:56:00 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-03-26 15:56:00 +0300 |
commit | 21aca14e43326ea9af45f1e848ebca52808f8470 (patch) | |
tree | 25c5838a8b40ecb5996c7f1ccdfc1a90f69bd23b | |
parent | 13f80a152a3a84286330b1bc6d9818279b976e91 (diff) | |
parent | 3c45fdd171fa6ebd65f19f9fac9b204865e13136 (diff) |
Merge branch 'master' into blender2.8
-rw-r--r-- | doc/python_api/rst/info_overview.rst | 3 | ||||
-rw-r--r-- | intern/ghost/test/CMakeLists.txt | 11 | ||||
-rw-r--r-- | intern/ghost/test/multitest/MultiTest.c | 2 | ||||
-rw-r--r-- | source/blender/blenfont/BLF_api.h | 4 | ||||
-rw-r--r-- | source/blender/blenfont/intern/blf.c | 11 | ||||
-rw-r--r-- | source/blender/blenfont/intern/blf_glyph.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_text.h | 41 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/text.c | 185 | ||||
-rw-r--r-- | source/blender/depsgraph/util/deg_util_function.h | 2 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 5 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_layout.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_text/text_ops.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 8 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 4 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 11 |
15 files changed, 189 insertions, 106 deletions
diff --git a/doc/python_api/rst/info_overview.rst b/doc/python_api/rst/info_overview.rst index 721374cd472..4b8df47990c 100644 --- a/doc/python_api/rst/info_overview.rst +++ b/doc/python_api/rst/info_overview.rst @@ -194,10 +194,11 @@ User interface classes are given a context in which to draw, buttons window, fil then they are drawn when that area is displayed so they are never called by Python scripts directly. +.. _info_overview_registration: + Registration ============ - Module Registration ------------------- diff --git a/intern/ghost/test/CMakeLists.txt b/intern/ghost/test/CMakeLists.txt index ef6e8915871..da387094619 100644 --- a/intern/ghost/test/CMakeLists.txt +++ b/intern/ghost/test/CMakeLists.txt @@ -203,6 +203,11 @@ target_link_libraries(gears_c glewmx_lib string_lib ${OPENGL_gl_LIBRARY} +<<<<<<< HEAD +======= + ${OPENGL_glu_LIBRARY} + ${CMAKE_DL_LIBS} +>>>>>>> master ${PLATFORM_LINKLIBS} ) @@ -216,6 +221,11 @@ target_link_libraries(gears_cpp glewmx_lib string_lib ${OPENGL_gl_LIBRARY} +<<<<<<< HEAD +======= + ${OPENGL_glu_LIBRARY} + ${CMAKE_DL_LIBS} +>>>>>>> master ${PLATFORM_LINKLIBS} ) @@ -248,5 +258,6 @@ target_link_libraries(multitest_c ${OPENGL_gl_LIBRARY} ${FREETYPE_LIBRARY} ${ZLIB_LIBRARIES} + ${CMAKE_DL_LIBS} ${PLATFORM_LINKLIBS} ) diff --git a/intern/ghost/test/multitest/MultiTest.c b/intern/ghost/test/multitest/MultiTest.c index a5b5a511cb2..833b5c720a1 100644 --- a/intern/ghost/test/multitest/MultiTest.c +++ b/intern/ghost/test/multitest/MultiTest.c @@ -949,7 +949,7 @@ int main(int argc, char **argv) MultiTestApp *app; #ifndef USE_BMF - BLF_init(11, 72); + BLF_init(); #endif app = multitestapp_new(); diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h index 22559edad22..cd3a15f1c88 100644 --- a/source/blender/blenfont/BLF_api.h +++ b/source/blender/blenfont/BLF_api.h @@ -33,6 +33,7 @@ #define __BLF_API_H__ #include "BLI_compiler_attrs.h" +#include "BLI_sys_types.h" /* enable this only if needed (unused circa 2016) */ #define BLF_BLUR_ENABLE 0 @@ -47,6 +48,9 @@ void BLF_default_dpi(int dpi); void BLF_default_set(int fontid); int BLF_default(void); /* get default font ID so we can pass it to other functions */ +void BLF_antialias_set(bool enabled); +bool BLF_antialias_get(void); + void BLF_cache_clear(void); int BLF_load(const char *name) ATTR_NONNULL(); diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c index 0cca1852c91..8e705616c41 100644 --- a/source/blender/blenfont/intern/blf.c +++ b/source/blender/blenfont/intern/blf.c @@ -85,6 +85,7 @@ static FontBLF *global_font[BLF_MAX_FONT] = {NULL}; static int global_font_default = -1; static int global_font_points = 11; static int global_font_dpi = 72; +static bool global_use_antialias = true; /* XXX, should these be made into global_font_'s too? */ int blf_mono_font = -1; @@ -182,6 +183,16 @@ int BLF_default(void) return global_font_default; } +void BLF_antialias_set(bool enabled) +{ + global_use_antialias = enabled; +} + +bool BLF_antialias_get(void) +{ + return global_use_antialias; +} + int BLF_load(const char *name) { FontBLF *font; diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c index 5a8691c9b4f..1f31a2dbd0a 100644 --- a/source/blender/blenfont/intern/blf_glyph.c +++ b/source/blender/blenfont/intern/blf_glyph.c @@ -56,7 +56,7 @@ #include "BLF_api.h" #ifndef BLF_STANDALONE -#include "GPU_immediate.h" +# include "GPU_immediate.h" #endif #include "blf_internal_types.h" @@ -207,7 +207,7 @@ GlyphBLF *blf_glyph_add(FontBLF *font, unsigned int index, unsigned int c) GlyphBLF *g; FT_Error err; FT_Bitmap bitmap, tempbitmap; - const bool is_sharp = (U.text_render & USER_TEXT_DISABLE_AA) != 0; + const bool is_sharp = !BLF_antialias_get(); int flags = FT_LOAD_TARGET_NORMAL | FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP; FT_BBox bbox; unsigned int key; diff --git a/source/blender/blenkernel/BKE_text.h b/source/blender/blenkernel/BKE_text.h index 14d3318e059..b3b1ad23b32 100644 --- a/source/blender/blenkernel/BKE_text.h +++ b/source/blender/blenkernel/BKE_text.h @@ -135,47 +135,6 @@ enum { TXT_MOVE_LINE_DOWN = 1 }; - -/* Undo opcodes */ - -/* Complex editing */ -/* 1 - opcode is followed by 1 byte for ascii character and opcode (repeat)) */ -/* 2 - opcode is followed by 2 bytes for utf-8 character and opcode (repeat)) */ -/* 3 - opcode is followed by 3 bytes for utf-8 character and opcode (repeat)) */ -/* 4 - opcode is followed by 4 bytes for unicode character and opcode (repeat)) */ -#define UNDO_INSERT_1 013 -#define UNDO_INSERT_2 014 -#define UNDO_INSERT_3 015 -#define UNDO_INSERT_4 016 - -#define UNDO_BS_1 017 -#define UNDO_BS_2 020 -#define UNDO_BS_3 021 -#define UNDO_BS_4 022 - -#define UNDO_DEL_1 023 -#define UNDO_DEL_2 024 -#define UNDO_DEL_3 025 -#define UNDO_DEL_4 026 - -/* Text block (opcode is followed - * by 4 character length ID + the text - * block itself + the 4 character length - * ID (repeat) and opcode (repeat)) */ -#define UNDO_DBLOCK 027 /* Delete block */ -#define UNDO_IBLOCK 030 /* Insert block */ - -/* Misc */ -#define UNDO_INDENT 032 -#define UNDO_UNINDENT 033 -#define UNDO_COMMENT 034 -#define UNDO_UNCOMMENT 035 - -#define UNDO_MOVE_LINES_UP 036 -#define UNDO_MOVE_LINES_DOWN 037 - -#define UNDO_DUPLICATE 040 - #ifdef __cplusplus } #endif diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 4ae9818f891..13e42053d73 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -120,6 +120,49 @@ * */ + +/* Undo opcodes */ + +enum { + /* Complex editing */ + /* 1 - opcode is followed by 1 byte for ascii character and opcode (repeat)) */ + /* 2 - opcode is followed by 2 bytes for utf-8 character and opcode (repeat)) */ + /* 3 - opcode is followed by 3 bytes for utf-8 character and opcode (repeat)) */ + /* 4 - opcode is followed by 4 bytes for unicode character and opcode (repeat)) */ + UNDO_INSERT_1 = 013, + UNDO_INSERT_2 = 014, + UNDO_INSERT_3 = 015, + UNDO_INSERT_4 = 016, + + UNDO_BS_1 = 017, + UNDO_BS_2 = 020, + UNDO_BS_3 = 021, + UNDO_BS_4 = 022, + + UNDO_DEL_1 = 023, + UNDO_DEL_2 = 024, + UNDO_DEL_3 = 025, + UNDO_DEL_4 = 026, + + /* Text block (opcode is followed + * by 4 character length ID + the text + * block itself + the 4 character length + * ID (repeat) and opcode (repeat)) */ + UNDO_DBLOCK = 027, /* Delete block */ + UNDO_IBLOCK = 030, /* Insert block */ + + /* Misc */ + UNDO_INDENT = 032, + UNDO_UNINDENT = 033, + UNDO_COMMENT = 034, + UNDO_UNCOMMENT = 035, + + UNDO_MOVE_LINES_UP = 036, + UNDO_MOVE_LINES_DOWN = 037, + + UNDO_DUPLICATE = 040, +}; + /***/ static void txt_pop_first(Text *text); @@ -147,8 +190,8 @@ int txt_get_undostate(void) static void init_undo_text(Text *text) { text->undo_pos = -1; - text->undo_len = TXT_INIT_UNDO; - text->undo_buf = MEM_mallocN(text->undo_len, "undo buf"); + text->undo_len = 0; + text->undo_buf = NULL; } /** @@ -1422,25 +1465,40 @@ void txt_insert_buf(Text *text, const char *in_buffer) static bool max_undo_test(Text *text, int x) { - while (text->undo_pos + x >= text->undo_len) { - if (text->undo_len * 2 > TXT_MAX_UNDO) { - /* XXX error("Undo limit reached, buffer cleared\n"); */ - MEM_freeN(text->undo_buf); - init_undo_text(text); - return false; - } - else { - void *tmp = text->undo_buf; - text->undo_buf = MEM_callocN(text->undo_len * 2, "undo buf"); - memcpy(text->undo_buf, tmp, text->undo_len); - text->undo_len *= 2; - MEM_freeN(tmp); - } - } + /* Normally over-allocating is preferred, + * however in this case the buffer is small enough and re-allocation + * fast enough for each undo step that it's not a problem to allocate each time. + * This also saves on some memory when we have many text buffers + * that would have an empty undo memory allocated. + */ + /* Add one for the null terminator. */ + text->undo_len = text->undo_pos + x + 1; + if (text->undo_len > TXT_MAX_UNDO) { + /* XXX error("Undo limit reached, buffer cleared\n"); */ + MEM_freeN(text->undo_buf); + init_undo_text(text); + return false; + } + else { + /* Small reallocations on each undo step is fine. */ + text->undo_buf = MEM_recallocN(text->undo_buf, text->undo_len); + } return true; } +static void txt_undo_end(Text *text) +{ + int undo_pos_end = text->undo_pos + 1; + BLI_assert(undo_pos_end + 1 == text->undo_len); + text->undo_buf[undo_pos_end] = '\0'; +} + +/* Call once undo is done. */ +#ifndef NDEBUG + +#endif + #if 0 /* UNUSED */ static void dump_buffer(Text *text) { @@ -1628,21 +1686,21 @@ static void txt_undo_store_uint32(char *undo_buf, int *undo_pos, unsigned int va (*undo_pos)++; } -/* store the cur cursor to the undo buffer */ +/* store the cur cursor to the undo buffer (6 bytes)*/ static void txt_undo_store_cur(Text *text) { txt_undo_store_uint16(text->undo_buf, &text->undo_pos, text->curc); txt_undo_store_uint32(text->undo_buf, &text->undo_pos, txt_get_span(text->lines.first, text->curl)); } -/* store the sel cursor to the undo buffer */ +/* store the sel cursor to the undo buffer (6 bytes) */ static void txt_undo_store_sel(Text *text) { txt_undo_store_uint16(text->undo_buf, &text->undo_pos, text->selc); txt_undo_store_uint32(text->undo_buf, &text->undo_pos, txt_get_span(text->lines.first, text->sell)); } -/* store both cursors to the undo buffer */ +/* store both cursors to the undo buffer (12 bytes) */ static void txt_undo_store_cursors(Text *text) { txt_undo_store_cur(text); @@ -1653,42 +1711,46 @@ static void txt_undo_store_cursors(Text *text) static void txt_undo_add_blockop(Text *text, int op, const char *buf) { unsigned int length = strlen(buf); - - if (!max_undo_test(text, length + 11 + 12)) - return; + if (!max_undo_test(text, 2 + 12 + 4 + length + 4 + 1)) { + return; + } + /* 2 bytes */ text->undo_pos++; text->undo_buf[text->undo_pos] = op; text->undo_pos++; - + /* 12 bytes */ txt_undo_store_cursors(text); - + /* 4 bytes */ txt_undo_store_uint32(text->undo_buf, &text->undo_pos, length); - + /* 'length' bytes */ strncpy(text->undo_buf + text->undo_pos, buf, length); text->undo_pos += length; - + /* 4 bytes */ txt_undo_store_uint32(text->undo_buf, &text->undo_pos, length); + /* 1 byte */ text->undo_buf[text->undo_pos] = op; - - text->undo_buf[text->undo_pos + 1] = 0; + + txt_undo_end(text); } /* store a regular operator */ void txt_undo_add_op(Text *text, int op) { - if (!max_undo_test(text, 15)) + if (!max_undo_test(text, 2 + 12 + 1)) { return; + } + /* 2 bytes */ text->undo_pos++; text->undo_buf[text->undo_pos] = op; - text->undo_pos++; - + /* 12 bytes */ txt_undo_store_cursors(text); - + /* 1 byte */ text->undo_buf[text->undo_pos] = op; - text->undo_buf[text->undo_pos + 1] = 0; + + txt_undo_end(text); } /* store an operator for a single character */ @@ -1697,35 +1759,41 @@ static void txt_undo_add_charop(Text *text, int op_start, unsigned int c) char utf8[BLI_UTF8_MAX]; size_t i, utf8_size = BLI_str_utf8_from_unicode(c, utf8); - if (!max_undo_test(text, 3 + utf8_size + 12)) - return; - - text->undo_pos++; - - if (utf8_size < 4) { + if (utf8_size < 4 && 0) { + if (!max_undo_test(text, 2 + 6 + utf8_size + 1)) { + return; + } + /* 2 bytes */ + text->undo_pos++; text->undo_buf[text->undo_pos] = op_start + utf8_size - 1; text->undo_pos++; - + /* 6 bytes */ txt_undo_store_cur(text); - + /* 'utf8_size' bytes */ for (i = 0; i < utf8_size; i++) { text->undo_buf[text->undo_pos] = utf8[i]; text->undo_pos++; } - + /* 1 byte */ text->undo_buf[text->undo_pos] = op_start + utf8_size - 1; } else { + if (!max_undo_test(text, 2 + 6 + 4 + 1)) { + return; + } + /* 2 bytes */ + text->undo_pos++; text->undo_buf[text->undo_pos] = op_start + 3; text->undo_pos++; - - txt_undo_store_cursors(text); - + /* 6 bytes */ + txt_undo_store_cur(text); + /* 4 bytes */ txt_undo_store_uint32(text->undo_buf, &text->undo_pos, c); + /* 1 byte */ text->undo_buf[text->undo_pos] = op_start + 3; } - text->undo_buf[text->undo_pos + 1] = 0; + txt_undo_end(text); } /* extends Link */ @@ -1747,30 +1815,35 @@ static void txt_undo_add_unprefix_op( BLI_assert(BLI_listbase_count(line_index_mask) == line_index_mask_len); /* OP byte + UInt32 count + counted UInt32 line numbers + UInt32 count + 12-bytes selection + OP byte */ - if (!max_undo_test(text, 1 + 4 + (line_index_mask_len * 4) + 4 + 12 + 1)) { + if (!max_undo_test(text, 2 + 4 + (line_index_mask_len * 4) + 4 + 12 + 1)) { return; } - /* Opening buffer sequence with OP */ + /* 2 bytes */ text->undo_pos++; text->undo_buf[text->undo_pos] = undo_op; text->undo_pos++; - /* Adding number of line numbers to read */ + /* Adding number of line numbers to read + * 4 bytes */ txt_undo_store_uint32(text->undo_buf, &text->undo_pos, line_index_mask_len); - /* Adding linenumbers of lines that shall not be indented if undoing */ + /* Adding linenumbers of lines that shall not be indented if undoing. + * 'line_index_mask_len * 4' bytes */ for (idata = line_index_mask->first; idata; idata = idata->next) { txt_undo_store_uint32(text->undo_buf, &text->undo_pos, idata->value); } - /* Adding number of line numbers to read again */ + /* Adding number of line numbers to read again. + * 4 bytes */ txt_undo_store_uint32(text->undo_buf, &text->undo_pos, line_index_mask_len); - /* Adding current selection */ + /* Adding current selection. + * 12 bytes */ txt_undo_store_cursors(text); - /* Closing with OP (same as above) */ + /* Closing with OP (same as above). + * 1 byte */ text->undo_buf[text->undo_pos] = undo_op; /* Marking as last undo operation */ - text->undo_buf[text->undo_pos + 1] = 0; + txt_undo_end(text); } static unsigned short txt_undo_read_uint16(const char *undo_buf, int *undo_pos) @@ -1913,7 +1986,7 @@ static unsigned int txt_redo_read_unicode(const char *undo_buf, int *undo_pos, s unicode = BLI_str_utf8_as_unicode(utf8); break; case 4: /* 32-bit unicode symbol */ - unicode = txt_undo_read_uint32(undo_buf, undo_pos); + unicode = txt_redo_read_uint32(undo_buf, undo_pos); break; default: /* should never happen */ diff --git a/source/blender/depsgraph/util/deg_util_function.h b/source/blender/depsgraph/util/deg_util_function.h index 96f52147fe7..41669919c99 100644 --- a/source/blender/depsgraph/util/deg_util_function.h +++ b/source/blender/depsgraph/util/deg_util_function.h @@ -30,7 +30,7 @@ #pragma once -#if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1800) +#if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1900) #include <functional> diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index b1dc30945c4..8a2baa53d30 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -7788,7 +7788,10 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s /* highlight has timers for tooltips and auto open */ if (state == BUTTON_STATE_HIGHLIGHT) { - but->flag &= ~UI_SELECT; + /* for list-items (that are not drawn with regular emboss), don't change selection based on hovering */ + if (((but->flag & UI_BUT_LIST_ITEM) == 0) && (but->dragflag & UI_EMBOSS_NONE)) { + but->flag &= ~UI_SELECT; + } button_tooltip_timer_reset(C, but); diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 30a18ddc8bc..969367f485c 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -1488,7 +1488,7 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index } /* Mark non-embossed textfields inside a listbox. */ - if (but && (block->flag & UI_BLOCK_LIST_ITEM) && (but->type == UI_BTYPE_TEXT) && (but->dt & UI_EMBOSS_NONE)) { + if (but && (block->flag & UI_BLOCK_LIST_ITEM) && (but->dt & UI_EMBOSS_NONE)) { UI_but_flag_enable(but, UI_BUT_LIST_ITEM); } diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 772cd6bd419..08b98ba51e0 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -961,7 +961,7 @@ static int text_line_break_exec(bContext *C, wmOperator *UNUSED(op)) text_update_cursor_moved(C); WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text); - return OPERATOR_CANCELLED; + return OPERATOR_FINISHED; } void TEXT_OT_line_break(wmOperatorType *ot) diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 27a9f971ee6..eaadde52940 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -447,6 +447,12 @@ static void rna_userdef_text_update(Main *UNUSED(bmain), Scene *UNUSED(scene), P WM_main_add_notifier(NC_WINDOW, NULL); } +static void rna_userdef_text_antialiasing_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + BLF_antialias_set((U.text_render & USER_TEXT_DISABLE_AA) == 0); + rna_userdef_text_update(bmain, scene, ptr); +} + static PointerRNA rna_Theme_space_generic_get(PointerRNA *ptr) { return rna_pointer_inherit_refine(ptr, &RNA_ThemeSpaceGeneric, ptr->data); @@ -4216,7 +4222,7 @@ static void rna_def_userdef_system(BlenderRNA *brna) prop = RNA_def_property(srna, "use_text_antialiasing", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "text_render", USER_TEXT_DISABLE_AA); RNA_def_property_ui_text(prop, "Text Anti-aliasing", "Draw user interface text anti-aliased"); - RNA_def_property_update(prop, 0, "rna_userdef_text_update"); + RNA_def_property_update(prop, 0, "rna_userdef_text_antialiasing_update"); prop = RNA_def_property(srna, "select_method", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "gpu_select_method"); diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index c8af0fc3889..e673b1d386b 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -62,6 +62,8 @@ #include "BLT_translation.h" +#include "BLF_api.h" + #include "DNA_mesh_types.h" /* only for USE_BMESH_SAVE_AS_COMPAT */ #include "DNA_object_types.h" #include "DNA_space_types.h" @@ -353,6 +355,8 @@ static void wm_init_userdef(Main *bmain, const bool read_userdef_from_memory) /* update tempdir from user preferences */ BKE_tempdir_init(U.tempdir); + + BLF_antialias_set((U.text_render & USER_TEXT_DISABLE_AA) == 0); } diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index fb8130f8954..782d0c502a4 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -2321,12 +2321,23 @@ static int wm_exit_blender_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; } +static int wm_exit_blender_invoke(bContext *C, wmOperator *op, const wmEvent *event) +{ + if (U.uiflag & USER_QUIT_PROMPT) { + return wm_exit_blender_exec(C, op); + } + else { + return WM_operator_confirm(C, op, event); + } +} + static void WM_OT_quit_blender(wmOperatorType *ot) { ot->name = "Quit Blender"; ot->idname = "WM_OT_quit_blender"; ot->description = "Quit Blender"; + ot->invoke = wm_exit_blender_invoke; ot->exec = wm_exit_blender_exec; } |