Revision: 6948
Author: nogu.dev
Date: Sun Feb 13 03:00:59 2011
Log: * gtk3/toolbar/Makefile.am
- Add uim-toolbar-gtk3-systray.
* helper/eggtrayicon.c
- Don't include gdkconfig.h in GTK+3.
- (egg_tray_icon_class_init): Don't set expose_event in GTK+3.
- (egg_tray_icon_clear_manager_window):
Replace gdk_window_lookup_for_display()
with gdk_x11_window_lookup_for_display()
- (egg_tray_icon_expose)
* Don't use expose_event in GTK+3.
* Call gtk_render_focus() instead of gtk_paint_focus() in GTK+3.
- (egg_tray_icon_get_visual_property):
Use gdk_visual_get_{red,blue,green}_pixel_details()
and gdk_visual_get_depth()
- (egg_tray_icon_set_colormap): Comment out this function in GTK+3.
- (egg_tray_icon_realize): Replace gdk_window_set_back_pixmap()
with gdk_window_set_background_pattern().
* helper/toolbar-systray-gtk.c
- (main): Don't call gtk_set_locale().
http://code.google.com/p/uim/source/detail?r=6948
Modified:
/trunk/gtk3/toolbar/Makefile.am
/trunk/helper/eggtrayicon.c
/trunk/helper/toolbar-systray-gtk.c
=======================================
--- /trunk/gtk3/toolbar/Makefile.am Sat Feb 12 19:58:37 2011
+++ /trunk/gtk3/toolbar/Makefile.am Sun Feb 13 03:00:59 2011
@@ -39,7 +39,7 @@
endif
if GTK3
-bin_PROGRAMS = uim-toolbar-gtk3
+bin_PROGRAMS = uim-toolbar-gtk3 uim-toolbar-gtk3-systray
uim_toolbar_gtk3_SOURCES = ../../helper/toolbar-standalone-gtk.c \
../../helper/toolbar-common-gtk.c
uim_toolbar_gtk3_LDADD = @GTK3_LIBS@ $(top_builddir)/uim/libuim-scm.la \
@@ -47,4 +47,15 @@
$(top_builddir)/uim/libuim-custom.la
uim_toolbar_gtk3_CPPFLAGS = -I$(top_srcdir) -I$(top_builddir)
uim_toolbar_gtk3_CFLAGS = @GTK3_CFLAGS@
+
+uim_toolbar_gtk3_systray_SOURCES = ../../helper/toolbar-systray-gtk.c \
+ ../../helper/toolbar-common-gtk.c \
+ ../../helper/eggtrayicon.c
../../helper/eggtrayicon.h
+uim_toolbar_gtk3_systray_LDADD = @GTK3_LIBS@ \
+ @X11_LIBS@ \
+ $(top_builddir)/uim/libuim-scm.la \
+ $(top_builddir)/uim/libuim.la \
+ $(top_builddir)/uim/libuim-custom.la
+uim_toolbar_gtk3_systray_CPPFLAGS = -I$(top_srcdir) -I$(top_builddir)
+uim_toolbar_gtk3_systray_CFLAGS = @GTK3_CFLAGS@
endif
=======================================
--- /trunk/helper/eggtrayicon.c Fri Nov 5 06:33:12 2010
+++ /trunk/helper/eggtrayicon.c Sun Feb 13 03:00:59 2011
@@ -25,7 +25,9 @@
#include "eggtrayicon.h"
+#if !GTK_CHECK_VERSION(2, 90, 0)
#include <gdkconfig.h>
+#endif
#include <gdk/gdkx.h>
#include <X11/Xatom.h>
#include <gtk/gtk.h>
@@ -135,7 +137,9 @@
widget_class->realize = egg_tray_icon_realize;
widget_class->style_set = egg_tray_icon_style_set;
widget_class->delete_event = egg_tray_icon_delete;
+#if !GTK_CHECK_VERSION(2, 90, 0)
widget_class->expose_event = egg_tray_icon_expose;
+#endif
g_object_class_install_property (gobject_class,
PROP_ORIENTATION,
@@ -200,8 +204,13 @@
{
GdkWindow *gdkwin;
+#if GTK_CHECK_VERSION(2, 24, 0)
+ gdkwin = gdk_x11_window_lookup_for_display (display,
+ icon->manager_window);
+#else
gdkwin = gdk_window_lookup_for_display (display,
icon->manager_window);
+#endif
gdk_window_remove_filter (gdkwin, egg_tray_icon_manager_filter,
icon);
@@ -270,8 +279,10 @@
event->area.width, event->area.height);
}
+#if !GTK_CHECK_VERSION(2, 90, 0)
if (GTK_WIDGET_CLASS (parent_class)->expose_event)
retval = GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event);
+#endif
focus_child = gtk_container_get_focus_child(GTK_CONTAINER (widget));
#if GTK_CHECK_VERSION(2, 18, 0)
@@ -288,11 +299,17 @@
width = allocation.width - 2 * border_width;
height = allocation.height - 2 * border_width;
+#if GTK_CHECK_VERSION(2, 90, 0)
+ gtk_render_focus (gtk_widget_get_style_context(widget),
+ gtk_widget_get_window(widget),
+ x, y, width, height);
+#else
gtk_paint_focus (gtk_widget_get_style(widget),
gtk_widget_get_window(widget),
gtk_widget_get_state (widget),
&event->area, widget, "tray_icon",
x, y, width, height);
+#endif
}
#else
if (focus_child && GTK_WIDGET_HAS_FOCUS (focus_child))
@@ -384,6 +401,10 @@
gulong bytes_after;
int error, result;
GdkVisual *visual;
+ gint red_prec;
+ gint blue_prec;
+ gint green_prec;
+ gint depth;
g_assert (icon->manager_window != None);
@@ -408,8 +429,19 @@
}
icon->manager_visual = visual;
+#if GTK_CHECK_VERSION(2, 22, 0)
+ gdk_visual_get_red_pixel_details(visual, NULL, NULL, &red_prec);
+ gdk_visual_get_blue_pixel_details(visual, NULL, NULL, &blue_prec);
+ gdk_visual_get_green_pixel_details(visual, NULL, NULL, &green_prec);
+ depth = gdk_visual_get_depth(visual);
+#else
+ red_prec = visual->red_prec;
+ blue_prec = visual->blue_prec;
+ green_prec = visual->blue_prec;
+ depth = visual->depth;
+#endif
icon->manager_visual_rgba = visual != NULL &&
- (visual->red_prec + visual->blue_prec + visual->green_prec <
visual->depth);
+ (red_prec + blue_prec + green_prec < depth);
/* For the background-relative hack we use when we aren't using a real
RGBA
* visual, we can't be double-buffered */
@@ -517,8 +549,13 @@
{
GdkWindow *gdkwin;
+#if GTK_CHECK_VERSION(2, 24, 0)
+ gdkwin = gdk_x11_window_lookup_for_display (gtk_widget_get_display
(GTK_WIDGET (icon)),
+ icon->manager_window);
+#else
gdkwin = gdk_window_lookup_for_display (gtk_widget_get_display
(GTK_WIDGET (icon)),
icon->manager_window);
+#endif
gdk_window_add_filter (gdkwin, egg_tray_icon_manager_filter, icon);
@@ -576,6 +613,7 @@
return TRUE;
}
+#if !GTK_CHECK_VERSION(2, 90, 0)
static void
egg_tray_icon_set_colormap (EggTrayIcon *icon)
{
@@ -610,6 +648,7 @@
if (new_colormap)
g_object_unref (colormap);
}
+#endif
static void
egg_tray_icon_realize (GtkWidget *widget)
@@ -620,7 +659,9 @@
egg_tray_icon_realize_internal (widget);
#endif
+#if !GTK_CHECK_VERSION(2, 90, 0)
egg_tray_icon_set_colormap (icon);
+#endif
GTK_WIDGET_CLASS (parent_class)->realize (widget);
if (icon->manager_visual_rgba)
@@ -632,7 +673,11 @@
else
{
/* Set a parent-relative background pixmap */
+#if GTK_CHECK_VERSION(2, 90, 0)
+ gdk_window_set_background_pattern (gtk_widget_get_window(widget),
NULL);
+#else
gdk_window_set_back_pixmap (gtk_widget_get_window(widget), NULL,
TRUE);
+#endif
}
if (icon->manager_window != None)
=======================================
--- /trunk/helper/toolbar-systray-gtk.c Thu Jan 6 18:09:56 2011
+++ /trunk/helper/toolbar-systray-gtk.c Sun Feb 13 03:00:59 2011
@@ -76,8 +76,6 @@
textdomain(PACKAGE);
bind_textdomain_codeset(PACKAGE, "UTF-8");
- gtk_set_locale();
-
uim_init();
gtk_init(&argc, &argv);