It now only warns when the clipboard is implemented but get/set failed. This is consistent with other properties like current-vo.
Unified · Split
| @@ -45,11 +45,17 @@ static int get_data(struct clipboard_ctx *cl, struct clipboard_access_params *pa · 44 unmodified lines | ||
| 45 | 45 | |
| 46 | 46 | if (!vo) |
| 47 | 47 | return CLIPBOARD_UNAVAILABLE; |
| 48 | − if (vo_control(vo, VOCTRL_GET_CLIPBOARD, &vc) == VO_TRUE) { | |
| 48 | + int ret = vo_control(vo, VOCTRL_GET_CLIPBOARD, &vc); | |
| 49 | + switch (ret) { | |
| 50 | + case VO_TRUE: | |
| 49 | 51 | *out = vc.data; |
| 50 | 52 | return CLIPBOARD_SUCCESS; |
| 51 | − } else { | |
| 52 | − MP_WARN(cl, "VO is not initialized, or it does not support getting clipboard.\n"); | |
| 53 | + case VO_NOTAVAIL: | |
| 54 | + case VO_NOTIMPL: | |
| 55 | + MP_VERBOSE(cl, "VO does not support getting clipboard in the requested format.\n"); | |
| 56 | + return CLIPBOARD_UNAVAILABLE; | |
| 57 | + default: | |
| 58 | + MP_WARN(cl, "Failed getting VO clipboard.\n"); | |
| 53 | 59 | return CLIPBOARD_FAILED; |
| 54 | 60 | } |
| 55 | 61 | } |
| @@ -66,10 +72,16 @@ static int set_data(struct clipboard_ctx *cl, struct clipboard_access_params *pa · 10 unmodified lines | ||
| 66 | 72 | |
| 67 | 73 | if (!vo) |
| 68 | 74 | return CLIPBOARD_UNAVAILABLE; |
| 69 | − if (vo_control(vo, VOCTRL_SET_CLIPBOARD, &vc) == VO_TRUE) { | |
| 75 | + int ret = vo_control(vo, VOCTRL_SET_CLIPBOARD, &vc); | |
| 76 | + switch (ret) { | |
| 77 | + case VO_TRUE: | |
| 70 | 78 | return CLIPBOARD_SUCCESS; |
| 71 | − } else { | |
| 72 | − MP_WARN(cl, "VO is not initialized, or it does not support setting clipboard.\n"); | |
| 79 | + case VO_NOTAVAIL: | |
| 80 | + case VO_NOTIMPL: | |
| 81 | + MP_VERBOSE(cl, "VO does not support setting clipboard in the requested format.\n"); | |
| 82 | + return CLIPBOARD_UNAVAILABLE; | |
| 83 | + default: | |
| 84 | + MP_WARN(cl, "Failed setting VO clipboard.\n"); | |
| 73 | 85 | return CLIPBOARD_FAILED; |
| 74 | 86 | } |
| 75 | 87 | } |