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:
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/CMakeLists.txt8
-rw-r--r--source/blender/windowmanager/WM_api.h4
-rw-r--r--source/blender/windowmanager/WM_types.h4
-rw-r--r--source/blender/windowmanager/gizmo/intern/wm_gizmo.c2
-rw-r--r--source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c1
-rw-r--r--source/blender/windowmanager/gizmo/intern/wm_gizmo_group_type.c1
-rw-r--r--source/blender/windowmanager/gizmo/intern/wm_gizmo_type.c1
-rw-r--r--source/blender/windowmanager/intern/wm.c165
-rw-r--r--source/blender/windowmanager/intern/wm_draw.c2
-rw-r--r--source/blender/windowmanager/intern/wm_event_query.c32
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c38
-rw-r--r--source/blender/windowmanager/intern/wm_files.c56
-rw-r--r--source/blender/windowmanager/intern/wm_files_link.c8
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c7
-rw-r--r--source/blender/windowmanager/intern/wm_jobs.c9
-rw-r--r--source/blender/windowmanager/intern/wm_operator_props.c32
-rw-r--r--source/blender/windowmanager/intern/wm_operator_type.c5
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c111
-rw-r--r--source/blender/windowmanager/intern/wm_playanim.c4
-rw-r--r--source/blender/windowmanager/intern/wm_window.c2
20 files changed, 360 insertions, 132 deletions
diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt
index 07e962aaf89..6de36acb343 100644
--- a/source/blender/windowmanager/CMakeLists.txt
+++ b/source/blender/windowmanager/CMakeLists.txt
@@ -36,13 +36,16 @@ set(INC
../makesdna
../makesrna
../nodes
- ../render/extern/include
+ ../render
../sequencer
../../../intern/clog
../../../intern/ghost
../../../intern/glew-mx
../../../intern/guardedalloc
../../../intern/memutil
+
+ # for writefile.c: dna_type_offsets.h
+ ${CMAKE_BINARY_DIR}/source/blender/makesdna/intern
)
set(INC_SYS
@@ -206,3 +209,6 @@ if(WITH_XR_OPENXR)
endif()
blender_add_lib_nolist(bf_windowmanager "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
+
+# Needed so we can use dna_type_offsets.h for defaults initialization.
+add_dependencies(bf_windowmanager bf_dna)
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 8d4ef29af74..fd0b99fb9ae 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -729,6 +729,7 @@ enum {
WM_JOB_TYPE_LIGHT_BAKE,
WM_JOB_TYPE_FSMENU_BOOKMARK_VALIDATE,
WM_JOB_TYPE_QUADRIFLOW_REMESH,
+ WM_JOB_TYPE_TRACE_IMAGE,
/* add as needed, bake, seq proxy build
* if having hard coded values is a problem */
};
@@ -856,6 +857,9 @@ void WM_event_ndof_to_quat(const struct wmNDOFMotionData *ndof, float q[4]);
float WM_event_tablet_data(const struct wmEvent *event, int *pen_flip, float tilt[2]);
bool WM_event_is_tablet(const struct wmEvent *event);
+int WM_event_absolute_delta_x(const struct wmEvent *event);
+int WM_event_absolute_delta_y(const struct wmEvent *event);
+
#ifdef WITH_INPUT_IME
bool WM_event_is_ime_switch(const struct wmEvent *event);
#endif
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index a8d24205268..7fa2851cbf3 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -595,6 +595,10 @@ typedef struct wmEvent {
/** Ascii, unicode, mouse coords, angles, vectors, dragdrop info. */
void *customdata;
+ /* True if the operating system inverted the delta x/y values and resulting
+ * prev x/y values, for natural scroll direction. For absolute scroll direction,
+ * the delta must be negated again. */
+ char is_direction_inverted;
} wmEvent;
/**
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo.c
index b81b12a1b06..a56a506b1ab 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo.c
@@ -611,6 +611,7 @@ void WM_gizmo_calc_matrix_final(const wmGizmo *gz, float r_mat[4][4])
r_mat);
}
+/* -------------------------------------------------------------------- */
/** \name Gizmo Property Access
*
* Matches `WM_operator_properties` conventions.
@@ -755,6 +756,7 @@ void WM_gizmo_properties_free(PointerRNA *ptr)
/** \} */
+/* -------------------------------------------------------------------- */
/** \name General Utilities
*
* \{ */
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
index eea046cd1cf..e9a1b5e3df0 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
@@ -344,6 +344,7 @@ bool wm_gizmogroup_is_any_selected(const wmGizmoGroup *gzgroup)
/** \} */
+/* -------------------------------------------------------------------- */
/** \name Gizmo operators
*
* Basic operators for gizmo interaction with user configurable keymaps.
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group_type.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group_type.c
index f594ced6b66..a9e24867351 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group_type.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group_type.c
@@ -38,6 +38,7 @@
#include "wm_gizmo_intern.h"
#include "wm_gizmo_wmapi.h"
+/* -------------------------------------------------------------------- */
/** \name GizmoGroup Type Append
*
* \note This follows conventions from #WM_operatortype_find #WM_operatortype_append & friends.
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_type.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_type.c
index 3956ff8fd36..efd7a13d02a 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_type.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_type.c
@@ -45,6 +45,7 @@
#include "wm_gizmo_intern.h"
#include "wm_gizmo_wmapi.h"
+/* -------------------------------------------------------------------- */
/** \name Gizmo Type Append
*
* \note This follows conventions from #WM_operatortype_find #WM_operatortype_append & friends.
diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c
index e7010461c68..a10284e9740 100644
--- a/source/blender/windowmanager/intern/wm.c
+++ b/source/blender/windowmanager/intern/wm.c
@@ -25,6 +25,9 @@
* Also Blender's main event loop (WM_main).
*/
+/* Allow using deprecated functionality for .blend file I/O. */
+#define DNA_DEPRECATED_ALLOW
+
#include <stddef.h>
#include <string.h>
@@ -69,6 +72,8 @@
# include "BPY_extern_run.h"
#endif
+#include "BLO_read_write.h"
+
/* ****************************************************** */
static void window_manager_free_data(ID *id)
@@ -98,6 +103,158 @@ static void window_manager_foreach_id(ID *id, LibraryForeachIDData *data)
}
}
+static void write_wm_xr_data(BlendWriter *writer, wmXrData *xr_data)
+{
+ BKE_screen_view3d_shading_blend_write(writer, &xr_data->session_settings.shading);
+}
+
+static void window_manager_blend_write(BlendWriter *writer, ID *id, const void *id_address)
+{
+ wmWindowManager *wm = (wmWindowManager *)id;
+
+ BLO_write_id_struct(writer, wmWindowManager, id_address, &wm->id);
+ BKE_id_blend_write(writer, &wm->id);
+ write_wm_xr_data(writer, &wm->xr);
+
+ LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
+ /* update deprecated screen member (for so loading in 2.7x uses the correct screen) */
+ win->screen = BKE_workspace_active_screen_get(win->workspace_hook);
+
+ BLO_write_struct(writer, wmWindow, win);
+ BLO_write_struct(writer, WorkSpaceInstanceHook, win->workspace_hook);
+ BLO_write_struct(writer, Stereo3dFormat, win->stereo3d_format);
+
+ BKE_screen_area_map_blend_write(writer, &win->global_areas);
+
+ /* data is written, clear deprecated data again */
+ win->screen = NULL;
+ }
+}
+
+static void direct_link_wm_xr_data(BlendDataReader *reader, wmXrData *xr_data)
+{
+ BKE_screen_view3d_shading_blend_read_data(reader, &xr_data->session_settings.shading);
+}
+
+static void window_manager_blend_read_data(BlendDataReader *reader, ID *id)
+{
+ wmWindowManager *wm = (wmWindowManager *)id;
+
+ id_us_ensure_real(&wm->id);
+ BLO_read_list(reader, &wm->windows);
+
+ LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
+ BLO_read_data_address(reader, &win->parent);
+
+ WorkSpaceInstanceHook *hook = win->workspace_hook;
+ BLO_read_data_address(reader, &win->workspace_hook);
+
+ /* This will be NULL for any pre-2.80 blend file. */
+ if (win->workspace_hook != NULL) {
+ /* We need to restore a pointer to this later when reading workspaces,
+ * so store in global oldnew-map.
+ * Note that this is only needed for versioning of older .blend files now.. */
+ BLO_read_data_globmap_add(reader, hook, win->workspace_hook);
+ /* Cleanup pointers to data outside of this data-block scope. */
+ win->workspace_hook->act_layout = NULL;
+ win->workspace_hook->temp_workspace_store = NULL;
+ win->workspace_hook->temp_layout_store = NULL;
+ }
+
+ BKE_screen_area_map_blend_read_data(reader, &win->global_areas);
+
+ win->ghostwin = NULL;
+ win->gpuctx = NULL;
+ win->eventstate = NULL;
+ win->cursor_keymap_status = NULL;
+ win->tweak = NULL;
+#ifdef WIN32
+ win->ime_data = NULL;
+#endif
+
+ BLI_listbase_clear(&win->queue);
+ BLI_listbase_clear(&win->handlers);
+ BLI_listbase_clear(&win->modalhandlers);
+ BLI_listbase_clear(&win->gesture);
+
+ win->active = 0;
+
+ win->cursor = 0;
+ win->lastcursor = 0;
+ win->modalcursor = 0;
+ win->grabcursor = 0;
+ win->addmousemove = true;
+ BLO_read_data_address(reader, &win->stereo3d_format);
+
+ /* Multi-view always fallback to anaglyph at file opening
+ * otherwise quad-buffer saved files can break Blender. */
+ if (win->stereo3d_format) {
+ win->stereo3d_format->display_mode = S3D_DISPLAY_ANAGLYPH;
+ }
+ }
+
+ direct_link_wm_xr_data(reader, &wm->xr);
+
+ BLI_listbase_clear(&wm->timers);
+ BLI_listbase_clear(&wm->operators);
+ BLI_listbase_clear(&wm->paintcursors);
+ BLI_listbase_clear(&wm->queue);
+ BKE_reports_init(&wm->reports, RPT_STORE);
+
+ BLI_listbase_clear(&wm->keyconfigs);
+ wm->defaultconf = NULL;
+ wm->addonconf = NULL;
+ wm->userconf = NULL;
+ wm->undo_stack = NULL;
+
+ wm->message_bus = NULL;
+
+ wm->xr.runtime = NULL;
+
+ BLI_listbase_clear(&wm->jobs);
+ BLI_listbase_clear(&wm->drags);
+
+ wm->windrawable = NULL;
+ wm->winactive = NULL;
+ wm->initialized = 0;
+ wm->op_undo_depth = 0;
+ wm->is_interface_locked = 0;
+}
+
+static void lib_link_wm_xr_data(BlendLibReader *reader, ID *parent_id, wmXrData *xr_data)
+{
+ BLO_read_id_address(reader, parent_id->lib, &xr_data->session_settings.base_pose_object);
+}
+
+static void lib_link_workspace_instance_hook(BlendLibReader *reader,
+ WorkSpaceInstanceHook *hook,
+ ID *id)
+{
+ WorkSpace *workspace = BKE_workspace_active_get(hook);
+ BLO_read_id_address(reader, id->lib, &workspace);
+ BKE_workspace_active_set(hook, workspace);
+}
+
+static void window_manager_blend_read_lib(BlendLibReader *reader, ID *id)
+{
+ wmWindowManager *wm = (wmWindowManager *)id;
+
+ LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
+ if (win->workspace_hook) { /* NULL for old files */
+ lib_link_workspace_instance_hook(reader, win->workspace_hook, &wm->id);
+ }
+ BLO_read_id_address(reader, wm->id.lib, &win->scene);
+ /* deprecated, but needed for versioning (will be NULL'ed then) */
+ BLO_read_id_address(reader, NULL, &win->screen);
+
+ LISTBASE_FOREACH (ScrArea *, area, &win->global_areas.areabase) {
+ BKE_screen_area_blend_read_lib(reader, &wm->id, area);
+ }
+
+ lib_link_wm_xr_data(reader, &wm->id, &wm->xr);
+ }
+}
+
IDTypeInfo IDType_ID_WM = {
.id_code = ID_WM,
.id_filter = 0,
@@ -116,10 +273,12 @@ IDTypeInfo IDType_ID_WM = {
.foreach_id = window_manager_foreach_id,
.foreach_cache = NULL,
- .blend_write = NULL,
- .blend_read_data = NULL,
- .blend_read_lib = NULL,
+ .blend_write = window_manager_blend_write,
+ .blend_read_data = window_manager_blend_read_data,
+ .blend_read_lib = window_manager_blend_read_lib,
.blend_read_expand = NULL,
+
+ .blend_read_undo_preserve = NULL,
};
#define MAX_OP_REGISTERED 32
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index 3449c6974f5..b11dae27d19 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -103,7 +103,7 @@ static void wm_paintcursor_draw(bContext *C, ScrArea *area, ARegion *region)
continue;
}
- if ((pc->region_type != RGN_TYPE_ANY) && (region->regiontype != pc->region_type)) {
+ if (!ELEM(pc->region_type, RGN_TYPE_ANY, region->regiontype)) {
continue;
}
diff --git a/source/blender/windowmanager/intern/wm_event_query.c b/source/blender/windowmanager/intern/wm_event_query.c
index db80296bdb8..a996796104b 100644
--- a/source/blender/windowmanager/intern/wm_event_query.c
+++ b/source/blender/windowmanager/intern/wm_event_query.c
@@ -423,6 +423,38 @@ bool WM_event_is_tablet(const struct wmEvent *event)
/** \} */
/* -------------------------------------------------------------------- */
+/** \name Event Scroll's Absolute Deltas
+ *
+ * User may change the scroll behavior, and the deltas are automatically inverted.
+ * These functions return the absolute direction, swipe up/right gives positive values.
+ *
+ * \{ */
+
+int WM_event_absolute_delta_x(const struct wmEvent *event)
+{
+ int dx = event->x - event->prevx;
+
+ if (!event->is_direction_inverted) {
+ dx = -dx;
+ }
+
+ return dx;
+}
+
+int WM_event_absolute_delta_y(const struct wmEvent *event)
+{
+ int dy = event->y - event->prevy;
+
+ if (!event->is_direction_inverted) {
+ dy = -dy;
+ }
+
+ return dy;
+}
+
+/** \} */
+
+/* -------------------------------------------------------------------- */
/** \name Event IME Input Access
* \{ */
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 8f141a8e23b..bf970aa2034 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -1731,8 +1731,21 @@ void WM_event_remove_handlers(bContext *C, ListBase *handlers)
BLI_assert(handler_base->type != 0);
if (handler_base->type == WM_HANDLER_TYPE_OP) {
wmEventHandler_Op *handler = (wmEventHandler_Op *)handler_base;
+
if (handler->op) {
wmWindow *win = CTX_wm_window(C);
+
+ if (handler->is_fileselect) {
+ /* Exit File Browsers referring to this handler/operator. */
+ LISTBASE_FOREACH (wmWindow *, temp_win, &wm->windows) {
+ ScrArea *file_area = ED_fileselect_handler_area_find(temp_win, handler->op);
+ if (!file_area) {
+ continue;
+ }
+ ED_area_exit(C, file_area);
+ }
+ }
+
if (handler->op->type->cancel) {
ScrArea *area = CTX_wm_area(C);
ARegion *region = CTX_wm_region(C);
@@ -3471,25 +3484,15 @@ void WM_event_add_fileselect(bContext *C, wmOperator *op)
if (handler->is_fileselect == false) {
continue;
}
- bScreen *screen = CTX_wm_screen(C);
- bool cancel_handler = true;
- /* Find the area with the file selector for this handler. */
- ED_screen_areas_iter (win, screen, area) {
- if (area->spacetype == SPACE_FILE) {
- SpaceFile *sfile = area->spacedata.first;
+ ScrArea *file_area = ED_fileselect_handler_area_find(win, handler->op);
- if (sfile->op == handler->op) {
- CTX_wm_area_set(C, area);
- wm_handler_fileselect_do(C, &win->modalhandlers, handler, EVT_FILESELECT_CANCEL);
- cancel_handler = false;
- break;
- }
- }
+ if (file_area) {
+ CTX_wm_area_set(C, file_area);
+ wm_handler_fileselect_do(C, &win->modalhandlers, handler, EVT_FILESELECT_CANCEL);
}
-
/* If not found we stop the handler without changing the screen. */
- if (cancel_handler) {
+ else {
wm_handler_fileselect_do(
C, &win->modalhandlers, handler, EVT_FILESELECT_EXTERNAL_CANCEL);
}
@@ -4394,10 +4397,13 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, void
event.prevx = event.x - pd->deltaX;
event.prevy = event.y - (-pd->deltaY);
+ /* The direction is inverted from the device due to system preferences. */
+ event.is_direction_inverted = pd->isDirectionInverted;
+
wm_event_add(win, &event);
break;
}
- /* ,ouse button, */
+ /* Mouse button. */
case GHOST_kEventButtonDown:
case GHOST_kEventButtonUp: {
GHOST_TEventButtonData *bd = customdata;
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index a862d221815..4706287a3a9 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -2482,7 +2482,7 @@ void WM_OT_open_mainfile(wmOperatorType *ot)
FILE_OPENFILE,
WM_FILESEL_FILEPATH,
FILE_DEFAULTDISPLAY,
- FILE_SORT_ALPHA);
+ FILE_SORT_DEFAULT);
RNA_def_boolean(
ot->srna, "load_ui", true, "Load UI", "Load user interface setup in the .blend file");
@@ -2804,7 +2804,7 @@ void WM_OT_save_as_mainfile(wmOperatorType *ot)
FILE_SAVE,
WM_FILESEL_FILEPATH,
FILE_DEFAULTDISPLAY,
- FILE_SORT_ALPHA);
+ FILE_SORT_DEFAULT);
RNA_def_boolean(ot->srna, "compress", false, "Compress", "Write compressed .blend file");
RNA_def_boolean(ot->srna,
"relative_remap",
@@ -2874,7 +2874,7 @@ void WM_OT_save_mainfile(wmOperatorType *ot)
FILE_SAVE,
WM_FILESEL_FILEPATH,
FILE_DEFAULTDISPLAY,
- FILE_SORT_ALPHA);
+ FILE_SORT_DEFAULT);
RNA_def_boolean(ot->srna, "compress", false, "Compress", "Write compressed .blend file");
RNA_def_boolean(ot->srna,
"relative_remap",
@@ -3190,8 +3190,13 @@ static uiBlock *block_create__close_file_dialog(struct bContext *C,
const int text_points_max = MAX2(style->widget.points, style->widgetlabel.points);
const int dialog_width = icon_size + (text_points_max * 34 * U.dpi_fac);
+ /* By default, the space between icon and text/buttons will be equal to the 'columnspace',
+ this extra padding will add some space by increasing the left column width,
+ making the icon placement more symmetrical, between the block edge and the text. */
+ const float icon_padding = 6.0f * U.dpi_fac;
/* Calculate icon column factor. */
- const float split_factor = (float)icon_size / (float)(dialog_width - style->columnspace);
+ const float split_factor = ((float)icon_size + icon_padding) /
+ (float)(dialog_width - style->columnspace);
uiBlock *block = UI_block_begin(C, region, close_file_dialog_name, UI_EMBOSS);
@@ -3207,8 +3212,10 @@ static uiBlock *block_create__close_file_dialog(struct bContext *C,
uiLayout *split_block = uiLayoutSplit(block_layout, split_factor, false);
/* Alert Icon. */
- uiLayout *layout = uiLayoutColumn(split_block, false);
- uiDefButAlert(block, ALERT_ICON_QUESTION, 0, 0, 0, icon_size);
+ uiLayout *layout = uiLayoutRow(split_block, false);
+ /* Using 'align_left' with 'row' avoids stretching the icon along the width of column. */
+ uiLayoutSetAlignment(layout, UI_LAYOUT_ALIGN_LEFT);
+ uiDefButAlert(block, ALERT_ICON_QUESTION, 0, 0, icon_size, icon_size);
/* The rest of the content on the right. */
layout = uiLayoutColumn(split_block, false);
@@ -3221,10 +3228,9 @@ static uiBlock *block_create__close_file_dialog(struct bContext *C,
char filename[FILE_MAX];
if (blendfile_pathpath[0] != '\0') {
BLI_split_file_part(blendfile_pathpath, filename, sizeof(filename));
- BLI_path_extension_replace(filename, sizeof(filename), "");
}
else {
- STRNCPY(filename, IFACE_("Untitled"));
+ STRNCPY(filename, IFACE_("untitled.blend"));
}
uiItemL(layout, filename, ICON_NONE);
@@ -3236,7 +3242,7 @@ static uiBlock *block_create__close_file_dialog(struct bContext *C,
LISTBASE_FOREACH (Report *, report, &reports.list) {
uiLayout *row = uiLayoutColumn(layout, false);
uiLayoutSetScaleY(row, 0.6f);
- uiItemS_ex(row, 1.2f);
+ uiItemS(row);
/* Error messages created in ED_image_save_all_modified_info() can be long,
* but are made to separate into two parts at first colon between text and paths.
@@ -3259,12 +3265,8 @@ static uiBlock *block_create__close_file_dialog(struct bContext *C,
/* Modified Images Checkbox. */
if (modified_images_count > 0) {
char message[64];
- BLI_snprintf(message,
- sizeof(message),
- (modified_images_count == 1) ? "Save %u modified image" :
- "Save %u modified images",
- modified_images_count);
- uiItemS_ex(layout, 2.0f);
+ BLI_snprintf(message, sizeof(message), "Save %u modified image(s)", modified_images_count);
+ uiItemS(layout);
uiDefButBitC(block,
UI_BTYPE_CHECKBOX,
1,
@@ -3284,7 +3286,7 @@ static uiBlock *block_create__close_file_dialog(struct bContext *C,
BKE_reports_clear(&reports);
- uiItemS_ex(layout, 1.0f);
+ uiItemS_ex(layout, modified_images_count > 0 ? 2.0f : 4.0f);
/* Buttons. */
#ifdef _WIN32
@@ -3296,13 +3298,10 @@ static uiBlock *block_create__close_file_dialog(struct bContext *C,
if (windows_layout) {
/* Windows standard layout. */
- uiLayout *split = uiLayoutSplit(block_layout, 0.174f, true);
+ uiLayout *split = uiLayoutSplit(layout, 0.0f, true);
uiLayoutSetScaleY(split, 1.2f);
uiLayoutColumn(split, false);
- uiItemS(layout);
-
- uiLayoutColumn(split, false);
wm_block_file_close_save_button(block, post_action);
uiLayoutColumn(split, false);
@@ -3314,21 +3313,16 @@ static uiBlock *block_create__close_file_dialog(struct bContext *C,
else {
/* Non-Windows layout (macOS and Linux). */
- uiLayout *split = uiLayoutSplit(block_layout, 0.167f, true);
+ uiLayout *split = uiLayoutSplit(layout, 0.3f, true);
uiLayoutSetScaleY(split, 1.2f);
- layout = uiLayoutColumn(split, false);
- uiItemS(layout);
-
- /* Split button area into two sections: 40/60. */
- uiLayout *split_left = uiLayoutSplit(split, 0.40f, true);
-
- /* First button uses 75% of left side (30% of original). */
- uiLayoutSplit(split_left, 0.75f, true);
+ uiLayoutColumn(split, false);
wm_block_file_close_discard_button(block, post_action);
- /* The right side is split 50/50 (each 30% of original). */
- uiLayout *split_right = uiLayoutSplit(split_left, 0.50f, true);
+ uiLayout *split_right = uiLayoutSplit(split, 0.1f, true);
+
+ uiLayoutColumn(split_right, false);
+ /* Empty space. */
uiLayoutColumn(split_right, false);
wm_block_file_close_cancel_button(block, post_action);
diff --git a/source/blender/windowmanager/intern/wm_files_link.c b/source/blender/windowmanager/intern/wm_files_link.c
index cfbc037d19c..49ac250d9a3 100644
--- a/source/blender/windowmanager/intern/wm_files_link.c
+++ b/source/blender/windowmanager/intern/wm_files_link.c
@@ -598,7 +598,7 @@ void WM_OT_link(wmOperatorType *ot)
WM_FILESEL_FILEPATH | WM_FILESEL_DIRECTORY | WM_FILESEL_FILENAME |
WM_FILESEL_RELPATH | WM_FILESEL_FILES | WM_FILESEL_SHOW_PROPS,
FILE_DEFAULTDISPLAY,
- FILE_SORT_ALPHA);
+ FILE_SORT_DEFAULT);
wm_link_append_properties_common(ot, true);
}
@@ -622,7 +622,7 @@ void WM_OT_append(wmOperatorType *ot)
WM_FILESEL_FILEPATH | WM_FILESEL_DIRECTORY | WM_FILESEL_FILENAME |
WM_FILESEL_FILES | WM_FILESEL_SHOW_PROPS,
FILE_DEFAULTDISPLAY,
- FILE_SORT_ALPHA);
+ FILE_SORT_DEFAULT);
wm_link_append_properties_common(ot, false);
RNA_def_boolean(ot->srna,
@@ -1172,7 +1172,7 @@ void WM_OT_lib_relocate(wmOperatorType *ot)
WM_FILESEL_FILEPATH | WM_FILESEL_DIRECTORY | WM_FILESEL_FILENAME |
WM_FILESEL_FILES | WM_FILESEL_RELPATH,
FILE_DEFAULTDISPLAY,
- FILE_SORT_ALPHA);
+ FILE_SORT_DEFAULT);
}
static int wm_lib_reload_exec(bContext *C, wmOperator *op)
@@ -1202,7 +1202,7 @@ void WM_OT_lib_reload(wmOperatorType *ot)
WM_FILESEL_FILEPATH | WM_FILESEL_DIRECTORY | WM_FILESEL_FILENAME |
WM_FILESEL_RELPATH,
FILE_DEFAULTDISPLAY,
- FILE_SORT_ALPHA);
+ FILE_SORT_DEFAULT);
}
/** \} */
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index ac9d3848f3a..926e61f4a0e 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -72,15 +72,16 @@
#include "BKE_addon.h"
#include "BKE_appdir.h"
-#include "BKE_mask.h" /* free mask clipboard */
-#include "BKE_material.h" /* BKE_material_copybuf_clear */
-#include "BKE_sequencer.h" /* free seq clipboard */
+#include "BKE_mask.h" /* free mask clipboard */
+#include "BKE_material.h" /* BKE_material_copybuf_clear */
#include "BKE_studiolight.h"
#include "BKE_tracking.h" /* free tracking clipboard */
#include "RE_engine.h"
#include "RE_pipeline.h" /* RE_ free stuff */
+#include "SEQ_sequencer.h" /* free seq clipboard */
+
#include "IMB_thumbs.h"
#ifdef WITH_PYTHON
diff --git a/source/blender/windowmanager/intern/wm_jobs.c b/source/blender/windowmanager/intern/wm_jobs.c
index 361b3ed3d7f..a1140c01d44 100644
--- a/source/blender/windowmanager/intern/wm_jobs.c
+++ b/source/blender/windowmanager/intern/wm_jobs.c
@@ -35,7 +35,8 @@
#include "BKE_context.h"
#include "BKE_global.h"
-#include "BKE_sequencer.h"
+
+#include "SEQ_sequencer.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -226,7 +227,7 @@ bool WM_jobs_test(wmWindowManager *wm, void *owner, int job_type)
/* job can be running or about to run (suspended) */
for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next) {
if (wm_job->owner == owner) {
- if (job_type == WM_JOB_TYPE_ANY || (wm_job->job_type == job_type)) {
+ if (ELEM(job_type, WM_JOB_TYPE_ANY, wm_job->job_type)) {
if (wm_job->running || wm_job->suspended) {
return true;
}
@@ -250,7 +251,7 @@ float WM_jobs_progress(wmWindowManager *wm, void *owner)
static void wm_jobs_update_progress_bars(wmWindowManager *wm)
{
- float total_progress = 0.f;
+ float total_progress = 0.0f;
float jobs_progress = 0;
LISTBASE_FOREACH (wmJob *, wm_job, &wm->jobs) {
@@ -586,7 +587,7 @@ void WM_jobs_kill_type(struct wmWindowManager *wm, void *owner, int job_type)
next_job = wm_job->next;
if (!owner || wm_job->owner == owner) {
- if (job_type == WM_JOB_TYPE_ANY || wm_job->job_type == job_type) {
+ if (ELEM(job_type, WM_JOB_TYPE_ANY, wm_job->job_type)) {
wm_jobs_kill_job(wm, wm_job);
}
}
diff --git a/source/blender/windowmanager/intern/wm_operator_props.c b/source/blender/windowmanager/intern/wm_operator_props.c
index 62294d70306..631a4d23eb5 100644
--- a/source/blender/windowmanager/intern/wm_operator_props.c
+++ b/source/blender/windowmanager/intern/wm_operator_props.c
@@ -48,6 +48,30 @@ void WM_operator_properties_confirm_or_exec(wmOperatorType *ot)
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
}
+/**
+ * Extends rna_enum_fileselect_params_sort_items with a default item for operators to use.
+ */
+static const EnumPropertyItem *wm_operator_properties_filesel_sort_items_itemf(
+ struct bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
+{
+ EnumPropertyItem *items;
+ const EnumPropertyItem default_item = {
+ FILE_SORT_DEFAULT,
+ "DEFAULT",
+ 0,
+ "Default",
+ "Automatically determine sort method for files",
+ };
+ int totitem = 0;
+
+ RNA_enum_item_add(&items, &totitem, &default_item);
+ RNA_enum_items_add(&items, &totitem, rna_enum_fileselect_params_sort_items);
+ RNA_enum_item_end(&items, &totitem);
+ *r_free = true;
+
+ return items;
+}
+
/* default properties for fileselect */
void WM_operator_properties_filesel(wmOperatorType *ot,
int filter,
@@ -204,8 +228,8 @@ void WM_operator_properties_filesel(wmOperatorType *ot,
prop = RNA_def_enum(ot->srna, "display_type", file_display_items, display, "Display Type", "");
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
- prop = RNA_def_enum(
- ot->srna, "sort_method", rna_enum_file_sort_items, sort, "File sorting mode", "");
+ prop = RNA_def_enum(ot->srna, "sort_method", DummyRNA_NULL_items, sort, "File sorting mode", "");
+ RNA_def_enum_funcs(prop, wm_operator_properties_filesel_sort_items_itemf);
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
}
@@ -260,12 +284,12 @@ void WM_operator_properties_select_random(wmOperatorType *ot)
{
RNA_def_float_percentage(ot->srna,
"percent",
- 50.f,
+ 50.0f,
0.0f,
100.0f,
"Percent",
"Percentage of objects to select randomly",
- 0.f,
+ 0.0f,
100.0f);
RNA_def_int(ot->srna,
"seed",
diff --git a/source/blender/windowmanager/intern/wm_operator_type.c b/source/blender/windowmanager/intern/wm_operator_type.c
index cde0cb77678..7621862708e 100644
--- a/source/blender/windowmanager/intern/wm_operator_type.c
+++ b/source/blender/windowmanager/intern/wm_operator_type.c
@@ -95,6 +95,7 @@ void WM_operatortype_iter(GHashIterator *ghi)
BLI_ghashIterator_init(ghi, global_ops_hash);
}
+/* -------------------------------------------------------------------- */
/** \name Operator Type Append
* \{ */
@@ -324,13 +325,11 @@ static int wm_macro_end(wmOperator *op, int retval)
/* macro exec only runs exec calls */
static int wm_macro_exec(bContext *C, wmOperator *op)
{
- wmOperator *opm;
int retval = OPERATOR_FINISHED;
wm_macro_start(op);
- for (opm = op->macro.first; opm; opm = opm->next) {
-
+ LISTBASE_FOREACH (wmOperator *, opm, &op->macro) {
if (opm->type->exec) {
retval = opm->type->exec(C, opm);
OPERATOR_RETVAL_CHECK(retval);
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 613de5a9b17..9eedd5b2faa 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -1810,7 +1810,7 @@ static void WM_OT_call_menu(wmOperatorType *ot)
{
ot->name = "Call Menu";
ot->idname = "WM_OT_call_menu";
- ot->description = "Call (draw) a pre-defined menu";
+ ot->description = "Call (draw) a predefined menu";
ot->exec = wm_call_menu_exec;
ot->poll = WM_operator_winactive;
@@ -1841,7 +1841,7 @@ static void WM_OT_call_menu_pie(wmOperatorType *ot)
{
ot->name = "Call Pie Menu";
ot->idname = "WM_OT_call_menu_pie";
- ot->description = "Call (draw) a pre-defined pie menu";
+ ot->description = "Call (draw) a predefined pie menu";
ot->invoke = wm_call_pie_menu_invoke;
ot->exec = wm_call_pie_menu_exec;
@@ -1875,7 +1875,7 @@ static void WM_OT_call_panel(wmOperatorType *ot)
{
ot->name = "Call Panel";
ot->idname = "WM_OT_call_panel";
- ot->description = "Call (draw) a pre-defined panel";
+ ot->description = "Call (draw) a predefined panel";
ot->exec = wm_call_panel_exec;
ot->poll = WM_operator_winactive;
@@ -2886,7 +2886,7 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even
case PROP_FACTOR:
new_value = (WM_RADIAL_CONTROL_DISPLAY_SIZE - dist) / WM_RADIAL_CONTROL_DISPLAY_WIDTH;
if (snap) {
- new_value = ((int)ceil(new_value * 10.f) * 10.0f) / 100.f;
+ new_value = ((int)ceil(new_value * 10.0f) * 10.0f) / 100.0f;
}
/* Invert new value to increase the factor moving the mouse to the right */
new_value = 1 - new_value;
@@ -3771,7 +3771,7 @@ static void gesture_circle_modal_keymap(wmKeyConfig *keyconf)
{GESTURE_MODAL_CIRCLE_SIZE, "SIZE", 0, "Size", ""},
{GESTURE_MODAL_SELECT, "SELECT", 0, "Select", ""},
- {GESTURE_MODAL_DESELECT, "DESELECT", 0, "DeSelect", ""},
+ {GESTURE_MODAL_DESELECT, "DESELECT", 0, "Deselect", ""},
{GESTURE_MODAL_NOP, "NOP", 0, "No Operation", ""},
{0, NULL, 0, NULL, NULL},
@@ -3834,7 +3834,7 @@ static void gesture_box_modal_keymap(wmKeyConfig *keyconf)
static const EnumPropertyItem modal_items[] = {
{GESTURE_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""},
{GESTURE_MODAL_SELECT, "SELECT", 0, "Select", ""},
- {GESTURE_MODAL_DESELECT, "DESELECT", 0, "DeSelect", ""},
+ {GESTURE_MODAL_DESELECT, "DESELECT", 0, "Deselect", ""},
{GESTURE_MODAL_BEGIN, "BEGIN", 0, "Begin", ""},
{GESTURE_MODAL_MOVE, "MOVE", 0, "Move", ""},
{0, NULL, 0, NULL, NULL},
@@ -3968,39 +3968,40 @@ void wm_window_keymap(wmKeyConfig *keyconf)
*
* \{ */
-static bool rna_id_enum_filter_single(ID *id, void *user_data)
+static bool rna_id_enum_filter_single(const ID *id, void *user_data)
{
return (id != user_data);
}
/* Generic itemf's for operators that take library args */
-static const EnumPropertyItem *rna_id_itemf(bContext *UNUSED(C),
- PointerRNA *UNUSED(ptr),
- bool *r_free,
+static const EnumPropertyItem *rna_id_itemf(bool *r_free,
ID *id,
bool local,
- bool (*filter_ids)(ID *id, void *user_data),
+ bool (*filter_ids)(const ID *id, void *user_data),
void *user_data)
{
EnumPropertyItem item_tmp = {0}, *item = NULL;
int totitem = 0;
int i = 0;
- for (; id; id = id->next) {
- if ((filter_ids != NULL) && filter_ids(user_data, id) == false) {
- i++;
- continue;
- }
- if (local == false || !ID_IS_LINKED(id)) {
- item_tmp.identifier = item_tmp.name = id->name + 2;
- item_tmp.value = i++;
-
- /* Show collection color tag icons in menus. */
- if (GS(id->name) == ID_GR) {
- item_tmp.icon = UI_icon_color_from_collection((Collection *)id);
+ if (id != NULL) {
+ const short id_type = GS(id->name);
+ for (; id; id = id->next) {
+ if ((filter_ids != NULL) && filter_ids(id, user_data) == false) {
+ i++;
+ continue;
}
+ if (local == false || !ID_IS_LINKED(id)) {
+ item_tmp.identifier = item_tmp.name = id->name + 2;
+ item_tmp.value = i++;
- RNA_enum_item_add(&item, &totitem, &item_tmp);
+ /* Show collection color tag icons in menus. */
+ if (id_type == ID_GR) {
+ item_tmp.icon = UI_icon_color_from_collection((Collection *)id);
+ }
+
+ RNA_enum_item_add(&item, &totitem, &item_tmp);
+ }
}
}
@@ -4012,119 +4013,111 @@ static const EnumPropertyItem *rna_id_itemf(bContext *UNUSED(C),
/* can add more as needed */
const EnumPropertyItem *RNA_action_itemf(bContext *C,
- PointerRNA *ptr,
+ PointerRNA *UNUSED(ptr),
PropertyRNA *UNUSED(prop),
bool *r_free)
{
- return rna_id_itemf(
- C, ptr, r_free, C ? (ID *)CTX_data_main(C)->actions.first : NULL, false, NULL, NULL);
+
+ return rna_id_itemf(r_free, C ? (ID *)CTX_data_main(C)->actions.first : NULL, false, NULL, NULL);
}
#if 0 /* UNUSED */
const EnumPropertyItem *RNA_action_local_itemf(bContext *C,
- PointerRNA *ptr,
+ PointerRNA *UNUSED(ptr),
PropertyRNA *UNUSED(prop),
bool *r_free)
{
- return rna_id_itemf(C, ptr, r_free, C ? (ID *)CTX_data_main(C)->action.first : NULL, true);
+ return rna_id_itemf(r_free, C ? (ID *)CTX_data_main(C)->action.first : NULL, true);
}
#endif
const EnumPropertyItem *RNA_collection_itemf(bContext *C,
- PointerRNA *ptr,
+ PointerRNA *UNUSED(ptr),
PropertyRNA *UNUSED(prop),
bool *r_free)
{
return rna_id_itemf(
- C, ptr, r_free, C ? (ID *)CTX_data_main(C)->collections.first : NULL, false, NULL, NULL);
+ r_free, C ? (ID *)CTX_data_main(C)->collections.first : NULL, false, NULL, NULL);
}
const EnumPropertyItem *RNA_collection_local_itemf(bContext *C,
- PointerRNA *ptr,
+ PointerRNA *UNUSED(ptr),
PropertyRNA *UNUSED(prop),
bool *r_free)
{
return rna_id_itemf(
- C, ptr, r_free, C ? (ID *)CTX_data_main(C)->collections.first : NULL, true, NULL, NULL);
+ r_free, C ? (ID *)CTX_data_main(C)->collections.first : NULL, true, NULL, NULL);
}
const EnumPropertyItem *RNA_image_itemf(bContext *C,
- PointerRNA *ptr,
+ PointerRNA *UNUSED(ptr),
PropertyRNA *UNUSED(prop),
bool *r_free)
{
- return rna_id_itemf(
- C, ptr, r_free, C ? (ID *)CTX_data_main(C)->images.first : NULL, false, NULL, NULL);
+ return rna_id_itemf(r_free, C ? (ID *)CTX_data_main(C)->images.first : NULL, false, NULL, NULL);
}
const EnumPropertyItem *RNA_image_local_itemf(bContext *C,
- PointerRNA *ptr,
+ PointerRNA *UNUSED(ptr),
PropertyRNA *UNUSED(prop),
bool *r_free)
{
- return rna_id_itemf(
- C, ptr, r_free, C ? (ID *)CTX_data_main(C)->images.first : NULL, true, NULL, NULL);
+ return rna_id_itemf(r_free, C ? (ID *)CTX_data_main(C)->images.first : NULL, true, NULL, NULL);
}
const EnumPropertyItem *RNA_scene_itemf(bContext *C,
- PointerRNA *ptr,
+ PointerRNA *UNUSED(ptr),
PropertyRNA *UNUSED(prop),
bool *r_free)
{
- return rna_id_itemf(
- C, ptr, r_free, C ? (ID *)CTX_data_main(C)->scenes.first : NULL, false, NULL, NULL);
+ return rna_id_itemf(r_free, C ? (ID *)CTX_data_main(C)->scenes.first : NULL, false, NULL, NULL);
}
const EnumPropertyItem *RNA_scene_local_itemf(bContext *C,
- PointerRNA *ptr,
+ PointerRNA *UNUSED(ptr),
PropertyRNA *UNUSED(prop),
bool *r_free)
{
- return rna_id_itemf(
- C, ptr, r_free, C ? (ID *)CTX_data_main(C)->scenes.first : NULL, true, NULL, NULL);
+ return rna_id_itemf(r_free, C ? (ID *)CTX_data_main(C)->scenes.first : NULL, true, NULL, NULL);
}
const EnumPropertyItem *RNA_scene_without_active_itemf(bContext *C,
- PointerRNA *ptr,
+ PointerRNA *UNUSED(ptr),
PropertyRNA *UNUSED(prop),
bool *r_free)
{
Scene *scene_active = C ? CTX_data_scene(C) : NULL;
- return rna_id_itemf(C,
- ptr,
- r_free,
+ return rna_id_itemf(r_free,
C ? (ID *)CTX_data_main(C)->scenes.first : NULL,
false,
rna_id_enum_filter_single,
scene_active);
}
const EnumPropertyItem *RNA_movieclip_itemf(bContext *C,
- PointerRNA *ptr,
+ PointerRNA *UNUSED(ptr),
PropertyRNA *UNUSED(prop),
bool *r_free)
{
return rna_id_itemf(
- C, ptr, r_free, C ? (ID *)CTX_data_main(C)->movieclips.first : NULL, false, NULL, NULL);
+ r_free, C ? (ID *)CTX_data_main(C)->movieclips.first : NULL, false, NULL, NULL);
}
const EnumPropertyItem *RNA_movieclip_local_itemf(bContext *C,
- PointerRNA *ptr,
+ PointerRNA *UNUSED(ptr),
PropertyRNA *UNUSED(prop),
bool *r_free)
{
return rna_id_itemf(
- C, ptr, r_free, C ? (ID *)CTX_data_main(C)->movieclips.first : NULL, true, NULL, NULL);
+ r_free, C ? (ID *)CTX_data_main(C)->movieclips.first : NULL, true, NULL, NULL);
}
const EnumPropertyItem *RNA_mask_itemf(bContext *C,
- PointerRNA *ptr,
+ PointerRNA *UNUSED(ptr),
PropertyRNA *UNUSED(prop),
bool *r_free)
{
- return rna_id_itemf(
- C, ptr, r_free, C ? (ID *)CTX_data_main(C)->masks.first : NULL, false, NULL, NULL);
+ return rna_id_itemf(r_free, C ? (ID *)CTX_data_main(C)->masks.first : NULL, false, NULL, NULL);
}
const EnumPropertyItem *RNA_mask_local_itemf(bContext *C,
- PointerRNA *ptr,
+ PointerRNA *UNUSED(ptr),
PropertyRNA *UNUSED(prop),
bool *r_free)
{
- return rna_id_itemf(
- C, ptr, r_free, C ? (ID *)CTX_data_main(C)->masks.first : NULL, true, NULL, NULL);
+ return rna_id_itemf(r_free, C ? (ID *)CTX_data_main(C)->masks.first : NULL, true, NULL, NULL);
}
/** \} */
diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c
index 5d1607fe506..60bcb687dbf 100644
--- a/source/blender/windowmanager/intern/wm_playanim.c
+++ b/source/blender/windowmanager/intern/wm_playanim.c
@@ -1274,7 +1274,7 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
g_WS.ghost_system = GHOST_CreateSystem();
GHOST_AddEventConsumer(g_WS.ghost_system, consumer);
- playanim_window_open("Blender:Anim", start_x, start_y, ibuf->x, ibuf->y);
+ playanim_window_open("Blender Animation Player", start_x, start_y, ibuf->x, ibuf->y);
}
GHOST_GetMainDisplayDimensions(g_WS.ghost_system, &maxwinx, &maxwiny);
@@ -1391,7 +1391,7 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
while (ps.picture) {
int hasevent;
#ifndef USE_IMB_CACHE
- if (ibuf != NULL && ibuf->ftype == 0) {
+ if (ibuf != NULL && ibuf->ftype == IMB_FTYPE_NONE) {
IMB_freeImBuf(ibuf);
}
#endif
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index 6c9b6915da8..589b8e2f156 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -1767,7 +1767,7 @@ static char *wm_clipboard_text_get_ex(bool selection, int *r_len, bool firstline
if (firstline) {
/* will return an over-alloc'ed value in the case there are newlines */
for (char *p = buf; *p; p++) {
- if ((*p != '\n') && (*p != '\r')) {
+ if (!ELEM(*p, '\n', '\r')) {
*(p2++) = *p;
}
else {