Mercurial > dwindows
changeset 1223:1255ba41adad
Added taskbar support for GTK...
This will only work for desktops running Gnome...
It will do nothing for Unity/KDE desktops.
GTK3 support is tested.... will test GTK2 after committing.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Mon, 10 Oct 2011 04:38:45 +0000 |
parents | aac69b11e821 |
children | cfe8608253a8 |
files | gtk/dw.c gtk3/dw.c readme |
diffstat | 3 files changed, 79 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/gtk/dw.c Mon Oct 10 02:54:27 2011 +0000 +++ b/gtk/dw.c Mon Oct 10 04:38:45 2011 +0000 @@ -7561,6 +7561,24 @@ DW_MUTEX_UNLOCK; } +#if GTK_CHECK_VERSION(2,10,0) +/* Translate the status message into a message on our buddy window */ +static void _status_translate(GtkStatusIcon *status_icon, guint button, guint activate_time, gpointer user_data) +{ + GdkEventButton event = { 0 }; + long x, y; + gboolean retval; + + dw_pointer_query_pos(&x, &y); + + event.button = button; + event.x = x; + event.y = y; + + g_signal_emit_by_name(G_OBJECT(user_data), "button_press_event", &event, &retval); +} +#endif + /* * Inserts an icon into the taskbar. * Parameters: @@ -7570,7 +7588,21 @@ */ void dw_taskbar_insert(HWND handle, HICN icon, char *bubbletext) { - /* TODO */ +#if GTK_CHECK_VERSION(2,10,0) + GtkStatusIcon *status; + GdkPixbuf *pixbuf; + int _locked_by_me = FALSE; + + DW_MUTEX_LOCK; + pixbuf = _find_pixbuf(icon); + status = gtk_status_icon_new_from_pixbuf(pixbuf); + if(bubbletext) + gtk_status_icon_set_tooltip_text(status, bubbletext); + g_object_set_data(G_OBJECT(handle), "_dw_taskbar", status); + g_signal_connect(G_OBJECT (status), "popup-menu", G_CALLBACK (_status_translate), handle); + gtk_status_icon_set_visible(status, TRUE); + DW_MUTEX_UNLOCK; +#endif } /* @@ -7581,7 +7613,15 @@ */ void dw_taskbar_delete(HWND handle, HICN icon) { - /* TODO */ +#if GTK_CHECK_VERSION(2,10,0) + GtkStatusIcon *status; + int _locked_by_me = FALSE; + + DW_MUTEX_LOCK; + status = g_object_get_data(G_OBJECT(handle), "_dw_taskbar"); + g_object_unref(G_OBJECT(status)); + DW_MUTEX_UNLOCK; +#endif } /*
--- a/gtk3/dw.c Mon Oct 10 02:54:27 2011 +0000 +++ b/gtk3/dw.c Mon Oct 10 04:38:45 2011 +0000 @@ -6507,6 +6507,22 @@ DW_MUTEX_UNLOCK; } +/* Translate the status message into a message on our buddy window */ +static void _status_translate(GtkStatusIcon *status_icon, guint button, guint activate_time, gpointer user_data) +{ + GdkEventButton event = { 0 }; + long x, y; + gboolean retval; + + dw_pointer_query_pos(&x, &y); + + event.button = button; + event.x = x; + event.y = y; + + g_signal_emit_by_name(G_OBJECT(user_data), "button_press_event", &event, &retval); +} + /* * Inserts an icon into the taskbar. * Parameters: @@ -6516,7 +6532,19 @@ */ void dw_taskbar_insert(HWND handle, HICN icon, char *bubbletext) { - /* TODO */ + GtkStatusIcon *status; + GdkPixbuf *pixbuf; + int _locked_by_me = FALSE; + + DW_MUTEX_LOCK; + pixbuf = _find_pixbuf(icon, NULL, NULL); + status = gtk_status_icon_new_from_pixbuf(pixbuf); + if(bubbletext) + gtk_status_icon_set_tooltip_text(status, bubbletext); + g_object_set_data(G_OBJECT(handle), "_dw_taskbar", status); + g_signal_connect(G_OBJECT (status), "popup-menu", G_CALLBACK (_status_translate), handle); + gtk_status_icon_set_visible(status, TRUE); + DW_MUTEX_UNLOCK; } /* @@ -6527,7 +6555,13 @@ */ void dw_taskbar_delete(HWND handle, HICN icon) { - /* TODO */ + GtkStatusIcon *status; + int _locked_by_me = FALSE; + + DW_MUTEX_LOCK; + status = g_object_get_data(G_OBJECT(handle), "_dw_taskbar"); + g_object_unref(G_OBJECT(status)); + DW_MUTEX_UNLOCK; } /*
--- a/readme Mon Oct 10 02:54:27 2011 +0000 +++ b/readme Mon Oct 10 04:38:45 2011 +0000 @@ -54,7 +54,7 @@ which just call dw_container_set/change_row_title() but with (void *). Added dw_container_set_row_bg() to set alternating row colors. Currently Mac, Win and GTK are supported. -Added taskbar support on the Mac. +Added taskbar support on the Mac and GTK. Improved container optimization on Mac, header width now taken into account. Fixes for incorrect return codes from the dw_event_* functions on Windows. Fixes for incorrect behavior on key_press callbacks on Mac and Windows.