* java/Makefile.in (clean): Fix distclean and bootstrap-clean rules. * java/debug.sh (jdb_port): (attach_existing): (num_pids): (line): Add new options to upload a gdbserver binary to the device. * java/org/gnu/emacs/EmacsActivity.java (EmacsActivity): Make focusedActivities public. * java/org/gnu/emacs/EmacsContextMenu.java (EmacsContextMenu): New class. * java/org/gnu/emacs/EmacsDrawRectangle.java (perform): Fix bounds computation. * java/org/gnu/emacs/EmacsGC.java (markDirty): Set stroke width explicitly. * java/org/gnu/emacs/EmacsService.java (EmacsService) (getLocationOnScreen, nameKeysym): New functions. * java/org/gnu/emacs/EmacsView.java (EmacsView): Disable focus highlight. (onCreateContextMenu, popupMenu, cancelPopupMenu): New functions. * java/org/gnu/emacs/EmacsWindow.java (EmacsWindow): Implement a kind of ``override redirect'' window for tooltips. * src/android.c (struct android_emacs_service): New method `name_keysym'. (android_run_select_thread, android_init_events): (android_select): Release select thread on semaphores instead of signals to avoid one nasty race on SIGUSR2 delivery. (android_init_emacs_service): Initialize new method. (android_create_window): Handle CW_OVERRIDE_REDIRECT. (android_move_resize_window, android_map_raised) (android_translate_coordinates, android_get_keysym_name) (android_build_string, android_exception_check): New functions. * src/android.h: Update prototypes. * src/androidfns.c (android_set_parent_frame, Fx_create_frame) (unwind_create_tip_frame, android_create_tip_frame) (android_hide_tip, compute_tip_xy, Fx_show_tip, Fx_hide_tip) (syms_of_androidfns): Implement tooltips and iconification reporting. * src/androidgui.h (enum android_window_value_mask): Add CWOverrideRedirect. (struct android_set_window_attributes): Add `override_redirect'. (ANDROID_IS_MODIFIER_KEY): Recognize Caps Lock. * src/androidmenu.c (struct android_emacs_context_menu): New struct. (android_init_emacs_context_menu, android_unwind_local_frame) (android_push_local_frame, android_menu_show, init_androidmenu): New functions. * src/androidterm.c (handle_one_android_event): Fix NULL pointer dereference. (android_fullscreen_hook): Handle fullscreen correctly. (android_draw_box_rect): Fix top line. (get_keysym_name): Implement function. (android_create_terminal): Remove scroll bar stubs and add menu hook. * src/androidterm.h: Update prototypes. * src/emacs.c (android_emacs_init): Initialize androidmenu.c. * xcompile/Makefile.in: Fix clean rules.
108 lines
2.9 KiB
Java
108 lines
2.9 KiB
Java
/* Communication module for Android terminals. -*- c-file-style: "GNU" -*-
|
|
|
|
Copyright (C) 2023 Free Software Foundation, Inc.
|
|
|
|
This file is part of GNU Emacs.
|
|
|
|
GNU Emacs is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or (at
|
|
your option) any later version.
|
|
|
|
GNU Emacs is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
|
|
|
|
package org.gnu.emacs;
|
|
|
|
import android.graphics.Rect;
|
|
import android.graphics.Paint;
|
|
|
|
import android.graphics.PorterDuff.Mode;
|
|
import android.graphics.PorterDuffXfermode;
|
|
import android.graphics.Xfermode;
|
|
|
|
/* X like graphics context structures. Keep the enums in synch with
|
|
androidgui.h! */
|
|
|
|
public class EmacsGC extends EmacsHandleObject
|
|
{
|
|
public static final int GC_COPY = 0;
|
|
public static final int GC_XOR = 1;
|
|
|
|
public static final int GC_FILL_SOLID = 0;
|
|
public static final int GC_FILL_OPAQUE_STIPPLED = 1;
|
|
|
|
public static final Xfermode xorAlu, srcInAlu;
|
|
|
|
public int function, fill_style;
|
|
public int foreground, background;
|
|
public int clip_x_origin, clip_y_origin;
|
|
public int ts_origin_x, ts_origin_y;
|
|
public Rect clip_rects[], real_clip_rects[];
|
|
public EmacsPixmap clip_mask, stipple;
|
|
public Paint gcPaint;
|
|
|
|
static
|
|
{
|
|
xorAlu = new PorterDuffXfermode (Mode.XOR);
|
|
srcInAlu = new PorterDuffXfermode (Mode.SRC_IN);
|
|
}
|
|
|
|
/* The following fields are only set on immutable GCs. */
|
|
|
|
public
|
|
EmacsGC (short handle)
|
|
{
|
|
/* For historical reasons the C code has an extra layer of
|
|
indirection above this GC handle. struct android_gc is the GC
|
|
used by Emacs code, while android_gcontext is the type of the
|
|
handle. */
|
|
super (handle);
|
|
|
|
fill_style = GC_FILL_SOLID;
|
|
function = GC_COPY;
|
|
foreground = 0;
|
|
background = 0xffffff;
|
|
gcPaint = new Paint ();
|
|
}
|
|
|
|
/* Mark this GC as dirty. Apply parameters to the paint and
|
|
recompute real_clip_rects. */
|
|
|
|
public void
|
|
markDirty ()
|
|
{
|
|
int i;
|
|
|
|
if ((ts_origin_x != 0 || ts_origin_y != 0)
|
|
&& clip_rects != null)
|
|
{
|
|
real_clip_rects = new Rect[clip_rects.length];
|
|
|
|
for (i = 0; i < clip_rects.length; ++i)
|
|
{
|
|
real_clip_rects[i] = new Rect (clip_rects[i]);
|
|
real_clip_rects[i].offset (ts_origin_x, ts_origin_y);
|
|
}
|
|
}
|
|
else
|
|
real_clip_rects = clip_rects;
|
|
|
|
gcPaint.setStrokeWidth (1f);
|
|
gcPaint.setColor (foreground | 0xff000000);
|
|
gcPaint.setXfermode (function == GC_XOR
|
|
? xorAlu : srcInAlu);
|
|
}
|
|
|
|
public void
|
|
resetXfermode ()
|
|
{
|
|
gcPaint.setXfermode (function == GC_XOR
|
|
? xorAlu : srcInAlu);
|
|
}
|
|
};
|