diff options
author | Jeroen Bakker <jeroen@blender.org> | 2021-08-02 16:09:15 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2021-08-02 16:13:21 +0300 |
commit | d60a7a87445c140a42b6470ef2c54c411d8e4bf3 (patch) | |
tree | 5c6c61b07c5fe2f03d99d2262967315f9c9e4963 /source/blender/editors/screen/screen_ops.c | |
parent | 8edb2222ae0c954771a9cddc2d8c02a7a4d68eae (diff) |
WindowManager: Support Dynamic tooltips when dragging.
Originally the operator name was drawn next to the dragging content.
After that there was an option to add custom, static text with the
dragging content. This patch allows dynamic text to be drawn.
The custom text was implemented as out parameter of the poll function
what made the code unclear. This patch introduces a tooltip function
that separates tooltip generation from the poll function.
NOTE: the text should always be returned in its own memory block. This
block will be freed after it is copied in the drag struct.
Reviewed By: Severin
Differential Revision: https://developer.blender.org/D12104
Diffstat (limited to 'source/blender/editors/screen/screen_ops.c')
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 8d7d742e44b..9534be3509b 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -5695,10 +5695,7 @@ static void keymap_modal_set(wmKeyConfig *keyconf) WM_modalkeymap_assign(keymap, "SCREEN_OT_area_move"); } -static bool blend_file_drop_poll(bContext *UNUSED(C), - wmDrag *drag, - const wmEvent *UNUSED(event), - const char **UNUSED(r_tooltip)) +static bool blend_file_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) { if (drag->type == WM_DRAG_PATH) { if (drag->icon == ICON_FILE_BLEND) { @@ -5728,8 +5725,9 @@ void ED_keymap_screen(wmKeyConfig *keyconf) /* dropbox for entire window */ ListBase *lb = WM_dropboxmap_find("Window", 0, 0); - WM_dropbox_add(lb, "WM_OT_drop_blend_file", blend_file_drop_poll, blend_file_drop_copy, NULL); - WM_dropbox_add(lb, "UI_OT_drop_color", UI_drop_color_poll, UI_drop_color_copy, NULL); + WM_dropbox_add( + lb, "WM_OT_drop_blend_file", blend_file_drop_poll, blend_file_drop_copy, NULL, NULL); + WM_dropbox_add(lb, "UI_OT_drop_color", UI_drop_color_poll, UI_drop_color_copy, NULL, NULL); keymap_modal_set(keyconf); } |