summaryrefslogtreecommitdiff
path: root/src/terminal-window.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/terminal-window.c')
-rw-r--r--src/terminal-window.c94
1 files changed, 66 insertions, 28 deletions
diff --git a/src/terminal-window.c b/src/terminal-window.c
index 0d04f11..69b953c 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -43,6 +43,11 @@
#include "skey-popup.h"
#endif
+#if GTK_CHECK_VERSION(3, 0, 0)
+ #include <gdk/gdk.h>
+ #include <gdk/gdkkeysyms-compat.h>
+#endif
+
struct _TerminalWindowPrivate
{
GtkActionGroup *action_group;
@@ -1035,10 +1040,8 @@ update_edit_menu_cb (GtkClipboard *clipboard,
}
static void
-edit_menu_activate_callback (GtkMenuItem *menuitem,
- gpointer user_data)
+update_edit_menu(TerminalWindow *window)
{
- TerminalWindow *window = (TerminalWindow *) user_data;
GtkClipboard *clipboard;
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (window), GDK_SELECTION_CLIPBOARD);
@@ -1522,23 +1525,43 @@ terminal_window_realize (GtkWidget *widget)
TerminalWindowPrivate *priv = window->priv;
#ifdef GDK_WINDOWING_X11
GdkScreen *screen;
- GdkColormap *colormap;
GtkAllocation widget_allocation;
-
+ #if GTK_CHECK_VERSION (3, 0, 0)
+ GdkVisual *visual;
+ #else
+ GdkColormap *colormap;
+ #endif
gtk_widget_get_allocation (widget, &widget_allocation);
screen = gtk_widget_get_screen (GTK_WIDGET (window));
- if (gdk_screen_is_composited (screen) &&
- (colormap = gdk_screen_get_rgba_colormap (screen)) != NULL)
- {
- /* Set RGBA colormap if possible so VTE can use real transparency */
- gtk_widget_set_colormap (widget, colormap);
- priv->have_argb_visual = TRUE;
- }
- else
- {
- gtk_widget_set_colormap (widget, gdk_screen_get_default_colormap (screen));
- priv->have_argb_visual = FALSE;
- }
+
+ #if GTK_CHECK_VERSION (3, 0, 0)
+ if (gdk_screen_is_composited (screen) &&
+ (visual = gdk_screen_get_rgba_visual (screen)) != NULL)
+ {
+ /* Set RGBA visual if possible so VTE can use real transparency */
+ gtk_widget_set_visual (GTK_WIDGET (widget), visual);
+ priv->have_argb_visual = TRUE;
+ }
+ else
+ {
+ gtk_widget_set_visual (GTK_WIDGET (window), gdk_screen_get_system_visual (screen));
+ priv->have_argb_visual = FALSE;
+ }
+ #else
+ if (gdk_screen_is_composited (screen) &&
+ (colormap = gdk_screen_get_rgba_colormap (screen)) != NULL)
+ {
+ /* Set RGBA colormap if possible so VTE can use real transparency */
+ gtk_widget_set_colormap (widget, colormap);
+ priv->have_argb_visual = TRUE;
+ }
+ else
+ {
+ gtk_widget_set_colormap (widget, gdk_screen_get_default_colormap (screen));
+ priv->have_argb_visual = FALSE;
+ }
+ #endif
+
#endif
_terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,
@@ -2099,6 +2122,7 @@ terminal_window_init (TerminalWindow *window)
GError *error;
GtkWindowGroup *window_group;
GtkAccelGroup *accel_group;
+ GtkClipboard *clipboard;
priv = window->priv = G_TYPE_INSTANCE_GET_PRIVATE (window, TERMINAL_TYPE_WINDOW, TerminalWindowPrivate);
@@ -2126,7 +2150,11 @@ terminal_window_init (TerminalWindow *window)
gtk_notebook_set_scrollable (GTK_NOTEBOOK (priv->notebook), TRUE);
gtk_notebook_set_show_border (GTK_NOTEBOOK (priv->notebook), FALSE);
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->notebook), FALSE);
- gtk_notebook_set_group (GTK_NOTEBOOK (priv->notebook), GUINT_TO_POINTER (1));
+ #if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_notebook_set_group_name (GTK_NOTEBOOK (priv->notebook), I_("mate-terminal-window"));
+ #else
+ gtk_notebook_set_group (GTK_NOTEBOOK (priv->notebook), GUINT_TO_POINTER (1));
+ #endif
gtk_notebook_set_scrollable (GTK_NOTEBOOK (priv->notebook),
TRUE);
g_signal_connect (priv->notebook, "button-press-event",
@@ -2143,6 +2171,11 @@ terminal_window_init (TerminalWindow *window)
G_CALLBACK (terminal_window_update_tabs_menu_sensitivity),
window, NULL, G_CONNECT_SWAPPED | G_CONNECT_AFTER);
+ #if GTK_CHECK_VERSION(3, 0, 0)
+ g_signal_connect (priv->notebook, "create-window",
+ G_CALLBACK (handle_tab_droped_on_desktop), window);
+ #endif
+
gtk_box_pack_end (GTK_BOX (main_vbox), priv->notebook, TRUE, TRUE, 0);
gtk_widget_show (priv->notebook);
@@ -2172,16 +2205,10 @@ terminal_window_init (TerminalWindow *window)
gtk_ui_manager_insert_action_group (manager, action_group, 0);
g_object_unref (action_group);
- action = gtk_action_group_get_action (action_group, "Edit");
- g_signal_connect (action, "activate",
- G_CALLBACK (edit_menu_activate_callback), window);
-
- /* Set this action invisible so the Edit menu doesn't flash the first
- * time it's shown and there's no text/uri-list on the clipboard.
- */
- action = gtk_action_group_get_action (priv->action_group, "EditPasteURIPaths");
- gtk_action_set_visible (action, FALSE);
-
+ clipboard = gtk_widget_get_clipboard (GTK_WIDGET (window), GDK_SELECTION_CLIPBOARD);
+ g_signal_connect_swapped (clipboard, "owner-change",
+ G_CALLBACK (update_edit_menu), window);
+ update_edit_menu (window);
/* Idem for this action, since the window is not fullscreen. */
action = gtk_action_group_get_action (priv->action_group, "PopupLeaveFullscreen");
gtk_action_set_visible (action, FALSE);
@@ -2262,7 +2289,9 @@ terminal_window_class_init (TerminalWindowClass *klass)
"}\n"
"widget \"*.mate-terminal-tab-close-button\" style \"mate-terminal-tab-close-button-style\"");
+ #if !GTK_CHECK_VERSION(3, 0, 0)
gtk_notebook_set_window_creation_hook (handle_tab_droped_on_desktop, NULL, NULL);
+ #endif
}
static void
@@ -2272,6 +2301,7 @@ terminal_window_dispose (GObject *object)
TerminalWindowPrivate *priv = window->priv;
TerminalApp *app;
GdkScreen *screen;
+ GtkClipboard *clipboard;
remove_popup_info (window);
@@ -2295,6 +2325,10 @@ terminal_window_dispose (GObject *object)
g_signal_handlers_disconnect_by_func (app,
G_CALLBACK (terminal_window_encoding_list_changed_cb),
window);
+ clipboard = gtk_widget_get_clipboard (GTK_WIDGET (window), GDK_SELECTION_CLIPBOARD);
+ g_signal_handlers_disconnect_by_func (clipboard,
+ G_CALLBACK (update_edit_menu),
+ window);
screen = gtk_widget_get_screen (GTK_WIDGET (object));
if (screen)
@@ -3980,7 +4014,11 @@ tabs_next_or_previous_tab_cb (GtkAction *action,
gtk_binding_set_activate (gtk_binding_set_by_class (klass),
keyval,
GDK_CONTROL_MASK,
+ #if GTK_CHECK_VERSION(3, 0, 0)
+ G_OBJECT (priv->notebook));
+ #else
GTK_OBJECT (priv->notebook));
+ #endif
}
static void