This commit is contained in:
rongyouli 2023-08-29 18:27:24 +08:00
parent 8a92ceb3a8
commit f994ef342b
7 changed files with 154 additions and 167 deletions

9
debian/changelog vendored
View File

@ -1,3 +1,12 @@
mate-terminal (1.24.0-ok4.1) yangtze; urgency=medium
* BUG号:#I5JPQD点击菜单栏后最小化菜单栏并未消失窗口拖动后也有此问题
* 任务号:无
* 其他改动说明:无
* 其他改动影响域:无
-- rongyouli <rongyouli@kylinos.cn> Tue, 29 Aug 2023 18:24:04 +0800
mate-terminal (1.24.0-ok4) yangtze; urgency=medium
* BUG号:131248 【wayland】【终端】fn+f11进行全屏后再次fn+f11取消全屏不能恢复原来大小;

View File

@ -534,7 +534,7 @@ init_color_scheme_menu (GtkWidget *widget)
GtkCellRenderer *renderer;
GtkTreeIter iter;
GtkListStore *store;
int i;
gsize i;
store = gtk_list_store_new (1, G_TYPE_STRING);
for (i = 0; i < G_N_ELEMENTS (color_schemes); ++i)
@ -654,6 +654,64 @@ terminal_profile_editor_focus_widget (GtkWidget *editor,
gtk_widget_grab_focus (widget);
}
static gboolean
on_profile_editor_notebook_scroll_event (GtkWidget *widget,
GdkEventScroll *event)
{
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
GtkWidget *child, *event_widget, *action_widget;
child = gtk_notebook_get_nth_page (notebook, gtk_notebook_get_current_page (notebook));
if (child == NULL)
return FALSE;
event_widget = gtk_get_event_widget ((GdkEvent*) event);
/* Ignore scroll events from the content of the page */
if (event_widget == NULL || event_widget == child || gtk_widget_is_ancestor (event_widget, child))
return FALSE;
/* And also from the action widgets */
action_widget = gtk_notebook_get_action_widget (notebook, GTK_PACK_START);
if (event_widget == action_widget || (action_widget != NULL && gtk_widget_is_ancestor (event_widget, action_widget)))
return FALSE;
action_widget = gtk_notebook_get_action_widget (notebook, GTK_PACK_END);
if (event_widget == action_widget || (action_widget != NULL && gtk_widget_is_ancestor (event_widget, action_widget)))
return FALSE;
switch (event->direction) {
case GDK_SCROLL_RIGHT:
case GDK_SCROLL_DOWN:
gtk_notebook_next_page (notebook);
break;
case GDK_SCROLL_LEFT:
case GDK_SCROLL_UP:
gtk_notebook_prev_page (notebook);
break;
case GDK_SCROLL_SMOOTH:
switch (gtk_notebook_get_tab_pos (notebook)) {
case GTK_POS_LEFT:
case GTK_POS_RIGHT:
if (event->delta_y > 0)
gtk_notebook_next_page (notebook);
else if (event->delta_y < 0)
gtk_notebook_prev_page (notebook);
break;
case GTK_POS_TOP:
case GTK_POS_BOTTOM:
if (event->delta_x > 0)
gtk_notebook_next_page (notebook);
else if (event->delta_x < 0)
gtk_notebook_prev_page (notebook);
break;
}
break;
}
return TRUE;
}
/**
* terminal_profile_edit:
* @profile: a #TerminalProfile
@ -849,6 +907,13 @@ terminal_profile_edit (TerminalProfile *profile,
terminal_profile_editor_focus_widget (editor, widget_name);
w = GTK_WIDGET (gtk_builder_get_object (builder, "profile-editor-notebook"));
gtk_widget_add_events (w, GDK_SCROLL_MASK);
g_signal_connect (w,
"scroll-event",
G_CALLBACK (on_profile_editor_notebook_scroll_event),
NULL);
gtk_window_set_transient_for (GTK_WINDOW (editor),
GTK_WINDOW (transient_parent));
gtk_window_present (GTK_WINDOW (editor));

View File

@ -41,8 +41,10 @@
#include <stdlib.h>
#include <time.h>
#ifdef HAVE_SMCLIENT
#include "eggsmclient.h"
#include "eggdesktopfile.h"
#endif /* HAVE_SMCLIENT */
#define FALLBACK_PROFILE_ID "default"
@ -1376,6 +1378,7 @@ terminal_app_manage_profiles (TerminalApp *app,
gtk_window_present (GTK_WINDOW (app->manage_profiles_dialog));
}
#ifdef HAVE_SMCLIENT
static void
terminal_app_save_state_cb (EggSMClient *client,
GKeyFile *key_file,
@ -1390,6 +1393,7 @@ terminal_app_client_quit_cb (EggSMClient *client,
{
g_signal_emit (app, signals[QUIT], 0);
}
#endif /* HAVE_SMCLIENT */
/* Class implementation */
@ -1470,6 +1474,7 @@ terminal_app_init (TerminalApp *app)
terminal_accels_init ();
#ifdef HAVE_SMCLIENT
EggSMClient *sm_client;
char *desktop_file;
@ -1485,6 +1490,7 @@ terminal_app_init (TerminalApp *app)
G_CALLBACK (terminal_app_save_state_cb), app);
g_signal_connect (sm_client, "quit",
G_CALLBACK (terminal_app_client_quit_cb), app);
#endif /* HAVE_SMCLIENT */
}
static void
@ -1492,11 +1498,13 @@ terminal_app_finalize (GObject *object)
{
TerminalApp *app = TERMINAL_APP (object);
#ifdef HAVE_SMCLIENT
EggSMClient *sm_client;
sm_client = egg_sm_client_get ();
g_signal_handlers_disconnect_matched (sm_client, G_SIGNAL_MATCH_DATA,
0, 0, NULL, NULL, app);
#endif /* HAVE_SMCLIENT */
g_signal_handlers_disconnect_by_func (settings_global,
G_CALLBACK(terminal_app_profile_list_notify_cb),
@ -1741,6 +1749,7 @@ terminal_app_handle_options (TerminalApp *app,
/* fall-through on success */
}
#ifdef HAVE_SMCLIENT
EggSMClient *sm_client;
sm_client = egg_sm_client_get ();
@ -1754,6 +1763,7 @@ terminal_app_handle_options (TerminalApp *app,
!terminal_options_merge_config (options, key_file, SOURCE_SESSION, error))
return FALSE;
}
#endif /* HAVE_SMCLIENT */
/* Make sure we open at least one window */
terminal_options_ensure_window (options);

View File

@ -248,7 +248,7 @@ terminal_encoding_is_valid (TerminalEncoding *encoding)
" input \"%s\"\n",
ascii_sample);
_terminal_debug_print (TERMINAL_DEBUG_ENCODINGS,
" output \"%s\" bytes read %u written %u\n",
" output \"%s\" bytes read %" G_GSIZE_FORMAT " written %" G_GSIZE_FORMAT "\n",
converted ? converted : "(null)", bytes_read, bytes_written);
if (error)
_terminal_debug_print (TERMINAL_DEBUG_ENCODINGS,

View File

@ -1167,6 +1167,7 @@ terminal_screen_set_font (TerminalScreen *screen)
TerminalScreenPrivate *priv = screen->priv;
TerminalProfile *profile;
PangoFontDescription *desc;
int size;
profile = priv->profile;
@ -1176,14 +1177,11 @@ terminal_screen_set_font (TerminalScreen *screen)
g_object_get (profile, TERMINAL_PROFILE_FONT, &desc, NULL);
g_assert (desc);
size = pango_font_description_get_size (desc);
if (pango_font_description_get_size_is_absolute (desc))
pango_font_description_set_absolute_size (desc,
priv->font_scale *
pango_font_description_get_size (desc));
pango_font_description_set_absolute_size (desc, priv->font_scale * size);
else
pango_font_description_set_size (desc,
priv->font_scale *
pango_font_description_get_size (desc));
pango_font_description_set_size (desc, (int)(priv->font_scale * size));
vte_terminal_set_font (VTE_TERMINAL (screen), desc);
@ -1445,7 +1443,11 @@ get_child_environment (TerminalScreen *screen,
g_hash_table_replace (env_table, g_strdup ("TERM"), g_strdup ("xterm-256color")); /* FIXME configurable later? */
/* FIXME: moving the tab between windows, or the window between displays will make the next two invalid... */
g_hash_table_replace (env_table, g_strdup ("WINDOWID"), g_strdup_printf ("%ld", GDK_WINDOW_XID (gtk_widget_get_window (window))));
#ifdef GDK_WINDOWING_X11
if (GDK_IS_X11_DISPLAY (display)) {
g_hash_table_replace (env_table, g_strdup ("WINDOWID"), g_strdup_printf ("%ld", GDK_WINDOW_XID (gtk_widget_get_window (window))));
}
#endif
g_hash_table_replace (env_table, g_strdup ("DISPLAY"), g_strdup (gdk_display_get_name (display)));
g_settings_schema_source_list_schemas (g_settings_schema_source_get_default (), TRUE, &list_schemas, NULL);
@ -1532,8 +1534,6 @@ static void handle_error_child (TerminalScreen *screen,
info_bar, FALSE, FALSE, 0);
gtk_info_bar_set_default_response (GTK_INFO_BAR (info_bar), GTK_RESPONSE_CANCEL);
gtk_widget_show (info_bar);
g_error_free (err);
}
static void term_spawn_callback (GtkWidget *terminal,
@ -1546,7 +1546,6 @@ static void term_spawn_callback (GtkWidget *terminal,
if (error)
{
handle_error_child (screen, error);
g_error_free (error);
}
else
{

View File

@ -1482,9 +1482,6 @@ popup_clipboard_targets_received_cb (GtkClipboard *clipboard,
GtkAction *action;
gboolean can_paste, can_paste_uris, show_link, show_email_link, show_call_link, show_input_method_menu;
int n_pages;
GdkEvent *event;
GdkSeat *seat;
GdkDevice *device;
if (!gtk_widget_get_realized (GTK_WIDGET (screen)))
{
@ -1557,17 +1554,13 @@ popup_clipboard_targets_received_cb (GtkClipboard *clipboard,
if (!gtk_menu_get_attach_widget (GTK_MENU (popup_menu)))
gtk_menu_attach_to_widget (GTK_MENU (popup_menu),GTK_WIDGET (screen),NULL);
event = gtk_get_current_event ();
seat = gdk_display_get_default_seat (gdk_display_get_default());
device = gdk_seat_get_pointer (seat);
gdk_event_set_device (event, device);
gtk_menu_popup_at_pointer (GTK_MENU (popup_menu), (const GdkEvent*) event);
gdk_event_free (event);
gtk_menu_popup (GTK_MENU (popup_menu),
NULL, NULL,
NULL, NULL,
info->button,
info->timestamp);
gtk_style_context_add_class(gtk_widget_get_style_context (popup_menu),
GTK_STYLE_CLASS_CONTEXT_MENU);
}
static void
@ -3587,6 +3580,7 @@ static gboolean
confirm_close_window_or_tab (TerminalWindow *window,
TerminalScreen *screen)
{
GtkBuilder *builder;
TerminalWindowPrivate *priv = window->priv;
GtkWidget *dialog;
gboolean do_confirm;
@ -3636,30 +3630,34 @@ confirm_close_window_or_tab (TerminalWindow *window,
if (has_processes)
{
if (n_tabs > 1)
confirm_msg = _("There are still processes running in some terminals in this window. "
confirm_msg = _("There are still processes running in some terminals in this window.\n"
"Closing the window will kill all of them.");
else
confirm_msg = _("There is still a process running in this terminal. "
confirm_msg = _("There is still a process running in this terminal.\n"
"Closing the terminal will kill it.");
} else if (n_tabs > 1)
confirm_msg = _("There are multiple tabs open in this window.");
else
return FALSE;
dialog = priv->confirm_close_dialog =
gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_WARNING,
GTK_BUTTONS_CANCEL,
"%s", n_tabs > 1 ? _("Close this window?") : _("Close this terminal?"));
// dialog = priv->confirm_close_dialog =
// gtk_message_dialog_new (GTK_WINDOW (window),
// GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
// GTK_MESSAGE_WARNING,
// GTK_BUTTONS_CANCEL,
// "%s", n_tabs > 1 ? _("Close this window?") : _("Close this terminal?"));
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
"%s", confirm_msg);
gtk_window_set_title (GTK_WINDOW (dialog), "");
gtk_dialog_add_button (GTK_DIALOG (dialog), n_tabs > 1 ? _("C_lose Window") : _("C_lose Terminal"), GTK_RESPONSE_ACCEPT);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
builder = gtk_builder_new_from_resource (TERMINAL_RESOURCES_PATH_PREFIX G_DIR_SEPARATOR_S "ui/confirm-close-dialog.ui");
priv->confirm_close_dialog = dialog = GTK_WIDGET (gtk_builder_get_object (builder, "confirm_close_dialog"));
if (n_tabs > 1) {
gtk_label_set_text (GTK_LABEL (gtk_builder_get_object (builder, "question_text")), _("Close this window?"));
gtk_button_set_label (GTK_BUTTON (gtk_builder_get_object (builder, "button_close")), _("C_lose Window"));
} else {
gtk_label_set_text (GTK_LABEL (gtk_builder_get_object (builder, "question_text")), _("Close this terminal?"));
gtk_button_set_label (GTK_BUTTON (gtk_builder_get_object (builder, "button_close")), _("C_lose Terminal"));
}
gtk_label_set_text (GTK_LABEL (gtk_builder_get_object (builder, "description_text")), confirm_msg);
g_object_unref (builder);
g_object_set_data (G_OBJECT (dialog), "close-screen", screen);
@ -3668,6 +3666,8 @@ confirm_close_window_or_tab (TerminalWindow *window,
g_signal_connect (dialog, "response",
G_CALLBACK (confirm_close_response_cb), window);
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (window));
gtk_window_set_title (GTK_WINDOW (dialog), "");
gtk_window_present (GTK_WINDOW (dialog));
return TRUE;
@ -4255,53 +4255,29 @@ static void
terminal_set_title_callback (GtkAction *action,
TerminalWindow *window)
{
GtkBuilder *builder;
TerminalWindowPrivate *priv = window->priv;
GtkWidget *dialog, *message_area, *hbox, *label, *entry;
GtkWidget *dialog, *entry;
if (priv->active_screen == NULL)
return;
/* FIXME: hook the screen up so this dialogue closes if the terminal screen closes */
builder = gtk_builder_new_from_resource (TERMINAL_RESOURCES_PATH_PREFIX G_DIR_SEPARATOR_S "ui/set-title-dialog.ui");
dialog = GTK_WIDGET (gtk_builder_get_object (builder, "dialog"));
entry = GTK_WIDGET (gtk_builder_get_object (builder, "title_entry"));
g_object_unref (builder);
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_OTHER,
GTK_BUTTONS_OK_CANCEL,
"%s", "");
gtk_window_set_title (GTK_WINDOW (dialog), _("Set Title"));
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
gtk_window_set_role (GTK_WINDOW (dialog), "mate-terminal-change-title");
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
/* Alternative button order was set automatically by GtkMessageDialog */
gtk_widget_grab_focus (entry);
gtk_entry_set_text (GTK_ENTRY (entry), terminal_screen_get_raw_title (priv->active_screen));
gtk_editable_select_region (GTK_EDITABLE (entry), 0, -1);
g_object_set_data (G_OBJECT (dialog), "title-entry", entry);
g_signal_connect (dialog, "response",
G_CALLBACK (terminal_set_title_dialog_response_cb), priv->active_screen);
g_signal_connect (dialog, "delete-event",
G_CALLBACK (terminal_util_dialog_response_on_delete), NULL);
message_area = gtk_message_dialog_get_message_area (GTK_MESSAGE_DIALOG (dialog));
gtk_container_foreach (GTK_CONTAINER (message_area), (GtkCallback) gtk_widget_hide, NULL);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_box_pack_start (GTK_BOX (message_area), hbox, FALSE, FALSE, 0);
label = gtk_label_new_with_mnemonic (_("_Title:"));
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
gtk_label_set_yalign (GTK_LABEL (label), 0.5);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
entry = gtk_entry_new ();
gtk_entry_set_width_chars (GTK_ENTRY (entry), 32);
gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
gtk_widget_show_all (hbox);
gtk_widget_grab_focus (entry);
gtk_entry_set_text (GTK_ENTRY (entry), terminal_screen_get_raw_title (priv->active_screen));
gtk_editable_select_region (GTK_EDITABLE (entry), 0, -1);
g_object_set_data (G_OBJECT (dialog), "title-entry", entry);
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (window));
gtk_window_present (GTK_WINDOW (dialog));
}
@ -4442,6 +4418,7 @@ help_about_callback (GtkAction *action,
GKeyFile *key_file;
GError *error = NULL;
char **authors, **contributors, **artists, **documenters, **array_strv;
gchar *comments = NULL;
gsize data_len, n_authors = 0, n_contributors = 0, n_artists = 0, n_documenters = 0 , i;
GPtrArray *array;
@ -4488,6 +4465,9 @@ help_about_callback (GtkAction *action,
licence_text = terminal_util_get_licence_text ();
comments = g_strdup_printf (_("MATE Terminal is a terminal emulator for the MATE Desktop Environment.\nPowered by Virtual TErminal %d.%d.%d"),
vte_get_major_version (), vte_get_minor_version (), vte_get_micro_version ());
gtk_show_about_dialog (GTK_WINDOW (window),
"program-name", _("MATE Terminal"),
"version", VERSION,
@ -4497,8 +4477,8 @@ help_about_callback (GtkAction *action,
"Copyright \xc2\xa9 2006 Guilherme de S. Pastore\n"
"Copyright \xc2\xa9 20072010 Christian Persch\n"
"Copyright \xc2\xa9 2011 Perberos\n"
"Copyright \xc2\xa9 2012-2020 MATE developers"),
"comments", _("A terminal emulator for the MATE desktop"),
"Copyright \xc2\xa9 2012-2021 MATE developers"),
"comments", comments,
"authors", array_strv,
"artists", artists,
"documenters", documenters,
@ -4506,9 +4486,10 @@ help_about_callback (GtkAction *action,
"wrap-license", TRUE,
"translator-credits", _("translator-credits"),
"logo-icon-name", MATE_TERMINAL_ICON_NAME,
"website", "https://mate-desktop.org",
"website", PACKAGE_URL,
NULL);
g_free (comments);
g_strfreev (array_strv);
g_strfreev (artists);
g_strfreev (documenters);

View File

@ -34,7 +34,9 @@
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#ifdef HAVE_SMCLIENT
#include "eggsmclient.h"
#endif /* HAVE_SMCLIENT */
#include "terminal-accels.h"
#include "terminal-app.h"
@ -406,79 +408,6 @@ name_lost_cb (GDBusConnection *connection,
gtk_main_quit ();
}
/* Settings storage works as follows:
* /apps/mate-terminal/global/
* /apps/mate-terminal/profiles/Foo/
*
* It's somewhat tricky to manage the profiles/ dir since we need to track
* the list of profiles, but GSettings doesn't have a concept of notifying that
* a directory has appeared or disappeared.
*
* Session state is stored entirely in the RestartCommand command line.
*
* The number one rule: all stored information is EITHER per-session,
* per-profile, or set from a command line option. THERE CAN BE NO
* OVERLAP. The UI and implementation totally break if you overlap
* these categories. See mate-terminal 1.x for why.
*
* Don't use this code as an example of how to use GSettings - it's hugely
* overcomplicated due to the profiles stuff. Most apps should not
* have to do scary things of this nature, and should not have
* a profiles feature.
*
*/
/* Copied from libcaja/caja-program-choosing.c; Needed in case
* we have no DESKTOP_STARTUP_ID (with its accompanying timestamp).
*/
static Time
slowly_and_stupidly_obtain_timestamp (Display *xdisplay)
{
Window xwindow;
XEvent event;
{
XSetWindowAttributes attrs;
Atom atom_name;
Atom atom_type;
const char *name;
attrs.override_redirect = True;
attrs.event_mask = PropertyChangeMask | StructureNotifyMask;
xwindow =
XCreateWindow (xdisplay,
RootWindow (xdisplay, 0),
-100, -100, 1, 1,
0,
CopyFromParent,
CopyFromParent,
(Visual *)CopyFromParent,
CWOverrideRedirect | CWEventMask,
&attrs);
atom_name = XInternAtom (xdisplay, "WM_NAME", TRUE);
g_assert (atom_name != None);
atom_type = XInternAtom (xdisplay, "STRING", TRUE);
g_assert (atom_type != None);
name = "Fake Window";
XChangeProperty (xdisplay,
xwindow, atom_name,
atom_type,
8, PropModeReplace, (unsigned char *)name, strlen (name));
}
XWindowEvent (xdisplay,
xwindow,
PropertyChangeMask,
&event);
XDestroyWindow(xdisplay, xwindow);
return event.xproperty.time;
}
static char *
get_factory_name_for_display (const char *display_name)
{
@ -529,8 +458,7 @@ main (int argc, char **argv)
int i;
char **argv_copy;
int argc_copy;
const char *startup_id, *display_name, *home_dir;
GdkDisplay *display;
const char *startup_id, *home_dir;
TerminalOptions *options;
GError *error = NULL;
char *working_directory;
@ -555,8 +483,6 @@ main (int argc, char **argv)
working_directory = g_get_current_dir ();
gdk_set_allowed_backends ("x11");
/* Now change directory to $HOME so we don't prevent unmounting, e.g. if the
* factory is started by caja-open-terminal. See bug #565328.
* On failure back to /.
@ -574,8 +500,10 @@ main (int argc, char **argv)
FALSE,
&argc, &argv,
&error,
#ifdef HAVE_SMCLIENT
gtk_get_option_group (TRUE),
egg_sm_client_get_option_group (),
#endif /* HAVE_SMCLIENT */
NULL);
g_free (working_directory);
@ -596,20 +524,15 @@ main (int argc, char **argv)
g_unsetenv ("GIO_LAUNCHED_DESKTOP_FILE_PID");
g_unsetenv ("GIO_LAUNCHED_DESKTOP_FILE");
display = gdk_display_get_default ();
display_name = gdk_display_get_name (display);
options->display_name = g_strdup (display_name);
if (options->startup_id == NULL)
{
/* Create a fake one containing a timestamp that we can use */
Time timestamp;
timestamp = slowly_and_stupidly_obtain_timestamp (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()));
options->startup_id = g_strdup_printf ("_TIME%lu", timestamp);
options->startup_id = g_strdup_printf ("_TIME%lu", g_get_monotonic_time () / 1000);
}
gdk_init (&argc, &argv);
const char *display_name = gdk_display_get_name (gdk_display_get_default ());
options->display_name = g_strdup (display_name);
if (options->use_factory)
{
OwnData *data;
@ -644,7 +567,7 @@ main (int argc, char **argv)
}
else
{
gtk_init(&argc, &argv);
terminal_app_handle_options (terminal_app_get (), options, TRUE /* allow resume */, &error);
terminal_options_free (options);