Communicate frame titles to the window manager on Android
* java/org/gnu/emacs/EmacsActivity.java (detachWindow) (attachWindow): Call updateWmName. (updateWmName): New function; transfer wm name from the window attached to the task's description. * java/org/gnu/emacs/EmacsWindow.java (EmacsWindow) <wmName>: New field. (setWmName): New function. * src/android.c (android_init_emacs_window): Link to new function. (android_set_wm_name): New function. * src/android.h (struct android_emacs_service): Delete unused entries. * src/androidfns.c (android_set_name_internal, android_set_name) (android_implicitly_set_name, android_explicitly_set_name) (android_set_title): Port from X. * src/androidterm.c (android_term_init): Compute default frame title. * src/androidterm.h (struct android_display_info) <x_id_name>: New field.
This commit is contained in:
@@ -27,6 +27,7 @@ import java.util.ArrayList;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager.TaskDescription;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
@@ -166,6 +167,10 @@ public class EmacsActivity extends Activity
|
||||
layout.removeView (window.view);
|
||||
window = null;
|
||||
|
||||
/* Reset the WM name. */
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
|
||||
updateWmName ();
|
||||
|
||||
invalidateFocus (0);
|
||||
}
|
||||
}
|
||||
@@ -205,6 +210,11 @@ public class EmacsActivity extends Activity
|
||||
invalidateFocus (1);
|
||||
}
|
||||
});
|
||||
|
||||
/* Synchronize the window's window manager name with this activity's
|
||||
task in the recents list. */
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
|
||||
updateWmName ();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -522,6 +532,29 @@ public class EmacsActivity extends Activity
|
||||
}
|
||||
}
|
||||
|
||||
/* Update the name of this activity's task description from the
|
||||
current window, or reset the same if no window is attached. */
|
||||
|
||||
@SuppressWarnings ("deprecation")
|
||||
public final void
|
||||
updateWmName ()
|
||||
{
|
||||
String wmName;
|
||||
TaskDescription description;
|
||||
|
||||
if (window == null || window.wmName == null)
|
||||
wmName = "Emacs";
|
||||
else
|
||||
wmName = window.wmName;
|
||||
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU)
|
||||
description = new TaskDescription (wmName);
|
||||
else
|
||||
description = (new TaskDescription.Builder ()
|
||||
.setLabel (wmName).build ());
|
||||
setTaskDescription (description);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void
|
||||
onAttachedToWindow ()
|
||||
|
||||
Reference in New Issue
Block a user