diff options
| author | Po Lu | 2023-01-13 15:53:08 +0800 |
|---|---|---|
| committer | Po Lu | 2023-01-13 15:53:08 +0800 |
| commit | f9732131cf3c67e24db74a3d49f256d3c189a7e3 (patch) | |
| tree | e44e097c0c4c513390f58fa0020c8662943fbac6 /src/androidterm.c | |
| parent | 2fa5583d96fe78ff66d6fd41f18e54e4e20ea7d6 (diff) | |
| download | emacs-f9732131cf3c67e24db74a3d49f256d3c189a7e3.tar.gz emacs-f9732131cf3c67e24db74a3d49f256d3c189a7e3.zip | |
Update Android port
* configure.ac (ANDROID_MIN_SDK): New variable.
(DX): Remove and replace with D8.
(XCONFIGURE): Check for the minimum version of Android the cross
compiler compiles for. Generate java/AndroidManifest.xml from
java/AndroidManifest.xml.in. Allow using Zlib on Android.
* java/AndroidManifest.xml.in: New file. Use the minimum SDK
detected by configure.
* java/Makefile.in (top_srcdir, version): New variables.
(DX, D8): Replace with D8.
(ANDROID_MIN_SDK, APK_NAME): New variables.
(.PHONY):
(.PRECIOUS):
(classes.dex):
(emacs.apk): Generate $(APK_NAME) instead of `emacs.apk'.
* java/debug.sh: New option --attach-existing. Attach to an
existing Emacs instance when specified.
* java/org/gnu/emacs/EmacsActivity.java (EmacsActivity): New
field `isPaused'.
(invalidateFocus1): Fix infinite recursion.
(detachWindow): Deiconify window.
(attachWindow): Iconify the window if the activity is paused.
(onCreate): Use the ``no title bar'' theme.
(onPause, onResume): New functions.
* java/org/gnu/emacs/EmacsNative.java (sendTouchUp, sendTouchDown)
(sendTouchMove, sendWheel, sendIconified, sendDeiconified): New
functions.
* java/org/gnu/emacs/EmacsSdk7FontDriver.java (Sdk7Typeface):
(list): Remove logging for code that is mostly going to be unused.
* java/org/gnu/emacs/EmacsService.java (ringBell, queryTree)
(getScreenWidth, getScreenHeight, detectMouse): New functions.
* java/org/gnu/emacs/EmacsSurfaceView.java (EmacsSurfaceView)
(surfaceChanged, surfaceCreated, surfaceDestroyed): Add extra
debug logging. Avoid deadlock in surfaceCreated.
* java/org/gnu/emacs/EmacsView.java (EmacsView): Try very hard
to make the SurfaceView respect Z order. It didn't work.
(handleDirtyBitmap): Copy over the contents from the old bitmap.
(explicitlyDirtyBitmap): New function.
(onLayout): Don't dirty bitmap if unnecessary.
(damageRect, swapBuffers): Don't synchronize so hard.
(onTouchEvent): Call window.onTouchEvent instead.
(moveChildToBack, raise, lower): New functions.
* java/org/gnu/emacs/EmacsWindow.java (Coordinate): New
subclass.
(pointerMap, isMapped, isIconified, dontFocusOnMap)
(dontAcceptFocus): New fields.
(EmacsWindow): Don't immediately register unmapped window.
(viewLayout): Send configure event outside the lock.
(requestViewLayout): Explicitly dirty the bitmap.
(mapWindow): Register the window now. Respect dontFocusOnMap.
(unmapWindow): Unregister the window now.
(figureChange, onTouchEvent): New functions.
(onSomeKindOfMotionEvent): Handle scroll wheel events.
(reparentTo, makeInputFocus, raise, lower, getWindowGeometry)
(noticeIconified, noticeDeiconified, setDontAcceptFocus)
(setDontFocusOnMap, getDontFocusOnMap): New functions.
* java/org/gnu/emacs/EmacsWindowAttachmentManager.java
(registerWindow, detachWindow): Synchronize.
(noticeIconified, noticeDeiconified): New functions.
(copyWindows): New function.
* lisp/frame.el (frame-geometry, frame-edges)
(mouse-absolute-pixel-position, set-mouse-absolute-pixel-position)
(frame-list-z-order, frame-restack, display-mouse-p)
(display-monitor-attributes-list): Implement on Android.
* lisp/mwheel.el (mouse-wheel-down-event):
(mouse-wheel-up-event):
(mouse-wheel-left-event):
(mouse-wheel-right-event): Define on Android.
* src/android.c (struct android_emacs_service): New methods
`ringBell', `queryTree', `getScreenWidth', `getScreenHeight',
and `detectMouse'.
(struct android_event_queue, android_init_events)
(android_next_event, android_write_event): Remove write limit.
(android_file_access_p): Handle directories correcty.
(android_close): Fix coding style.
(android_fclose): New function.
(android_init_emacs_service): Initialize new methods.
(android_reparent_window): Implement function.
(android_bell, android_set_input_focus, android_raise_window)
(android_lower_window, android_query_tree, android_get_geometry)
(android_get_screen_width, android_get_screen_height)
(android_get_mm_width, android_get_mm_height, android_detect_mouse)
(android_set_dont_focus_on_map, android_set_dont_accept_focus):
New functions.
(struct android_dir): New structure.
(android_opendir, android_readdir, android_closedir): New
functions.
(emacs_abort): Implement here on Android and poke debuggerd into
generating a tombstone.
* src/android.h: Update prototypes.
* src/androidfns.c (android_set_parent_frame): New function.
(android_default_font_parameter): Use sane font size by default.
(Fx_display_pixel_width, Fx_display_pixel_height)
(Fx_display_mm_width, Fx_display_mm_height)
(Fx_display_monitor_attributes_list): Rename to start with
`android-'. Implement. Fiddle with documentation to introduce
Android specific nuances.
(Fandroid_display_monitor_attributes_list): New function.
(Fx_frame_geometry, frame_geometry): New function.
(Fandroid_frame_geometry): Implement correctly.
(Fx_frame_list_z_order): Rename to start with `android-'.
(android_frame_list_z_order, Fandroid_frame_list_z_order):
Implement.
(Fx_frame_restack): Rename to start with `android-'.
(Fandroid_frame_restack): ``Implement''.
(Fx_mouse_absolute_pixel_position): Rename to start with
`android-'.
(Fandroid_mouse_absolute_pixel_position): ``Implement''.
(Fx_set_mouse_absolute_pixel_position): Rename to start with
`android-'.
(Fandroid_set_mouse_absolute_pixel_position): ``Implement''.
(Fandroid_detect_mouse): New function.
(android_set_menu_bar_lines): Use FRAME_ANDROID_DRAWABLE when
clearing area.
(android_set_no_focus_on_map, android_set_no_accept_focus): New
functions.
(android_frame_parm_handlers): Register new frame parameter
handlers.
(syms_of_androidfns): Update appropriately.
* src/androidfont.c (androidfont_draw): Use
FRAME_ANDROID_DRAWABLE instead of FRAME_ANDROID_WINDOW.
* src/androidgui.h (enum android_event_type): New events.
(struct android_touch_event, struct android_wheel_event)
(struct android_iconify_event): New structures.
(union android_event): Add new events.
* src/androidterm.c (android_clear_frame): Use
FRAME_ANDROID_DRAWABLE instead of FRAME_ANDROID_WINDOW.
(android_flash, android_ring_bell): Implement bell ringing.
(android_toggle_invisible_pointer): Don't TODO function that
can't be implemented.
(show_back_buffer, android_flush_dirty_back_buffer_on): Check if
a buffer flip is required before doing the flip.
(android_lower_frame, android_raise_frame): Implement functions.
(android_update_tools, android_find_tool): New functions.
(handle_one_android_event): Handle new iconification, wheel and
touch events.
(android_read_socket): Implement pending-autoraise-frames.
(android_frame_up_to_date): Implement bell ringing.
(android_buffer_flipping_unblocked_hook): Check if a buffer flip
is required before doing the flip.
(android_focus_frame, android_frame_highlight)
(android_frame_unhighlight): New function.
(android_frame_rehighlight): Implement functions.
(android_iconify_frame): Always display error.
(android_set_alpha): Update commentary.
(android_free_frame_resources): Free frame touch points.
(android_scroll_run, android_flip_and_flush)
(android_clear_rectangle, android_draw_fringe_bitmap)
(android_draw_glyph_string_background, android_fill_triangle)
(android_clear_point, android_draw_relief_rect)
(android_draw_box_rect, android_draw_glyph_string_bg_rect)
(android_draw_image_foreground, android_draw_stretch_glyph_string)
(android_draw_underwave, android_draw_glyph_string_foreground)
(android_draw_composite_glyph_string_foreground)
(android_draw_glyphless_glyph_string_foreground)
(android_draw_glyph_string, android_clear_frame_area)
(android_clear_under_internal_border, android_draw_hollow_cursor)
(android_draw_bar_cursor, android_draw_vertical_window_border)
(android_draw_window_divider): Use FRAME_ANDROID_DRAWABLE
instead of FRAME_ANDROID_WINDOW for drawing operations.
* src/androidterm.h (struct android_touch_point): New structure.
(struct android_output): New fields.
(FRAME_ANDROID_NEED_BUFFER_FLIP): New macro.
* src/dired.c (emacs_readdir, open_directory)
(directory_files_internal_unwind, read_dirent)
(directory_files_internal, file_name_completion): Add
indirection over readdir and opendir. Use android variants on
Android.
* src/dispnew.c (Fopen_termscript):
* src/fileio.c (fclose_unwind): Use emacs_fclose.
(Faccess_file): Call android_file_access_p.
(file_accessible_directory_p): Append right suffix to Android
assets directory.
(do_auto_save_unwind): Use emacs_fclose.
* src/keyboard.c (lispy_function_keys): Use right function key
for page up and page down.
(Fopen_dribble_file): Use emacs_fclose.
* src/lisp.h: New prototype emacs_fclose.
* src/lread.c (close_infile_unwind): Use emacs_fclose.
* src/sfnt.c (sfnt_curve_is_flat): Fix area-squared computation.
(sfnt_prepare_raster): Compute raster width and height
consistently with outline building.
(sfnt_build_outline_edges): Use the same offsets used to set
offy and offx.
(main): Adjust debug code.
* src/sfntfont-android.c (sfntfont_android_saturate32): Delete
function.
(sfntfont_android_blend, sfntfont_android_blendrgb): Remove
unnecessary debug code.
(sfntfont_android_composite_bitmap): Prevent out of bounds
write.
(sfntfont_android_put_glyphs): Use FRAME_ANDROID_DRAWABLE.
(init_sfntfont_android): Initialize Monospace Serif font to
something sensible.
* src/sfntfont.c (sfntfont_text_extents): Clear glyph metrics
before summing up pcm.
(sfntfont_draw): Use s->font instead of s->face->font.
* src/sysdep.c (emacs_fclose): Wrap around android_fclose on
android.
* src/term.c (Fsuspend_tty):
(delete_tty): Use emacs_fclose.
* src/verbose.mk.in (AM_V_DX): Replace with D8 version.
Diffstat (limited to 'src/androidterm.c')
| -rw-r--r-- | src/androidterm.c | 589 |
1 files changed, 518 insertions, 71 deletions
diff --git a/src/androidterm.c b/src/androidterm.c index 05fe7f01bf9..220858c0fec 100644 --- a/src/androidterm.c +++ b/src/androidterm.c | |||
| @@ -19,6 +19,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 19 | 19 | ||
| 20 | #include <config.h> | 20 | #include <config.h> |
| 21 | #include <stdio.h> | 21 | #include <stdio.h> |
| 22 | #include <math.h> | ||
| 22 | 23 | ||
| 23 | #include "lisp.h" | 24 | #include "lisp.h" |
| 24 | #include "androidterm.h" | 25 | #include "androidterm.h" |
| @@ -46,6 +47,11 @@ struct android_display_info *x_display_list; | |||
| 46 | 47 | ||
| 47 | static bool any_help_event_p; | 48 | static bool any_help_event_p; |
| 48 | 49 | ||
| 50 | /* Counters for tallying up scroll wheel events if | ||
| 51 | mwheel_coalesce_scroll_events is true. */ | ||
| 52 | |||
| 53 | static double wheel_event_x, wheel_event_y; | ||
| 54 | |||
| 49 | enum | 55 | enum |
| 50 | { | 56 | { |
| 51 | ANDROID_EVENT_NORMAL, | 57 | ANDROID_EVENT_NORMAL, |
| @@ -83,19 +89,133 @@ android_clear_frame (struct frame *f) | |||
| 83 | /* Clearing the frame will erase any cursor, so mark them all as no | 89 | /* Clearing the frame will erase any cursor, so mark them all as no |
| 84 | longer visible. */ | 90 | longer visible. */ |
| 85 | mark_window_cursors_off (XWINDOW (FRAME_ROOT_WINDOW (f))); | 91 | mark_window_cursors_off (XWINDOW (FRAME_ROOT_WINDOW (f))); |
| 86 | android_clear_window (FRAME_ANDROID_WINDOW (f)); | 92 | android_clear_window (FRAME_ANDROID_DRAWABLE (f)); |
| 93 | } | ||
| 94 | |||
| 95 | static void | ||
| 96 | android_flash (struct frame *f) | ||
| 97 | { | ||
| 98 | struct android_gc *gc; | ||
| 99 | struct android_gc_values values; | ||
| 100 | int rc; | ||
| 101 | fd_set fds; | ||
| 102 | |||
| 103 | block_input (); | ||
| 104 | |||
| 105 | values.function = ANDROID_GC_XOR; | ||
| 106 | values.foreground = (FRAME_FOREGROUND_PIXEL (f) | ||
| 107 | ^ FRAME_BACKGROUND_PIXEL (f)); | ||
| 108 | |||
| 109 | gc = android_create_gc ((ANDROID_GC_FUNCTION | ||
| 110 | | ANDROID_GC_FOREGROUND), | ||
| 111 | &values); | ||
| 112 | |||
| 113 | /* Get the height not including a menu bar widget. */ | ||
| 114 | int height = FRAME_PIXEL_HEIGHT (f); | ||
| 115 | /* Height of each line to flash. */ | ||
| 116 | int flash_height = FRAME_LINE_HEIGHT (f); | ||
| 117 | /* These will be the left and right margins of the rectangles. */ | ||
| 118 | int flash_left = FRAME_INTERNAL_BORDER_WIDTH (f); | ||
| 119 | int flash_right = FRAME_PIXEL_WIDTH (f) - FRAME_INTERNAL_BORDER_WIDTH (f); | ||
| 120 | int width = flash_right - flash_left; | ||
| 121 | |||
| 122 | /* If window is tall, flash top and bottom line. */ | ||
| 123 | if (height > 3 * FRAME_LINE_HEIGHT (f)) | ||
| 124 | { | ||
| 125 | android_fill_rectangle (FRAME_ANDROID_DRAWABLE (f), gc, | ||
| 126 | flash_left, | ||
| 127 | (FRAME_INTERNAL_BORDER_WIDTH (f) | ||
| 128 | + FRAME_TOP_MARGIN_HEIGHT (f)), | ||
| 129 | width, flash_height); | ||
| 130 | android_fill_rectangle (FRAME_ANDROID_DRAWABLE (f), gc, | ||
| 131 | flash_left, | ||
| 132 | (height - flash_height | ||
| 133 | - FRAME_INTERNAL_BORDER_WIDTH (f)), | ||
| 134 | width, flash_height); | ||
| 135 | |||
| 136 | } | ||
| 137 | else | ||
| 138 | /* If it is short, flash it all. */ | ||
| 139 | android_fill_rectangle (FRAME_ANDROID_DRAWABLE (f), gc, | ||
| 140 | flash_left, FRAME_INTERNAL_BORDER_WIDTH (f), | ||
| 141 | width, (height - 2 | ||
| 142 | * FRAME_INTERNAL_BORDER_WIDTH (f))); | ||
| 143 | |||
| 144 | flush_frame (f); | ||
| 145 | |||
| 146 | struct timespec delay = make_timespec (0, 150 * 1000 * 1000); | ||
| 147 | struct timespec wakeup = timespec_add (current_timespec (), delay); | ||
| 148 | |||
| 149 | /* Keep waiting until past the time wakeup or any input gets | ||
| 150 | available. */ | ||
| 151 | while (! detect_input_pending ()) | ||
| 152 | { | ||
| 153 | struct timespec current = current_timespec (); | ||
| 154 | struct timespec timeout; | ||
| 155 | |||
| 156 | /* Break if result would not be positive. */ | ||
| 157 | if (timespec_cmp (wakeup, current) <= 0) | ||
| 158 | break; | ||
| 159 | |||
| 160 | /* How long `select' should wait. */ | ||
| 161 | timeout = make_timespec (0, 10 * 1000 * 1000); | ||
| 162 | |||
| 163 | /* Wait for some input to become available on the X | ||
| 164 | connection. */ | ||
| 165 | FD_ZERO (&fds); | ||
| 166 | |||
| 167 | /* Try to wait that long--but we might wake up sooner. */ | ||
| 168 | rc = pselect (0, &fds, NULL, NULL, &timeout, NULL); | ||
| 169 | |||
| 170 | /* Some input is available, exit the visible bell. */ | ||
| 171 | if (rc >= 0) | ||
| 172 | break; | ||
| 173 | } | ||
| 174 | |||
| 175 | /* If window is tall, flash top and bottom line. */ | ||
| 176 | if (height > 3 * FRAME_LINE_HEIGHT (f)) | ||
| 177 | { | ||
| 178 | android_fill_rectangle (FRAME_ANDROID_DRAWABLE (f), gc, | ||
| 179 | flash_left, | ||
| 180 | (FRAME_INTERNAL_BORDER_WIDTH (f) | ||
| 181 | + FRAME_TOP_MARGIN_HEIGHT (f)), | ||
| 182 | width, flash_height); | ||
| 183 | android_fill_rectangle (FRAME_ANDROID_DRAWABLE (f), gc, | ||
| 184 | flash_left, | ||
| 185 | (height - flash_height | ||
| 186 | - FRAME_INTERNAL_BORDER_WIDTH (f)), | ||
| 187 | width, flash_height); | ||
| 188 | } | ||
| 189 | else | ||
| 190 | /* If it is short, flash it all. */ | ||
| 191 | android_fill_rectangle (FRAME_ANDROID_DRAWABLE (f), gc, | ||
| 192 | flash_left, FRAME_INTERNAL_BORDER_WIDTH (f), | ||
| 193 | width, (height - 2 | ||
| 194 | * FRAME_INTERNAL_BORDER_WIDTH (f))); | ||
| 195 | |||
| 196 | android_free_gc (gc); | ||
| 197 | flush_frame (f); | ||
| 198 | |||
| 199 | unblock_input (); | ||
| 87 | } | 200 | } |
| 88 | 201 | ||
| 89 | static void | 202 | static void |
| 90 | android_ring_bell (struct frame *f) | 203 | android_ring_bell (struct frame *f) |
| 91 | { | 204 | { |
| 92 | /* TODO */ | 205 | if (visible_bell) |
| 206 | android_flash (f); | ||
| 207 | else | ||
| 208 | { | ||
| 209 | block_input (); | ||
| 210 | android_bell (); | ||
| 211 | unblock_input (); | ||
| 212 | } | ||
| 93 | } | 213 | } |
| 94 | 214 | ||
| 95 | static void | 215 | static void |
| 96 | android_toggle_invisible_pointer (struct frame *f, bool invisible) | 216 | android_toggle_invisible_pointer (struct frame *f, bool invisible) |
| 97 | { | 217 | { |
| 98 | /* TODO */ | 218 | |
| 99 | } | 219 | } |
| 100 | 220 | ||
| 101 | /* Start an update of frame F. This function is installed as a hook | 221 | /* Start an update of frame F. This function is installed as a hook |
| @@ -127,10 +247,17 @@ show_back_buffer (struct frame *f) | |||
| 127 | { | 247 | { |
| 128 | struct android_swap_info swap_info; | 248 | struct android_swap_info swap_info; |
| 129 | 249 | ||
| 250 | /* Somehow Android frames can be swapped while garbaged. */ | ||
| 251 | if (FRAME_GARBAGED_P (f)) | ||
| 252 | return; | ||
| 253 | |||
| 130 | memset (&swap_info, 0, sizeof (swap_info)); | 254 | memset (&swap_info, 0, sizeof (swap_info)); |
| 131 | swap_info.swap_window = FRAME_ANDROID_WINDOW (f); | 255 | swap_info.swap_window = FRAME_ANDROID_WINDOW (f); |
| 132 | swap_info.swap_action = ANDROID_COPIED; | 256 | swap_info.swap_action = ANDROID_COPIED; |
| 133 | android_swap_buffers (&swap_info, 1); | 257 | android_swap_buffers (&swap_info, 1); |
| 258 | |||
| 259 | /* Now the back buffer no longer needs to be flipped. */ | ||
| 260 | FRAME_ANDROID_NEED_BUFFER_FLIP (f) = false; | ||
| 134 | } | 261 | } |
| 135 | 262 | ||
| 136 | /* Flip back buffers on F if it has undrawn content. */ | 263 | /* Flip back buffers on F if it has undrawn content. */ |
| @@ -142,7 +269,8 @@ android_flush_dirty_back_buffer_on (struct frame *f) | |||
| 142 | || buffer_flipping_blocked_p () | 269 | || buffer_flipping_blocked_p () |
| 143 | /* If the frame is not already up to date, do not flush buffers | 270 | /* If the frame is not already up to date, do not flush buffers |
| 144 | on input, as that will result in flicker. */ | 271 | on input, as that will result in flicker. */ |
| 145 | || !FRAME_ANDROID_COMPLETE_P (f)) | 272 | || !FRAME_ANDROID_COMPLETE_P (f) |
| 273 | && FRAME_ANDROID_NEED_BUFFER_FLIP (f)) | ||
| 146 | return; | 274 | return; |
| 147 | 275 | ||
| 148 | show_back_buffer (f); | 276 | show_back_buffer (f); |
| @@ -174,13 +302,13 @@ static void android_frame_rehighlight (struct android_display_info *); | |||
| 174 | static void | 302 | static void |
| 175 | android_lower_frame (struct frame *f) | 303 | android_lower_frame (struct frame *f) |
| 176 | { | 304 | { |
| 177 | /* TODO. */ | 305 | android_lower_window (FRAME_ANDROID_WINDOW (f)); |
| 178 | } | 306 | } |
| 179 | 307 | ||
| 180 | static void | 308 | static void |
| 181 | android_raise_frame (struct frame *f) | 309 | android_raise_frame (struct frame *f) |
| 182 | { | 310 | { |
| 183 | /* TODO. */ | 311 | android_raise_window (FRAME_ANDROID_WINDOW (f)); |
| 184 | } | 312 | } |
| 185 | 313 | ||
| 186 | static void | 314 | static void |
| @@ -354,6 +482,46 @@ android_construct_mouse_click (struct input_event *result, | |||
| 354 | return Qnil; | 482 | return Qnil; |
| 355 | } | 483 | } |
| 356 | 484 | ||
| 485 | /* Generate a TOUCHSCREEN_UPDATE_EVENT for all pressed tools in FRAME. | ||
| 486 | Return the event in IE. Do not set IE->timestamp, as that is left | ||
| 487 | to the caller. */ | ||
| 488 | |||
| 489 | static void | ||
| 490 | android_update_tools (struct frame *f, struct input_event *ie) | ||
| 491 | { | ||
| 492 | struct android_touch_point *touchpoint; | ||
| 493 | |||
| 494 | ie->kind = TOUCHSCREEN_UPDATE_EVENT; | ||
| 495 | XSETFRAME (ie->frame_or_window, f); | ||
| 496 | ie->arg = Qnil; | ||
| 497 | |||
| 498 | /* Build the list of active touches. */ | ||
| 499 | for (touchpoint = FRAME_OUTPUT_DATA (f)->touch_points; | ||
| 500 | touchpoint; touchpoint = touchpoint->next) | ||
| 501 | ie->arg = Fcons (list3i (touchpoint->x, | ||
| 502 | touchpoint->y, | ||
| 503 | touchpoint->tool_id), | ||
| 504 | ie->arg); | ||
| 505 | } | ||
| 506 | |||
| 507 | /* Find and return an existing tool pressed against FRAME, identified | ||
| 508 | by POINTER_ID. Return NULL if no tool by that ID was found. */ | ||
| 509 | |||
| 510 | static struct android_touch_point * | ||
| 511 | android_find_tool (struct frame *f, int pointer_id) | ||
| 512 | { | ||
| 513 | struct android_touch_point *touchpoint; | ||
| 514 | |||
| 515 | for (touchpoint = FRAME_OUTPUT_DATA (f)->touch_points; | ||
| 516 | touchpoint; touchpoint = touchpoint->next) | ||
| 517 | { | ||
| 518 | if (touchpoint->tool_id == pointer_id) | ||
| 519 | return touchpoint; | ||
| 520 | } | ||
| 521 | |||
| 522 | return NULL; | ||
| 523 | } | ||
| 524 | |||
| 357 | static int | 525 | static int |
| 358 | handle_one_android_event (struct android_display_info *dpyinfo, | 526 | handle_one_android_event (struct android_display_info *dpyinfo, |
| 359 | union android_event *event, int *finish, | 527 | union android_event *event, int *finish, |
| @@ -364,6 +532,10 @@ handle_one_android_event (struct android_display_info *dpyinfo, | |||
| 364 | Mouse_HLInfo *hlinfo; | 532 | Mouse_HLInfo *hlinfo; |
| 365 | union buffered_input_event inev; | 533 | union buffered_input_event inev; |
| 366 | int modifiers, count, do_help; | 534 | int modifiers, count, do_help; |
| 535 | struct android_touch_point *touchpoint, **last; | ||
| 536 | Lisp_Object window; | ||
| 537 | int scroll_height; | ||
| 538 | double scroll_unit; | ||
| 367 | 539 | ||
| 368 | /* It is okay for this to not resemble handle_one_xevent so much. | 540 | /* It is okay for this to not resemble handle_one_xevent so much. |
| 369 | Differences in event handling code are much less nasty than | 541 | Differences in event handling code are much less nasty than |
| @@ -633,6 +805,28 @@ handle_one_android_event (struct android_display_info *dpyinfo, | |||
| 633 | 805 | ||
| 634 | f = mouse_or_wdesc_frame (dpyinfo, event->xbutton.window); | 806 | f = mouse_or_wdesc_frame (dpyinfo, event->xbutton.window); |
| 635 | 807 | ||
| 808 | if (f && event->xbutton.type == ANDROID_BUTTON_PRESS | ||
| 809 | && !popup_activated () | ||
| 810 | /* && !x_window_to_scroll_bar (event->xbutton.display, */ | ||
| 811 | /* event->xbutton.window, 2) */ | ||
| 812 | && !FRAME_NO_ACCEPT_FOCUS (f)) | ||
| 813 | { | ||
| 814 | /* When clicking into a child frame or when clicking | ||
| 815 | into a parent frame with the child frame selected and | ||
| 816 | `no-accept-focus' is not set, select the clicked | ||
| 817 | frame. */ | ||
| 818 | struct frame *hf = dpyinfo->highlight_frame; | ||
| 819 | |||
| 820 | if (FRAME_PARENT_FRAME (f) || (hf && frame_ancestor_p (f, hf))) | ||
| 821 | { | ||
| 822 | android_set_input_focus (FRAME_ANDROID_WINDOW (f), | ||
| 823 | event->xbutton.time); | ||
| 824 | |||
| 825 | if (FRAME_PARENT_FRAME (f)) | ||
| 826 | android_raise_window (FRAME_ANDROID_WINDOW (f)); | ||
| 827 | } | ||
| 828 | } | ||
| 829 | |||
| 636 | if (f) | 830 | if (f) |
| 637 | { | 831 | { |
| 638 | /* Is this in the tab-bar? */ | 832 | /* Is this in the tab-bar? */ |
| @@ -715,6 +909,223 @@ handle_one_android_event (struct android_display_info *dpyinfo, | |||
| 715 | 909 | ||
| 716 | goto OTHER; | 910 | goto OTHER; |
| 717 | 911 | ||
| 912 | /* Touch events. The events here don't parallel X so much. */ | ||
| 913 | case ANDROID_TOUCH_DOWN: | ||
| 914 | |||
| 915 | if (!any) | ||
| 916 | goto OTHER; | ||
| 917 | |||
| 918 | /* This event is sent when a tool is put on the screen. X and Y | ||
| 919 | are the location of the finger, and pointer_id identifies the | ||
| 920 | tool for as long as it is still held down. First, see if the | ||
| 921 | touch point already exists and can be reused (this shouldn't | ||
| 922 | happen, but be safe.) */ | ||
| 923 | |||
| 924 | touchpoint = android_find_tool (any, event->touch.pointer_id); | ||
| 925 | |||
| 926 | if (touchpoint) | ||
| 927 | { | ||
| 928 | /* Simply update the tool position and send an update. */ | ||
| 929 | touchpoint->x = event->touch.x; | ||
| 930 | touchpoint->y = event->touch.x; | ||
| 931 | android_update_tools (any, &inev.ie); | ||
| 932 | inev.ie.timestamp = event->touch.time; | ||
| 933 | |||
| 934 | goto OTHER; | ||
| 935 | } | ||
| 936 | |||
| 937 | /* Otherwise, link a new touchpoint onto the output's list of | ||
| 938 | pressed tools. */ | ||
| 939 | |||
| 940 | touchpoint = xmalloc (sizeof *touchpoint); | ||
| 941 | touchpoint->tool_id = event->touch.pointer_id; | ||
| 942 | touchpoint->x = event->touch.x; | ||
| 943 | touchpoint->y = event->touch.x; | ||
| 944 | touchpoint->next = FRAME_OUTPUT_DATA (any)->touch_points; | ||
| 945 | FRAME_OUTPUT_DATA (any)->touch_points = touchpoint; | ||
| 946 | |||
| 947 | /* Now generate the Emacs event. */ | ||
| 948 | inev.ie.kind = TOUCHSCREEN_BEGIN_EVENT; | ||
| 949 | inev.ie.timestamp = event->touch.time; | ||
| 950 | XSETFRAME (inev.ie.frame_or_window, any); | ||
| 951 | XSETINT (inev.ie.x, event->touch.x); | ||
| 952 | XSETINT (inev.ie.y, event->touch.y); | ||
| 953 | XSETINT (inev.ie.arg, event->touch.pointer_id); | ||
| 954 | |||
| 955 | goto OTHER; | ||
| 956 | |||
| 957 | case ANDROID_TOUCH_MOVE: | ||
| 958 | |||
| 959 | if (!any) | ||
| 960 | goto OTHER; | ||
| 961 | |||
| 962 | /* Look for the tool that moved. */ | ||
| 963 | |||
| 964 | touchpoint = android_find_tool (any, event->touch.pointer_id); | ||
| 965 | |||
| 966 | /* If it doesn't exist, skip processing this event. */ | ||
| 967 | |||
| 968 | if (!touchpoint) | ||
| 969 | goto OTHER; | ||
| 970 | |||
| 971 | /* Otherwise, update the position and send the update event. */ | ||
| 972 | |||
| 973 | touchpoint->x = event->touch.x; | ||
| 974 | touchpoint->y = event->touch.y; | ||
| 975 | android_update_tools (any, &inev.ie); | ||
| 976 | inev.ie.timestamp = event->touch.time; | ||
| 977 | |||
| 978 | goto OTHER; | ||
| 979 | |||
| 980 | case ANDROID_TOUCH_UP: | ||
| 981 | |||
| 982 | if (!any) | ||
| 983 | goto OTHER; | ||
| 984 | |||
| 985 | /* Now find and unlink the tool in question. */ | ||
| 986 | |||
| 987 | last = &FRAME_OUTPUT_DATA (any)->touch_points; | ||
| 988 | while ((touchpoint = *last)) | ||
| 989 | { | ||
| 990 | if (touchpoint->tool_id == event->touch.pointer_id) | ||
| 991 | { | ||
| 992 | *last = touchpoint->next; | ||
| 993 | |||
| 994 | /* The tool was unlinked. Free it and generate the | ||
| 995 | appropriate Emacs event. */ | ||
| 996 | xfree (touchpoint); | ||
| 997 | inev.ie.kind = TOUCHSCREEN_END_EVENT; | ||
| 998 | inev.ie.timestamp = event->touch.time; | ||
| 999 | |||
| 1000 | XSETFRAME (inev.ie.frame_or_window, any); | ||
| 1001 | XSETINT (inev.ie.x, event->touch.x); | ||
| 1002 | XSETINT (inev.ie.y, event->touch.y); | ||
| 1003 | XSETINT (inev.ie.arg, event->touch.pointer_id); | ||
| 1004 | |||
| 1005 | /* Break out of the loop. */ | ||
| 1006 | goto OTHER; | ||
| 1007 | } | ||
| 1008 | else | ||
| 1009 | last = &touchpoint->next; | ||
| 1010 | } | ||
| 1011 | |||
| 1012 | /* No touch point was found. This shouldn't happen. */ | ||
| 1013 | goto OTHER; | ||
| 1014 | |||
| 1015 | /* Wheel motion. The events here don't parallel X because | ||
| 1016 | Android doesn't have scroll valuators. */ | ||
| 1017 | |||
| 1018 | case ANDROID_WHEEL: | ||
| 1019 | |||
| 1020 | if (!any) | ||
| 1021 | goto OTHER; | ||
| 1022 | |||
| 1023 | if (fabs (event->wheel.x_delta) > 0 | ||
| 1024 | || fabs (event->wheel.y_delta) > 0) | ||
| 1025 | { | ||
| 1026 | if (mwheel_coalesce_scroll_events) | ||
| 1027 | { | ||
| 1028 | if (signbit (event->wheel.x_delta) | ||
| 1029 | != signbit (wheel_event_x)) | ||
| 1030 | wheel_event_x = 0.0; | ||
| 1031 | |||
| 1032 | if (signbit (event->wheel.y_delta) | ||
| 1033 | != signbit (wheel_event_y)) | ||
| 1034 | wheel_event_y = 0.0; | ||
| 1035 | |||
| 1036 | /* Tally up deltas until one of them exceeds 1.0. */ | ||
| 1037 | wheel_event_x += event->wheel.x_delta; | ||
| 1038 | wheel_event_y += event->wheel.y_delta; | ||
| 1039 | |||
| 1040 | if (fabs (wheel_event_x) < 1.0 | ||
| 1041 | && fabs (wheel_event_y) < 1.0) | ||
| 1042 | goto OTHER; | ||
| 1043 | } | ||
| 1044 | else | ||
| 1045 | { | ||
| 1046 | /* Use the deltas in the event. */ | ||
| 1047 | wheel_event_x = event->wheel.x_delta; | ||
| 1048 | wheel_event_y = event->wheel.y_delta; | ||
| 1049 | } | ||
| 1050 | |||
| 1051 | /* Determine what kind of event to send. */ | ||
| 1052 | inev.ie.kind = ((fabs (wheel_event_y) | ||
| 1053 | >= fabs (wheel_event_x)) | ||
| 1054 | ? WHEEL_EVENT : HORIZ_WHEEL_EVENT); | ||
| 1055 | inev.ie.timestamp = event->wheel.time; | ||
| 1056 | |||
| 1057 | /* Set the event coordinates. */ | ||
| 1058 | XSETINT (inev.ie.x, event->wheel.x); | ||
| 1059 | XSETINT (inev.ie.y, event->wheel.y); | ||
| 1060 | |||
| 1061 | /* Set the frame. */ | ||
| 1062 | XSETFRAME (inev.ie.frame_or_window, any); | ||
| 1063 | |||
| 1064 | /* Figure out the scroll direction. */ | ||
| 1065 | inev.ie.modifiers = (signbit ((fabs (wheel_event_x) | ||
| 1066 | >= fabs (wheel_event_y)) | ||
| 1067 | ? wheel_event_x | ||
| 1068 | : wheel_event_y) | ||
| 1069 | ? down_modifier : up_modifier); | ||
| 1070 | |||
| 1071 | /* Figure out how much to scale the deltas by. */ | ||
| 1072 | window = window_from_coordinates (any, event->wheel.x, | ||
| 1073 | event->wheel.y, NULL, | ||
| 1074 | false, false); | ||
| 1075 | |||
| 1076 | if (WINDOWP (window)) | ||
| 1077 | scroll_height = XWINDOW (window)->pixel_height; | ||
| 1078 | else | ||
| 1079 | /* EVENT_X and EVENT_Y can be outside the | ||
| 1080 | frame if F holds the input grab, so fall | ||
| 1081 | back to the height of the frame instead. */ | ||
| 1082 | scroll_height = FRAME_PIXEL_HEIGHT (any); | ||
| 1083 | |||
| 1084 | scroll_unit = pow (scroll_height, 2.0 / 3.0); | ||
| 1085 | |||
| 1086 | /* Add the keyboard modifiers. */ | ||
| 1087 | inev.ie.modifiers | ||
| 1088 | |= android_android_to_emacs_modifiers (dpyinfo, | ||
| 1089 | event->wheel.state); | ||
| 1090 | |||
| 1091 | /* Finally include the scroll deltas. */ | ||
| 1092 | inev.ie.arg = list3 (Qnil, | ||
| 1093 | make_float (wheel_event_x | ||
| 1094 | * scroll_unit), | ||
| 1095 | make_float (wheel_event_y | ||
| 1096 | * scroll_unit)); | ||
| 1097 | |||
| 1098 | wheel_event_x = 0.0; | ||
| 1099 | wheel_event_y = 0.0; | ||
| 1100 | } | ||
| 1101 | |||
| 1102 | goto OTHER; | ||
| 1103 | |||
| 1104 | /* Iconification. This is vastly simpler than on X. */ | ||
| 1105 | case ANDROID_ICONIFIED: | ||
| 1106 | |||
| 1107 | if (FRAME_ICONIFIED_P (any)) | ||
| 1108 | goto OTHER; | ||
| 1109 | |||
| 1110 | SET_FRAME_VISIBLE (any, false); | ||
| 1111 | SET_FRAME_ICONIFIED (any, true); | ||
| 1112 | |||
| 1113 | inev.ie.kind = ICONIFY_EVENT; | ||
| 1114 | XSETFRAME (inev.ie.frame_or_window, any); | ||
| 1115 | goto OTHER; | ||
| 1116 | |||
| 1117 | case ANDROID_DEICONIFIED: | ||
| 1118 | |||
| 1119 | if (!FRAME_ICONIFIED_P (any)) | ||
| 1120 | goto OTHER; | ||
| 1121 | |||
| 1122 | SET_FRAME_VISIBLE (any, true); | ||
| 1123 | SET_FRAME_ICONIFIED (any, false); | ||
| 1124 | |||
| 1125 | inev.ie.kind = DEICONIFY_EVENT; | ||
| 1126 | XSETFRAME (inev.ie.frame_or_window, any); | ||
| 1127 | goto OTHER; | ||
| 1128 | |||
| 718 | default: | 1129 | default: |
| 719 | goto OTHER; | 1130 | goto OTHER; |
| 720 | } | 1131 | } |
| @@ -781,8 +1192,7 @@ android_read_socket (struct terminal *terminal, | |||
| 781 | now. */ | 1192 | now. */ |
| 782 | if (dpyinfo->pending_autoraise_frame) | 1193 | if (dpyinfo->pending_autoraise_frame) |
| 783 | { | 1194 | { |
| 784 | /* android_raise_frame (dpyinfo->pending_autoraise_frame); | 1195 | android_raise_frame (dpyinfo->pending_autoraise_frame); |
| 785 | TODO */ | ||
| 786 | dpyinfo->pending_autoraise_frame = NULL; | 1196 | dpyinfo->pending_autoraise_frame = NULL; |
| 787 | } | 1197 | } |
| 788 | 1198 | ||
| @@ -796,7 +1206,8 @@ android_frame_up_to_date (struct frame *f) | |||
| 796 | block_input (); | 1206 | block_input (); |
| 797 | FRAME_MOUSE_UPDATE (f); | 1207 | FRAME_MOUSE_UPDATE (f); |
| 798 | 1208 | ||
| 799 | if (!buffer_flipping_blocked_p ()) | 1209 | if (!buffer_flipping_blocked_p () |
| 1210 | && FRAME_ANDROID_NEED_BUFFER_FLIP (f)) | ||
| 800 | show_back_buffer (f); | 1211 | show_back_buffer (f); |
| 801 | 1212 | ||
| 802 | /* The frame is now complete, as its contents have been drawn. */ | 1213 | /* The frame is now complete, as its contents have been drawn. */ |
| @@ -808,7 +1219,10 @@ static void | |||
| 808 | android_buffer_flipping_unblocked_hook (struct frame *f) | 1219 | android_buffer_flipping_unblocked_hook (struct frame *f) |
| 809 | { | 1220 | { |
| 810 | block_input (); | 1221 | block_input (); |
| 811 | show_back_buffer (f); | 1222 | |
| 1223 | if (FRAME_ANDROID_NEED_BUFFER_FLIP (f)) | ||
| 1224 | show_back_buffer (f); | ||
| 1225 | |||
| 812 | unblock_input (); | 1226 | unblock_input (); |
| 813 | } | 1227 | } |
| 814 | 1228 | ||
| @@ -935,7 +1349,25 @@ android_get_focus_frame (struct frame *f) | |||
| 935 | static void | 1349 | static void |
| 936 | android_focus_frame (struct frame *f, bool noactivate) | 1350 | android_focus_frame (struct frame *f, bool noactivate) |
| 937 | { | 1351 | { |
| 938 | /* TODO */ | 1352 | /* Set the input focus to the frame's window. The system only lets |
| 1353 | this work on child frames. */ | ||
| 1354 | android_set_input_focus (FRAME_ANDROID_WINDOW (f), | ||
| 1355 | ANDROID_CURRENT_TIME); | ||
| 1356 | } | ||
| 1357 | |||
| 1358 | /* The two procedures below only have to update the cursor on Android, | ||
| 1359 | as there are no window borders there. */ | ||
| 1360 | |||
| 1361 | static void | ||
| 1362 | android_frame_highlight (struct frame *f) | ||
| 1363 | { | ||
| 1364 | gui_update_cursor (f, true); | ||
| 1365 | } | ||
| 1366 | |||
| 1367 | static void | ||
| 1368 | android_frame_unhighlight (struct frame *f) | ||
| 1369 | { | ||
| 1370 | gui_update_cursor (f, true); | ||
| 939 | } | 1371 | } |
| 940 | 1372 | ||
| 941 | static void | 1373 | static void |
| @@ -963,12 +1395,10 @@ android_frame_rehighlight (struct android_display_info *dpyinfo) | |||
| 963 | if (dpyinfo->highlight_frame != old_highlight) | 1395 | if (dpyinfo->highlight_frame != old_highlight) |
| 964 | { | 1396 | { |
| 965 | /* This is not yet required on Android. */ | 1397 | /* This is not yet required on Android. */ |
| 966 | #if 0 | ||
| 967 | if (old_highlight) | 1398 | if (old_highlight) |
| 968 | android_frame_unhighlight (old_highlight); | 1399 | android_frame_unhighlight (old_highlight); |
| 969 | if (dpyinfo->highlight_frame) | 1400 | if (dpyinfo->highlight_frame) |
| 970 | android_frame_highlight (dpyinfo->highlight_frame); | 1401 | android_frame_highlight (dpyinfo->highlight_frame); |
| 971 | #endif | ||
| 972 | } | 1402 | } |
| 973 | } | 1403 | } |
| 974 | 1404 | ||
| @@ -1027,7 +1457,8 @@ android_fullscreen_hook (struct frame *f) | |||
| 1027 | void | 1457 | void |
| 1028 | android_iconify_frame (struct frame *f) | 1458 | android_iconify_frame (struct frame *f) |
| 1029 | { | 1459 | { |
| 1030 | /* TODO */ | 1460 | /* This really doesn't work on Android. */ |
| 1461 | error ("Can't notify window manager of iconification"); | ||
| 1031 | } | 1462 | } |
| 1032 | 1463 | ||
| 1033 | static void | 1464 | static void |
| @@ -1149,7 +1580,7 @@ android_set_offset (struct frame *f, int xoff, int yoff, | |||
| 1149 | static void | 1580 | static void |
| 1150 | android_set_alpha (struct frame *f) | 1581 | android_set_alpha (struct frame *f) |
| 1151 | { | 1582 | { |
| 1152 | /* TODO */ | 1583 | /* Not supported on Android. */ |
| 1153 | } | 1584 | } |
| 1154 | 1585 | ||
| 1155 | static Lisp_Object | 1586 | static Lisp_Object |
| @@ -1215,6 +1646,7 @@ android_free_frame_resources (struct frame *f) | |||
| 1215 | { | 1646 | { |
| 1216 | struct android_display_info *dpyinfo; | 1647 | struct android_display_info *dpyinfo; |
| 1217 | Mouse_HLInfo *hlinfo; | 1648 | Mouse_HLInfo *hlinfo; |
| 1649 | struct android_touch_point *last, *next; | ||
| 1218 | 1650 | ||
| 1219 | dpyinfo = FRAME_DISPLAY_INFO (f); | 1651 | dpyinfo = FRAME_DISPLAY_INFO (f); |
| 1220 | hlinfo = &dpyinfo->mouse_highlight; | 1652 | hlinfo = &dpyinfo->mouse_highlight; |
| @@ -1256,6 +1688,18 @@ android_free_frame_resources (struct frame *f) | |||
| 1256 | if (f == dpyinfo->last_mouse_frame) | 1688 | if (f == dpyinfo->last_mouse_frame) |
| 1257 | dpyinfo->last_mouse_frame = NULL; | 1689 | dpyinfo->last_mouse_frame = NULL; |
| 1258 | 1690 | ||
| 1691 | /* Free all tool presses currently active on this frame. */ | ||
| 1692 | next = FRAME_OUTPUT_DATA (f)->touch_points; | ||
| 1693 | while (next) | ||
| 1694 | { | ||
| 1695 | last = next; | ||
| 1696 | next = next->next; | ||
| 1697 | xfree (last); | ||
| 1698 | } | ||
| 1699 | |||
| 1700 | /* Clear this in case unblock_input reads events. */ | ||
| 1701 | FRAME_OUTPUT_DATA (f)->touch_points = NULL; | ||
| 1702 | |||
| 1259 | unblock_input (); | 1703 | unblock_input (); |
| 1260 | } | 1704 | } |
| 1261 | 1705 | ||
| @@ -1316,8 +1760,8 @@ android_scroll_run (struct window *w, struct run *run) | |||
| 1316 | /* Cursor off. Will be switched on again in gui_update_window_end. */ | 1760 | /* Cursor off. Will be switched on again in gui_update_window_end. */ |
| 1317 | gui_clear_cursor (w); | 1761 | gui_clear_cursor (w); |
| 1318 | 1762 | ||
| 1319 | android_copy_area (FRAME_ANDROID_WINDOW (f), | 1763 | android_copy_area (FRAME_ANDROID_DRAWABLE (f), |
| 1320 | FRAME_ANDROID_WINDOW (f), | 1764 | FRAME_ANDROID_DRAWABLE (f), |
| 1321 | f->output_data.android->normal_gc, | 1765 | f->output_data.android->normal_gc, |
| 1322 | x, from_y, width, height, x, to_y); | 1766 | x, from_y, width, height, x, to_y); |
| 1323 | 1767 | ||
| @@ -1337,7 +1781,9 @@ static void | |||
| 1337 | android_flip_and_flush (struct frame *f) | 1781 | android_flip_and_flush (struct frame *f) |
| 1338 | { | 1782 | { |
| 1339 | block_input (); | 1783 | block_input (); |
| 1340 | show_back_buffer (f); | 1784 | |
| 1785 | if (FRAME_ANDROID_NEED_BUFFER_FLIP (f)) | ||
| 1786 | show_back_buffer (f); | ||
| 1341 | 1787 | ||
| 1342 | /* The frame is complete again as its contents were just | 1788 | /* The frame is complete again as its contents were just |
| 1343 | flushed. */ | 1789 | flushed. */ |
| @@ -1355,7 +1801,7 @@ android_clear_rectangle (struct frame *f, struct android_gc *gc, int x, | |||
| 1355 | | ANDROID_GC_FOREGROUND), | 1801 | | ANDROID_GC_FOREGROUND), |
| 1356 | &xgcv); | 1802 | &xgcv); |
| 1357 | android_set_foreground (gc, xgcv.background); | 1803 | android_set_foreground (gc, xgcv.background); |
| 1358 | android_fill_rectangle (FRAME_ANDROID_WINDOW (f), gc, | 1804 | android_fill_rectangle (FRAME_ANDROID_DRAWABLE (f), gc, |
| 1359 | x, y, width, height); | 1805 | x, y, width, height); |
| 1360 | android_set_foreground (gc, xgcv.foreground); | 1806 | android_set_foreground (gc, xgcv.foreground); |
| 1361 | } | 1807 | } |
| @@ -1405,7 +1851,7 @@ android_draw_fringe_bitmap (struct window *w, struct glyph_row *row, | |||
| 1405 | if (face->stipple) | 1851 | if (face->stipple) |
| 1406 | { | 1852 | { |
| 1407 | android_set_fill_style (face->gc, ANDROID_FILL_OPAQUE_STIPPLED); | 1853 | android_set_fill_style (face->gc, ANDROID_FILL_OPAQUE_STIPPLED); |
| 1408 | android_fill_rectangle (FRAME_ANDROID_WINDOW (f), face->gc, | 1854 | android_fill_rectangle (FRAME_ANDROID_DRAWABLE (f), face->gc, |
| 1409 | p->bx, p->by, p->nx, p->ny); | 1855 | p->bx, p->by, p->nx, p->ny); |
| 1410 | android_set_fill_style (face->gc, ANDROID_FILL_SOLID); | 1856 | android_set_fill_style (face->gc, ANDROID_FILL_SOLID); |
| 1411 | 1857 | ||
| @@ -1428,7 +1874,7 @@ android_draw_fringe_bitmap (struct window *w, struct glyph_row *row, | |||
| 1428 | unsigned long background, cursor_pixel; | 1874 | unsigned long background, cursor_pixel; |
| 1429 | int depth; | 1875 | int depth; |
| 1430 | 1876 | ||
| 1431 | drawable = FRAME_ANDROID_WINDOW (f); | 1877 | drawable = FRAME_ANDROID_DRAWABLE (f); |
| 1432 | clipmask = ANDROID_NONE; | 1878 | clipmask = ANDROID_NONE; |
| 1433 | background = face->background; | 1879 | background = face->background; |
| 1434 | cursor_pixel = f->output_data.android->cursor_pixel; | 1880 | cursor_pixel = f->output_data.android->cursor_pixel; |
| @@ -1697,7 +2143,7 @@ android_draw_glyph_string_background (struct glyph_string *s, bool force_p) | |||
| 1697 | { | 2143 | { |
| 1698 | /* Fill background with a stipple pattern. */ | 2144 | /* Fill background with a stipple pattern. */ |
| 1699 | android_set_fill_style (s->gc, ANDROID_FILL_OPAQUE_STIPPLED); | 2145 | android_set_fill_style (s->gc, ANDROID_FILL_OPAQUE_STIPPLED); |
| 1700 | android_fill_rectangle (FRAME_ANDROID_WINDOW (s->f), s->gc, | 2146 | android_fill_rectangle (FRAME_ANDROID_DRAWABLE (s->f), s->gc, |
| 1701 | s->x, s->y + box_line_width, | 2147 | s->x, s->y + box_line_width, |
| 1702 | s->background_width, | 2148 | s->background_width, |
| 1703 | s->height - 2 * box_line_width); | 2149 | s->height - 2 * box_line_width); |
| @@ -1734,7 +2180,7 @@ android_fill_triangle (struct frame *f, struct android_gc *gc, | |||
| 1734 | abc[1] = point2; | 2180 | abc[1] = point2; |
| 1735 | abc[2] = point3; | 2181 | abc[2] = point3; |
| 1736 | 2182 | ||
| 1737 | android_fill_polygon (FRAME_ANDROID_WINDOW (f), | 2183 | android_fill_polygon (FRAME_ANDROID_DRAWABLE (f), |
| 1738 | gc, abc, 3, ANDROID_CONVEX, | 2184 | gc, abc, 3, ANDROID_CONVEX, |
| 1739 | ANDROID_COORD_MODE_ORIGIN); | 2185 | ANDROID_COORD_MODE_ORIGIN); |
| 1740 | } | 2186 | } |
| @@ -1776,7 +2222,7 @@ android_clear_point (struct frame *f, struct android_gc *gc, | |||
| 1776 | android_get_gc_values (gc, ANDROID_GC_BACKGROUND | ANDROID_GC_FOREGROUND, | 2222 | android_get_gc_values (gc, ANDROID_GC_BACKGROUND | ANDROID_GC_FOREGROUND, |
| 1777 | &xgcv); | 2223 | &xgcv); |
| 1778 | android_set_foreground (gc, xgcv.background); | 2224 | android_set_foreground (gc, xgcv.background); |
| 1779 | android_draw_point (FRAME_ANDROID_WINDOW (f), gc, x, y); | 2225 | android_draw_point (FRAME_ANDROID_DRAWABLE (f), gc, x, y); |
| 1780 | android_set_foreground (gc, xgcv.foreground); | 2226 | android_set_foreground (gc, xgcv.foreground); |
| 1781 | } | 2227 | } |
| 1782 | 2228 | ||
| @@ -1798,7 +2244,7 @@ android_draw_relief_rect (struct frame *f, int left_x, int top_y, int right_x, | |||
| 1798 | black_gc = f->output_data.android->black_relief.gc; | 2244 | black_gc = f->output_data.android->black_relief.gc; |
| 1799 | normal_gc = f->output_data.android->normal_gc; | 2245 | normal_gc = f->output_data.android->normal_gc; |
| 1800 | 2246 | ||
| 1801 | drawable = FRAME_ANDROID_WINDOW (f); | 2247 | drawable = FRAME_ANDROID_DRAWABLE (f); |
| 1802 | 2248 | ||
| 1803 | android_set_clip_rectangles (white_gc, 0, 0, clip_rect, 1); | 2249 | android_set_clip_rectangles (white_gc, 0, 0, clip_rect, 1); |
| 1804 | android_set_clip_rectangles (black_gc, 0, 0, clip_rect, 1); | 2250 | android_set_clip_rectangles (black_gc, 0, 0, clip_rect, 1); |
| @@ -1811,11 +2257,11 @@ android_draw_relief_rect (struct frame *f, int left_x, int top_y, int right_x, | |||
| 1811 | /* Draw lines. */ | 2257 | /* Draw lines. */ |
| 1812 | 2258 | ||
| 1813 | if (top_p) | 2259 | if (top_p) |
| 1814 | android_fill_rectangle (FRAME_ANDROID_WINDOW (f), gc, left_x, top_y, | 2260 | android_fill_rectangle (FRAME_ANDROID_DRAWABLE (f), gc, left_x, top_y, |
| 1815 | right_x - left_x + 1, hwidth); | 2261 | right_x - left_x + 1, hwidth); |
| 1816 | 2262 | ||
| 1817 | if (left_p) | 2263 | if (left_p) |
| 1818 | android_fill_rectangle (FRAME_ANDROID_WINDOW (f), gc, left_x, top_y, | 2264 | android_fill_rectangle (FRAME_ANDROID_DRAWABLE (f), gc, left_x, top_y, |
| 1819 | vwidth, bottom_y - top_y + 1); | 2265 | vwidth, bottom_y - top_y + 1); |
| 1820 | 2266 | ||
| 1821 | if (raised_p) | 2267 | if (raised_p) |
| @@ -1824,12 +2270,12 @@ android_draw_relief_rect (struct frame *f, int left_x, int top_y, int right_x, | |||
| 1824 | gc = white_gc; | 2270 | gc = white_gc; |
| 1825 | 2271 | ||
| 1826 | if (bot_p) | 2272 | if (bot_p) |
| 1827 | android_fill_rectangle (FRAME_ANDROID_WINDOW (f), gc, left_x, | 2273 | android_fill_rectangle (FRAME_ANDROID_DRAWABLE (f), gc, left_x, |
| 1828 | bottom_y - hwidth + 1, | 2274 | bottom_y - hwidth + 1, |
| 1829 | right_x - left_x + 1, hwidth); | 2275 | right_x - left_x + 1, hwidth); |
| 1830 | 2276 | ||
| 1831 | if (right_p) | 2277 | if (right_p) |
| 1832 | android_fill_rectangle (FRAME_ANDROID_WINDOW (f), gc, | 2278 | android_fill_rectangle (FRAME_ANDROID_DRAWABLE (f), gc, |
| 1833 | right_x - vwidth + 1, | 2279 | right_x - vwidth + 1, |
| 1834 | top_y, vwidth, bottom_y - top_y + 1); | 2280 | top_y, vwidth, bottom_y - top_y + 1); |
| 1835 | 2281 | ||
| @@ -1853,7 +2299,7 @@ android_draw_relief_rect (struct frame *f, int left_x, int top_y, int right_x, | |||
| 1853 | 2299 | ||
| 1854 | if (top_p && left_p && bot_p && right_p | 2300 | if (top_p && left_p && bot_p && right_p |
| 1855 | && hwidth > 1 && vwidth > 1) | 2301 | && hwidth > 1 && vwidth > 1) |
| 1856 | android_draw_rectangle (FRAME_ANDROID_WINDOW (f), | 2302 | android_draw_rectangle (FRAME_ANDROID_DRAWABLE (f), |
| 1857 | black_gc, left_x, top_y, | 2303 | black_gc, left_x, top_y, |
| 1858 | right_x - left_x, bottom_y - top_y); | 2304 | right_x - left_x, bottom_y - top_y); |
| 1859 | else | 2305 | else |
| @@ -1913,22 +2359,22 @@ android_draw_box_rect (struct glyph_string *s, | |||
| 1913 | android_set_clip_rectangles (s->gc, 0, 0, clip_rect, 1); | 2359 | android_set_clip_rectangles (s->gc, 0, 0, clip_rect, 1); |
| 1914 | 2360 | ||
| 1915 | /* Top. */ | 2361 | /* Top. */ |
| 1916 | android_fill_rectangle (FRAME_ANDROID_WINDOW (s->f), s->gc, left_x, | 2362 | android_fill_rectangle (FRAME_ANDROID_DRAWABLE (s->f), s->gc, left_x, |
| 1917 | left_x, right_x - left_x + 1, hwidth); | 2363 | left_x, right_x - left_x + 1, hwidth); |
| 1918 | 2364 | ||
| 1919 | /* Left. */ | 2365 | /* Left. */ |
| 1920 | if (left_p) | 2366 | if (left_p) |
| 1921 | android_fill_rectangle (FRAME_ANDROID_WINDOW (s->f), s->gc, left_x, | 2367 | android_fill_rectangle (FRAME_ANDROID_DRAWABLE (s->f), s->gc, left_x, |
| 1922 | top_y, vwidth, bottom_y - top_y + 1); | 2368 | top_y, vwidth, bottom_y - top_y + 1); |
| 1923 | 2369 | ||
| 1924 | /* Bottom. */ | 2370 | /* Bottom. */ |
| 1925 | android_fill_rectangle (FRAME_ANDROID_WINDOW (s->f), s->gc, left_x, | 2371 | android_fill_rectangle (FRAME_ANDROID_DRAWABLE (s->f), s->gc, left_x, |
| 1926 | bottom_y - hwidth + 1, right_x - left_x + 1, | 2372 | bottom_y - hwidth + 1, right_x - left_x + 1, |
| 1927 | hwidth); | 2373 | hwidth); |
| 1928 | 2374 | ||
| 1929 | /* Right. */ | 2375 | /* Right. */ |
| 1930 | if (right_p) | 2376 | if (right_p) |
| 1931 | android_fill_rectangle (FRAME_ANDROID_WINDOW (s->f), s->gc, | 2377 | android_fill_rectangle (FRAME_ANDROID_DRAWABLE (s->f), s->gc, |
| 1932 | right_x - vwidth + 1, top_y, vwidth, | 2378 | right_x - vwidth + 1, top_y, vwidth, |
| 1933 | bottom_y - top_y + 1); | 2379 | bottom_y - top_y + 1); |
| 1934 | 2380 | ||
| @@ -2153,7 +2599,7 @@ android_draw_glyph_string_bg_rect (struct glyph_string *s, int x, int y, | |||
| 2153 | { | 2599 | { |
| 2154 | /* Fill background with a stipple pattern. */ | 2600 | /* Fill background with a stipple pattern. */ |
| 2155 | android_set_fill_style (s->gc, ANDROID_FILL_OPAQUE_STIPPLED); | 2601 | android_set_fill_style (s->gc, ANDROID_FILL_OPAQUE_STIPPLED); |
| 2156 | android_fill_rectangle (FRAME_ANDROID_WINDOW (s->f), s->gc, x, | 2602 | android_fill_rectangle (FRAME_ANDROID_DRAWABLE (s->f), s->gc, x, |
| 2157 | y, w, h); | 2603 | y, w, h); |
| 2158 | android_set_fill_style (s->gc, ANDROID_FILL_SOLID); | 2604 | android_set_fill_style (s->gc, ANDROID_FILL_SOLID); |
| 2159 | } | 2605 | } |
| @@ -2294,7 +2740,7 @@ android_draw_image_foreground (struct glyph_string *s) | |||
| 2294 | 2740 | ||
| 2295 | if (gui_intersect_rectangles (&clip_rect, &image_rect, &r)) | 2741 | if (gui_intersect_rectangles (&clip_rect, &image_rect, &r)) |
| 2296 | android_copy_area (s->img->pixmap, | 2742 | android_copy_area (s->img->pixmap, |
| 2297 | FRAME_ANDROID_WINDOW (s->f), | 2743 | FRAME_ANDROID_DRAWABLE (s->f), |
| 2298 | s->gc, s->slice.x + r.x - x, | 2744 | s->gc, s->slice.x + r.x - x, |
| 2299 | s->slice.y + r.y - y, | 2745 | s->slice.y + r.y - y, |
| 2300 | r.width, r.height, r.x, r.y); | 2746 | r.width, r.height, r.x, r.y); |
| @@ -2307,7 +2753,7 @@ android_draw_image_foreground (struct glyph_string *s) | |||
| 2307 | if (s->hl == DRAW_CURSOR && !s->img->mask) | 2753 | if (s->hl == DRAW_CURSOR && !s->img->mask) |
| 2308 | { | 2754 | { |
| 2309 | int relief = eabs (s->img->relief); | 2755 | int relief = eabs (s->img->relief); |
| 2310 | android_draw_rectangle (FRAME_ANDROID_WINDOW (s->f), s->gc, | 2756 | android_draw_rectangle (FRAME_ANDROID_DRAWABLE (s->f), s->gc, |
| 2311 | x - relief, y - relief, | 2757 | x - relief, y - relief, |
| 2312 | s->slice.width + relief*2 - 1, | 2758 | s->slice.width + relief*2 - 1, |
| 2313 | s->slice.height + relief*2 - 1); | 2759 | s->slice.height + relief*2 - 1); |
| @@ -2317,7 +2763,7 @@ android_draw_image_foreground (struct glyph_string *s) | |||
| 2317 | } | 2763 | } |
| 2318 | else | 2764 | else |
| 2319 | /* Draw a rectangle if image could not be loaded. */ | 2765 | /* Draw a rectangle if image could not be loaded. */ |
| 2320 | android_draw_rectangle (FRAME_ANDROID_WINDOW (s->f), s->gc, x, y, | 2766 | android_draw_rectangle (FRAME_ANDROID_DRAWABLE (s->f), s->gc, x, y, |
| 2321 | s->slice.width - 1, s->slice.height - 1); | 2767 | s->slice.width - 1, s->slice.height - 1); |
| 2322 | } | 2768 | } |
| 2323 | 2769 | ||
| @@ -2444,7 +2890,7 @@ android_draw_stretch_glyph_string (struct glyph_string *s) | |||
| 2444 | { | 2890 | { |
| 2445 | /* Fill background with a stipple pattern. */ | 2891 | /* Fill background with a stipple pattern. */ |
| 2446 | android_set_fill_style (gc, ANDROID_FILL_OPAQUE_STIPPLED); | 2892 | android_set_fill_style (gc, ANDROID_FILL_OPAQUE_STIPPLED); |
| 2447 | android_fill_rectangle (FRAME_ANDROID_WINDOW (s->f), | 2893 | android_fill_rectangle (FRAME_ANDROID_DRAWABLE (s->f), |
| 2448 | gc, x, y, w, h); | 2894 | gc, x, y, w, h); |
| 2449 | android_set_fill_style (gc, ANDROID_FILL_SOLID); | 2895 | android_set_fill_style (gc, ANDROID_FILL_SOLID); |
| 2450 | 2896 | ||
| @@ -2457,7 +2903,7 @@ android_draw_stretch_glyph_string (struct glyph_string *s) | |||
| 2457 | | ANDROID_GC_BACKGROUND), | 2903 | | ANDROID_GC_BACKGROUND), |
| 2458 | &xgcv); | 2904 | &xgcv); |
| 2459 | android_set_foreground (gc, xgcv.background); | 2905 | android_set_foreground (gc, xgcv.background); |
| 2460 | android_fill_rectangle (FRAME_ANDROID_WINDOW (s->f), | 2906 | android_fill_rectangle (FRAME_ANDROID_DRAWABLE (s->f), |
| 2461 | gc, x, y, w, h); | 2907 | gc, x, y, w, h); |
| 2462 | android_set_foreground (gc, xgcv.foreground); | 2908 | android_set_foreground (gc, xgcv.foreground); |
| 2463 | } | 2909 | } |
| @@ -2536,7 +2982,7 @@ android_draw_underwave (struct glyph_string *s, int decoration_width) | |||
| 2536 | 2982 | ||
| 2537 | while (x1 <= xmax) | 2983 | while (x1 <= xmax) |
| 2538 | { | 2984 | { |
| 2539 | android_draw_line (FRAME_ANDROID_WINDOW (s->f), s->gc, | 2985 | android_draw_line (FRAME_ANDROID_DRAWABLE (s->f), s->gc, |
| 2540 | x1, y1, x2, y2); | 2986 | x1, y1, x2, y2); |
| 2541 | x1 = x2, y1 = y2; | 2987 | x1 = x2, y1 = y2; |
| 2542 | x2 += dx, y2 = y0 + odd*dy; | 2988 | x2 += dx, y2 = y0 + odd*dy; |
| @@ -2567,7 +3013,7 @@ android_draw_glyph_string_foreground (struct glyph_string *s) | |||
| 2567 | for (i = 0; i < s->nchars; ++i) | 3013 | for (i = 0; i < s->nchars; ++i) |
| 2568 | { | 3014 | { |
| 2569 | struct glyph *g = s->first_glyph + i; | 3015 | struct glyph *g = s->first_glyph + i; |
| 2570 | android_draw_rectangle (FRAME_ANDROID_WINDOW (s->f), | 3016 | android_draw_rectangle (FRAME_ANDROID_DRAWABLE (s->f), |
| 2571 | s->gc, x, s->y, | 3017 | s->gc, x, s->y, |
| 2572 | g->pixel_width - 1, | 3018 | g->pixel_width - 1, |
| 2573 | s->height - 1); | 3019 | s->height - 1); |
| @@ -2618,7 +3064,7 @@ android_draw_composite_glyph_string_foreground (struct glyph_string *s) | |||
| 2618 | if (s->font_not_found_p) | 3064 | if (s->font_not_found_p) |
| 2619 | { | 3065 | { |
| 2620 | if (s->cmp_from == 0) | 3066 | if (s->cmp_from == 0) |
| 2621 | android_draw_rectangle (FRAME_ANDROID_WINDOW (s->f), | 3067 | android_draw_rectangle (FRAME_ANDROID_DRAWABLE (s->f), |
| 2622 | s->gc, x, s->y, | 3068 | s->gc, x, s->y, |
| 2623 | s->width - 1, s->height - 1); | 3069 | s->width - 1, s->height - 1); |
| 2624 | } | 3070 | } |
| @@ -2754,7 +3200,7 @@ android_draw_glyphless_glyph_string_foreground (struct glyph_string *s) | |||
| 2754 | false); | 3200 | false); |
| 2755 | } | 3201 | } |
| 2756 | if (glyph->u.glyphless.method != GLYPHLESS_DISPLAY_THIN_SPACE) | 3202 | if (glyph->u.glyphless.method != GLYPHLESS_DISPLAY_THIN_SPACE) |
| 2757 | android_draw_rectangle (FRAME_ANDROID_WINDOW (s->f), s->gc, | 3203 | android_draw_rectangle (FRAME_ANDROID_DRAWABLE (s->f), s->gc, |
| 2758 | x, s->ybase - glyph->ascent, | 3204 | x, s->ybase - glyph->ascent, |
| 2759 | glyph->pixel_width - 1, | 3205 | glyph->pixel_width - 1, |
| 2760 | glyph->ascent + glyph->descent - 1); | 3206 | glyph->ascent + glyph->descent - 1); |
| @@ -2987,14 +3433,14 @@ android_draw_glyph_string (struct glyph_string *s) | |||
| 2987 | s->underline_position = position; | 3433 | s->underline_position = position; |
| 2988 | y = s->ybase + position; | 3434 | y = s->ybase + position; |
| 2989 | if (s->face->underline_defaulted_p) | 3435 | if (s->face->underline_defaulted_p) |
| 2990 | android_fill_rectangle (FRAME_ANDROID_WINDOW (s->f), s->gc, | 3436 | android_fill_rectangle (FRAME_ANDROID_DRAWABLE (s->f), s->gc, |
| 2991 | s->x, y, decoration_width, thickness); | 3437 | s->x, y, decoration_width, thickness); |
| 2992 | else | 3438 | else |
| 2993 | { | 3439 | { |
| 2994 | struct android_gc_values xgcv; | 3440 | struct android_gc_values xgcv; |
| 2995 | android_get_gc_values (s->gc, ANDROID_GC_FOREGROUND, &xgcv); | 3441 | android_get_gc_values (s->gc, ANDROID_GC_FOREGROUND, &xgcv); |
| 2996 | android_set_foreground (s->gc, s->face->underline_color); | 3442 | android_set_foreground (s->gc, s->face->underline_color); |
| 2997 | android_fill_rectangle (FRAME_ANDROID_WINDOW (s->f), s->gc, | 3443 | android_fill_rectangle (FRAME_ANDROID_DRAWABLE (s->f), s->gc, |
| 2998 | s->x, y, decoration_width, thickness); | 3444 | s->x, y, decoration_width, thickness); |
| 2999 | android_set_foreground (s->gc, xgcv.foreground); | 3445 | android_set_foreground (s->gc, xgcv.foreground); |
| 3000 | } | 3446 | } |
| @@ -3006,7 +3452,7 @@ android_draw_glyph_string (struct glyph_string *s) | |||
| 3006 | unsigned long dy = 0, h = 1; | 3452 | unsigned long dy = 0, h = 1; |
| 3007 | 3453 | ||
| 3008 | if (s->face->overline_color_defaulted_p) | 3454 | if (s->face->overline_color_defaulted_p) |
| 3009 | android_fill_rectangle (FRAME_ANDROID_WINDOW (s->f), | 3455 | android_fill_rectangle (FRAME_ANDROID_DRAWABLE (s->f), |
| 3010 | s->gc, s->x, s->y + dy, | 3456 | s->gc, s->x, s->y + dy, |
| 3011 | decoration_width, h); | 3457 | decoration_width, h); |
| 3012 | else | 3458 | else |
| @@ -3014,8 +3460,8 @@ android_draw_glyph_string (struct glyph_string *s) | |||
| 3014 | struct android_gc_values xgcv; | 3460 | struct android_gc_values xgcv; |
| 3015 | android_get_gc_values (s->gc, ANDROID_GC_FOREGROUND, &xgcv); | 3461 | android_get_gc_values (s->gc, ANDROID_GC_FOREGROUND, &xgcv); |
| 3016 | android_set_foreground (s->gc, s->face->overline_color); | 3462 | android_set_foreground (s->gc, s->face->overline_color); |
| 3017 | android_fill_rectangle (FRAME_ANDROID_WINDOW (s->f), s->gc, s->x, | 3463 | android_fill_rectangle (FRAME_ANDROID_DRAWABLE (s->f), s->gc, |
| 3018 | s->y + dy, decoration_width, h); | 3464 | s->x, s->y + dy, decoration_width, h); |
| 3019 | android_set_foreground (s->gc, xgcv.foreground); | 3465 | android_set_foreground (s->gc, xgcv.foreground); |
| 3020 | } | 3466 | } |
| 3021 | } | 3467 | } |
| @@ -3044,8 +3490,9 @@ android_draw_glyph_string (struct glyph_string *s) | |||
| 3044 | struct android_gc_values xgcv; | 3490 | struct android_gc_values xgcv; |
| 3045 | android_get_gc_values (s->gc, ANDROID_GC_FOREGROUND, &xgcv); | 3491 | android_get_gc_values (s->gc, ANDROID_GC_FOREGROUND, &xgcv); |
| 3046 | android_set_foreground (s->gc, s->face->strike_through_color); | 3492 | android_set_foreground (s->gc, s->face->strike_through_color); |
| 3047 | android_fill_rectangle (FRAME_ANDROID_WINDOW (s->f), s->gc, s->x, | 3493 | android_fill_rectangle (FRAME_ANDROID_DRAWABLE (s->f), s->gc, |
| 3048 | glyph_y + dy, decoration_width, h); | 3494 | s->x, glyph_y + dy, decoration_width, |
| 3495 | h); | ||
| 3049 | android_set_foreground (s->gc, xgcv.foreground); | 3496 | android_set_foreground (s->gc, xgcv.foreground); |
| 3050 | } | 3497 | } |
| 3051 | } | 3498 | } |
| @@ -3125,7 +3572,7 @@ static void | |||
| 3125 | android_clear_frame_area (struct frame *f, int x, int y, | 3572 | android_clear_frame_area (struct frame *f, int x, int y, |
| 3126 | int width, int height) | 3573 | int width, int height) |
| 3127 | { | 3574 | { |
| 3128 | android_clear_area (FRAME_ANDROID_WINDOW (f), | 3575 | android_clear_area (FRAME_ANDROID_DRAWABLE (f), |
| 3129 | x, y, width, height); | 3576 | x, y, width, height); |
| 3130 | } | 3577 | } |
| 3131 | 3578 | ||
| @@ -3154,25 +3601,25 @@ android_clear_under_internal_border (struct frame *f) | |||
| 3154 | struct android_gc *gc = f->output_data.android->normal_gc; | 3601 | struct android_gc *gc = f->output_data.android->normal_gc; |
| 3155 | 3602 | ||
| 3156 | android_set_foreground (gc, color); | 3603 | android_set_foreground (gc, color); |
| 3157 | android_fill_rectangle (FRAME_ANDROID_WINDOW (f), gc, 0, margin, | 3604 | android_fill_rectangle (FRAME_ANDROID_DRAWABLE (f), gc, 0, margin, |
| 3158 | width, border); | 3605 | width, border); |
| 3159 | android_fill_rectangle (FRAME_ANDROID_WINDOW (f), gc, 0, 0, | 3606 | android_fill_rectangle (FRAME_ANDROID_DRAWABLE (f), gc, 0, 0, |
| 3160 | border, height); | 3607 | border, height); |
| 3161 | android_fill_rectangle (FRAME_ANDROID_WINDOW (f), gc, width - border, | 3608 | android_fill_rectangle (FRAME_ANDROID_DRAWABLE (f), gc, width - border, |
| 3162 | 0, border, height); | 3609 | 0, border, height); |
| 3163 | android_fill_rectangle (FRAME_ANDROID_WINDOW (f), gc, 0, | 3610 | android_fill_rectangle (FRAME_ANDROID_DRAWABLE (f), gc, 0, |
| 3164 | height - border, width, border); | 3611 | height - border, width, border); |
| 3165 | android_set_foreground (gc, FRAME_FOREGROUND_PIXEL (f)); | 3612 | android_set_foreground (gc, FRAME_FOREGROUND_PIXEL (f)); |
| 3166 | } | 3613 | } |
| 3167 | else | 3614 | else |
| 3168 | { | 3615 | { |
| 3169 | android_clear_area (FRAME_ANDROID_WINDOW (f), 0, 0, | 3616 | android_clear_area (FRAME_ANDROID_DRAWABLE (f), 0, 0, |
| 3170 | border, height); | 3617 | border, height); |
| 3171 | android_clear_area (FRAME_ANDROID_WINDOW (f), 0, | 3618 | android_clear_area (FRAME_ANDROID_DRAWABLE (f), 0, |
| 3172 | margin, width, border); | 3619 | margin, width, border); |
| 3173 | android_clear_area (FRAME_ANDROID_WINDOW (f), width - border, | 3620 | android_clear_area (FRAME_ANDROID_DRAWABLE (f), width - border, |
| 3174 | 0, border, height); | 3621 | 0, border, height); |
| 3175 | android_clear_area (FRAME_ANDROID_WINDOW (f), 0, | 3622 | android_clear_area (FRAME_ANDROID_DRAWABLE (f), 0, |
| 3176 | height - border, width, border); | 3623 | height - border, width, border); |
| 3177 | } | 3624 | } |
| 3178 | } | 3625 | } |
| @@ -3221,7 +3668,7 @@ android_draw_hollow_cursor (struct window *w, struct glyph_row *row) | |||
| 3221 | } | 3668 | } |
| 3222 | /* Set clipping, draw the rectangle, and reset clipping again. */ | 3669 | /* Set clipping, draw the rectangle, and reset clipping again. */ |
| 3223 | android_clip_to_row (w, row, TEXT_AREA, gc); | 3670 | android_clip_to_row (w, row, TEXT_AREA, gc); |
| 3224 | android_draw_rectangle (FRAME_ANDROID_WINDOW (f), gc, x, y, wd, h - 1); | 3671 | android_draw_rectangle (FRAME_ANDROID_DRAWABLE (f), gc, x, y, wd, h - 1); |
| 3225 | android_reset_clip_rectangles (f, gc); | 3672 | android_reset_clip_rectangles (f, gc); |
| 3226 | } | 3673 | } |
| 3227 | 3674 | ||
| @@ -3295,7 +3742,7 @@ android_draw_bar_cursor (struct window *w, struct glyph_row *row, int width, | |||
| 3295 | if ((cursor_glyph->resolved_level & 1) != 0) | 3742 | if ((cursor_glyph->resolved_level & 1) != 0) |
| 3296 | x += cursor_glyph->pixel_width - width; | 3743 | x += cursor_glyph->pixel_width - width; |
| 3297 | 3744 | ||
| 3298 | android_fill_rectangle (FRAME_ANDROID_WINDOW (f), gc, x, | 3745 | android_fill_rectangle (FRAME_ANDROID_DRAWABLE (f), gc, x, |
| 3299 | WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y), | 3746 | WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y), |
| 3300 | width, row->height); | 3747 | width, row->height); |
| 3301 | } | 3748 | } |
| @@ -3318,7 +3765,7 @@ android_draw_bar_cursor (struct window *w, struct glyph_row *row, int width, | |||
| 3318 | if ((cursor_glyph->resolved_level & 1) != 0 | 3765 | if ((cursor_glyph->resolved_level & 1) != 0 |
| 3319 | && cursor_glyph->pixel_width > w->phys_cursor_width - 1) | 3766 | && cursor_glyph->pixel_width > w->phys_cursor_width - 1) |
| 3320 | x += cursor_glyph->pixel_width - w->phys_cursor_width + 1; | 3767 | x += cursor_glyph->pixel_width - w->phys_cursor_width + 1; |
| 3321 | android_fill_rectangle (FRAME_ANDROID_WINDOW (f), gc, x, | 3768 | android_fill_rectangle (FRAME_ANDROID_DRAWABLE (f), gc, x, |
| 3322 | cursor_start_y, | 3769 | cursor_start_y, |
| 3323 | w->phys_cursor_width - 1, width); | 3770 | w->phys_cursor_width - 1, width); |
| 3324 | } | 3771 | } |
| @@ -3387,7 +3834,7 @@ android_draw_vertical_window_border (struct window *w, int x, int y0, int y1) | |||
| 3387 | android_set_foreground (f->output_data.android->normal_gc, | 3834 | android_set_foreground (f->output_data.android->normal_gc, |
| 3388 | face->foreground); | 3835 | face->foreground); |
| 3389 | 3836 | ||
| 3390 | android_draw_line (FRAME_ANDROID_WINDOW (f), | 3837 | android_draw_line (FRAME_ANDROID_DRAWABLE (f), |
| 3391 | f->output_data.android->normal_gc, | 3838 | f->output_data.android->normal_gc, |
| 3392 | x, y0, x, y1); | 3839 | x, y0, x, y1); |
| 3393 | } | 3840 | } |
| @@ -3415,17 +3862,17 @@ android_draw_window_divider (struct window *w, int x0, int x1, int y0, int y1) | |||
| 3415 | { | 3862 | { |
| 3416 | android_set_foreground (f->output_data.android->normal_gc, | 3863 | android_set_foreground (f->output_data.android->normal_gc, |
| 3417 | color_first); | 3864 | color_first); |
| 3418 | android_fill_rectangle (FRAME_ANDROID_WINDOW (f), | 3865 | android_fill_rectangle (FRAME_ANDROID_DRAWABLE (f), |
| 3419 | f->output_data.android->normal_gc, | 3866 | f->output_data.android->normal_gc, |
| 3420 | x0, y0, 1, y1 - y0); | 3867 | x0, y0, 1, y1 - y0); |
| 3421 | android_set_foreground (f->output_data.android->normal_gc, | 3868 | android_set_foreground (f->output_data.android->normal_gc, |
| 3422 | color); | 3869 | color); |
| 3423 | android_fill_rectangle (FRAME_ANDROID_WINDOW (f), | 3870 | android_fill_rectangle (FRAME_ANDROID_DRAWABLE (f), |
| 3424 | f->output_data.android->normal_gc, | 3871 | f->output_data.android->normal_gc, |
| 3425 | x0 + 1, y0, x1 - x0 - 2, y1 - y0); | 3872 | x0 + 1, y0, x1 - x0 - 2, y1 - y0); |
| 3426 | android_set_foreground (f->output_data.android->normal_gc, | 3873 | android_set_foreground (f->output_data.android->normal_gc, |
| 3427 | color_last); | 3874 | color_last); |
| 3428 | android_fill_rectangle (FRAME_ANDROID_WINDOW (f), | 3875 | android_fill_rectangle (FRAME_ANDROID_DRAWABLE (f), |
| 3429 | f->output_data.android->normal_gc, | 3876 | f->output_data.android->normal_gc, |
| 3430 | x1 - 1, y0, 1, y1 - y0); | 3877 | x1 - 1, y0, 1, y1 - y0); |
| 3431 | } | 3878 | } |
| @@ -3435,16 +3882,16 @@ android_draw_window_divider (struct window *w, int x0, int x1, int y0, int y1) | |||
| 3435 | { | 3882 | { |
| 3436 | android_set_foreground (f->output_data.android->normal_gc, | 3883 | android_set_foreground (f->output_data.android->normal_gc, |
| 3437 | color_first); | 3884 | color_first); |
| 3438 | android_fill_rectangle (FRAME_ANDROID_WINDOW (f), | 3885 | android_fill_rectangle (FRAME_ANDROID_DRAWABLE (f), |
| 3439 | f->output_data.android->normal_gc, | 3886 | f->output_data.android->normal_gc, |
| 3440 | x0, y0, x1 - x0, 1); | 3887 | x0, y0, x1 - x0, 1); |
| 3441 | android_set_foreground (f->output_data.android->normal_gc, color); | 3888 | android_set_foreground (f->output_data.android->normal_gc, color); |
| 3442 | android_fill_rectangle (FRAME_ANDROID_WINDOW (f), | 3889 | android_fill_rectangle (FRAME_ANDROID_DRAWABLE (f), |
| 3443 | f->output_data.android->normal_gc, | 3890 | f->output_data.android->normal_gc, |
| 3444 | x0, y0 + 1, x1 - x0, y1 - y0 - 2); | 3891 | x0, y0 + 1, x1 - x0, y1 - y0 - 2); |
| 3445 | android_set_foreground (f->output_data.android->normal_gc, | 3892 | android_set_foreground (f->output_data.android->normal_gc, |
| 3446 | color_last); | 3893 | color_last); |
| 3447 | android_fill_rectangle (FRAME_ANDROID_WINDOW (f), | 3894 | android_fill_rectangle (FRAME_ANDROID_DRAWABLE (f), |
| 3448 | f->output_data.android->normal_gc, | 3895 | f->output_data.android->normal_gc, |
| 3449 | x0, y1 - 1, x1 - x0, 1); | 3896 | x0, y1 - 1, x1 - x0, 1); |
| 3450 | } | 3897 | } |
| @@ -3453,7 +3900,7 @@ android_draw_window_divider (struct window *w, int x0, int x1, int y0, int y1) | |||
| 3453 | /* In any other case do not draw the first and last pixels | 3900 | /* In any other case do not draw the first and last pixels |
| 3454 | differently. */ | 3901 | differently. */ |
| 3455 | android_set_foreground (f->output_data.android->normal_gc, color); | 3902 | android_set_foreground (f->output_data.android->normal_gc, color); |
| 3456 | android_fill_rectangle (FRAME_ANDROID_WINDOW (f), | 3903 | android_fill_rectangle (FRAME_ANDROID_DRAWABLE (f), |
| 3457 | f->output_data.android->normal_gc, | 3904 | f->output_data.android->normal_gc, |
| 3458 | x0, y0, x1 - x0, y1 - y0); | 3905 | x0, y0, x1 - x0, y1 - y0); |
| 3459 | } | 3906 | } |