Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Amrit Borah
xfce4-terminal
Commits
98e4ca22
Commit
98e4ca22
authored
Apr 26, 2022
by
Amrit Borah
Browse files
.
parent
de6fb37b
Changes
4
Hide whitespace changes
Inline
Side-by-side
terminal/terminal-app.c
View file @
98e4ca22
...
...
@@ -56,12 +56,6 @@
static
void
terminal_app_finalize
(
GObject
*
object
);
static
void
terminal_app_update_accels
(
TerminalApp
*
app
);
static
void
terminal_app_update_tab_key_accels
(
TerminalApp
*
app
);
static
void
terminal_app_store_tab_key_accel
(
gpointer
data
,
const
gchar
*
accel_path
,
guint
accel_key
,
GdkModifierType
accel_mods
,
gboolean
changed
);
static
void
terminal_app_update_windows_accels
(
gpointer
user_data
);
static
gboolean
terminal_app_accel_map_load
(
gpointer
user_data
);
static
gboolean
terminal_app_accel_map_save
(
gpointer
user_data
);
...
...
@@ -101,7 +95,6 @@ struct _TerminalApp
guint
accel_map_load_id
;
guint
accel_map_save_id
;
GtkAccelMap
*
accel_map
;
GSList
*
tab_key_accels
;
};
...
...
@@ -191,10 +184,6 @@ terminal_app_finalize (GObject *object)
if
(
app
->
session_client
!=
NULL
)
g_object_unref
(
G_OBJECT
(
app
->
session_client
));
for
(
lp
=
app
->
tab_key_accels
;
lp
!=
NULL
;
lp
=
lp
->
next
)
g_free
(((
TerminalAccel
*
)
lp
->
data
)
->
path
);
g_slist_free_full
(
app
->
tab_key_accels
,
g_free
);
(
*
G_OBJECT_CLASS
(
terminal_app_parent_class
)
->
finalize
)
(
object
);
}
...
...
@@ -227,43 +216,6 @@ terminal_app_update_accels (TerminalApp *app)
static
void
terminal_app_update_tab_key_accels
(
TerminalApp
*
app
)
{
if
(
app
->
tab_key_accels
!=
NULL
)
{
GSList
*
lp
;
for
(
lp
=
app
->
tab_key_accels
;
lp
!=
NULL
;
lp
=
lp
->
next
)
g_free
(((
TerminalAccel
*
)
lp
->
data
)
->
path
);
g_slist_free_full
(
app
->
tab_key_accels
,
g_free
);
app
->
tab_key_accels
=
NULL
;
}
gtk_accel_map_foreach
(
app
,
terminal_app_store_tab_key_accel
);
}
static
void
terminal_app_store_tab_key_accel
(
gpointer
data
,
const
gchar
*
accel_path
,
guint
accel_key
,
GdkModifierType
accel_mods
,
gboolean
changed
)
{
if
(
accel_key
==
GDK_KEY_Tab
||
accel_key
==
GDK_KEY_ISO_Left_Tab
)
{
TerminalApp
*
app
=
TERMINAL_APP
(
data
);
TerminalAccel
*
accel
=
g_new0
(
TerminalAccel
,
1
);
accel
->
path
=
g_strdup
(
g_strrstr
(
accel_path
,
"/"
)
+
1
);
// <Actions>/terminal-window/action
accel
->
mods
=
accel_mods
;
app
->
tab_key_accels
=
g_slist_prepend
(
app
->
tab_key_accels
,
accel
);
}
}
static
void
terminal_app_update_windows_accels
(
gpointer
user_data
)
{
...
...
@@ -272,8 +224,6 @@ terminal_app_update_windows_accels (gpointer user_data)
for
(
lp
=
app
->
windows
;
lp
!=
NULL
;
lp
=
lp
->
next
)
{
terminal_window_update_tab_key_accels
(
TERMINAL_WINDOW
(
lp
->
data
),
app
->
tab_key_accels
);
/* the accel_map is loaded after the first windows are created, so they can't create the go-to actions on page-insert */
terminal_window_update_goto_accels
(
TERMINAL_WINDOW
(
lp
->
data
));
}
...
...
@@ -318,9 +268,6 @@ terminal_app_accel_map_changed (TerminalApp *app)
/* schedule new save */
app
->
accel_map_save_id
=
gdk_threads_add_timeout_seconds
(
10
,
terminal_app_accel_map_save
,
app
);
/* identify accelerators containing the Tab key */
terminal_app_update_tab_key_accels
(
app
);
/* update the tab-key accel list in each window */
terminal_app_update_windows_accels
(
app
);
}
...
...
@@ -346,9 +293,6 @@ terminal_app_accel_map_load (gpointer user_data)
g_signal_connect_swapped
(
G_OBJECT
(
app
->
accel_map
),
"changed"
,
G_CALLBACK
(
terminal_app_accel_map_changed
),
app
);
/* identify accelerators containing the Tab key */
terminal_app_update_tab_key_accels
(
app
);
return
FALSE
;
}
...
...
@@ -390,8 +334,6 @@ terminal_app_take_window (TerminalApp *app,
g_signal_connect
(
G_OBJECT
(
window
),
"key-release-event"
,
G_CALLBACK
(
terminal_app_unset_urgent_bell
),
app
);
app
->
windows
=
g_slist_prepend
(
app
->
windows
,
window
);
terminal_window_update_tab_key_accels
(
TERMINAL_WINDOW
(
window
),
app
->
tab_key_accels
);
}
...
...
terminal/terminal-widget.c
View file @
98e4ca22
...
...
@@ -117,12 +117,6 @@ static void terminal_widget_disconnect_accelerators (TerminalWidget *widg
struct
_TerminalWidgetClass
{
VteTerminalClass
parent_class
;
/* Connects widget-specific accelerators to the given accelGroup */
void
(
*
connect_accelerators
)
(
TerminalWidget
*
widget
,
GtkAccelGroup
*
accel_group
);
/* Disconnects widget-specific accelerators to the given accelGroup */
void
(
*
disconnect_accelerators
)
(
TerminalWidget
*
widget
,
GtkAccelGroup
*
accel_group
);
};
struct
_TerminalWidget
...
...
@@ -899,10 +893,6 @@ terminal_widget_connect_accelerators (TerminalWidget *widget)
action_entries
,
G_N_ELEMENTS
(
action_entries
),
widget
);
/* as well append accelerators of derived widgets */
if
(
TERMINAL_WIDGET_GET_CLASS
(
widget
)
->
connect_accelerators
!=
NULL
)
(
*
TERMINAL_WIDGET_GET_CLASS
(
widget
)
->
connect_accelerators
)
(
widget
,
widget
->
accel_group
);
}
...
...
terminal/terminal-window.c
View file @
98e4ca22
...
...
@@ -298,8 +298,6 @@ struct _TerminalWindowPrivate
TerminalVisibility
scrollbar_visibility
;
TerminalZoomLevel
zoom
;
GSList
*
tab_key_accels
;
/* if this is a TerminalWindowDropdown */
guint
drop_down
:
1
;
};
...
...
@@ -749,27 +747,8 @@ terminal_window_key_press_event (GtkWidget *widget,
TerminalWindow
*
window
=
TERMINAL_WINDOW
(
widget
);
const
guint
modifiers
=
event
->
state
&
gtk_accelerator_get_default_mod_mask
();
/* support shortcuts that contain the Tab key
Tab sometimes becomes ISO_Left_Tab (e.g. in Ctrl+Shift+Tab) so check both here */
if
(
G_UNLIKELY
(
window
->
priv
->
tab_key_accels
!=
NULL
&&
(
event
->
keyval
==
GDK_KEY_Tab
||
event
->
keyval
==
GDK_KEY_ISO_Left_Tab
)))
{
GSList
*
lp
;
for
(
lp
=
window
->
priv
->
tab_key_accels
;
lp
!=
NULL
;
lp
=
lp
->
next
)
{
TerminalAccel
*
accel
=
lp
->
data
;
if
(
accel
->
mods
==
modifiers
)
{
guint
length
=
strlen
(
accel
->
path
);
for
(
unsigned
long
i
=
0
;
i
<
sizeof
(
action_entries
)
/
sizeof
(
XfceGtkActionEntry
);
i
++
)
{
XfceGtkActionEntry
entry
=
action_entries
[
i
];
if
(
strncmp
(
accel
->
path
,
entry
.
accel_path
+
strlen
(
entry
.
accel_path
)
-
length
,
length
)
==
0
)
((
void
(
*
)
(
TerminalWindow
*
))
entry
.
callback
)
(
window
);
}
}
}
}
if
(
xfce_gtk_handle_tab_accels
(
event
,
window
->
priv
->
accel_group
,
window
,
action_entries
,
G_N_ELEMENTS
(
action_entries
))
==
TRUE
)
return
TRUE
;
return
(
*
GTK_WIDGET_CLASS
(
terminal_window_parent_class
)
->
key_press_event
)
(
widget
,
event
);
}
...
...
@@ -3017,20 +2996,6 @@ terminal_window_action_show_menubar (TerminalWindow *window)
/**
* terminal_window_update_tab_key_accels:
* @window : A #TerminalWindow.
* @tab_key_accels : A list of Tab key accelerators.
**/
void
terminal_window_update_tab_key_accels
(
TerminalWindow
*
window
,
GSList
*
tab_key_accels
)
{
window
->
priv
->
tab_key_accels
=
tab_key_accels
;
}
static
void
terminal_window_create_menu
(
TerminalWindow
*
window
,
TerminalWindowAction
action
,
...
...
terminal/terminal-window.h
View file @
98e4ca22
...
...
@@ -191,9 +191,6 @@ gint terminal_window_get_toolbar_height (TerminalWindow
void
terminal_window_action_show_menubar
(
TerminalWindow
*
window
);
void
terminal_window_update_tab_key_accels
(
TerminalWindow
*
window
,
GSList
*
tab_key_accels
);
void
terminal_window_update_goto_accels
(
TerminalWindow
*
window
);
XfceGtkActionEntry
*
terminal_window_get_action_entry
(
TerminalWindow
*
window
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment