aboutsummaryrefslogtreecommitdiffstats
path: root/src/androidterm.c
diff options
context:
space:
mode:
authorPo Lu2025-12-23 10:39:45 +0800
committerPo Lu2025-12-23 10:39:45 +0800
commitb0140bcd44326632538dc377dd336b82a1df4dd9 (patch)
treedab1a81e3369797347d317b9fd11b033fe5e3aba /src/androidterm.c
parent22070c6f2f2cf31861642295ec215a177741c361 (diff)
downloademacs-b0140bcd44326632538dc377dd336b82a1df4dd9.tar.gz
emacs-b0140bcd44326632538dc377dd336b82a1df4dd9.zip
Implement set_window_size_and_position_hook on Android
* java/org/gnu/emacs/EmacsWindow.java (moveResizeWindow): New method, which alters all of the bounding box of a window at once. * src/android.c (android_init_emacs_window): Load method `move_resize_window'. (android_move_resize_window): Invoke this method, rather than a sequence of operations that will produce two ConfigureNotify events. * src/androidterm.c (android_set_window_size_and_position_1) (android_set_window_size_and_position): New functions; ported from X. (android_create_terminal): Register the same.
Diffstat (limited to 'src/androidterm.c')
-rw-r--r--src/androidterm.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/androidterm.c b/src/androidterm.c
index d9830e5cd08..7342b8d2dae 100644
--- a/src/androidterm.c
+++ b/src/androidterm.c
@@ -2334,6 +2334,48 @@ android_set_window_size (struct frame *f, bool change_gravity,
2334 do_pending_window_change (false); 2334 do_pending_window_change (false);
2335} 2335}
2336 2336
2337static void
2338android_set_window_size_and_position_1 (struct frame *f, int width, int height)
2339{
2340 int x = f->left_pos;
2341 int y = f->top_pos;
2342
2343 android_move_resize_window (FRAME_ANDROID_WINDOW (f), x, y, width, height);
2344
2345 SET_FRAME_GARBAGED (f);
2346
2347 if (FRAME_VISIBLE_P (f))
2348 android_wait_for_event (f, ANDROID_CONFIGURE_NOTIFY);
2349 else
2350 /* Call adjust_frame_size right. It might be tempting to clear out
2351 f->new_width and f->new_height here. */
2352 adjust_frame_size (f, FRAME_PIXEL_TO_TEXT_WIDTH (f, width),
2353 FRAME_PIXEL_TO_TEXT_HEIGHT (f, height),
2354 5, 0, Qx_set_window_size_1);
2355}
2356
2357void
2358android_set_window_size_and_position (struct frame *f, int width, int height)
2359{
2360 block_input ();
2361
2362 android_set_window_size_and_position_1 (f, width, height);
2363 android_clear_under_internal_border (f);
2364
2365 /* If cursor was outside the new size, mark it as off. */
2366 mark_window_cursors_off (XWINDOW (FRAME_ROOT_WINDOW (f)));
2367
2368 /* Clear out any recollection of where the mouse highlighting was,
2369 since it might be in a place that's outside the new frame size.
2370 Actually checking whether it is outside is a pain in the neck,
2371 so don't try--just let the highlighting be done afresh with new size. */
2372 cancel_mouse_face (f);
2373
2374 unblock_input ();
2375
2376 do_pending_window_change (false);
2377}
2378
2337/* Calculate the absolute position in frame F 2379/* Calculate the absolute position in frame F
2338 from its current recorded position values and gravity. */ 2380 from its current recorded position values and gravity. */
2339 2381
@@ -6705,6 +6747,8 @@ android_create_terminal (struct android_display_info *dpyinfo)
6705 terminal->fullscreen_hook = android_fullscreen_hook; 6747 terminal->fullscreen_hook = android_fullscreen_hook;
6706 terminal->iconify_frame_hook = android_iconify_frame; 6748 terminal->iconify_frame_hook = android_iconify_frame;
6707 terminal->set_window_size_hook = android_set_window_size; 6749 terminal->set_window_size_hook = android_set_window_size;
6750 terminal->set_window_size_and_position_hook
6751 = android_set_window_size_and_position;
6708 terminal->set_frame_offset_hook = android_set_offset; 6752 terminal->set_frame_offset_hook = android_set_offset;
6709 terminal->set_frame_alpha_hook = android_set_alpha; 6753 terminal->set_frame_alpha_hook = android_set_alpha;
6710 terminal->set_new_font_hook = android_new_font; 6754 terminal->set_new_font_hook = android_new_font;