1
0
mirror of https://github.com/moparisthebest/FireTray synced 2024-12-24 06:48:48 -05:00

continue implementation for text icon

This commit is contained in:
foudfou 2011-09-10 01:47:26 +02:00
parent 6737a670e5
commit b62cdf9b78
4 changed files with 44 additions and 9 deletions

View File

@ -208,6 +208,8 @@ mozt.Handler = {
shutdown: function() { // NOT USED YET shutdown: function() { // NOT USED YET
if (this._inMailApp) if (this._inMailApp)
mozt.Messaging.disable(); mozt.Messaging.disable();
mozt.IconLinux.shutdown();
} }
}; // mozt.Handler }; // mozt.Handler

View File

@ -90,6 +90,13 @@ mozt.IconLinux = {
return true; return true;
}, },
shutdown: function() {
gobject.close();
gdk.close();
gtk.close();
// glib.close();
},
setImage: function(filename) { setImage: function(filename) {
if (!this.trayIcon) if (!this.trayIcon)
return false; return false;
@ -152,7 +159,9 @@ mozt.IconLinux = {
// { // {
// GdkColormap* cmap=gdk_screen_get_system_colormap(gdk_screen_get_default()) // GdkColormap* cmap=gdk_screen_get_system_colormap(gdk_screen_get_default())
// int screen_depth=24; // int screen_depth=24;
// if(cmap) screen_depth=cmap->visual->depth; // if(cmap)
// GdkVisual* visual = gdk_colormap_get_visual(cmap);
// screen_depth=visual->depth;
// GdkColor fore = { 0, 0, 0, 0 }; // GdkColor fore = { 0, 0, 0, 0 };
// GdkColor alpha = { 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF}; // GdkColor alpha = { 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF};
// if( gdk_color_parse (colorstr, &fore) ) DEBUGSTR("COLOR OK") // if( gdk_color_parse (colorstr, &fore) ) DEBUGSTR("COLOR OK")
@ -161,6 +170,7 @@ mozt.IconLinux = {
// alpha.red=0; //make sure alpha is different from fore // alpha.red=0; //make sure alpha is different from fore
// gdk_colormap_alloc_color (cmap, &fore,true,true); // gdk_colormap_alloc_color (cmap, &fore,true,true);
// gdk_colormap_alloc_color (cmap, &alpha,true,true); // gdk_colormap_alloc_color (cmap, &alpha,true,true);
// GdkPixmap *pm = gdk_pixmap_new (NULL, w, h, screen_depth); // GdkPixmap *pm = gdk_pixmap_new (NULL, w, h, screen_depth);
// GdkGC *gc = gdk_gc_new (pm); // GdkGC *gc = gdk_gc_new (pm);
// gdk_gc_set_foreground(gc,&alpha); // gdk_gc_set_foreground(gc,&alpha);

View File

@ -55,13 +55,31 @@ function gdk_defines(lib) {
this.GDK_INTERP_NEAREST = 1, // GdkInterpType this.GDK_INTERP_NEAREST = 1, // GdkInterpType
this.GdkWindow = ctypes.StructType("GdkWindow"); this.GdkWindow = ctypes.StructType("GdkWindow");
this.GdkVisual = ctypes.StructType("GdkVisual"); this.GdkByteOrder = ctype.StructType("GdkByteOrder");
this.GdkColor = ctypes.StructType("GdkColor"), [ this.GdkVisualType = ctype.StructType("GdkVisualType");
this.GdkVisual = ctypes.StructType("GdkVisual", [
{ "parent_instance": gobject.GObject },
{ "type": this.GdkVisualType },
{ "depth": gobject.gint },
{ "byte": this.GdkByteOrder },
{ "colormap": gobject.gint },
{ "bits": gobject.gint },
{ "red_mask": gobject.guint32 },
{ "red_shift": gobject.gint },
{ "red_prec": gobject.gint },
{ "green_mask": gobject.guint32 },
{ "green_shift": gobject.gint },
{ "green_prec": gobject.gint },
{ "blue_mask": gobject.guint32 },
{ "blue_shift": gobject.gint },
{ "blue_prec": gobject.gint }
]);
this.GdkColor = ctypes.StructType("GdkColor", [
{ "pixel": gobject.guint32 }, { "pixel": gobject.guint32 },
{ "red": gobject.guint16 }, { "red": gobject.guint16 },
{ "green": gobject.guint16 }, { "green": gobject.guint16 },
{ "blue": gobject.guint16 } { "blue": gobject.guint16 }
]; ]);
this.GdkColormap = ctypes.StructType("GdkColormap", [ this.GdkColormap = ctypes.StructType("GdkColormap", [
{ "size": gobject.gint }, { "size": gobject.gint },
{ "colors": this.GdkColor.ptr } { "colors": this.GdkColor.ptr }
@ -101,6 +119,12 @@ function gdk_defines(lib) {
lib.lazy_bind("gdk_pixbuf_get_height", ctypes.int, this.GdkPixbuf.ptr); lib.lazy_bind("gdk_pixbuf_get_height", ctypes.int, this.GdkPixbuf.ptr);
lib.lazy_bind("gdk_pixbuf_composite", ctypes.void_t, this.GdkPixbuf.ptr, this.GdkPixbuf.ptr, ctypes.int, ctypes.int, ctypes.int, ctypes.int, ctypes.double, ctypes.double, ctypes.double, ctypes.double, ctypes.int, ctypes.int); lib.lazy_bind("gdk_pixbuf_composite", ctypes.void_t, this.GdkPixbuf.ptr, this.GdkPixbuf.ptr, ctypes.int, ctypes.int, ctypes.int, ctypes.int, ctypes.double, ctypes.double, ctypes.double, ctypes.double, ctypes.int, ctypes.int);
lib.lazy_bind("gdk_screen_get_system_colormap", this.GdkColormap.ptr, this.GdkScreen.ptr); lib.lazy_bind("gdk_screen_get_system_colormap", this.GdkColormap.ptr, this.GdkScreen.ptr);
lib.lazy_bind("gdk_colormap_get_visual", this.GdkVisual.ptr, this.GdkColormap.ptr);
lib.lazy_bind("gdk_color_parse", gobject.gboolean, gobject.gchar.ptr, this.GdkColor.ptr);
lib.lazy_bind("gdk_colormap_alloc_color", gobject.gboolean, this.GdkColormap.ptr, this.GdkColor.ptr, gobject.gboolean, gobject.gboolean);
// gdk_pixmap_new
// gdk_gc_new
} }

View File

@ -45,8 +45,7 @@ function gtk_defines(lib) {
this.GtkMenuShell = ctypes.StructType("GtkMenuShell"); this.GtkMenuShell = ctypes.StructType("GtkMenuShell");
this.GtkImageMenuItem = ctypes.StructType("GtkImageMenuItem"); this.GtkImageMenuItem = ctypes.StructType("GtkImageMenuItem");
// FIXME: rename to "_t" this.GtkMenuPositionFunc_t = ctypes.FunctionType(
this.GtkMenuPositionFunc = ctypes.FunctionType(
ctypes.default_abi, ctypes.void_t, ctypes.default_abi, ctypes.void_t,
[this.GtkMenu.ptr, gobject.gint.ptr, gobject.gint.ptr, [this.GtkMenu.ptr, gobject.gint.ptr, gobject.gint.ptr,
gobject.gboolean.ptr, gobject.gpointer]).ptr; gobject.gboolean.ptr, gobject.gpointer]).ptr;
@ -72,7 +71,7 @@ function gtk_defines(lib) {
lib.lazy_bind("gtk_widget_show_all", ctypes.void_t, this.GtkWidget.ptr); lib.lazy_bind("gtk_widget_show_all", ctypes.void_t, this.GtkWidget.ptr);
lib.lazy_bind("gtk_menu_popup", ctypes.void_t, lib.lazy_bind("gtk_menu_popup", ctypes.void_t,
this.GtkMenu.ptr, this.GtkWidget.ptr, this.GtkWidget.ptr, this.GtkMenu.ptr, this.GtkWidget.ptr, this.GtkWidget.ptr,
this.GtkMenuPositionFunc, gobject.gpointer, gobject.guint, this.GtkMenuPositionFunc_t, gobject.gpointer, gobject.guint,
gobject.guint); gobject.guint);
lib.lazy_bind("gtk_status_icon_position_menu", ctypes.void_t, lib.lazy_bind("gtk_status_icon_position_menu", ctypes.void_t,
this.GtkMenu.ptr, gobject.gint.ptr, gobject.gint.ptr, this.GtkMenu.ptr, gobject.gint.ptr, gobject.gint.ptr,