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/space_image/space_image.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/space_image/space_image.c')
-rw-r--r-- | source/blender/editors/space_image/space_image.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index 5a03b4f6ef0..4107fd619aa 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -253,10 +253,7 @@ static void image_keymap(struct wmKeyConfig *keyconf) } /* dropboxes */ -static bool image_drop_poll(bContext *C, - wmDrag *drag, - const wmEvent *event, - const char **UNUSED(r_tooltip)) +static bool image_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event) { ScrArea *area = CTX_wm_area(C); if (ED_region_overlap_isect_any_xy(area, &event->x)) { @@ -282,7 +279,7 @@ static void image_dropboxes(void) { ListBase *lb = WM_dropboxmap_find("Image", SPACE_IMAGE, 0); - WM_dropbox_add(lb, "IMAGE_OT_open", image_drop_poll, image_drop_copy, NULL); + WM_dropbox_add(lb, "IMAGE_OT_open", image_drop_poll, image_drop_copy, NULL, NULL); } /** |