diff options
Diffstat (limited to 'src/androidfns.c')
| -rw-r--r-- | src/androidfns.c | 106 |
1 files changed, 105 insertions, 1 deletions
diff --git a/src/androidfns.c b/src/androidfns.c index eaecb78338b..0675a0a3c98 100644 --- a/src/androidfns.c +++ b/src/androidfns.c | |||
| @@ -2287,6 +2287,57 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0, | |||
| 2287 | 2287 | ||
| 2288 | goto start_timer; | 2288 | goto start_timer; |
| 2289 | } | 2289 | } |
| 2290 | else if (tooltip_reuse_hidden_frame && BASE_EQ (frame, tip_last_frame)) | ||
| 2291 | { | ||
| 2292 | bool delete = false; | ||
| 2293 | Lisp_Object tail, elt, parm, last; | ||
| 2294 | |||
| 2295 | /* Check if every parameter in PARMS has the same value in | ||
| 2296 | tip_last_parms. This may destruct tip_last_parms which, | ||
| 2297 | however, will be recreated below. */ | ||
| 2298 | for (tail = parms; CONSP (tail); tail = XCDR (tail)) | ||
| 2299 | { | ||
| 2300 | elt = XCAR (tail); | ||
| 2301 | parm = CAR (elt); | ||
| 2302 | /* The left, top, right and bottom parameters are handled | ||
| 2303 | by compute_tip_xy so they can be ignored here. */ | ||
| 2304 | if (!EQ (parm, Qleft) && !EQ (parm, Qtop) | ||
| 2305 | && !EQ (parm, Qright) && !EQ (parm, Qbottom)) | ||
| 2306 | { | ||
| 2307 | last = Fassq (parm, tip_last_parms); | ||
| 2308 | if (NILP (Fequal (CDR (elt), CDR (last)))) | ||
| 2309 | { | ||
| 2310 | /* We lost, delete the old tooltip. */ | ||
| 2311 | delete = true; | ||
| 2312 | break; | ||
| 2313 | } | ||
| 2314 | else | ||
| 2315 | tip_last_parms | ||
| 2316 | = call2 (Qassq_delete_all, parm, tip_last_parms); | ||
| 2317 | } | ||
| 2318 | else | ||
| 2319 | tip_last_parms | ||
| 2320 | = call2 (Qassq_delete_all, parm, tip_last_parms); | ||
| 2321 | } | ||
| 2322 | |||
| 2323 | /* Now check if every parameter in what is left of | ||
| 2324 | tip_last_parms with a non-nil value has an association in | ||
| 2325 | PARMS. */ | ||
| 2326 | for (tail = tip_last_parms; CONSP (tail); tail = XCDR (tail)) | ||
| 2327 | { | ||
| 2328 | elt = XCAR (tail); | ||
| 2329 | parm = CAR (elt); | ||
| 2330 | if (!EQ (parm, Qleft) && !EQ (parm, Qtop) && !EQ (parm, Qright) | ||
| 2331 | && !EQ (parm, Qbottom) && !NILP (CDR (elt))) | ||
| 2332 | { | ||
| 2333 | /* We lost, delete the old tooltip. */ | ||
| 2334 | delete = true; | ||
| 2335 | break; | ||
| 2336 | } | ||
| 2337 | } | ||
| 2338 | |||
| 2339 | android_hide_tip (delete); | ||
| 2340 | } | ||
| 2290 | else | 2341 | else |
| 2291 | android_hide_tip (true); | 2342 | android_hide_tip (true); |
| 2292 | } | 2343 | } |
| @@ -2453,7 +2504,7 @@ DEFUN ("x-hide-tip", Fx_hide_tip, Sx_hide_tip, 0, 0, 0, | |||
| 2453 | #endif /* 0 */ | 2504 | #endif /* 0 */ |
| 2454 | return Qnil; | 2505 | return Qnil; |
| 2455 | #else /* !ANDROID_STUBIFY */ | 2506 | #else /* !ANDROID_STUBIFY */ |
| 2456 | return android_hide_tip (true); | 2507 | return android_hide_tip (!tooltip_reuse_hidden_frame); |
| 2457 | #endif /* ANDROID_STUBIFY */ | 2508 | #endif /* ANDROID_STUBIFY */ |
| 2458 | } | 2509 | } |
| 2459 | 2510 | ||
| @@ -2476,6 +2527,25 @@ there is no mouse. */) | |||
| 2476 | #endif | 2527 | #endif |
| 2477 | } | 2528 | } |
| 2478 | 2529 | ||
| 2530 | DEFUN ("android-detect-keyboard", Fandroid_detect_keyboard, | ||
| 2531 | Sandroid_detect_keyboard, 0, 0, 0, | ||
| 2532 | doc: /* Return whether a keyboard is connected. | ||
| 2533 | Return non-nil if a key is connected to this computer, or nil | ||
| 2534 | if there is no keyboard. */) | ||
| 2535 | (void) | ||
| 2536 | { | ||
| 2537 | #ifndef ANDROID_STUBIFY | ||
| 2538 | /* If no display connection is present, just return nil. */ | ||
| 2539 | |||
| 2540 | if (!android_init_gui) | ||
| 2541 | return Qnil; | ||
| 2542 | |||
| 2543 | return android_detect_keyboard () ? Qt : Qnil; | ||
| 2544 | #else /* ANDROID_STUBIFY */ | ||
| 2545 | return Qt; | ||
| 2546 | #endif /* ANDROID_STUBIFY */ | ||
| 2547 | } | ||
| 2548 | |||
| 2479 | DEFUN ("android-toggle-on-screen-keyboard", | 2549 | DEFUN ("android-toggle-on-screen-keyboard", |
| 2480 | Fandroid_toggle_on_screen_keyboard, | 2550 | Fandroid_toggle_on_screen_keyboard, |
| 2481 | Sandroid_toggle_on_screen_keyboard, 2, 2, 0, | 2551 | Sandroid_toggle_on_screen_keyboard, 2, 2, 0, |
| @@ -3197,6 +3267,10 @@ syms_of_androidfns_for_pdumper (void) | |||
| 3197 | jstring string; | 3267 | jstring string; |
| 3198 | Lisp_Object language, country, script, variant; | 3268 | Lisp_Object language, country, script, variant; |
| 3199 | const char *data; | 3269 | const char *data; |
| 3270 | FILE *fd; | ||
| 3271 | char *line; | ||
| 3272 | size_t size; | ||
| 3273 | long pid; | ||
| 3200 | 3274 | ||
| 3201 | /* Find the Locale class. */ | 3275 | /* Find the Locale class. */ |
| 3202 | 3276 | ||
| @@ -3367,6 +3441,35 @@ syms_of_androidfns_for_pdumper (void) | |||
| 3367 | 3441 | ||
| 3368 | /* Set Vandroid_os_language. */ | 3442 | /* Set Vandroid_os_language. */ |
| 3369 | Vandroid_os_language = list4 (language, country, script, variant); | 3443 | Vandroid_os_language = list4 (language, country, script, variant); |
| 3444 | |||
| 3445 | /* Detect whether Emacs is running under libloader.so or another | ||
| 3446 | process tracing mechanism, and disable `android_use_exec_loader' if | ||
| 3447 | so, leaving subprocesses started by Emacs to the care of that | ||
| 3448 | loader instance. */ | ||
| 3449 | |||
| 3450 | if (android_get_current_api_level () >= 29) /* Q */ | ||
| 3451 | { | ||
| 3452 | fd = fopen ("/proc/self/status", "r"); | ||
| 3453 | if (!fd) | ||
| 3454 | return; | ||
| 3455 | |||
| 3456 | line = NULL; | ||
| 3457 | while (getline (&line, &size, fd) != -1) | ||
| 3458 | { | ||
| 3459 | if (strncmp (line, "TracerPid:", sizeof "TracerPid:" - 1)) | ||
| 3460 | continue; | ||
| 3461 | |||
| 3462 | pid = atol (line + sizeof "TracerPid:" - 1); | ||
| 3463 | |||
| 3464 | if (pid) | ||
| 3465 | android_use_exec_loader = false; | ||
| 3466 | |||
| 3467 | break; | ||
| 3468 | } | ||
| 3469 | |||
| 3470 | free (line); | ||
| 3471 | fclose (fd); | ||
| 3472 | } | ||
| 3370 | } | 3473 | } |
| 3371 | 3474 | ||
| 3372 | #endif /* ANDROID_STUBIFY */ | 3475 | #endif /* ANDROID_STUBIFY */ |
| @@ -3560,6 +3663,7 @@ language to be US English if LANGUAGE is empty. */); | |||
| 3560 | defsubr (&Sx_show_tip); | 3663 | defsubr (&Sx_show_tip); |
| 3561 | defsubr (&Sx_hide_tip); | 3664 | defsubr (&Sx_hide_tip); |
| 3562 | defsubr (&Sandroid_detect_mouse); | 3665 | defsubr (&Sandroid_detect_mouse); |
| 3666 | defsubr (&Sandroid_detect_keyboard); | ||
| 3563 | defsubr (&Sandroid_toggle_on_screen_keyboard); | 3667 | defsubr (&Sandroid_toggle_on_screen_keyboard); |
| 3564 | defsubr (&Sx_server_vendor); | 3668 | defsubr (&Sx_server_vendor); |
| 3565 | defsubr (&Sx_server_version); | 3669 | defsubr (&Sx_server_version); |