📄 changelog-plugins.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"><html><body background="paper1.gif"><h3>Changelog for GKrellM Plugins</h3><hr size="4"><h4>Changes for version 2.2.7 - 2.2.9</h4>none<h4>Changes for version 2.2.5</h4><ul><li>gkrellmd plugins can read config from a gkrellmd.conf file. Pluginspecific config must appear like so:<pre> [monitor-name] config line 0 config line 1 ... [/monitor-name]</pre>gkrellmd plugins can read the config lines with:<pre> const gchar *gkrellmd_config_getline(GkrellmdMonitor *mon);</pre></li><li>gkrellmd plugins can read data sent from their gkrellm client plugins(demo5 is updated to demonstrate this) using the functions:<pre> gboolean gkrellm_client_send_to_server(gchar *key_name, gchar *line); void gkrellmd_client_input_connect(GkrellmdMonitor *mon, void (*func)(GkrellmdClient *, gchar *));</pre></li><li>Various other new functions (mostly to round out using text markup):<pre> GkrellmDecal *gkrellm_create_decal_text_markup(GkrellmPanel *p, gchar *string, GkrellmTextstyle *ts, GkrellmStyle *style, gint x, gint y, gint w); void gkrellm_decal_text_markup_insert(GkrellmDecal *d, gchar *s, GkrellmTextstyle *ts, gint x_off, gint y_off); void gkrellm_decal_text_nth_inserted_set_offset(GkrellmDecal *d, gint n, gint x_off, gint y_off); void gkrellm_decal_text_nth_inserted_get_offset(GkrellmDecal *d, gint n, gint *x_off, gint *y_off); void gkrellm_config_instant_apply(GkrellmMonitor *mon); GtkTreeSelection *gkrellm_gtk_scrolled_selection(GtkTreeView *treeview, GtkWidget *box, GtkSelectionMode s_mode, GtkPolicyType h_policy, GtkPolicyType v_policy, void (*func_cb)(), gpointer data); void gkrellm_text_markup_extents(PangoFontDescription *font_desc, gchar *text, gint len, gint *width, gint *height, gint *baseline, gint *y_ink); gint gkrellm_gdk_string_markup_width(PangoFontDescription *, gchar *); gint gkrellm_gdk_text_markup_width(PangoFontDescription *font_desc, const gchar *string, gint len); void gkrellm_gdk_draw_string_markup(GdkDrawable *drawable, PangoFontDescription *font, GdkGC *gc, gint x, gint y, gchar *string); void gkrellm_gdk_draw_text_markup(GdkDrawable *drawable, PangoFontDescription *font, GdkGC *gc, gint x, gint y, gchar *string, gint len);</pre></li><h4>Changes for versions 2.2.3 - 2.2.4</h4>none<h4>Changes for version 2.2.2</h4> New function to get theme position settings for panel labels.<pre> void gkrellm_panel_label_get_position(GkrellmStyle *style, gint *x_position, gint *y_off);</pre><h4>Changes for version 2.2.1</h4> New functions for drawing text decals using Pango markup:<pre> void gkrellm_draw_decal_markup(GkrellmPanel *p, GkrellmDecal *d, gchar *text); void gkrellm_decal_scroll_text_set_markup(GkrellmPanel *p, GkrellmDecal *d, gchar *text);</pre> The gkrellm_decal_scroll_text_set_text() function introduced in 2.2.0 no longer uses markup.<h4>Changes for version 2.2.0</h4><ul> <li> Gkrellm text drawing is converted from GdkFont to Pango. The main issue here is that plugins should not be using GdkFont functions such as gdk_string_width() and should use the gkrellm_gdk functions listed below. With maybe only one or two exceptions, existing plugins should compile (with some possible warnings) and run fine since gkrellm now intercepts some straight GdkFont functions. Without this interception, many plugins would crash gkrellm. A plugin using gdk_string_width() can compile under all gkrellm versions by substituting in gkrellm_gdk_string_width() and having this define: <pre> #if !GKRELLM_CHECK_VERSION(2,2,0) #define gkrellm_gdk_string_width gdk_string_width #endif </pre> </li> <li> There can now be gkrellmd server plugins. See the tutorial demo5 plugin on the plugins page at gkrellm.net. </li> <li>Updated the plugins reference with the new functions. Updated demo3 to use new scrolling text functions. </li> <li> gkrellm_draw_decal_text() now ignores the "value" arg and internally checks for changed text before doing a redraw. </li> <li> gkrellm_create_decal_text_with_height() behavior is changed because GdkFont baseline has a different definition from Pango baseline. So the last arg to the function now has a different meaning. See the plugin programmers reference. </li></ul><blockquote>General new functions:<pre> void gkrellm_decal_get_size(GkrellmDecal *d, gint *w, gint *h); void gkrellm_decal_text_set_offset(GkrellmDecal *d, gint x, gint y); void gkrellm_decal_text_get_offset(GkrellmDecal *d, gint *x, gint *y); void gkrellm_chart_reuse_text_format(GkrellmChart *cp); gchar *gkrellm_get_hostname(void);</pre>New functions to minimize Pango drawing when scrolling text:<pre> void gkrellm_decal_scroll_text_set_text(GkrellmPanel *p, GkrellmDecal *d, gchar *text); void gkrellm_decal_scroll_text_get_size(GkrellmDecal *d, gint *w, gint *h); void gkrellm_decal_scroll_text_align_center(GkrellmDecal *d, gboolean center); void gkrellm_decal_scroll_text_horizontal_loop(GkrellmDecal *d, gboolean loop); void gkrellm_decal_scroll_text_vertical_loop(GkrellmDecal *d, gboolean loop);</pre>Some convenience functions for transitioning from GdkFont toPangoFontDescription:<pre> void gkrellm_text_extents(PangoFontDescription *font_desc, gchar *text, gint len, gint *width, gint *height, gint *baseline, gint *y_ink); gint gkrellm_gdk_string_width(PangoFontDescription *, gchar *); void gkrellm_gdk_draw_string(GdkDrawable *drawable, PangoFontDescription *font, GdkGC *gc, gint x, gint y, gchar *string); void gkrellm_gdk_draw_text(GdkDrawable *drawable, PangoFontDescription *font, GdkGC *gc, gint x, gint y, gchar *string, gint len);</pre>New functions to implement client/server capable plugins:<pre> /* -------- gkrellm client plugin functions ----------- */ gboolean gkrellm_client_mode(void); void gkrellm_client_plugin_get_setup(gchar *key_name, void (*setup_func_cb)(gchar *str)); void gkrellm_client_plugin_serve_data_connect(GkrellmMonitor *mon, gchar *key_name, void (*func_cb)(gchar *line)); void gkrellm_client_plugin_reconnect_connect(gchar *key_name, void (*func_cb)()); /* -------- gkrellmd server plugin functions ----------- */ void gkrellmd_plugin_serve_setup(GkrellmdMonitor *mon, gchar *name, gchar *line); void gkrellmd_need_serve(GkrellmdMonitor *mon); void gkrellmd_set_serve_name(GkrellmdMonitor *mon, const gchar *name); void gkrellmd_serve_data(GkrellmdMonitor *mon, gchar *line); void gkrellmd_add_serveflag_done(gboolean *); /* -------- Small set of useful gkrellmd plugin functions -- */ void gkrellmd_free_glist_and_data(GList **list_head); gchar *gkrellmd_dup_token(gchar **string, gchar *delimeters); gboolean gkrellmd_dup_string(gchar **dst, gchar *src);</pre><h4>Changes for version 2.1.23 - 2.1.28</h4>none<h4>Changes for version 2.1.22</h4>Fix omission of check_func in alert plugin interface. Replacegkrellm_alert_plugin_connect() with:<pre> void gkrellm_alert_plugin_alert_connect(GkrellmAlertPlugin *gap, void (*alarm_func)(), void (*warn_func)(), void (*update_func)(), void (*check_func)(), void (*destroy_func)());</pre>(changes the API, but no plugins are using this yet).<h4>Changes for version 2.1.17 - 2.1.21</h4>none<h4>Changes for version 2.1.16</h4>Added a plugin API for alerts:<pre> void gkrellm_alert_get_alert_state(GkrellmAlert *alert, gboolean *alarm_state, gboolean *warn_state); GkrellmAlertPlugin *gkrellm_alert_plugin_add(GkrellmMonitor *mon, gchar *name); void gkrellm_alert_plugin_connect(GkrellmAlertPlugin *gap, void (*alarm_func)(), void (*warn_func)(), void (*update_func)(), void (*destroy_func)()); void gkrellm_alert_plugin_config_connect(GkrellmAlertPlugin *gap, gchar *tab_name, void (*config_create_func)(), void (*config_done_func), void (*config_save_func)(),void (*config_load_func)()); gchar *gkrellm_alert_plugin_config_get_id_string(GkrellmAlert *alert); void gkrellm_alert_plugin_alert_attach(GkrellmAlertPlugin *gap, GkrellmAlert *alert, gpointer data); void gkrellm_alert_plugin_alert_detach(GkrellmAlertPlugin *gap, GkrellmAlert *alert); gpointer gkrellm_alert_plugin_get_data(GkrellmAlertPlugin *gap, GkrellmAlert *alert); void gkrellm_alert_plugin_command_process(GkrellmAlert *alert, gchar *src, gchar *dst, gint dst_size);</pre>Other new functions:<pre> GtkWidget *gkrellm_gtk_category_vbox(GtkWidget *box, gchar *category_header, gint header_pad, gint box_pad, gboolean pack_start); void gkrellm_remove_launcher(GkrellmLauncher *launch);</pre></blockquote><h4>Changes for version 2.1.13 - 2.1.15</h4>none<h4>Changes for version 2.1.12</h4>As mentioned in the main Changelog, make install will install a gkrellm.pcfile so plugin makefiles may use:<pre> `pkg-config gkrellm --cflags` `pkg-config gkrellm --libs`</pre>New functions:<pre> void gkrellm_decal_text_clear(GkrellmDecal *d); void gkrellm_decal_text_insert(GkrellmDecal *d, gchar *s, GkrellmTextstyle *ts, gint x_off, gint y_off); GkrellmDecal *gkrellm_create_decal_text_with_height(GkrellmPanel *p, GkrellmTextstyle *ts, GkrellmStyle *style, gint x, gint y, gint w, gint h, gint y_baseline); void gkrellm_chartconfig_callback_block(GkrellmChartconfig *, gboolean);</pre><h4>Changes for version 2.1.10</h4>None<h4>Changes for version 2.1.9</h4>New functions:<pre> GkrellmPiximage *gkrellm_piximage_new_from_inline(const guint8 *data, gboolean copy_pixels); gboolean gkrellm_load_piximage_from_inline(gchar *name, const guint8 *data, GkrellmPiximage **image, gchar *subdir, gboolean copy_pixels); void gkrellm_alert_commands_config(GkrellmAlert *alert, gboolean alarm, gboolean warn); void gkrellm_reset_alert_soft(GkrellmAlert *alert);</pre>See the GKrellM2 plugin programmers reference for descriptions.<h4>Changes for version 2.1.8</h4>New functions:<pre> void gkrellm_panel_label_on_top_of_decals(GkrellmPanel *p, gboolean mode); gboolean gkrellm_alert_is_activated(GkrellmAlert *alert); void gkrellm_alert_dup(GkrellmAlert **ap, GkrellmAlert *a_src); void gkrellm_alert_config_create_connect(GkrellmAlert *alert, void (*func)(), gpointer data); void gkrellm_alert_command_process_connect(GkrellmAlert *alert, void (*func)(), gpointer data); gboolean gkrellm_alert_decal_visible(GkrellmAlert *alert); void gkrellm_alert_set_delay(GkrellmAlert *alert, gint delay); void gkrellm_alert_delay_config(GkrellmAlert *alert, gint step, gint high, gint low); void gkrellm_gtk_alert_button(GtkWidget *box, GtkWidget **button, gboolean expand, gboolean fill, gint pad, gboolean pack_start, void (*cb_func)(), gpointer data);</pre>The GKrellM2 plugin programmers reference is updated with these functionsand now includes a link to a tutorial demo-alert.c.<h4>Changes for version 2.1.2 - 2.1.7</h4>None<h4>Changes for version 2.1.1</h4>Users can set a theme scale. Buttons made withgkrellm_make_scaled_button() and krells are automatically theme scaled, butplugins that have their own multi framedecal images will need a code change if they want the decal image to beuser scalable. This fragment shows a clean way to do it:<pre> gkrellm_load_piximae("foo", foo_xpm, &foo_piximage, FOO_STYLE_NAME);#if defined(GKRELLM_HAVE_THEME_SCALE) /* New function scales to multiple of frame height and does not require | the plugin to maintain a pixmap and mask. */ foo_decal = gkrellm_make_scaled_decal_pixmap(panel, foo_piximage, style, N_FOO_FRAMES, -1, -1, 0, 0);#else gkrellm_scale_piximage_to_pixmap(foo_piximage, &foo_pixmap, &foo_mask, 0, 0); foo_decal = gkrellm_create_decal_pixmap(p, foo_pixmap, foo_mask, N_FOO_FRAMES, style, -1, -1);#endif</pre>However, if the plugin needs to maintain the pixmap and mask, you canhandle things yourself byscaling the decal frame height by the theme_scale value andthen creating the pixmap height to be a multiple of the frame height:<pre>#if defined(GKRELLM_HAVE_THEME_SCALE) h = gdk_pixbuf_get_height(foo_piximage->pixbuf) / N_FOO_FRAMES; h *= gkrellm_get_theme_scale(); /* New function */ h *= N_FOO_FRAMES; w = -1; /* Scales to drawn image size * theme_scale */#else h = 0; /* Will scale to drawn image size */ w = 0;#endif gkrellm_scale_piximage_to_pixmap(foo_piximage, &foo_pixmap, &foo_mask, w, h); foo_decal = gkrellm_create_decal_pixmap(panel, foo_pixmap, foo_mask, N_FOO_FRAMES, style, -1, -1);</pre>Code that places decals relative to margins or to other decal/krellpositions and sizes should be fine, but if you place at hardwired locations,the x,y location values might need to bescaled by gkrellm_get_theme_scale() for things to look right when theuser changes the theme scale.<h4>Changes for version 2.1.0</h4>There is an issue with the new theming features in 2.1.0. There areonly two defined monitor types (chart and meter), but some monitorsare hybrids. The new spacer and cap theme images are applied basedon monitor type, but for hybrid monitors there is no way for gkrellmto determine which images should really be used. So there is anew function:<pre>gkrellm_spacers_set_types(GkrellmMonitor *mon, gint top, gint bottom);</pre>where top and bottom are GKRELLM_SPACER_CHART or GKRELLM_SPACER_METER.Hybrid monitors can now make this call to let gkrellm know what itis doing. See the builtin mem.c and my plugin gkrellmss (version 2.1)for examples of its usage.<h4>Changes for version 2.0.4</h4>None.<h4>Changes for version 2.0.3</h4><ul>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -