diff options
| author | Po Lu | 2023-03-11 08:34:57 +0800 |
|---|---|---|
| committer | Po Lu | 2023-03-11 08:34:57 +0800 |
| commit | e9a879260d791ccd509f031ea4e2f3fd645a9672 (patch) | |
| tree | 4dee22c74ed47bfff9974f303c495cb4ba2e8074 /src | |
| parent | 769a4e7ff51c370b055a964ae96e2ace43fc1936 (diff) | |
| download | emacs-e9a879260d791ccd509f031ea4e2f3fd645a9672.tar.gz emacs-e9a879260d791ccd509f031ea4e2f3fd645a9672.zip | |
Implement hourglass cursor on Android
* lisp/term/android-win.el (x-pointer-arrow, x-pointer-left-ptr)
(x-pointer-left-side, x-pointer-sb-h-double-arrow)
(x-pointer-sb-v-double-arrow, x-pointer-watch, x-pointer-xterm)
(x-pointer-invisible): New constants.
* src/androidterm.c (android_show_hourglass)
(android_hide_hourglass): New functions.
(android_toggle_visible_pointer, android_define_frame_cursor):
Define or don't define hourglass cursor if x->hourglass.
(android_redisplay_interface): Add new functions.
* src/androidterm.h (struct android_output): New field
`hourglass'.
Diffstat (limited to 'src')
| -rw-r--r-- | src/androidterm.c | 48 | ||||
| -rw-r--r-- | src/androidterm.h | 3 |
2 files changed, 48 insertions, 3 deletions
diff --git a/src/androidterm.c b/src/androidterm.c index 3a0f1ccc463..bd7e60dcb3f 100644 --- a/src/androidterm.c +++ b/src/androidterm.c | |||
| @@ -105,6 +105,45 @@ android_clear_frame (struct frame *f) | |||
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | static void | 107 | static void |
| 108 | android_show_hourglass (struct frame *f) | ||
| 109 | { | ||
| 110 | struct android_output *x; | ||
| 111 | |||
| 112 | /* This isn't implemented like X because a window brings alongside | ||
| 113 | too many unneeded resources. */ | ||
| 114 | |||
| 115 | x = FRAME_ANDROID_OUTPUT (f); | ||
| 116 | |||
| 117 | /* If the hourglass window is mapped inside a popup menu, input | ||
| 118 | could be lost if the menu is popped down and the grab is | ||
| 119 | relinquished, but the hourglass window is still up. Just | ||
| 120 | avoid displaying the hourglass at all while popups are | ||
| 121 | active. */ | ||
| 122 | |||
| 123 | if (popup_activated ()) | ||
| 124 | return; | ||
| 125 | |||
| 126 | x->hourglass = true; | ||
| 127 | |||
| 128 | if (!f->pointer_invisible) | ||
| 129 | android_define_cursor (FRAME_ANDROID_WINDOW (f), | ||
| 130 | x->hourglass_cursor); | ||
| 131 | } | ||
| 132 | |||
| 133 | static void | ||
| 134 | android_hide_hourglass (struct frame *f) | ||
| 135 | { | ||
| 136 | struct android_output *x; | ||
| 137 | |||
| 138 | x = FRAME_ANDROID_OUTPUT (f); | ||
| 139 | x->hourglass = false; | ||
| 140 | |||
| 141 | if (!f->pointer_invisible) | ||
| 142 | android_define_cursor (FRAME_ANDROID_WINDOW (f), | ||
| 143 | x->current_cursor); | ||
| 144 | } | ||
| 145 | |||
| 146 | static void | ||
| 108 | android_flash (struct frame *f) | 147 | android_flash (struct frame *f) |
| 109 | { | 148 | { |
| 110 | struct android_gc *gc; | 149 | struct android_gc *gc; |
| @@ -245,7 +284,9 @@ android_toggle_visible_pointer (struct frame *f, bool invisible) | |||
| 245 | dpyinfo->invisible_cursor); | 284 | dpyinfo->invisible_cursor); |
| 246 | else | 285 | else |
| 247 | android_define_cursor (FRAME_ANDROID_WINDOW (f), | 286 | android_define_cursor (FRAME_ANDROID_WINDOW (f), |
| 248 | f->output_data.android->current_cursor); | 287 | (FRAME_ANDROID_OUTPUT (f)->hourglass |
| 288 | ? f->output_data.android->hourglass_cursor | ||
| 289 | : f->output_data.android->current_cursor)); | ||
| 249 | 290 | ||
| 250 | f->pointer_invisible = invisible; | 291 | f->pointer_invisible = invisible; |
| 251 | } | 292 | } |
| @@ -4032,6 +4073,7 @@ static void | |||
| 4032 | android_define_frame_cursor (struct frame *f, Emacs_Cursor cursor) | 4073 | android_define_frame_cursor (struct frame *f, Emacs_Cursor cursor) |
| 4033 | { | 4074 | { |
| 4034 | if (!f->pointer_invisible | 4075 | if (!f->pointer_invisible |
| 4076 | && !FRAME_ANDROID_OUTPUT (f)->hourglass | ||
| 4035 | && f->output_data.android->current_cursor != cursor) | 4077 | && f->output_data.android->current_cursor != cursor) |
| 4036 | android_define_cursor (FRAME_ANDROID_WINDOW (f), cursor); | 4078 | android_define_cursor (FRAME_ANDROID_WINDOW (f), cursor); |
| 4037 | 4079 | ||
| @@ -5540,8 +5582,8 @@ static struct redisplay_interface android_redisplay_interface = | |||
| 5540 | android_draw_vertical_window_border, | 5582 | android_draw_vertical_window_border, |
| 5541 | android_draw_window_divider, | 5583 | android_draw_window_divider, |
| 5542 | NULL, | 5584 | NULL, |
| 5543 | NULL, | 5585 | android_show_hourglass, |
| 5544 | NULL, | 5586 | android_hide_hourglass, |
| 5545 | android_default_font_parameter, | 5587 | android_default_font_parameter, |
| 5546 | #endif | 5588 | #endif |
| 5547 | }; | 5589 | }; |
diff --git a/src/androidterm.h b/src/androidterm.h index 2e59365b56d..9396d5fe315 100644 --- a/src/androidterm.h +++ b/src/androidterm.h | |||
| @@ -209,6 +209,9 @@ struct android_output | |||
| 209 | Emacs_Cursor bottom_edge_cursor; | 209 | Emacs_Cursor bottom_edge_cursor; |
| 210 | Emacs_Cursor bottom_left_corner_cursor; | 210 | Emacs_Cursor bottom_left_corner_cursor; |
| 211 | 211 | ||
| 212 | /* Whether or not the hourglass cursor is being displayed. */ | ||
| 213 | bool hourglass; | ||
| 214 | |||
| 212 | /* This is the Emacs structure for the display this frame is on. */ | 215 | /* This is the Emacs structure for the display this frame is on. */ |
| 213 | struct android_display_info *display_info; | 216 | struct android_display_info *display_info; |
| 214 | 217 | ||