parent
f3e72e52a4
commit
387af1fe86
|
@ -138,8 +138,12 @@ static void terminal_screen_cook_title (TerminalScreen *screen);
|
||||||
static void terminal_screen_cook_icon_title (TerminalScreen *screen);
|
static void terminal_screen_cook_icon_title (TerminalScreen *screen);
|
||||||
|
|
||||||
static char* terminal_screen_check_match (TerminalScreen *screen,
|
static char* terminal_screen_check_match (TerminalScreen *screen,
|
||||||
|
#if VTE_CHECK_VERSION (0, 38, 0)
|
||||||
|
GdkEvent *event,
|
||||||
|
#else
|
||||||
int column,
|
int column,
|
||||||
int row,
|
int row,
|
||||||
|
#endif
|
||||||
int *flavor);
|
int *flavor);
|
||||||
|
|
||||||
static guint signals[LAST_SIGNAL] = { 0 };
|
static guint signals[LAST_SIGNAL] = { 0 };
|
||||||
|
@ -1679,14 +1683,19 @@ terminal_screen_button_press (GtkWidget *widget,
|
||||||
TerminalScreen *screen = TERMINAL_SCREEN (widget);
|
TerminalScreen *screen = TERMINAL_SCREEN (widget);
|
||||||
gboolean (* button_press_event) (GtkWidget*, GdkEventButton*) =
|
gboolean (* button_press_event) (GtkWidget*, GdkEventButton*) =
|
||||||
GTK_WIDGET_CLASS (terminal_screen_parent_class)->button_press_event;
|
GTK_WIDGET_CLASS (terminal_screen_parent_class)->button_press_event;
|
||||||
int char_width, char_height, row, col;
|
|
||||||
char *matched_string;
|
char *matched_string;
|
||||||
int matched_flavor = 0;
|
int matched_flavor = 0;
|
||||||
guint state;
|
guint state;
|
||||||
|
#if !VTE_CHECK_VERSION (0, 38, 0)
|
||||||
|
int char_width, char_height, row, col;
|
||||||
GtkBorder *inner_border = NULL;
|
GtkBorder *inner_border = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
state = event->state & gtk_accelerator_get_default_mod_mask ();
|
state = event->state & gtk_accelerator_get_default_mod_mask ();
|
||||||
|
|
||||||
|
#if VTE_CHECK_VERSION (0, 38, 0)
|
||||||
|
matched_string = terminal_screen_check_match (screen, event, &matched_flavor);
|
||||||
|
#else
|
||||||
terminal_screen_get_cell_size (screen, &char_width, &char_height);
|
terminal_screen_get_cell_size (screen, &char_width, &char_height);
|
||||||
|
|
||||||
gtk_widget_style_get (widget, "inner-border", &inner_border, NULL);
|
gtk_widget_style_get (widget, "inner-border", &inner_border, NULL);
|
||||||
|
@ -1694,8 +1703,8 @@ terminal_screen_button_press (GtkWidget *widget,
|
||||||
col = (event->y - (inner_border ? inner_border->top : 0)) / char_height;
|
col = (event->y - (inner_border ? inner_border->top : 0)) / char_height;
|
||||||
gtk_border_free (inner_border);
|
gtk_border_free (inner_border);
|
||||||
|
|
||||||
/* FIXMEchpe: add vte API to do this check by widget coords instead of grid coords */
|
|
||||||
matched_string = terminal_screen_check_match (screen, row, col, &matched_flavor);
|
matched_string = terminal_screen_check_match (screen, row, col, &matched_flavor);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (matched_string != NULL &&
|
if (matched_string != NULL &&
|
||||||
(event->button == 1 || event->button == 2) &&
|
(event->button == 1 || event->button == 2) &&
|
||||||
|
@ -2334,8 +2343,12 @@ terminal_screen_skey_match_remove (TerminalScreen *screen)
|
||||||
|
|
||||||
static char*
|
static char*
|
||||||
terminal_screen_check_match (TerminalScreen *screen,
|
terminal_screen_check_match (TerminalScreen *screen,
|
||||||
|
#if VTE_CHECK_VERSION (0, 38, 0)
|
||||||
|
GdkEvent *event,
|
||||||
|
#else
|
||||||
int column,
|
int column,
|
||||||
int row,
|
int row,
|
||||||
|
#endif
|
||||||
int *flavor)
|
int *flavor)
|
||||||
{
|
{
|
||||||
TerminalScreenPrivate *priv = screen->priv;
|
TerminalScreenPrivate *priv = screen->priv;
|
||||||
|
@ -2343,7 +2356,11 @@ terminal_screen_check_match (TerminalScreen *screen,
|
||||||
int tag;
|
int tag;
|
||||||
char *match;
|
char *match;
|
||||||
|
|
||||||
|
#if VTE_CHECK_VERSION (0, 38, 0)
|
||||||
|
match = vte_terminal_match_check_event (VTE_TERMINAL (screen), event, &tag);
|
||||||
|
#else
|
||||||
match = vte_terminal_match_check (VTE_TERMINAL (screen), column, row, &tag);
|
match = vte_terminal_match_check (VTE_TERMINAL (screen), column, row, &tag);
|
||||||
|
#endif
|
||||||
for (tags = priv->match_tags; tags != NULL; tags = tags->next)
|
for (tags = priv->match_tags; tags != NULL; tags = tags->next)
|
||||||
{
|
{
|
||||||
TagData *tag_data = (TagData*) tags->data;
|
TagData *tag_data = (TagData*) tags->data;
|
||||||
|
|
|
@ -1060,6 +1060,7 @@ update_edit_menu(TerminalWindow *window)
|
||||||
g_object_ref (window));
|
g_object_ref (window));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* width and height are character-based in vte 0.38, pixel-based in previous versions */
|
||||||
static void
|
static void
|
||||||
screen_resize_window_cb (TerminalScreen *screen,
|
screen_resize_window_cb (TerminalScreen *screen,
|
||||||
guint width,
|
guint width,
|
||||||
|
@ -1069,12 +1070,13 @@ screen_resize_window_cb (TerminalScreen *screen,
|
||||||
TerminalWindowPrivate *priv = window->priv;
|
TerminalWindowPrivate *priv = window->priv;
|
||||||
VteTerminal *terminal = VTE_TERMINAL (screen);
|
VteTerminal *terminal = VTE_TERMINAL (screen);
|
||||||
GtkWidget *widget = GTK_WIDGET (screen);
|
GtkWidget *widget = GTK_WIDGET (screen);
|
||||||
|
#if !VTE_CHECK_VERSION (0, 38, 0)
|
||||||
guint grid_width, grid_height;
|
guint grid_width, grid_height;
|
||||||
int char_width, char_height;
|
int char_width, char_height;
|
||||||
GtkBorder *inner_border = NULL;
|
GtkBorder *inner_border = NULL;
|
||||||
GtkAllocation widget_allocation;
|
GtkAllocation widget_allocation;
|
||||||
|
#endif
|
||||||
|
|
||||||
gtk_widget_get_allocation (widget, &widget_allocation);
|
|
||||||
/* Don't do anything if we're maximised or fullscreened */
|
/* Don't do anything if we're maximised or fullscreened */
|
||||||
// FIXME: realized && ... instead?
|
// FIXME: realized && ... instead?
|
||||||
if (!gtk_widget_get_realized (widget) ||
|
if (!gtk_widget_get_realized (widget) ||
|
||||||
|
@ -1083,6 +1085,11 @@ screen_resize_window_cb (TerminalScreen *screen,
|
||||||
|
|
||||||
/* NOTE: width and height already include the VteTerminal's padding! */
|
/* NOTE: width and height already include the VteTerminal's padding! */
|
||||||
|
|
||||||
|
#if VTE_CHECK_VERSION (0, 38, 0)
|
||||||
|
vte_terminal_set_size (terminal, width, height);
|
||||||
|
#else
|
||||||
|
gtk_widget_get_allocation (widget, &widget_allocation);
|
||||||
|
|
||||||
/* Short-circuit */
|
/* Short-circuit */
|
||||||
if (((int) width) == widget_allocation.width &&
|
if (((int) width) == widget_allocation.width &&
|
||||||
((int) height) == widget_allocation.height)
|
((int) height) == widget_allocation.height)
|
||||||
|
@ -1099,6 +1106,7 @@ screen_resize_window_cb (TerminalScreen *screen,
|
||||||
gtk_border_free (inner_border);
|
gtk_border_free (inner_border);
|
||||||
|
|
||||||
vte_terminal_set_size (terminal, grid_width, grid_height);
|
vte_terminal_set_size (terminal, grid_width, grid_height);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (screen != priv->active_screen)
|
if (screen != priv->active_screen)
|
||||||
return;
|
return;
|
||||||
|
@ -3128,18 +3136,29 @@ terminal_window_update_geometry (TerminalWindow *window)
|
||||||
char_height != priv->old_char_height ||
|
char_height != priv->old_char_height ||
|
||||||
widget != (GtkWidget*) priv->old_geometry_widget)
|
widget != (GtkWidget*) priv->old_geometry_widget)
|
||||||
{
|
{
|
||||||
GtkBorder *inner_border = NULL;
|
|
||||||
|
|
||||||
/* FIXME Since we're using xthickness/ythickness to compute
|
/* FIXME Since we're using xthickness/ythickness to compute
|
||||||
* padding we need to change the hints when the theme changes.
|
* padding we need to change the hints when the theme changes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if VTE_CHECK_VERSION (0, 38, 0)
|
||||||
|
GtkBorder padding;
|
||||||
|
|
||||||
|
gtk_style_context_get_padding(gtk_widget_get_style_context(widget),
|
||||||
|
gtk_widget_get_state_flags(widget),
|
||||||
|
&padding);
|
||||||
|
|
||||||
|
hints.base_width = padding.left + padding.right;
|
||||||
|
hints.base_height = padding.top + padding.bottom;
|
||||||
|
#else
|
||||||
|
GtkBorder *inner_border = NULL;
|
||||||
|
|
||||||
gtk_widget_style_get (widget, "inner-border", &inner_border, NULL);
|
gtk_widget_style_get (widget, "inner-border", &inner_border, NULL);
|
||||||
|
|
||||||
hints.base_width = (inner_border ? (inner_border->left + inner_border->right) : 0);
|
hints.base_width = (inner_border ? (inner_border->left + inner_border->right) : 0);
|
||||||
hints.base_height = (inner_border ? (inner_border->top + inner_border->bottom) : 0);
|
hints.base_height = (inner_border ? (inner_border->top + inner_border->bottom) : 0);
|
||||||
|
|
||||||
gtk_border_free (inner_border);
|
gtk_border_free (inner_border);
|
||||||
|
#endif
|
||||||
|
|
||||||
#define MIN_WIDTH_CHARS 4
|
#define MIN_WIDTH_CHARS 4
|
||||||
#define MIN_HEIGHT_CHARS 1
|
#define MIN_HEIGHT_CHARS 1
|
||||||
|
|
Loading…
Reference in New Issue