diff options
| author | Po Lu | 2022-04-04 19:07:01 +0800 |
|---|---|---|
| committer | Po Lu | 2022-04-04 19:10:30 +0800 |
| commit | 728a1c2fe080d2781ad1efebf64403764dfcd18d (patch) | |
| tree | 84392dcb94fc6b4adc2550636caa0b51423968ea /src | |
| parent | 773d4104a592fda4366d8db27d0307ee23de8bfe (diff) | |
| download | emacs-728a1c2fe080d2781ad1efebf64403764dfcd18d.tar.gz emacs-728a1c2fe080d2781ad1efebf64403764dfcd18d.zip | |
* src/xterm.c: Explain meaning of drag-and-drop state variables.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 90 |
1 files changed, 83 insertions, 7 deletions
diff --git a/src/xterm.c b/src/xterm.c index 2918b4037f4..2e4df67c76e 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -843,44 +843,120 @@ static void x_scroll_bar_end_update (struct x_display_info *, struct scroll_bar | |||
| 843 | static int x_filter_event (struct x_display_info *, XEvent *); | 843 | static int x_filter_event (struct x_display_info *, XEvent *); |
| 844 | #endif | 844 | #endif |
| 845 | 845 | ||
| 846 | /* Global state maintained during a drag-and-drop operation. */ | ||
| 847 | |||
| 848 | /* Flag that indicates if a drag-and-drop operation is in progress. */ | ||
| 846 | static bool x_dnd_in_progress; | 849 | static bool x_dnd_in_progress; |
| 850 | |||
| 851 | /* Flag that indicates if a drag-and-drop operation is no longer in | ||
| 852 | progress, but the nested event loop should continue to run, because | ||
| 853 | handle_one_xevent is waiting for the drop target to return some | ||
| 854 | important information. */ | ||
| 847 | static bool x_dnd_waiting_for_finish; | 855 | static bool x_dnd_waiting_for_finish; |
| 848 | /* 0 means nothing has happened. 1 means an XmDROP_START message was | 856 | |
| 849 | sent to the target, but no response has yet been received. 2 means | 857 | /* State of the Motif drop operation. |
| 850 | a response to our XmDROP_START message was received and the target | 858 | |
| 851 | accepted the drop, so Emacs should start waiting for the drop | 859 | 0 means nothing has happened, i.e. the event loop should not wait |
| 852 | target to convert one of the special selections XmTRANSFER_SUCCESS | 860 | for the receiver to send any data. 1 means an XmDROP_START message |
| 853 | or XmTRANSFER_FAILURE. */ | 861 | was sent to the target, but no response has yet been received. 2 |
| 862 | means a response to our XmDROP_START message was received and the | ||
| 863 | target accepted the drop, so Emacs should start waiting for the | ||
| 864 | drop target to convert one of the special selections | ||
| 865 | XmTRANSFER_SUCCESS or XmTRANSFER_FAILURE. */ | ||
| 854 | static int x_dnd_waiting_for_motif_finish; | 866 | static int x_dnd_waiting_for_motif_finish; |
| 867 | |||
| 868 | /* Whether or not F1 was pressed during the drag-and-drop operation. | ||
| 869 | |||
| 870 | Motif programs rely on this to decide whether or not help | ||
| 871 | information about the drop site should be displayed. */ | ||
| 855 | static bool x_dnd_xm_use_help; | 872 | static bool x_dnd_xm_use_help; |
| 873 | |||
| 874 | /* Whether or not Motif drag initiator info was set up. */ | ||
| 856 | static bool x_dnd_motif_setup_p; | 875 | static bool x_dnd_motif_setup_p; |
| 876 | |||
| 877 | /* The target window we are waiting for an XdndFinished message | ||
| 878 | from. */ | ||
| 857 | static Window x_dnd_pending_finish_target; | 879 | static Window x_dnd_pending_finish_target; |
| 880 | |||
| 881 | /* The protocol version of that target window. */ | ||
| 858 | static int x_dnd_waiting_for_finish_proto; | 882 | static int x_dnd_waiting_for_finish_proto; |
| 883 | |||
| 884 | /* Whether or not it is OK for something to be dropped on the frame | ||
| 885 | where the drag-and-drop operation originated. */ | ||
| 859 | static bool x_dnd_allow_current_frame; | 886 | static bool x_dnd_allow_current_frame; |
| 860 | 887 | ||
| 861 | /* Whether or not to return a frame from `x_dnd_begin_drag_and_drop'. | 888 | /* Whether or not to return a frame from `x_dnd_begin_drag_and_drop'. |
| 862 | 889 | ||
| 863 | 0 means to do nothing. 1 means to wait for the mouse to first exit | 890 | 0 means to do nothing. 1 means to wait for the mouse to first exit |
| 864 | `x_dnd_frame'. 2 means to wait for the mouse to move onto a frame, | 891 | `x_dnd_frame'. 2 means to wait for the mouse to move onto a frame, |
| 865 | and 3 means to `x_dnd_return_frame_object'. */ | 892 | and 3 means to return `x_dnd_return_frame_object'. */ |
| 866 | static int x_dnd_return_frame; | 893 | static int x_dnd_return_frame; |
| 894 | |||
| 895 | /* The frame that should be returned by | ||
| 896 | `x_dnd_begin_drag_and_drop'. */ | ||
| 867 | static struct frame *x_dnd_return_frame_object; | 897 | static struct frame *x_dnd_return_frame_object; |
| 868 | 898 | ||
| 899 | /* The last toplevel window the mouse pointer moved over. */ | ||
| 869 | static Window x_dnd_last_seen_window; | 900 | static Window x_dnd_last_seen_window; |
| 901 | |||
| 902 | /* The window where the drop happened. Normally None, but it is set | ||
| 903 | when something is actually dropped. */ | ||
| 870 | static Window x_dnd_end_window; | 904 | static Window x_dnd_end_window; |
| 905 | |||
| 906 | /* The XDND protocol version of `x_dnd_last_seen_window'. -1 means it | ||
| 907 | did not support XDND. */ | ||
| 871 | static int x_dnd_last_protocol_version; | 908 | static int x_dnd_last_protocol_version; |
| 909 | |||
| 910 | /* The Motif drag and drop protocol style of `x_dnd_last_seen_window'. | ||
| 911 | XM_DRAG_STYLE_NONE means the window does not support the Motif drag | ||
| 912 | or drop protocol. XM_DRAG_STYLE_DROP_ONLY means the window does | ||
| 913 | not respond to any drag protocol messages, so only drops should be | ||
| 914 | sent. Any other value means that the window supports both the drag | ||
| 915 | and drop protocols. */ | ||
| 872 | static int x_dnd_last_motif_style; | 916 | static int x_dnd_last_motif_style; |
| 917 | |||
| 918 | /* The timestamp where Emacs last acquired ownership of the | ||
| 919 | `XdndSelection' selection. */ | ||
| 873 | static Time x_dnd_selection_timestamp; | 920 | static Time x_dnd_selection_timestamp; |
| 874 | 921 | ||
| 922 | /* The drop target window to which the rectangle below applies. */ | ||
| 875 | static Window x_dnd_mouse_rect_target; | 923 | static Window x_dnd_mouse_rect_target; |
| 924 | |||
| 925 | /* A rectangle where XDND position messages should not be sent to the | ||
| 926 | drop target if the mouse pointer lies within. */ | ||
| 876 | static XRectangle x_dnd_mouse_rect; | 927 | static XRectangle x_dnd_mouse_rect; |
| 928 | |||
| 929 | /* The action the drop target actually chose to perform. | ||
| 930 | |||
| 931 | Under XDND, this is set upon receiving the XdndFinished or | ||
| 932 | XdndStatus messages from the drop target. | ||
| 933 | |||
| 934 | Under Motif, this is changed upon receiving a XmDROP_START message | ||
| 935 | in reply to our own. */ | ||
| 877 | static Atom x_dnd_action; | 936 | static Atom x_dnd_action; |
| 937 | |||
| 938 | /* The action we want the drop target to perform. The drop target may | ||
| 939 | elect to perform some different action, which is guaranteed to be | ||
| 940 | in `x_dnd_action' upon completion of a drop. */ | ||
| 878 | static Atom x_dnd_wanted_action; | 941 | static Atom x_dnd_wanted_action; |
| 879 | 942 | ||
| 943 | /* Array of selection targets available to the drop target. */ | ||
| 880 | static Atom *x_dnd_targets = NULL; | 944 | static Atom *x_dnd_targets = NULL; |
| 945 | |||
| 946 | /* The number of elements in that array. */ | ||
| 881 | static int x_dnd_n_targets; | 947 | static int x_dnd_n_targets; |
| 948 | |||
| 949 | /* The frame where the drag-and-drop operation originated. */ | ||
| 882 | static struct frame *x_dnd_frame; | 950 | static struct frame *x_dnd_frame; |
| 951 | |||
| 952 | /* The old window attributes of the root window before the | ||
| 953 | drag-and-drop operation started. It is used to keep the old event | ||
| 954 | mask around, since that should be restored after the operation | ||
| 955 | finishes. */ | ||
| 883 | static XWindowAttributes x_dnd_old_window_attrs; | 956 | static XWindowAttributes x_dnd_old_window_attrs; |
| 957 | |||
| 958 | /* Whether or not `x_dnd_cleaup_drag_and_drop' should actually clean | ||
| 959 | up the drag and drop operation. */ | ||
| 884 | static bool x_dnd_unwind_flag; | 960 | static bool x_dnd_unwind_flag; |
| 885 | 961 | ||
| 886 | struct x_client_list_window | 962 | struct x_client_list_window |