plugins/docklet/docklet-x11.c

changeset 10268
862ed5d3f227
parent 9791
f5c5bda0b96b
child 10297
b36800725b7a
equal deleted inserted replaced
10267:05279096b8c8 10268:862ed5d3f227
122 122
123 gtk_image_set_from_pixbuf(GTK_IMAGE(image), blank_icon); 123 gtk_image_set_from_pixbuf(GTK_IMAGE(image), blank_icon);
124 } 124 }
125 125
126 static void 126 static void
127 docklet_x11_position_menu(GtkMenu *menu, int *x, int *y, gboolean *push_in,
128 gpointer user_data)
129 {
130 GtkWidget *widget = GTK_WIDGET(docklet);
131 GtkRequisition req;
132 gint menu_xpos, menu_ypos;
133
134 gtk_widget_size_request(GTK_WIDGET(menu), &req);
135 gdk_window_get_origin(widget->window, &menu_xpos, &menu_ypos);
136
137 menu_xpos += widget->allocation.x;
138 menu_ypos += widget->allocation.y;
139
140 if (menu_ypos > gdk_screen_get_height(gtk_widget_get_screen(widget)) / 2)
141 menu_ypos -= req.height;
142 else
143 menu_ypos += widget->allocation.height;
144
145 *x = menu_xpos;
146 *y = menu_ypos;
147
148 *push_in = TRUE;
149 }
150
151 static void
127 docklet_x11_destroy() 152 docklet_x11_destroy()
128 { 153 {
129 docklet_remove(GTK_WIDGET_VISIBLE(docklet)); 154 docklet_remove(GTK_WIDGET_VISIBLE(docklet));
130 155
131 g_signal_handlers_disconnect_by_func(G_OBJECT(docklet), G_CALLBACK(docklet_x11_destroyed_cb), NULL); 156 g_signal_handlers_disconnect_by_func(G_OBJECT(docklet), G_CALLBACK(docklet_x11_destroyed_cb), NULL);
179 static struct docklet_ui_ops ui_ops = 204 static struct docklet_ui_ops ui_ops =
180 { 205 {
181 docklet_x11_create, 206 docklet_x11_create,
182 docklet_x11_destroy, 207 docklet_x11_destroy,
183 docklet_x11_update_icon, 208 docklet_x11_update_icon,
184 docklet_x11_blank_icon 209 docklet_x11_blank_icon,
210 docklet_x11_position_menu
185 }; 211 };
186 212
187 void 213 void
188 docklet_ui_init() 214 docklet_ui_init()
189 { 215 {

mercurial