Commit 9dd489c9 authored by Jens Secher's avatar Jens Secher

mercurial-importorig imported trayer version 1.1

parent 0252832a
trayer changelog
1.1
* multi monitor support
* add distancefrom parameter
* remove plugin handling code / code cleanup
1.0
* tray code extracted from the main fbpanel sources
* configuration using config file changed into command-line options
* positionx and positiony options removed
* distance option added
-----------------------------------------------------------------------------
fbpanel changes follow
-----------------------------------------------------------------------------
3.8
* warnings clean-up
* X11 memory leacher was fixed
* taskbar can be set to show only mapped/iconified and wins from other desktops
* transparency initial support
* gtkbar was ported to gtk2, so fbpanel is compiled with GTK_DISABLE_DEPRECETED
* initial dll support
3.7
* rounded corners (optional)
* taskbar view fix
3.6
* taskbar icon size fix
* menu icon size fix
* pager checks for drawable pixmap
3.5
* Drag-n-Drop for launchbar
* menu plugin
* removed limith for max task size in taskbar
3.4
* gtk2.2 linkage fix
* strut fix
* launchbar segfault on wrong config fix
* '&' at the end of action var in launchbar config is depreciated
3.3
* taskbar icon size fix
3.2
* scroll mouse in pager changes desktops
* packaging and makefiles now are ready for system wide install
additionally ./configure was implemented
* systray checks for another tray already running
3.1
* improving icon quility in taskbar
* system tray (aka notification area) support
* NET_WM_STRUT_PARTIAL and NET_WM_STRUT were implmented
* taskbar update icon image on every icon change
3.0
* official version bump :-)
3.0-rc-1
* porting to GTK2+. port is based on phako's patch
"[ 678749 ] make it compile and work with gtk2"
2.2
* support for XEmbed docklets via gtktray utility
2.1
* tray plugin was written
* documentation update
* web site update
2.0
* complete engine rewrite
* new plugin API
* pager fixes
1.4
* bug-fixes for pager plugin
1.3
* middle-click in taskbar will toggle shaded state of a window
* added image plugin - this is simple plugin that just shows an image
* pager eye-candy fixes
* close_module function update
1.2
* we've got new module - pager! Yeeaa-Haa!!
* segfault on wrong config file was fixed
1.1
* parsing engine was rewritten
* modules' static variables were converted to mallocs
* configurable size and postion of a panel
* ability to specify what modules to load
* '~' is accepted in config files
*
1.0
* 1.0-rc2 was released as 1.0
1.0-rc2
* taskbar config file was added an option to switch tooltips on/off
* added tooltips to taskbar (thanks to Joe MacDonald joe@deserted.net)
1.0-rc1
* copyright comments were changed
1.0-rc0
* added _NET_WM_STRUT support
* panel now is unfocusable. this fixes iconify bug under sawfish
* panel's height is calculated at run-time, instead of fixed 22
0.11
* improved EWMH/NETWM support
* added openbox support
* added clock customization (thanks to Tooar tooar@gmx.net)
* README was rewrited
* bug fixes
Copyright (C) 2005 Maciej "harnir" Delmanowski
Copyright (C) 2002 Anatoly Asviyan (aka Arsen)
Copyright (C) 2000 Peter Zelezny
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Soft-
ware"), to deal in the Software without restriction, including without
limitation the rights to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell copies of the Software, and to permit persons to
whom the Software is furnished to do so, subject to the following condi-
tions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Thanks goes to:
- Grzegorz Niewêg³owski <hoppke@dobremiasto.net> - code extraction from
fbpanel
- Rafal Bisingier <ravbc@man.poznan.pl> - conversion of configuration using
~/.fbpanel/* files to commandline options
- Thomas Rydzynski - added new option 'distance'
fbpanel credits follow
-----------------------------------------------------------------------------
I'd like to thank to GNOME project. I learn a lot from its code
and some pieces were used in fbpanel. Correct for version 3.0,
systray code and wm icon code were copied from GNOME
Credits to all people who contributed by writing code and solving
bugs.
Joe MacDonald <joeythesaint at users.sourceforge.net>
Jens Georg <phako at users.sourceforge.net>
and others
Credits and lot of thanks to Peter Zelezny <zed@linuxpower.org>
an author of fspanel (see http://www.chatjunkies.org/fspanel/
or http://freshmeat.net/projects/fspanel/)
The first version of fBpanel was started as hacking around fSpanel :-)
Installation:
1. Default way
Most users (99.99%) should use this way :-)
./confugire
make
su -
make install
2. Litle customization
Run ./configure --help to see supported options, then goto step 1
# Part 0
# load common stuff
TOPDIR = .
include $(TOPDIR)/Makefile.common
# Part 1
# recursive make
SRC = panel.c misc.c bg.c eggtraymanager.c eggmarshalers.c fixedtip.c main.c gdk-helper.c
OBJ = $(SRC:%.c=%.o)
DEP = $(SRC:%.c=%.dep)
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(MAKECMDGOALS),distclean)
ifneq ($(MAKECMDGOALS),tar)
-include $(DEP)
endif
endif
endif
TARGET = trayer
$(TARGET): $(OBJ)
$(CC) $(LDFLAGS) $(LIBS) $(OBJ) -o $@
ifeq (,$(DEVEL))
strip $@
endif
all: $(TARGET)
clean:
$(RM) $(TARGET) $(OBJ) $(DEP) *~
distclean:
rm -f Makefile.config config.h
install:
install -d $(PREFIX)/bin
install -m 755 $(TARGET) $(PREFIX)/bin
uninstall:
rm -f $(PREFIX)/bin/$(TARGET)
.PHONY: tar
CWD=$(shell pwd)
VER=$(shell grep -e "\#define[[:space:]]\+VERSION[[:space:]]\+" panel.c | \
sed -e 's/^[^\"]\+\"//' -e 's/\".*$$//' )
tar:
$(MAKE) distclean
cd ..; \
if [ -e trayer-$(VER) ]; then \
echo trayer-$(VER) already exist; \
echo "won't override";\
exit 1;\
else\
ln -s $(CWD) trayer-$(VER);\
tar --exclude CVS -hzcvf trayer-$(VER).tgz trayer-$(VER);\
rm -f trayer-$(VER);\
fi;
ifeq (,$(TOPDIR))
$(error TOPDIR variable must be defined)
endif
all:
$(TOPDIR)/Makefile.config:
$(error Please run $(TOPDIR)/configure first)
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(MAKECMDGOALS),distclean)
ifneq ($(MAKECMDGOALS),tar)
-include $(TOPDIR)/Makefile.config
endif
endif
endif
CC = gcc
LIBS = $(shell pkg-config --libs gtk+-2.0 gdk-pixbuf-2.0 gdk-pixbuf-xlib-2.0) -lX11 -L/usr/X11R6/lib -lXmu
INCS = $(shell pkg-config --cflags gtk+-2.0 gdk-pixbuf-2.0 gdk-pixbuf-xlib-2.0)
CFLAGS = -O2 # overwriten by command line or env. variable
CFLAGS += -Wall # always nice to have
ifneq (,$(DEVEL))
CFLAGS := -g -Wall
endif
# -DGTK_DISABLE_DEPRECATED does not work yet
CFLAGS += -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED
%.o: %.c
$(CC) $(CFLAGS) $(INCS) -c $<
%.dep: %.c
$(CC) $(CFLAGS) $(INCS) -MM $< -o $@
.PHONY: all clean distclean install uninstall
distclean: clean
install: all
PREFIX:=/usr
DEVEL:=
trayer-srg
NAME
trayer-srg is a lightweight GTK2-based systray for UNIX desktop
SYNOPSYS
trayer [OPTION]...
DESCRIPTION
trayer-srg was forked from trayer in january 2010 to add some
fancy features and clean up code.
trayer is small program designed to provide systray functionality present
in GNOME/KDE desktop enviroments for window managers wchich doesn't
support that function. It's similar to other applications such as
'peksystray' and 'docker'.
trayer code was extracted from fbpanel application, you can find more
about it on it's homepage: http://fbpanel.sourceforge.net/
You can find new versions of trayer and support on FVWM-Crystal
project homepage: http://fvwm-crystal.berlios.de/
There is also a debian maintained version of trayer, you
can find the mercurial repository on:
http://hg.debian.org/hg/collab-maint/trayer
You can find code of trayer-srg on his github page:
http://github.com/sargon/trayer-srg
OPTIONS
-h - prints help message and exits
-v - prints version and exits
--edge - screen edge to use <left|right|top|bottom>
--align - alignment <left|center|right>
--margin - length of margin in pixels
--distance - space between trayer's window and screen
edge
--distancefrom - Specifies which edge to calculate distance from, see
above.
--widthtype - how panel width is calculated:
request - follow widgets' size requests. can shrink
or grow dynamically
pixel - ocupy fixed number of pixels, then 'width'
variable holds a number
percent - be 'width' precent of an edge
--width - width of a panel (not used with --widthtype=request)
--heighttype - how panel height is calcilated:
pixel - ocupy fixed number of pixels, then 'height'
variable holds a number
--height - height of a panel in pixels
--SetDockTpe - Identify panel window type as dock <true|false>
--SetPartialStrut - Reserve panel's space so that it will not be covered
by maximazied windows <true|false>
--transparent - use transparency <true|false>
--tint - color used to "tint" background wallpaper
with
--alpha - pocentage of transparency <0-256>
--expand - specifies if trayer can accomodate extra
space or not <true|false>
--padding - extra space between trayer's window frame
and docked icons
--monitor - define the mointor on which you like
trayer to appear, number of zero to number
of monitors minus one
AUTHORS
Maciej Delmanowski <harnir@users.berlios.de>
Anatoly Asviyan <aanatoly@users.sf.net> - fbpanel
Rafal Bisingier <ravbc@man.poznan.pl> - conversion of configuration using ~/.fbpanel/* files to commandline options
Grzegorz Niewêg³owski <hoppke@dobremiasto.net> - code extraction from fbpanel
Thomas Rydzynski - added new option 'distance'
Keegan Carruthers-Smith <keegan.csmith@gmail.com> - fix align
Yury Akudovich - added new option distancefrom option
Jens Peter Secher <jps@debian.org> - various (debian trayer fork)
Daniel Ehlers - multi monitor support, code cleanup
TODO
====
REDUCE
------
+ remove remaining plugin overhead
after plugin loading/handling code is removed
the next step is to remove gtk code needed by
plugin behavior
+ clean up code
FANCY
-----
+ background color selectable
+ review image resizing
+ (code) documentation
- increase maintainbility
+ tray icon rendering
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include <X11/extensions/XShm.h>
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <gdk/gdkpixmap.h>
#include <gdk/gdkprivate.h>
#include "bg.h"
#include "dbg.h"
#include "config.h"
static Display *dpy;
//static int screen;
static Window xroot;
static Pixmap xrootbg = 0xc046ad;
static GC gc;
static Atom id = 0;
static Pixmap
bg_get_root_bg()
{
Pixmap ret;
ENTER;
ret = None;
if (id) {
int act_format, c = 2 ;
u_long nitems ;
u_long bytes_after ;
u_char *prop ;
Atom dummy_id;
do {
if (XGetWindowProperty(dpy, xroot, id, 0, 1,
False, XA_PIXMAP, &dummy_id, &act_format,
&nitems, &bytes_after, &prop) == Success) {
if (prop) {
ret = *((Pixmap *)prop);
XFree(prop);
break;
}
}
} while (--c > 0);
}
//fprintf(stderr, "_XROOTPMAP_ID = 0x%x\n", ret);
RET(ret);
}
GdkPixmap *
bg_new_for_win(Window win)
{
Window dummy;
Pixmap bgpix;
GdkPixmap *gbgpix;
unsigned int width, height ;
unsigned int border, depth;
int x, y;
ENTER;
XGetGeometry(dpy, win, &dummy, &x, &y, &width, &height, &border, &depth);
XTranslateCoordinates(dpy, win, xroot, 0, 0, &x, &y, &dummy);
gbgpix = gdk_pixmap_new(NULL, width, height, depth);
if (!gbgpix)
RET(NULL);
bgpix = gdk_x11_drawable_get_xid(gbgpix);
XSetTSOrigin(dpy, gc, -x, -y) ;
XFillRectangle(dpy, bgpix, gc, 0, 0, width, height);
RET(gbgpix);
}
void
bg_init(Display *dpyn)
{
XGCValues gcv;
uint mask;
ENTER;
dpy = dpyn;
id = XInternAtom(dpy, "_XROOTPMAP_ID", False);
xroot = DefaultRootWindow(dpy);
xrootbg = bg_get_root_bg();
gcv.ts_x_origin = 0;
gcv.ts_y_origin = 0;
gcv.fill_style = FillTiled;
mask = GCTileStipXOrigin | GCTileStipYOrigin | GCFillStyle;
if (xrootbg) {
gcv.tile = xrootbg;
mask |= GCTile ;
}
gc = XCreateGC (dpy, xroot, mask, &gcv) ;
RET();
}
void
bg_rootbg_changed()
{
ENTER;
xrootbg = bg_get_root_bg();
if (xrootbg != None) {
XGCValues gcv;
gcv.tile = xrootbg;
XChangeGC(dpy, gc, GCTile, &gcv);
DBG("changed\n");
}
RET();
}
void
bg_close()
{
ENTER;
XFreeGC(dpy, gc);
RET();
}
void
modify_drawable(GdkDrawable *base, GdkGC *gc, guint32 tintcolor, gint alpha)
{
int w, h;
GdkPixbuf *ret, *ret2;
static GdkColormap *cmap = NULL;
ENTER;
gdk_drawable_get_size (base, &w, &h);
if (!cmap) {
cmap = gdk_colormap_get_system ();
}
ret = gdk_pixbuf_get_from_drawable (NULL, base, cmap, 0, 0, 0, 0, w, h);
if (!ret)
RET();
ret2 = gdk_pixbuf_composite_color_simple(ret, w, h,
GDK_INTERP_HYPER, alpha, MIN(w, h), tintcolor, tintcolor);
//gdk_pixbuf_render_to_drawable (ret2, base, gc, 0, 0, 0, 0, w, h, GDK_RGB_DITHER_NONE, 0, 0);
gdk_draw_pixbuf (base, gc, ret2, 0, 0, 0, 0, w, h, GDK_RGB_DITHER_NONE, 0, 0);
g_object_unref(ret);
g_object_unref(ret2);
RET();
}
#ifdef TRANSPARENCY
#include <gdk/gdkwindow.h>
#include <gdk/gdkpixmap.h>
#include <gdk/gdkdrawable.h>
#include <gdk/gdkpixmap.h>
#include <gdk/gdkscreen.h>
typedef struct _GdkWindowPaint GdkWindowPaint;
struct _GdkWindowPaint
{
GdkRegion *region;
GdkPixmap *pixmap;
gint x_offset;
gint y_offset;
};
GdkGC *
gdk_window_get_bg_gc (GdkWindow *window,
GdkWindowPaint *paint)
{
GdkWindowObject *private = (GdkWindowObject *)window;
guint gc_mask = 0;
GdkGCValues gc_values;
ENTER;
if (private->bg_pixmap == GDK_PARENT_RELATIVE_BG && private->parent) {
GdkWindowPaint tmp_paint = *paint;
tmp_paint.x_offset += private->x;
tmp_paint.y_offset += private->y;
return gdk_window_get_bg_gc (GDK_WINDOW (private->parent), &tmp_paint);
} else if (private->bg_pixmap &&
private->bg_pixmap != GDK_PARENT_RELATIVE_BG &&
private->bg_pixmap != GDK_NO_BG) {
gc_values.fill = GDK_TILED;
gc_values.tile = private->bg_pixmap;
gc_values.ts_x_origin = -paint->x_offset;
gc_values.ts_y_origin = -paint->y_offset;
gc_mask = GDK_GC_FILL | GDK_GC_TILE | GDK_GC_TS_X_ORIGIN | GDK_GC_TS_Y_ORIGIN;
DBG("x_offset=%d y_offset=%d\n", paint->x_offset, paint->y_offset);
return gdk_gc_new_with_values (paint->pixmap, &gc_values, gc_mask);
} else {
GdkGC *gc = _gdk_drawable_get_scratch_gc (paint->pixmap, FALSE);
gdk_gc_set_foreground (gc, &(private->bg_color));
return g_object_ref (gc);
}
}
#endif
#ifndef _BG_H_
#define _BG_H_
#include <X11/X.h>
#include <gdk/gdk.h>
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
#include <glib.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
void bg_init();
void bg_rootbg_changed();
GdkPixmap *bg_new_for_win(Window win);
void modify_drawable(GdkDrawable *base, GdkGC *gc, guint32 tintcolor, gint alpha);
#endif
//created by ./configure script
#define PREFIX "/usr"
#include <stdio.h>
#define ERR(fmt, args...) fprintf(stderr, fmt, ## args)
#define DBG2(fmt, args...) fprintf(stderr, "%s:%-5d: " fmt, __FUNCTION__, __LINE__, ## args)
#define ENTER2 do { fprintf(stderr, "%s:%-5d: ENTER\n", __FUNCTION__, __LINE__); } while(0)
#define RET2(args...) do { fprintf(stderr, "%s:%-5d: RETURN\n", __FUNCTION__, __LINE__);\
return args; } while(0)
//#define DBG
#ifdef DBG
#define ENTER do { fprintf(stderr, "%s:%-5d: ENTER\n", __FUNCTION__, __LINE__); } while(0)
#define RET(args...) do { fprintf(stderr, "%s:%-5d: RETURN\n", __FUNCTION__, __LINE__);\
return args; } while(0)
#define DBG(fmt, args...) fprintf(stderr, "%s:%-5d: " fmt, __FUNCTION__, __LINE__, ## args)
#else
#define ENTER do { } while(0)
#define RET(args...) return args;
#define DBG(fmt, args...) do { } while(0)
#endif
#include <glib-object.h>
#ifdef G_ENABLE_DEBUG
#define g_marshal_value_peek_boolean(v) g_value_get_boolean (v)
#define g_marshal_value_peek_char(v) g_value_get_char (v)
#define g_marshal_value_peek_uchar(v) g_value_get_uchar (v)
#define g_marshal_value_peek_int(v) g_value_get_int (v)
#define g_marshal_value_peek_uint(v) g_value_get_uint (v)
#define g_marshal_value_peek_long(v) g_value_get_long (v)
#define g_marshal_value_peek_ulong(v) g_value_get_ulong (v)
#define g_marshal_value_peek_int64(v) g_value_get_int64 (v)
#define g_marshal_value_peek_uint64(v) g_value_get_uint64 (v)
#define g_marshal_value_peek_enum(v) g_value_get_enum (v)
#define g_marshal_value_peek_flags(v) g_value_get_flags (v)
#define g_marshal_value_peek_float(v) g_value_get_float (v)
#define g_marshal_value_peek_double(v) g_value_get_double (v)
#define g_marshal_value_peek_string(v) (char*) g_value_get_string (v)
#define g_marshal_value_peek_param(v) g_value_get_param (v)
#define g_marshal_value_peek_boxed(v) g_value_get_boxed (v)
#define g_marshal_value_peek_pointer(v) g_value_get_pointer (v)
#define g_marshal_value_peek_object(v) g_value_get_object (v)
#else /* !G_ENABLE_DEBUG */
/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API.
* Do not access GValues directly in your code. Instead, use the
* g_value_get_*() functions
*/
#define g_marshal_value_peek_boolean(v) (v)->data[0].v_int
#define g_marshal_value_peek_char(v) (v)->data[0].v_int
#define g_marshal_value_peek_uchar(v) (v)->data[0].v_uint
#define g_marshal_value_peek_int(v) (v)->data[0].v_int
#define g_marshal_value_peek_uint(v) (v)->data[0].v_uint
#define g_marshal_value_peek_long(v) (v)->data[0].v_long
#define g_marshal_value_peek_ulong(v) (v)->data[0].v_ulong
#define g_marshal_value_peek_int64(v) (v)->data[0].v_int64
#define g_marshal_value_peek_uint64(v) (v)->data[0].v_uint64
#define g_marshal_value_peek_enum(v) (v)->data[0].v_int
#define g_marshal_value_peek_flags(v) (v)->data[0].v_uint
#define g_marshal_value_peek_float(v) (v)->data[0].v_float
#define g_marshal_value_peek_double(v) (v)->data[0].v_double
#define g_marshal_value_peek_string(v) (v)->data[0].v_pointer
#define g_marshal_value_peek_param(v) (v)->data[0].v_pointer
#define g_marshal_value_peek_boxed(v) (v)->data[0].v_pointer
#define g_marshal_value_peek_pointer(v) (v)->data[0].v_pointer
#define g_marshal_value_peek_object(v) (v)->data[0].v_pointer
#endif /* !G_ENABLE_DEBUG */
/* VOID:OBJECT,OBJECT (eggmarshalers.list:1) */
void
_egg_marshal_VOID__OBJECT_OBJECT (GClosure *closure,
GValue *return_value,
guint n_param_values,
const GValue *param_values,
gpointer invocation_hint,
gpointer marshal_data)
{
typedef void (*GMarshalFunc_VOID__OBJECT_OBJECT) (gpointer data1,
gpointer arg_1,
gpointer arg_2,
gpointer data2);
register GMarshalFunc_VOID__OBJECT_OBJECT callback;
register GCClosure *cc = (GCClosure*) closure;
register gpointer data1, data2;
g_return_if_fail (n_param_values == 3);
if (G_CCLOSURE_SWAP_DATA (closure))
{
data1 = closure->data;
data2 = g_value_peek_pointer (param_values + 0);
}
else
{
data1 = g_value_peek_pointer (param_values + 0);
data2 = closure->data;
}
callback = (GMarshalFunc_VOID__OBJECT_OBJECT) (marshal_data ? marshal_data : cc->callback);
callback (data1,
g_marshal_value_peek_object (param_values + 1),
g_marshal_value_peek_object (param_values + 2),
data2);
}
/* VOID:OBJECT,STRING,LONG,LONG (eggmarshalers.list:2) */
void
_egg_marshal_VOID__OBJECT_STRING_LONG_LONG (GClosure *closure,
GValue *return_value,
guint n_param_values,
const GValue *param_values,
gpointer invocation_hint,
gpointer marshal_data)
{
typedef void (*GMarshalFunc_VOID__OBJECT_STRING_LONG_LONG) (gpointer data1,
gpointer arg_1,
gpointer arg_2,
glong arg_3,
glong arg_4,
gpointer data2);
register GMarshalFunc_VOID__OBJECT_STRING_LONG_LONG callback;
register GCClosure *cc = (GCClosure*) closure;
register gpointer data1, data2;
g_return_if_fail (n_param_values == 5);
if (G_CCLOSURE_SWAP_DATA (closure))
{
data1 = closure->data;
data2 = g_value_peek_pointer (param_values + 0);
}
else
{
data1 = g_value_peek_pointer (param_values + 0);
data2 = closure->data;
}
callback = (GMarshalFunc_VOID__OBJECT_STRING_LONG_LONG) (marshal_data ? marshal_data : cc->callback);
callback (data1,
g_marshal_value_peek_object (param_values + 1),
g_marshal_value_peek_string (param_values + 2),