1 #! /bin/sh /usr/share/dpatch/dpatch-run
2 ## 53_scim-1.4.7-trayicon.dpatch by Ikuya Awashiro <ikuya@fruitsbasket.info>
4 ## All lines beginning with `## DP:' are a description of the patch.
5 ## DP: Use better tray icon
6 ## DP: https://bugzilla.redhat.com/show_bug.cgi?id=447848
9 diff -urNad scim-1.4
.9~
/extras
/panel
/scim_panel_gtk.cpp scim-1.4
.9/extras
/panel
/scim_panel_gtk.cpp
10 --- scim-1.4
.9~
/extras
/panel
/scim_panel_gtk.cpp
2008-11-02 06:43:13.000000000 +0000
11 +++ scim-1.4
.9/extras
/panel
/scim_panel_gtk.cpp
2009-07-20 11:54:40.000000000 +0000
13 #include "scimstringview.h"
16 - #include "scimtrayicon.h"
17 +// #include "scimtrayicon.h"
23 static void ui_tray_icon_destroy_cb
(GtkObject
*object
,
25 +static void ui_tray_icon_popup_menu_cb
(GtkStatusIcon
*status_icon
,
27 + guint activate_time
,
28 + gpointer user_data
);
30 +static void ui_tray_icon_activate_cb
(GtkStatusIcon
*status_icon
,
31 + gpointer user_data
);
34 // Client Property Callback
36 static PangoFontDescription
*_default_font_desc
= 0;
39 -static ScimTrayIcon
*_tray_icon
= 0;
40 -static GtkWidget
*_tray_icon_factory_button
= 0;
41 -static gulong _tray_icon_destroy_signal_id
= 0;
42 +static GtkStatusIcon
*_tray_icon
= 0;
43 +// static GtkWidget
*_tray_icon_factory_button
= 0;
44 +// static gulong _tray_icon_destroy_signal_id
= 0;
47 static gboolean _input_window_draging
= FALSE
;
52 - g_signal_handler_disconnect
(G_OBJECT
(_tray_icon
),
53 - _tray_icon_destroy_signal_id
);
54 - gtk_widget_destroy
(GTK_WIDGET
(_tray_icon
));
55 + // g_signal_handler_disconnect
(G_OBJECT
(_tray_icon
),
56 + // _tray_icon_destroy_signal_id
);
57 + g_object_unref
(_tray_icon
);
66 - gtk_window_set_screen
(GTK_WINDOW
(_tray_icon
), screen
);
68 + // if (_tray_icon
) {
69 + // gtk_window_set_screen
(GTK_WINDOW
(_tray_icon
), screen
);
74 @@
-1337,65 +1344,75 @@
79 -ui_tray_icon_expose_event_cb (GtkWidget
*widget
, GdkEventExpose
*event
)
81 - gdk_window_clear_area
(widget-
>window
, event-
>area.x
, event-
>area.y
,
82 - event-
>area.width
, event-
>area.height
);
87 -ui_tray_icon_style_set_cb (GtkWidget
*widget
, GtkStyle
*previous_style
)
89 - gdk_window_set_back_pixmap
(widget-
>window
, NULL
, TRUE
);
93 -ui_tray_icon_realize_cb (GtkWidget
*widget
)
95 - if (GTK_WIDGET_NO_WINDOW
(widget
) || GTK_WIDGET_APP_PAINTABLE
(widget
))
98 - gtk_widget_set_app_paintable
(widget
, TRUE
);
99 - gtk_widget_set_double_buffered
(widget
, FALSE
);
100 - gdk_window_set_back_pixmap
(widget-
>window
, NULL
, TRUE
);
101 - g_signal_connect
(widget
, "expose_event",
102 - G_CALLBACK
(ui_tray_icon_expose_event_cb
), NULL
);
103 - g_signal_connect_after
(widget
, "style_set",
104 - G_CALLBACK
(ui_tray_icon_style_set_cb
), NULL
);
107 +// ui_tray_icon_expose_event_cb
(GtkWidget
*widget
, GdkEventExpose
*event
)
109 +// gdk_window_clear_area
(widget-
>window
, event-
>area.x
, event-
>area.y
,
110 +// event-
>area.width
, event-
>area.height
);
115 +// ui_tray_icon_style_set_cb
(GtkWidget
*widget
, GtkStyle
*previous_style
)
117 +// gdk_window_set_back_pixmap
(widget-
>window
, NULL
, TRUE
);
121 +// ui_tray_icon_realize_cb
(GtkWidget
*widget
)
123 +// if (GTK_WIDGET_NO_WINDOW
(widget
) || GTK_WIDGET_APP_PAINTABLE
(widget
))
126 +// gtk_widget_set_app_paintable
(widget
, TRUE
);
127 +// gtk_widget_set_double_buffered
(widget
, FALSE
);
128 +// gdk_window_set_back_pixmap
(widget-
>window
, NULL
, TRUE
);
129 +// g_signal_connect
(widget
, "expose_event",
130 +// G_CALLBACK
(ui_tray_icon_expose_event_cb
), NULL
);
131 +// g_signal_connect_after
(widget
, "style_set",
132 +// G_CALLBACK
(ui_tray_icon_style_set_cb
), NULL
);
136 ui_create_tray_icon_when_idle
(gpointer data
)
140 - _tray_icon
= scim_tray_icon_new
("SCIM Tray Icon");
141 - g_signal_connect
(G_OBJECT
(_tray_icon
), "realize",
142 - G_CALLBACK
(ui_tray_icon_realize_cb
), NULL
);
143 + _tray_icon
= gtk_status_icon_new_from_file
(SCIM_KEYBOARD_ICON_FILE
);
144 + // g_signal_connect
(G_OBJECT
(_tray_icon
), "realize",
145 + // G_CALLBACK
(ui_tray_icon_realize_cb
), NULL
);
147 - _tray_icon_destroy_signal_id
=
148 - g_signal_connect
(G_OBJECT
(_tray_icon
), "destroy",
149 - G_CALLBACK
(ui_tray_icon_destroy_cb
),
151 + // _tray_icon_destroy_signal_id
=
152 + // g_signal_connect
(G_OBJECT
(_tray_icon
), "destroy",
153 + // G_CALLBACK
(ui_tray_icon_destroy_cb
),
156 - image
= ui_create_icon
(SCIM_KEYBOARD_ICON_FILE
,
161 + // image
= ui_create_icon
(SCIM_KEYBOARD_ICON_FILE
,
167 - _tray_icon_factory_button
= gtk_event_box_new
();
168 - g_signal_connect
(G_OBJECT
(_tray_icon_factory_button
), "realize",
169 - G_CALLBACK
(ui_tray_icon_realize_cb
), NULL
);
170 - gtk_container_add
(GTK_CONTAINER
(_tray_icon_factory_button
), image
);
171 - gtk_container_add
(GTK_CONTAINER
(_tray_icon
), _tray_icon_factory_button
);
172 - g_signal_connect
(G_OBJECT
(_tray_icon_factory_button
), "button-release-event",
173 - G_CALLBACK
(ui_factory_button_click_cb
),
174 + // _tray_icon_factory_button
= gtk_event_box_new
();
175 + // g_signal_connect
(G_OBJECT
(_tray_icon_factory_button
), "realize",
176 + // G_CALLBACK
(ui_tray_icon_realize_cb
), NULL
);
177 + // gtk_container_add
(GTK_CONTAINER
(_tray_icon_factory_button
), image
);
178 + // gtk_container_add
(GTK_CONTAINER
(_tray_icon
), _tray_icon_factory_button
);
181 + // g_signal_connect
(G_OBJECT
(_tray_icon_factory_button
), "button-release-event",
182 + // G_CALLBACK
(ui_factory_button_click_cb
),
185 + g_signal_connect
(G_OBJECT
(_tray_icon
), "popup-menu",
186 + G_CALLBACK
(ui_tray_icon_popup_menu_cb
),
189 + g_signal_connect
(G_OBJECT
(_tray_icon
), "activate",
190 + G_CALLBACK
(ui_tray_icon_activate_cb
),
193 - gtk_widget_show_all
(GTK_WIDGET
(_tray_icon
));
194 + gtk_status_icon_set_visible
(_tray_icon
, TRUE
);
198 @@
-1686,6 +1703,19 @@
202 +ui_tray_icon_popup_menu_cb
(GtkStatusIcon
*status_icon
, guint button
,
203 + guint activate_time
, gpointer user_data
)
205 + action_show_command_menu
();
209 +ui_tray_icon_activate_cb
(GtkStatusIcon
*status_icon
, gpointer user_data
)
211 + _panel_agent-
>request_factory_menu
();
215 ui_factory_menu_activate_cb
(GtkMenuItem
*item
,
218 @@
-2243,19 +2273,19 @@
223 -ui_tray_icon_destroy_cb (GtkObject
*object
,
224 - gpointer user_data
)
226 - SCIM_DEBUG_MAIN
(1) << "Tray Icon destroyed!\n";
228 - gtk_widget_destroy
(GTK_WIDGET
(object
));
231 - _tray_icon_factory_button
= 0;
233 - g_idle_add
(ui_create_tray_icon_when_idle
, NULL
);
236 +// ui_tray_icon_destroy_cb
(GtkObject
*object
,
237 +// gpointer user_data
)
239 +// SCIM_DEBUG_MAIN
(1) << "Tray Icon destroyed!\n";
241 +// gtk_widget_destroy
(GTK_WIDGET
(object
));
244 +// _tray_icon_factory_button
= 0;
246 +// g_idle_add
(ui_create_tray_icon_when_idle
, NULL
);
251 @@
-2685,18 +2715,21 @@
255 - if (_tray_icon_factory_button
) {
256 - GtkWidget
*icon
= gtk_bin_get_child
(GTK_BIN
(_tray_icon_factory_button
));
257 + // if (_tray_icon_factory_button
) {
258 + // GtkWidget
*icon
= gtk_bin_get_child
(GTK_BIN
(_tray_icon_factory_button
));
261 - gtk_container_remove
(GTK_CONTAINER
(_tray_icon_factory_button
), icon
);
263 + // gtk_container_remove
(GTK_CONTAINER
(_tray_icon_factory_button
), icon
);
265 - icon
= ui_create_icon
(info.icon
, NULL
, TRAY_ICON_SIZE
, TRAY_ICON_SIZE
, true
);
266 + // icon
= ui_create_icon
(info.icon
, NULL
, TRAY_ICON_SIZE
, TRAY_ICON_SIZE
, true
);
268 - gtk_container_add
(GTK_CONTAINER
(_tray_icon_factory_button
), icon
);
269 + // gtk_container_add
(GTK_CONTAINER
(_tray_icon_factory_button
), icon
);
272 - gtk_tooltips_set_tip
(_tooltips
, _tray_icon_factory_button
, info.name.c_str
(), NULL
);
274 + // gtk_tooltips_set_tip
(_tooltips
, _tray_icon_factory_button
, info.name.c_str
(), NULL
);
277 + gtk_status_icon_set_from_file
(_tray_icon
, info.icon.c_str
());