emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/android bdaeecd1759 2/2: Update Android port


From: Po Lu
Subject: feature/android bdaeecd1759 2/2: Update Android port
Date: Tue, 20 Jun 2023 22:32:08 -0400 (EDT)

branch: feature/android
commit bdaeecd1759e6aee5ad8bf04ba6ed9bb8fb4453d
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Update Android port
    
    * src/androidfns.c (android_set_tool_bar_position):
    (frame_geometry):
    * src/androidterm.c (android_flash):
    (android_clear_under_internal_border): Synchronize with X.
---
 src/androidfns.c  | 38 ++++++++++++++++++++++++++++----------
 src/androidterm.c | 30 ++++++++++++++++++------------
 2 files changed, 46 insertions(+), 22 deletions(-)

diff --git a/src/androidfns.c b/src/androidfns.c
index 46ff073438a..11ed2e6c00a 100644
--- a/src/androidfns.c
+++ b/src/androidfns.c
@@ -254,15 +254,26 @@ android_set_tool_bar_position (struct frame *f,
                               Lisp_Object new_value,
                               Lisp_Object old_value)
 {
-  Lisp_Object choice = list4 (Qleft, Qright, Qtop, Qbottom);
+  if (!EQ (new_value, Qtop) && !EQ (new_value, Qbottom))
+    error ("Tool bar position must be either `top' or `bottom'");
 
-  if (!NILP (Fmemq (new_value, choice)))
-    {
-      if (!EQ (new_value, Qtop))
-       error ("The only supported tool bar position is top");
-    }
-  else
-    wrong_choice (choice, new_value);
+  if (EQ (new_value, old_value))
+    return;
+
+  /* Set the tool bar position.  */
+  fset_tool_bar_position (f, new_value);
+
+  /* Now reconfigure frame glyphs to place the tool bar at the
+     bottom.  While the inner height has not changed, call
+     `resize_frame_windows' to place each of the windows at its
+     new position.  */
+
+  adjust_frame_size (f, -1, -1, 3, false, Qtool_bar_position);
+  adjust_frame_glyphs (f);
+  SET_FRAME_GARBAGED (f);
+
+  if (FRAME_ANDROID_WINDOW (f))
+    android_clear_under_internal_border (f);
 }
 
 void
@@ -1470,7 +1481,7 @@ frame_geometry (Lisp_Object frame, Lisp_Object attribute)
 
   tab_bar_height = FRAME_TAB_BAR_HEIGHT (f);
   tab_bar_width = (tab_bar_height
-                   ? native_width - 2 * internal_border_width
+                  ? native_width - 2 * internal_border_width
                    : 0);
   inner_top += tab_bar_height;
 
@@ -1478,7 +1489,14 @@ frame_geometry (Lisp_Object frame, Lisp_Object attribute)
   tool_bar_width = (tool_bar_height
                    ? native_width - 2 * internal_border_width
                    : 0);
-  inner_top += tool_bar_height;
+
+  /* Subtract or add to the inner dimensions based on the tool bar
+     position.  */
+
+  if (EQ (FRAME_TOOL_BAR_POSITION (f), Qtop))
+    inner_top += tool_bar_height;
+  else
+    inner_bottom -= tool_bar_height;
 
   /* Construct list.  */
   if (EQ (attribute, Qouter_edges))
diff --git a/src/androidterm.c b/src/androidterm.c
index 29076981a47..aed8e24b9fa 100644
--- a/src/androidterm.c
+++ b/src/androidterm.c
@@ -181,7 +181,8 @@ android_flash (struct frame *f)
       android_fill_rectangle (FRAME_ANDROID_DRAWABLE (f), gc,
                              flash_left,
                              (height - flash_height
-                              - FRAME_INTERNAL_BORDER_WIDTH (f)),
+                              - FRAME_INTERNAL_BORDER_WIDTH (f)
+                              - FRAME_BOTTOM_MARGIN_HEIGHT (f)),
                              width, flash_height);
 
     }
@@ -234,7 +235,8 @@ android_flash (struct frame *f)
       android_fill_rectangle (FRAME_ANDROID_DRAWABLE (f), gc,
                              flash_left,
                              (height - flash_height
-                              - FRAME_INTERNAL_BORDER_WIDTH (f)),
+                              - FRAME_INTERNAL_BORDER_WIDTH (f)
+                              - FRAME_BOTTOM_MARGIN_HEIGHT (f)),
                              width, flash_height);
     }
   else
@@ -4213,14 +4215,16 @@ android_clear_under_internal_border (struct frame *f)
       int width = FRAME_PIXEL_WIDTH (f);
       int height = FRAME_PIXEL_HEIGHT (f);
       int margin = FRAME_TOP_MARGIN_HEIGHT (f);
-      int face_id =
-       (FRAME_PARENT_FRAME (f)
-        ? (!NILP (Vface_remapping_alist)
-           ? lookup_basic_face (NULL, f, CHILD_FRAME_BORDER_FACE_ID)
-           : CHILD_FRAME_BORDER_FACE_ID)
-        : (!NILP (Vface_remapping_alist)
-           ? lookup_basic_face (NULL, f, INTERNAL_BORDER_FACE_ID)
-           : INTERNAL_BORDER_FACE_ID));
+      int bottom_margin = FRAME_BOTTOM_MARGIN_HEIGHT (f);
+      int face_id = (FRAME_PARENT_FRAME (f)
+                    ? (!NILP (Vface_remapping_alist)
+                       ? lookup_basic_face (NULL, f,
+                                            CHILD_FRAME_BORDER_FACE_ID)
+                       : CHILD_FRAME_BORDER_FACE_ID)
+                    : (!NILP (Vface_remapping_alist)
+                       ? lookup_basic_face (NULL, f,
+                                            INTERNAL_BORDER_FACE_ID)
+                       : INTERNAL_BORDER_FACE_ID));
       struct face *face = FACE_FROM_ID_OR_NULL (f, face_id);
 
       if (face)
@@ -4236,7 +4240,8 @@ android_clear_under_internal_border (struct frame *f)
          android_fill_rectangle (FRAME_ANDROID_DRAWABLE (f), gc, width - 
border,
                                  0, border, height);
          android_fill_rectangle (FRAME_ANDROID_DRAWABLE (f), gc, 0,
-                                 height - border, width, border);
+                                 height - bottom_margin - border,
+                                 width, border);
          android_set_foreground (gc, FRAME_FOREGROUND_PIXEL (f));
        }
       else
@@ -4248,7 +4253,8 @@ android_clear_under_internal_border (struct frame *f)
          android_clear_area (FRAME_ANDROID_DRAWABLE (f), width - border,
                              0, border, height);
          android_clear_area (FRAME_ANDROID_DRAWABLE (f), 0,
-                             height - border, width, border);
+                             height - bottom_margin - border,
+                             width, border);
        }
     }
 }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]