Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Werner <stefan.werner@tangent-animation.com>2018-10-12 13:12:10 +0300
committerStefan Werner <stefan.werner@tangent-animation.com>2018-10-12 13:12:10 +0300
commita8e894951a0b54d7cffd90b347ca64cb0789fe43 (patch)
tree553fa0fe2a2a1545672fde49ac17e05e4c2880ea /source/blender/windowmanager/intern
parent7a89fa4a8550a7b3020bd762ab8b69ec836e2f6b (diff)
parentb618c185cb7c5930980e459c84b8818a0fba1f1d (diff)
Merge branch 'master' of git.blender.org:blender into cycles_embree
Diffstat (limited to 'source/blender/windowmanager/intern')
-rw-r--r--source/blender/windowmanager/intern/wm_cursors.c2
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c2
-rw-r--r--source/blender/windowmanager/intern/wm_files.c4
-rw-r--r--source/blender/windowmanager/intern/wm_files_link.c6
-rw-r--r--source/blender/windowmanager/intern/wm_jobs.c8
-rw-r--r--source/blender/windowmanager/intern/wm_keymap.c280
-rw-r--r--source/blender/windowmanager/intern/wm_keymap_utils.c328
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c13
-rw-r--r--source/blender/windowmanager/intern/wm_window.c27
9 files changed, 371 insertions, 299 deletions
diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c
index 24ec3aef759..e789099c799 100644
--- a/source/blender/windowmanager/intern/wm_cursors.c
+++ b/source/blender/windowmanager/intern/wm_cursors.c
@@ -274,7 +274,7 @@ bool wm_cursor_arrow_move(wmWindow *win, const wmEvent *event)
}
-/* afer this you can call restore too */
+/* after this you can call restore too */
void WM_cursor_time(wmWindow *win, int nr)
{
/* 10 8x8 digits */
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 3a300877750..0084c3a5407 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -2101,7 +2101,7 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
/* modal handlers can get removed in this loop, we keep the loop this way
*
* note: check 'handlers->first' because in rare cases the handlers can be cleared
- * by the event thats called, for eg:
+ * by the event that's called, for eg:
*
* Calling a python script which changes the area.type, see [#32232] */
for (handler = handlers->first; handler && handlers->first; handler = nexthandler) {
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 477699fccaa..796103677bf 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -641,7 +641,7 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports)
struct {
char app_template[64];
bool override;
-} wm_init_state_app_template = {0};
+} wm_init_state_app_template = {{0}};
/**
* Used for setting app-template from the command line:
@@ -964,7 +964,7 @@ static RecentFile *wm_file_history_find(const char *filepath)
/**
* Write #BLENDER_HISTORY_FILE as-is, without checking the environment
- * (thats handled by #wm_history_file_update).
+ * (that's handled by #wm_history_file_update).
*/
static void wm_history_file_write(void)
{
diff --git a/source/blender/windowmanager/intern/wm_files_link.c b/source/blender/windowmanager/intern/wm_files_link.c
index 72973d3de56..d8cc5b37b7d 100644
--- a/source/blender/windowmanager/intern/wm_files_link.c
+++ b/source/blender/windowmanager/intern/wm_files_link.c
@@ -361,7 +361,7 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
}
if (!BLI_ghash_haskey(libraries, libname)) {
- BLI_ghash_insert(libraries, BLI_strdup(libname), SET_INT_IN_POINTER(lib_idx));
+ BLI_ghash_insert(libraries, BLI_strdup(libname), POINTER_FROM_INT(lib_idx));
lib_idx++;
wm_link_append_data_library_add(lapp_data, libname);
}
@@ -382,7 +382,7 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
continue;
}
- lib_idx = GET_INT_FROM_POINTER(BLI_ghash_lookup(libraries, libname));
+ lib_idx = POINTER_AS_INT(BLI_ghash_lookup(libraries, libname));
item = wm_link_append_data_item_add(lapp_data, name, BKE_idcode_from_name(group), NULL);
BLI_BITMAP_ENABLE(item->libraries, lib_idx);
@@ -602,7 +602,7 @@ static void lib_relocate_do(
BKE_main_id_tag_all(bmain, LIB_TAG_PRE_EXISTING, true);
- /* We do not want any instanciation here! */
+ /* We do not want any instantiation here! */
wm_link_do(lapp_data, reports, bmain, NULL, NULL);
BKE_main_lock(bmain);
diff --git a/source/blender/windowmanager/intern/wm_jobs.c b/source/blender/windowmanager/intern/wm_jobs.c
index dd9e7edf413..92d51c9a400 100644
--- a/source/blender/windowmanager/intern/wm_jobs.c
+++ b/source/blender/windowmanager/intern/wm_jobs.c
@@ -64,12 +64,12 @@
* - add timer notifier to handle progress
*
* Stop job
- * - signal job to end
- * on end, job will tag itself as sleeping
+ * - signal job to end
+ * on end, job will tag itself as sleeping
*
* Remove job
* - signal job to end
- * on end, job will remove itself
+ * on end, job will remove itself
*
* When job is done:
* - it puts timer to sleep (or removes?)
@@ -175,7 +175,7 @@ static wmJob *wm_job_find(wmWindowManager *wm, void *owner, const int job_type)
/* ******************* public API ***************** */
/**
- * \return current job or adds new job, but doesnt run it.
+ * \return current job or adds new job, but doesn't run it.
*
* \note every owner only gets a single job,
* adding a new one will stop running job and when stopped it starts the new one.
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index 762cef4a635..2834e95527a 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -121,7 +121,7 @@ static void wm_keymap_item_properties_update_ot(wmKeyMapItem *kmi)
wmOperatorType *ot = WM_operatortype_find(kmi->idname, 0);
if (ot) {
if (ot->srna != kmi->ptr->type) {
- /* matches wm_keymap_item_properties_set but doesnt alloc new ptr */
+ /* matches wm_keymap_item_properties_set but doesn't alloc new ptr */
WM_operator_properties_create_ptr(kmi->ptr, ot);
/* 'kmi->ptr->data' NULL'd above, keep using existing properties.
* Note: the operators property types may have changed,
@@ -477,21 +477,6 @@ wmKeyMapItem *WM_keymap_add_item(wmKeyMap *keymap, const char *idname, int type,
return kmi;
}
-/* menu wrapper for WM_keymap_add_item */
-wmKeyMapItem *WM_keymap_add_menu(wmKeyMap *keymap, const char *idname, int type, int val, int modifier, int keymodifier)
-{
- wmKeyMapItem *kmi = WM_keymap_add_item(keymap, "WM_OT_call_menu", type, val, modifier, keymodifier);
- RNA_string_set(kmi->ptr, "name", idname);
- return kmi;
-}
-
-wmKeyMapItem *WM_keymap_add_menu_pie(wmKeyMap *keymap, const char *idname, int type, int val, int modifier, int keymodifier)
-{
- wmKeyMapItem *kmi = WM_keymap_add_item(keymap, "WM_OT_call_menu_pie", type, val, modifier, keymodifier);
- RNA_string_set(kmi->ptr, "name", idname);
- return kmi;
-}
-
bool WM_keymap_remove_item(wmKeyMap *keymap, wmKeyMapItem *kmi)
{
if (BLI_findindex(&keymap->items, kmi) != -1) {
@@ -771,7 +756,7 @@ wmKeyMap *WM_keymap_list_find(ListBase *lb, const char *idname, int spaceid, int
return NULL;
}
-wmKeyMap *WM_keymap_find(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid)
+wmKeyMap *WM_keymap_ensure(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid)
{
wmKeyMap *km = WM_keymap_list_find(&keyconf->keymaps, idname, spaceid, regionid);
@@ -798,7 +783,7 @@ wmKeyMap *WM_keymap_find_all(const bContext *C, const char *idname, int spaceid,
wmKeyMap *WM_modalkeymap_add(wmKeyConfig *keyconf, const char *idname, const EnumPropertyItem *items)
{
- wmKeyMap *km = WM_keymap_find(keyconf, idname, 0, 0);
+ wmKeyMap *km = WM_keymap_ensure(keyconf, idname, 0, 0);
km->flag |= KEYMAP_MODAL;
km->modal_items = items;
@@ -1664,265 +1649,6 @@ wmKeyMapItem *WM_keymap_item_find_id(wmKeyMap *keymap, int id)
return NULL;
}
-/* Guess an appropriate keymap from the operator name */
-/* Needs to be kept up to date with Keymap and Operator naming */
-wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname)
-{
- /* Op types purposely skipped for now:
- * BRUSH_OT
- * BOID_OT
- * BUTTONS_OT
- * CONSTRAINT_OT
- * PAINT_OT
- * ED_OT
- * FLUID_OT
- * TEXTURE_OT
- * UI_OT
- * VIEW2D_OT
- * WORLD_OT
- */
-
- wmKeyMap *km = NULL;
- SpaceLink *sl = CTX_wm_space_data(C);
-
- /* Window */
- if (STRPREFIX(opname, "WM_OT")) {
- km = WM_keymap_find_all(C, "Window", 0, 0);
- }
- /* Screen & Render */
- else if (STRPREFIX(opname, "SCREEN_OT") ||
- STRPREFIX(opname, "RENDER_OT") ||
- STRPREFIX(opname, "SOUND_OT") ||
- STRPREFIX(opname, "SCENE_OT"))
- {
- km = WM_keymap_find_all(C, "Screen", 0, 0);
- }
- /* Grease Pencil */
- else if (STRPREFIX(opname, "GPENCIL_OT")) {
- km = WM_keymap_find_all(C, "Grease Pencil", 0, 0);
- }
- /* Markers */
- else if (STRPREFIX(opname, "MARKER_OT")) {
- km = WM_keymap_find_all(C, "Markers", 0, 0);
- }
- /* Import/Export*/
- else if (STRPREFIX(opname, "IMPORT_") ||
- STRPREFIX(opname, "EXPORT_"))
- {
- km = WM_keymap_find_all(C, "Window", 0, 0);
- }
-
-
- /* 3D View */
- else if (STRPREFIX(opname, "VIEW3D_OT")) {
- km = WM_keymap_find_all(C, "3D View", sl->spacetype, 0);
- }
- else if (STRPREFIX(opname, "OBJECT_OT")) {
- /* exception, this needs to work outside object mode too */
- if (STRPREFIX(opname, "OBJECT_OT_mode_set"))
- km = WM_keymap_find_all(C, "Object Non-modal", 0, 0);
- else
- km = WM_keymap_find_all(C, "Object Mode", 0, 0);
- }
- /* Object mode related */
- else if (STRPREFIX(opname, "GROUP_OT") ||
- STRPREFIX(opname, "MATERIAL_OT") ||
- STRPREFIX(opname, "PTCACHE_OT") ||
- STRPREFIX(opname, "RIGIDBODY_OT"))
- {
- km = WM_keymap_find_all(C, "Object Mode", 0, 0);
- }
-
- /* Editing Modes */
- else if (STRPREFIX(opname, "MESH_OT")) {
- km = WM_keymap_find_all(C, "Mesh", 0, 0);
-
- /* some mesh operators are active in object mode too, like add-prim */
- if (km && !WM_keymap_poll((bContext *)C, km)) {
- km = WM_keymap_find_all(C, "Object Mode", 0, 0);
- }
- }
- else if (STRPREFIX(opname, "CURVE_OT") ||
- STRPREFIX(opname, "SURFACE_OT"))
- {
- km = WM_keymap_find_all(C, "Curve", 0, 0);
-
- /* some curve operators are active in object mode too, like add-prim */
- if (km && !WM_keymap_poll((bContext *)C, km)) {
- km = WM_keymap_find_all(C, "Object Mode", 0, 0);
- }
- }
- else if (STRPREFIX(opname, "ARMATURE_OT") ||
- STRPREFIX(opname, "SKETCH_OT"))
- {
- km = WM_keymap_find_all(C, "Armature", 0, 0);
- }
- else if (STRPREFIX(opname, "POSE_OT") ||
- STRPREFIX(opname, "POSELIB_OT"))
- {
- km = WM_keymap_find_all(C, "Pose", 0, 0);
- }
- else if (STRPREFIX(opname, "SCULPT_OT")) {
- switch (CTX_data_mode_enum(C)) {
- case OB_MODE_SCULPT:
- km = WM_keymap_find_all(C, "Sculpt", 0, 0);
- break;
- case OB_MODE_EDIT:
- km = WM_keymap_find_all(C, "UV Sculpt", 0, 0);
- break;
- }
- }
- else if (STRPREFIX(opname, "MBALL_OT")) {
- km = WM_keymap_find_all(C, "Metaball", 0, 0);
-
- /* some mball operators are active in object mode too, like add-prim */
- if (km && !WM_keymap_poll((bContext *)C, km)) {
- km = WM_keymap_find_all(C, "Object Mode", 0, 0);
- }
- }
- else if (STRPREFIX(opname, "LATTICE_OT")) {
- km = WM_keymap_find_all(C, "Lattice", 0, 0);
- }
- else if (STRPREFIX(opname, "PARTICLE_OT")) {
- km = WM_keymap_find_all(C, "Particle", 0, 0);
- }
- else if (STRPREFIX(opname, "FONT_OT")) {
- km = WM_keymap_find_all(C, "Font", 0, 0);
- }
- /* Paint Face Mask */
- else if (STRPREFIX(opname, "PAINT_OT_face_select")) {
- km = WM_keymap_find_all(C, "Face Mask", 0, 0);
- }
- else if (STRPREFIX(opname, "PAINT_OT")) {
- /* check for relevant mode */
- switch (CTX_data_mode_enum(C)) {
- case OB_MODE_WEIGHT_PAINT:
- km = WM_keymap_find_all(C, "Weight Paint", 0, 0);
- break;
- case OB_MODE_VERTEX_PAINT:
- km = WM_keymap_find_all(C, "Vertex Paint", 0, 0);
- break;
- case OB_MODE_TEXTURE_PAINT:
- km = WM_keymap_find_all(C, "Image Paint", 0, 0);
- break;
- }
- }
- /* Timeline */
- else if (STRPREFIX(opname, "TIME_OT")) {
- km = WM_keymap_find_all(C, "Timeline", sl->spacetype, 0);
- }
- /* Image Editor */
- else if (STRPREFIX(opname, "IMAGE_OT")) {
- km = WM_keymap_find_all(C, "Image", sl->spacetype, 0);
- }
- /* Clip Editor */
- else if (STRPREFIX(opname, "CLIP_OT")) {
- km = WM_keymap_find_all(C, "Clip", sl->spacetype, 0);
- }
- else if (STRPREFIX(opname, "MASK_OT")) {
- km = WM_keymap_find_all(C, "Mask Editing", 0, 0);
- }
- /* UV Editor */
- else if (STRPREFIX(opname, "UV_OT")) {
- /* Hack to allow using UV unwrapping ops from 3DView/editmode.
- * Mesh keymap is probably not ideal, but best place I could find to put those. */
- if (sl->spacetype == SPACE_VIEW3D) {
- km = WM_keymap_find_all(C, "Mesh", 0, 0);
- if (km && !WM_keymap_poll((bContext *)C, km)) {
- km = NULL;
- }
- }
- if (!km) {
- km = WM_keymap_find_all(C, "UV Editor", 0, 0);
- }
- }
- /* Node Editor */
- else if (STRPREFIX(opname, "NODE_OT")) {
- km = WM_keymap_find_all(C, "Node Editor", sl->spacetype, 0);
- }
- /* Animation Editor Channels */
- else if (STRPREFIX(opname, "ANIM_OT_channels")) {
- km = WM_keymap_find_all(C, "Animation Channels", 0, 0);
- }
- /* Animation Generic - after channels */
- else if (STRPREFIX(opname, "ANIM_OT")) {
- km = WM_keymap_find_all(C, "Animation", 0, 0);
- }
- /* Graph Editor */
- else if (STRPREFIX(opname, "GRAPH_OT")) {
- km = WM_keymap_find_all(C, "Graph Editor", sl->spacetype, 0);
- }
- /* Dopesheet Editor */
- else if (STRPREFIX(opname, "ACTION_OT")) {
- km = WM_keymap_find_all(C, "Dopesheet", sl->spacetype, 0);
- }
- /* NLA Editor */
- else if (STRPREFIX(opname, "NLA_OT")) {
- km = WM_keymap_find_all(C, "NLA Editor", sl->spacetype, 0);
- }
- /* Script */
- else if (STRPREFIX(opname, "SCRIPT_OT")) {
- km = WM_keymap_find_all(C, "Script", sl->spacetype, 0);
- }
- /* Text */
- else if (STRPREFIX(opname, "TEXT_OT")) {
- km = WM_keymap_find_all(C, "Text", sl->spacetype, 0);
- }
- /* Sequencer */
- else if (STRPREFIX(opname, "SEQUENCER_OT")) {
- km = WM_keymap_find_all(C, "Sequencer", sl->spacetype, 0);
- }
- /* Console */
- else if (STRPREFIX(opname, "CONSOLE_OT")) {
- km = WM_keymap_find_all(C, "Console", sl->spacetype, 0);
- }
- /* Console */
- else if (STRPREFIX(opname, "INFO_OT")) {
- km = WM_keymap_find_all(C, "Info", sl->spacetype, 0);
- }
- /* File browser */
- else if (STRPREFIX(opname, "FILE_OT")) {
- km = WM_keymap_find_all(C, "File Browser", sl->spacetype, 0);
- }
- /* Logic Editor */
- else if (STRPREFIX(opname, "LOGIC_OT")) {
- km = WM_keymap_find_all(C, "Logic Editor", sl->spacetype, 0);
- }
- /* Outliner */
- else if (STRPREFIX(opname, "OUTLINER_OT")) {
- km = WM_keymap_find_all(C, "Outliner", sl->spacetype, 0);
- }
- /* Transform */
- else if (STRPREFIX(opname, "TRANSFORM_OT")) {
- /* check for relevant editor */
- switch (sl->spacetype) {
- case SPACE_VIEW3D:
- km = WM_keymap_find_all(C, "3D View", sl->spacetype, 0);
- break;
- case SPACE_IPO:
- km = WM_keymap_find_all(C, "Graph Editor", sl->spacetype, 0);
- break;
- case SPACE_ACTION:
- km = WM_keymap_find_all(C, "Dopesheet", sl->spacetype, 0);
- break;
- case SPACE_NLA:
- km = WM_keymap_find_all(C, "NLA Editor", sl->spacetype, 0);
- break;
- case SPACE_IMAGE:
- km = WM_keymap_find_all(C, "UV Editor", 0, 0);
- break;
- case SPACE_NODE:
- km = WM_keymap_find_all(C, "Node Editor", sl->spacetype, 0);
- break;
- case SPACE_SEQ:
- km = WM_keymap_find_all(C, "Sequencer", sl->spacetype, 0);
- break;
- }
- }
-
- return km;
-}
-
const char *WM_bool_as_string(bool test)
{
return test ? IFACE_("ON") : IFACE_("OFF");
diff --git a/source/blender/windowmanager/intern/wm_keymap_utils.c b/source/blender/windowmanager/intern/wm_keymap_utils.c
new file mode 100644
index 00000000000..1774b876f38
--- /dev/null
+++ b/source/blender/windowmanager/intern/wm_keymap_utils.c
@@ -0,0 +1,328 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/windowmanager/intern/wm_keymap_utils.c
+ * \ingroup wm
+ *
+ * Utilities to help define keymaps.
+ */
+
+#include <string.h>
+
+#include "DNA_object_types.h"
+#include "DNA_space_types.h"
+#include "DNA_userdef_types.h"
+#include "DNA_windowmanager_types.h"
+
+#include "BLI_utildefines.h"
+
+#include "BKE_context.h"
+
+#include "RNA_access.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+/* menu wrapper for WM_keymap_add_item */
+
+/* -------------------------------------------------------------------- */
+/** \name Wrappers for #WM_keymap_add_item
+ * \{ */
+
+wmKeyMapItem *WM_keymap_add_menu(wmKeyMap *keymap, const char *idname, int type, int val, int modifier, int keymodifier)
+{
+ wmKeyMapItem *kmi = WM_keymap_add_item(keymap, "WM_OT_call_menu", type, val, modifier, keymodifier);
+ RNA_string_set(kmi->ptr, "name", idname);
+ return kmi;
+}
+
+wmKeyMapItem *WM_keymap_add_menu_pie(wmKeyMap *keymap, const char *idname, int type, int val, int modifier, int keymodifier)
+{
+ wmKeyMapItem *kmi = WM_keymap_add_item(keymap, "WM_OT_call_menu_pie", type, val, modifier, keymodifier);
+ RNA_string_set(kmi->ptr, "name", idname);
+ return kmi;
+}
+
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Introspection
+ * \{ */
+
+/* Guess an appropriate keymap from the operator name */
+/* Needs to be kept up to date with Keymap and Operator naming */
+wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname)
+{
+ /* Op types purposely skipped for now:
+ * BRUSH_OT
+ * BOID_OT
+ * BUTTONS_OT
+ * CONSTRAINT_OT
+ * PAINT_OT
+ * ED_OT
+ * FLUID_OT
+ * TEXTURE_OT
+ * UI_OT
+ * VIEW2D_OT
+ * WORLD_OT
+ */
+
+ wmKeyMap *km = NULL;
+ SpaceLink *sl = CTX_wm_space_data(C);
+
+ /* Window */
+ if (STRPREFIX(opname, "WM_OT")) {
+ km = WM_keymap_find_all(C, "Window", 0, 0);
+ }
+ /* Screen & Render */
+ else if (STRPREFIX(opname, "SCREEN_OT") ||
+ STRPREFIX(opname, "RENDER_OT") ||
+ STRPREFIX(opname, "SOUND_OT") ||
+ STRPREFIX(opname, "SCENE_OT"))
+ {
+ km = WM_keymap_find_all(C, "Screen", 0, 0);
+ }
+ /* Grease Pencil */
+ else if (STRPREFIX(opname, "GPENCIL_OT")) {
+ km = WM_keymap_find_all(C, "Grease Pencil", 0, 0);
+ }
+ /* Markers */
+ else if (STRPREFIX(opname, "MARKER_OT")) {
+ km = WM_keymap_find_all(C, "Markers", 0, 0);
+ }
+ /* Import/Export*/
+ else if (STRPREFIX(opname, "IMPORT_") ||
+ STRPREFIX(opname, "EXPORT_"))
+ {
+ km = WM_keymap_find_all(C, "Window", 0, 0);
+ }
+
+
+ /* 3D View */
+ else if (STRPREFIX(opname, "VIEW3D_OT")) {
+ km = WM_keymap_find_all(C, "3D View", sl->spacetype, 0);
+ }
+ else if (STRPREFIX(opname, "OBJECT_OT")) {
+ /* exception, this needs to work outside object mode too */
+ if (STRPREFIX(opname, "OBJECT_OT_mode_set"))
+ km = WM_keymap_find_all(C, "Object Non-modal", 0, 0);
+ else
+ km = WM_keymap_find_all(C, "Object Mode", 0, 0);
+ }
+ /* Object mode related */
+ else if (STRPREFIX(opname, "GROUP_OT") ||
+ STRPREFIX(opname, "MATERIAL_OT") ||
+ STRPREFIX(opname, "PTCACHE_OT") ||
+ STRPREFIX(opname, "RIGIDBODY_OT"))
+ {
+ km = WM_keymap_find_all(C, "Object Mode", 0, 0);
+ }
+
+ /* Editing Modes */
+ else if (STRPREFIX(opname, "MESH_OT")) {
+ km = WM_keymap_find_all(C, "Mesh", 0, 0);
+
+ /* some mesh operators are active in object mode too, like add-prim */
+ if (km && !WM_keymap_poll((bContext *)C, km)) {
+ km = WM_keymap_find_all(C, "Object Mode", 0, 0);
+ }
+ }
+ else if (STRPREFIX(opname, "CURVE_OT") ||
+ STRPREFIX(opname, "SURFACE_OT"))
+ {
+ km = WM_keymap_find_all(C, "Curve", 0, 0);
+
+ /* some curve operators are active in object mode too, like add-prim */
+ if (km && !WM_keymap_poll((bContext *)C, km)) {
+ km = WM_keymap_find_all(C, "Object Mode", 0, 0);
+ }
+ }
+ else if (STRPREFIX(opname, "ARMATURE_OT") ||
+ STRPREFIX(opname, "SKETCH_OT"))
+ {
+ km = WM_keymap_find_all(C, "Armature", 0, 0);
+ }
+ else if (STRPREFIX(opname, "POSE_OT") ||
+ STRPREFIX(opname, "POSELIB_OT"))
+ {
+ km = WM_keymap_find_all(C, "Pose", 0, 0);
+ }
+ else if (STRPREFIX(opname, "SCULPT_OT")) {
+ switch (CTX_data_mode_enum(C)) {
+ case OB_MODE_SCULPT:
+ km = WM_keymap_find_all(C, "Sculpt", 0, 0);
+ break;
+ case OB_MODE_EDIT:
+ km = WM_keymap_find_all(C, "UV Sculpt", 0, 0);
+ break;
+ }
+ }
+ else if (STRPREFIX(opname, "MBALL_OT")) {
+ km = WM_keymap_find_all(C, "Metaball", 0, 0);
+
+ /* some mball operators are active in object mode too, like add-prim */
+ if (km && !WM_keymap_poll((bContext *)C, km)) {
+ km = WM_keymap_find_all(C, "Object Mode", 0, 0);
+ }
+ }
+ else if (STRPREFIX(opname, "LATTICE_OT")) {
+ km = WM_keymap_find_all(C, "Lattice", 0, 0);
+ }
+ else if (STRPREFIX(opname, "PARTICLE_OT")) {
+ km = WM_keymap_find_all(C, "Particle", 0, 0);
+ }
+ else if (STRPREFIX(opname, "FONT_OT")) {
+ km = WM_keymap_find_all(C, "Font", 0, 0);
+ }
+ /* Paint Face Mask */
+ else if (STRPREFIX(opname, "PAINT_OT_face_select")) {
+ km = WM_keymap_find_all(C, "Face Mask", 0, 0);
+ }
+ else if (STRPREFIX(opname, "PAINT_OT")) {
+ /* check for relevant mode */
+ switch (CTX_data_mode_enum(C)) {
+ case OB_MODE_WEIGHT_PAINT:
+ km = WM_keymap_find_all(C, "Weight Paint", 0, 0);
+ break;
+ case OB_MODE_VERTEX_PAINT:
+ km = WM_keymap_find_all(C, "Vertex Paint", 0, 0);
+ break;
+ case OB_MODE_TEXTURE_PAINT:
+ km = WM_keymap_find_all(C, "Image Paint", 0, 0);
+ break;
+ }
+ }
+ /* Timeline */
+ else if (STRPREFIX(opname, "TIME_OT")) {
+ km = WM_keymap_find_all(C, "Timeline", sl->spacetype, 0);
+ }
+ /* Image Editor */
+ else if (STRPREFIX(opname, "IMAGE_OT")) {
+ km = WM_keymap_find_all(C, "Image", sl->spacetype, 0);
+ }
+ /* Clip Editor */
+ else if (STRPREFIX(opname, "CLIP_OT")) {
+ km = WM_keymap_find_all(C, "Clip", sl->spacetype, 0);
+ }
+ else if (STRPREFIX(opname, "MASK_OT")) {
+ km = WM_keymap_find_all(C, "Mask Editing", 0, 0);
+ }
+ /* UV Editor */
+ else if (STRPREFIX(opname, "UV_OT")) {
+ /* Hack to allow using UV unwrapping ops from 3DView/editmode.
+ * Mesh keymap is probably not ideal, but best place I could find to put those. */
+ if (sl->spacetype == SPACE_VIEW3D) {
+ km = WM_keymap_find_all(C, "Mesh", 0, 0);
+ if (km && !WM_keymap_poll((bContext *)C, km)) {
+ km = NULL;
+ }
+ }
+ if (!km) {
+ km = WM_keymap_find_all(C, "UV Editor", 0, 0);
+ }
+ }
+ /* Node Editor */
+ else if (STRPREFIX(opname, "NODE_OT")) {
+ km = WM_keymap_find_all(C, "Node Editor", sl->spacetype, 0);
+ }
+ /* Animation Editor Channels */
+ else if (STRPREFIX(opname, "ANIM_OT_channels")) {
+ km = WM_keymap_find_all(C, "Animation Channels", 0, 0);
+ }
+ /* Animation Generic - after channels */
+ else if (STRPREFIX(opname, "ANIM_OT")) {
+ km = WM_keymap_find_all(C, "Animation", 0, 0);
+ }
+ /* Graph Editor */
+ else if (STRPREFIX(opname, "GRAPH_OT")) {
+ km = WM_keymap_find_all(C, "Graph Editor", sl->spacetype, 0);
+ }
+ /* Dopesheet Editor */
+ else if (STRPREFIX(opname, "ACTION_OT")) {
+ km = WM_keymap_find_all(C, "Dopesheet", sl->spacetype, 0);
+ }
+ /* NLA Editor */
+ else if (STRPREFIX(opname, "NLA_OT")) {
+ km = WM_keymap_find_all(C, "NLA Editor", sl->spacetype, 0);
+ }
+ /* Script */
+ else if (STRPREFIX(opname, "SCRIPT_OT")) {
+ km = WM_keymap_find_all(C, "Script", sl->spacetype, 0);
+ }
+ /* Text */
+ else if (STRPREFIX(opname, "TEXT_OT")) {
+ km = WM_keymap_find_all(C, "Text", sl->spacetype, 0);
+ }
+ /* Sequencer */
+ else if (STRPREFIX(opname, "SEQUENCER_OT")) {
+ km = WM_keymap_find_all(C, "Sequencer", sl->spacetype, 0);
+ }
+ /* Console */
+ else if (STRPREFIX(opname, "CONSOLE_OT")) {
+ km = WM_keymap_find_all(C, "Console", sl->spacetype, 0);
+ }
+ /* Console */
+ else if (STRPREFIX(opname, "INFO_OT")) {
+ km = WM_keymap_find_all(C, "Info", sl->spacetype, 0);
+ }
+ /* File browser */
+ else if (STRPREFIX(opname, "FILE_OT")) {
+ km = WM_keymap_find_all(C, "File Browser", sl->spacetype, 0);
+ }
+ /* Logic Editor */
+ else if (STRPREFIX(opname, "LOGIC_OT")) {
+ km = WM_keymap_find_all(C, "Logic Editor", sl->spacetype, 0);
+ }
+ /* Outliner */
+ else if (STRPREFIX(opname, "OUTLINER_OT")) {
+ km = WM_keymap_find_all(C, "Outliner", sl->spacetype, 0);
+ }
+ /* Transform */
+ else if (STRPREFIX(opname, "TRANSFORM_OT")) {
+ /* check for relevant editor */
+ switch (sl->spacetype) {
+ case SPACE_VIEW3D:
+ km = WM_keymap_find_all(C, "3D View", sl->spacetype, 0);
+ break;
+ case SPACE_IPO:
+ km = WM_keymap_find_all(C, "Graph Editor", sl->spacetype, 0);
+ break;
+ case SPACE_ACTION:
+ km = WM_keymap_find_all(C, "Dopesheet", sl->spacetype, 0);
+ break;
+ case SPACE_NLA:
+ km = WM_keymap_find_all(C, "NLA Editor", sl->spacetype, 0);
+ break;
+ case SPACE_IMAGE:
+ km = WM_keymap_find_all(C, "UV Editor", 0, 0);
+ break;
+ case SPACE_NODE:
+ km = WM_keymap_find_all(C, "Node Editor", sl->spacetype, 0);
+ break;
+ case SPACE_SEQ:
+ km = WM_keymap_find_all(C, "Sequencer", sl->spacetype, 0);
+ break;
+ }
+ }
+
+ return km;
+}
+
+/** \} */
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 454d7dc57f0..45084980727 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -262,7 +262,7 @@ char *WM_operator_pystring_ex(bContext *C, wmOperator *op, const bool all_args,
}
}
else {
- /* only to get the orginal props for comparisons */
+ /* only to get the original props for comparisons */
PointerRNA opptr_default;
const bool macro_args_test = ot->macro.first ? macro_args : true;
@@ -607,7 +607,7 @@ void WM_operator_properties_sanitize(PointerRNA *ptr, const bool no_context)
/** set all props to their default,
* \param do_update Only update un-initialized props.
*
- * \note, theres nothing specific to operators here.
+ * \note, there's nothing specific to operators here.
* this could be made a general function.
*/
bool WM_operator_properties_default(PointerRNA *ptr, const bool do_update)
@@ -768,6 +768,7 @@ static uiBlock *wm_enum_search_menu(bContext *C, ARegion *ar, void *arg_op)
block = UI_block_begin(C, ar, "_popup", UI_EMBOSS);
UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_SEARCH_MENU);
+ UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP);
search[0] = '\0';
#if 0 /* ok, this isn't so easy... */
@@ -980,6 +981,8 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op)
block = UI_block_begin(C, ar, __func__, UI_EMBOSS);
UI_block_flag_disable(block, UI_BLOCK_LOOP);
+ UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_REGULAR);
+
/* UI_BLOCK_NUMSELECT for layer buttons */
UI_block_flag_enable(block, UI_BLOCK_NUMSELECT | UI_BLOCK_KEEP_OPEN | UI_BLOCK_MOVEMOUSE_QUIT);
@@ -1064,6 +1067,7 @@ static uiBlock *wm_block_dialog_create(bContext *C, ARegion *ar, void *userData)
block = UI_block_begin(C, ar, __func__, UI_EMBOSS);
UI_block_flag_disable(block, UI_BLOCK_LOOP);
+ UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_REGULAR);
/* intentionally don't use 'UI_BLOCK_MOVEMOUSE_QUIT', some dialogues have many items
* where quitting by accident is very annoying */
@@ -1106,6 +1110,7 @@ static uiBlock *wm_operator_ui_create(bContext *C, ARegion *ar, void *userData)
block = UI_block_begin(C, ar, __func__, UI_EMBOSS);
UI_block_flag_disable(block, UI_BLOCK_LOOP);
UI_block_flag_enable(block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_MOVEMOUSE_QUIT);
+ UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_REGULAR);
layout = UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, data->width, data->height, 0, style);
@@ -1433,6 +1438,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
* with the OS when the splash shows, window clipping in this case gives
* ugly results and clipping the splash isn't useful anyway, just disable it [#32938] */
UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_KEEP_OPEN | UI_BLOCK_NO_WIN_CLIP);
+ UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP);
/* XXX splash scales with pixelsize, should become widget-units */
but = uiDefBut(block, UI_BTYPE_IMAGE, 0, "", 0, 0.5f * U.widget_unit, U.pixelsize * 501, U.pixelsize * 282, ibuf, 0.0, 0.0, 0, 0, ""); /* button owns the imbuf now */
@@ -1582,6 +1588,7 @@ static uiBlock *wm_block_search_menu(bContext *C, ARegion *ar, void *userdata)
block = UI_block_begin(C, ar, "_popup", UI_EMBOSS);
UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_SEARCH_MENU);
+ UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP);
but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 10, init_data->size[0], UI_UNIT_Y, 0, 0, "");
UI_but_func_operator_search(but);
@@ -3320,7 +3327,7 @@ static void gesture_zoom_border_modal_keymap(wmKeyConfig *keyconf)
/* default keymap for windows and screens, only call once per WM */
void wm_window_keymap(wmKeyConfig *keyconf)
{
- wmKeyMap *keymap = WM_keymap_find(keyconf, "Window", 0, 0);
+ wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Window", 0, 0);
wmKeyMapItem *kmi;
/* note, this doesn't replace existing keymap items */
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index f6ebdae8414..04a236e5d66 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -102,8 +102,9 @@ static struct WMInitStruct {
int windowstate;
WinOverrideFlag override_flag;
+ bool window_focus;
bool native_pixels;
-} wm_init_state = {0, 0, 0, 0, GHOST_kWindowStateNormal, 0, true};
+} wm_init_state = {0, 0, 0, 0, GHOST_kWindowStateNormal, 0, true, true};
/* ******** win open & close ************ */
@@ -345,6 +346,7 @@ static uiBlock *block_create_confirm_quit(struct bContext *C, struct ARegion *ar
uiBlock *block = UI_block_begin(C, ar, "confirm_quit_popup", UI_EMBOSS);
UI_block_flag_enable(block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_LOOP | UI_BLOCK_NO_WIN_CLIP | UI_BLOCK_NUMSELECT);
+ UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP);
UI_block_emboss_set(block, UI_EMBOSS);
uiLayout *layout = UI_block_layout(
@@ -623,7 +625,9 @@ static void wm_window_ghostwindow_add(wmWindowManager *wm, const char *title, wm
#ifndef __APPLE__
/* set the state here, so minimized state comes up correct on windows */
- GHOST_SetWindowState(ghostwin, (GHOST_TWindowState)win->windowstate);
+ if (wm_init_state.window_focus) {
+ GHOST_SetWindowState(ghostwin, (GHOST_TWindowState)win->windowstate);
+ }
#endif
/* until screens get drawn, make it nice gray */
glClearColor(0.55, 0.55, 0.55, 0.0);
@@ -719,13 +723,13 @@ void wm_window_ghostwindows_ensure(wmWindowManager *wm)
win->eventstate = MEM_callocN(sizeof(wmEvent), "window event state");
/* add keymap handlers (1 handler for all keys in map!) */
- keymap = WM_keymap_find(wm->defaultconf, "Window", 0, 0);
+ keymap = WM_keymap_ensure(wm->defaultconf, "Window", 0, 0);
WM_event_add_keymap_handler(&win->handlers, keymap);
- keymap = WM_keymap_find(wm->defaultconf, "Screen", 0, 0);
+ keymap = WM_keymap_ensure(wm->defaultconf, "Screen", 0, 0);
WM_event_add_keymap_handler(&win->handlers, keymap);
- keymap = WM_keymap_find(wm->defaultconf, "Screen Editing", 0, 0);
+ keymap = WM_keymap_ensure(wm->defaultconf, "Screen Editing", 0, 0);
WM_event_add_keymap_handler(&win->modalhandlers, keymap);
/* add drop boxes */
@@ -808,7 +812,7 @@ wmWindow *WM_window_open_temp(bContext *C, int x, int y, int sizex, int sizey, i
sizex /= native_pixel_size;
sizey /= native_pixel_size;
- /* calculate postition */
+ /* calculate position */
rcti rect;
rect.xmin = x + win_prev->posx - sizex / 2;
rect.ymin = y + win_prev->posy - sizey / 2;
@@ -1467,7 +1471,7 @@ static int wm_window_timer(const bContext *C)
else if (wt->event_type == TIMERAUTOSAVE)
wm_autosave_timer(C, wm, wt);
else if (wt->event_type == TIMERNOTIFIER)
- WM_main_add_notifier(GET_UINT_FROM_POINTER(wt->customdata), NULL);
+ WM_main_add_notifier(POINTER_AS_UINT(wt->customdata), NULL);
else if (win) {
wmEvent event;
wm_event_init_from_window(win, &event);
@@ -1545,6 +1549,8 @@ void wm_ghost_init(bContext *C)
if (wm_init_state.native_pixels) {
GHOST_UseNativePixels();
}
+
+ GHOST_UseWindowFocus(wm_init_state.window_focus);
}
}
@@ -1597,7 +1603,7 @@ wmTimer *WM_event_add_timer_notifier(wmWindowManager *wm, wmWindow *win, unsigne
wt->stime = wt->ltime;
wt->timestep = timestep;
wt->win = win;
- wt->customdata = SET_UINT_IN_POINTER(type);
+ wt->customdata = POINTER_FROM_UINT(type);
wt->flags |= WM_TIMER_NO_FREE_CUSTOM_DATA;
BLI_addtail(&wm->timers, wt);
@@ -1831,6 +1837,11 @@ void WM_init_state_normal_set(void)
wm_init_state.override_flag |= WIN_OVERRIDE_WINSTATE;
}
+void WM_init_window_focus_set(bool do_it)
+{
+ wm_init_state.window_focus = do_it;
+}
+
void WM_init_native_pixels(bool do_it)
{
wm_init_state.native_pixels = do_it;