GTK3 support
parent
ff67cbbd09
commit
9537fb9c05
|
@ -522,6 +522,31 @@ reset_compat_defaults_cb (GtkWidget *button,
|
|||
static void
|
||||
init_color_scheme_menu (GtkWidget *combo_box)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(3, 0, 0)
|
||||
|
||||
GtkCellRenderer *renderer;
|
||||
GtkTreeIter iter;
|
||||
GtkListStore *store;
|
||||
int i;
|
||||
|
||||
store = gtk_list_store_new (1, G_TYPE_STRING);
|
||||
for (i = 0; i < G_N_ELEMENTS (color_schemes); ++i)
|
||||
gtk_list_store_insert_with_values (store, &iter, -1,
|
||||
0, _(color_schemes[i].name),
|
||||
-1);
|
||||
gtk_list_store_insert_with_values (store, &iter, -1,
|
||||
0, _("Custom"),
|
||||
-1);
|
||||
|
||||
gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box), GTK_TREE_MODEL (store));
|
||||
g_object_unref (store);
|
||||
|
||||
renderer = gtk_cell_renderer_text_new ();
|
||||
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box), renderer, TRUE);
|
||||
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_box), renderer, "text", 0, NULL);
|
||||
|
||||
#else
|
||||
|
||||
int i;
|
||||
|
||||
i = G_N_ELEMENTS (color_schemes);
|
||||
|
@ -530,6 +555,8 @@ init_color_scheme_menu (GtkWidget *combo_box)
|
|||
gtk_combo_box_prepend_text (GTK_COMBO_BOX (combo_box),
|
||||
_(color_schemes[--i].name));
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
static char*
|
||||
|
|
|
@ -29,6 +29,10 @@
|
|||
#include "terminal-profile.h"
|
||||
#include "terminal-util.h"
|
||||
|
||||
#if GTK_CHECK_VERSION(3, 0, 0)
|
||||
#include <gdk/gdkkeysyms-compat.h>
|
||||
#endif
|
||||
|
||||
/* NOTES
|
||||
*
|
||||
* There are two sources of keybindings changes, from GSettings and from
|
||||
|
|
|
@ -44,6 +44,11 @@
|
|||
|
||||
#include "eggshell.h"
|
||||
|
||||
#if GTK_CHECK_VERSION(3, 0, 0)
|
||||
#include <gdk/gdkkeysyms-compat.h>
|
||||
#define GDK_WINDOW_XWINDOW GDK_WINDOW_XID
|
||||
#endif
|
||||
|
||||
#define URL_MATCH_CURSOR (GDK_HAND2)
|
||||
#define SKEY_MATCH_CURSOR (GDK_HAND2)
|
||||
|
||||
|
|
|
@ -44,6 +44,11 @@
|
|||
#include "terminal-util.h"
|
||||
#include "terminal-window.h"
|
||||
|
||||
#if GTK_CHECK_VERSION(3, 0, 0)
|
||||
#define GDK_WINDOW_XWINDOW GDK_WINDOW_XID
|
||||
#define GDK_DRAWABLE_XID GDK_WINDOW_XID
|
||||
#endif
|
||||
|
||||
void
|
||||
terminal_util_set_unique_role (GtkWindow *window, const char *prefix)
|
||||
{
|
||||
|
@ -1049,7 +1054,11 @@ gboolean
|
|||
terminal_util_x11_get_net_wm_desktop (GdkWindow *window,
|
||||
guint32 *desktop)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(3, 0, 0)
|
||||
GdkDisplay *display = gdk_window_get_display (window);
|
||||
#else
|
||||
GdkDisplay *display = gdk_drawable_get_display (window);
|
||||
#endif
|
||||
Atom type;
|
||||
int format;
|
||||
guchar *data;
|
||||
|
@ -1092,7 +1101,11 @@ terminal_util_x11_set_net_wm_desktop (GdkWindow *window,
|
|||
* http://bugzilla.mate.org/show_bug.cgi?id=586311 asks for GTK+
|
||||
* to just handle everything behind the scenes including the desktop.
|
||||
*/
|
||||
#if GTK_CHECK_VERSION(3, 0, 0)
|
||||
GdkScreen *screen = gdk_window_get_screen (window);
|
||||
#else
|
||||
GdkScreen *screen = gdk_drawable_get_screen (window);
|
||||
#endif
|
||||
GdkDisplay *display = gdk_screen_get_display (screen);
|
||||
Display *xdisplay = GDK_DISPLAY_XDISPLAY (display);
|
||||
char *wm_selection_name;
|
||||
|
@ -1158,7 +1171,12 @@ terminal_util_x11_set_net_wm_desktop (GdkWindow *window,
|
|||
void
|
||||
terminal_util_x11_clear_demands_attention (GdkWindow *window)
|
||||
{
|
||||
|
||||
#if GTK_CHECK_VERSION(3, 0, 0)
|
||||
GdkScreen *screen = gdk_window_get_screen (window);
|
||||
#else
|
||||
GdkScreen *screen = gdk_drawable_get_screen (window);
|
||||
#endif
|
||||
GdkDisplay *display = gdk_screen_get_display (screen);
|
||||
XClientMessageEvent xclient;
|
||||
|
||||
|
@ -1195,7 +1213,11 @@ terminal_util_x11_clear_demands_attention (GdkWindow *window)
|
|||
gboolean
|
||||
terminal_util_x11_window_is_minimized (GdkWindow *window)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(3, 0, 0)
|
||||
GdkDisplay *display = gdk_window_get_display (window);
|
||||
#else
|
||||
GdkDisplay *display = gdk_drawable_get_display (window);
|
||||
#endif
|
||||
|
||||
Atom type;
|
||||
gint format;
|
||||
|
|
|
@ -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;
|
||||
|
@ -1518,11 +1523,29 @@ 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 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)
|
||||
{
|
||||
|
@ -1537,6 +1560,8 @@ terminal_window_realize (GtkWidget *widget)
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
_terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,
|
||||
"[window %p] realize, size %d : %d at (%d, %d)\n",
|
||||
widget,
|
||||
|
@ -2113,7 +2138,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);
|
||||
#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",
|
||||
|
@ -2130,6 +2159,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);
|
||||
|
||||
|
@ -2243,7 +2277,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
|
||||
|
@ -3911,7 +3947,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
|
||||
|
|
Loading…
Reference in New Issue