- Timestamp:
- Apr 20, 2018 2:54:27 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/drm/vbox_mode.c
r70625 r71946 769 769 bool src_isiomem; 770 770 771 /*772 * Re-set this regularly as in 5.0.20 and earlier the information was773 * lost on save and restore.774 */775 VBoxHGSMIUpdateInputMapping(vbox->guest_pool, 0, 0,776 vbox->input_mapping_width,777 vbox->input_mapping_height);778 771 if (!handle) { 779 772 bool cursor_enabled = false; … … 825 818 mask_size = ((width + 7) / 8 * height + 3) & ~3; 826 819 data_size = width * height * 4 + mask_size; 827 vbox->cursor_hot_x = min_t(u32, max(hot_x, 0), width);828 vbox->cursor_hot_y = min_t(u32, max(hot_y, 0), height);820 vbox->cursor_hot_x = hot_x; 821 vbox->cursor_hot_y = hot_y; 829 822 vbox->cursor_width = width; 830 823 vbox->cursor_height = height; … … 876 869 { 877 870 struct vbox_private *vbox = crtc->dev->dev_private; 878 u32 flags = VBOX_MOUSE_POINTER_VISIBLE |879 VBOX_MOUSE_POINTER_SHAPE | VBOX_MOUSE_POINTER_ALPHA;880 871 s32 crtc_x = 881 872 vbox->single_framebuffer ? crtc->x : to_vbox_crtc(crtc)->x_hint; 882 873 s32 crtc_y = 883 874 vbox->single_framebuffer ? crtc->y : to_vbox_crtc(crtc)->y_hint; 884 u32 host_x, host_y;885 u32 hot_x = 0;886 u32 hot_y = 0;887 875 int rc; 888 876 889 /* 890 * We compare these to unsigned later and don't 891 * need to handle negative. 892 */ 893 if (x + crtc_x < 0 || y + crtc_y < 0 || vbox->cursor_data_size == 0) 877 x += vbox->cursor_hot_x; 878 y += vbox->cursor_hot_y; 879 if (x + crtc_x < 0 || y + crtc_y < 0 || 880 x + crtc_x >= vbox->input_mapping_width || 881 y + crtc_y >= vbox->input_mapping_width || 882 vbox->cursor_data_size == 0) 894 883 return 0; 895 896 884 rc = VBoxHGSMICursorPosition(vbox->guest_pool, true, x + crtc_x, 897 y + crtc_y, &host_x, &host_y); 898 /* Work around a bug after save and restore in 5.0.20 and earlier. */ 899 if (RT_FAILURE(rc) || (host_x == 0 && host_y == 0)) 900 return rc == VINF_SUCCESS ? 0 901 : rc == VERR_NO_MEMORY ? -ENOMEM : -EINVAL; 902 if (x + crtc_x < host_x) 903 hot_x = min(host_x - x - crtc_x, vbox->cursor_width); 904 if (y + crtc_y < host_y) 905 hot_y = min(host_y - y - crtc_y, vbox->cursor_height); 906 if (hot_x == vbox->cursor_hot_x && hot_y == vbox->cursor_hot_y) 907 return 0; 908 vbox->cursor_hot_x = hot_x; 909 vbox->cursor_hot_y = hot_y; 910 rc = VBoxHGSMIUpdatePointerShape(vbox->guest_pool, flags, hot_x, hot_y, 911 vbox->cursor_width, 912 vbox->cursor_height, vbox->cursor_data, 913 vbox->cursor_data_size); 885 y + crtc_y, NULL, NULL); 914 886 return rc == VINF_SUCCESS ? 0 : rc == VERR_NO_MEMORY ? -ENOMEM : rc == 915 916 } 887 VERR_NOT_SUPPORTED ? -EBUSY : -EINVAL; 888 }
Note:
See TracChangeset
for help on using the changeset viewer.