/* Callback when the configuration dialog has recorded a configuration change. */ static gboolean space_apply_configuration(gpointer user_data) { GtkWidget * p = user_data; SpacePlugin * sp = lxpanel_plugin_get_data(p); /* Apply settings. */ if (panel_get_orientation(sp->panel) == GTK_ORIENTATION_HORIZONTAL) gtk_widget_set_size_request(p, sp->size, 2); else gtk_widget_set_size_request(p, 2, sp->size); /* Save config values */ config_group_set_int(sp->settings, "Size", sp->size); return FALSE; }
static void menu_pos(GtkMenu *menu, gint *x, gint *y, gboolean *push_in, GtkWidget *widget) { int ox, oy, w, h; kano_feedback_plugin_t *plugin = lxpanel_plugin_get_data(widget); GtkAllocation allocation; gtk_widget_get_allocation(GTK_WIDGET(widget), &allocation); gdk_window_get_origin(gtk_widget_get_window(widget), &ox, &oy); /* FIXME The X origin is being truncated for some reason, reset it from the allocaation. */ ox = allocation.x; #if GTK_CHECK_VERSION(2,20,0) GtkRequisition requisition; gtk_widget_get_requisition(GTK_WIDGET(menu), &requisition); w = requisition.width; h = requisition.height; #else w = GTK_WIDGET(menu)->requisition.width; h = GTK_WIDGET(menu)->requisition.height; #endif if (panel_get_orientation(plugin->panel) == GTK_ORIENTATION_HORIZONTAL) { *x = ox; if (*x + w > gdk_screen_width()) *x = ox + allocation.width - w; *y = oy - h; if (*y < 0) *y = oy + allocation.height; } else { *x = ox + allocation.width; if (*x > gdk_screen_width()) *x = ox - w; *y = oy; if (*y + h > gdk_screen_height()) *y = oy + allocation.height - h; } /* Debugging prints */ /*printf("widget: x,y=%d,%d w,h=%d,%d\n", ox, oy, allocation.width, allocation.height ); printf("w-h %d %d\n", w, h); */ *push_in = TRUE; return; }