big change : panel_monitor = all will draw one panel per monitor, panel_size accept percentage or pixel, update documentation, taskbar_mode = single_monitor show tasks of current monitor

git-svn-id: http://tint2.googlecode.com/svn/trunk@32 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
lorthiois@bbsoft.fr
2009-02-07 23:28:13 +00:00
parent 5b4d782ca2
commit 7393ceaf20
27 changed files with 1011 additions and 882 deletions

View File

@@ -27,6 +27,7 @@
#include "area.h"
#include "server.h"
#include "panel.h"
void refresh (Area *a)
@@ -37,13 +38,11 @@ void refresh (Area *a)
if (a->use_active)
draw(a, 1);
a->redraw = 0;
//printf("end draw pix\n");
}
Pixmap *pmap = (a->is_active == 0) ? (&a->pix.pmap) : (&a->pix_active.pmap);
// draw current Area
XCopyArea (server.dsp, *pmap, server.pmap, server.gc, 0, 0, a->width, a->height, a->posx, a->posy);
Pixmap *pmap = (a->is_active == 0) ? (&a->pix.pmap) : (&a->pix_active.pmap);
XCopyArea (server.dsp, *pmap, ((Panel *)a->panel)->root_pmap, server.gc, 0, 0, a->width, a->height, a->posx, a->posy);
// and then refresh child object
GSList *l = a->list;
@@ -71,7 +70,7 @@ void draw (Area *a, int active)
*pmap = XCreatePixmap (server.dsp, server.root_win, a->width, a->height, server.depth);
// add layer of root pixmap
XCopyArea (server.dsp, server.pmap, *pmap, server.gc, a->posx, a->posy, a->width, a->height, 0, 0);
XCopyArea (server.dsp, ((Panel *)a->panel)->root_pmap, *pmap, server.gc, a->posx, a->posy, a->width, a->height, 0, 0);
cairo_surface_t *cs;
cairo_t *c;
@@ -153,9 +152,8 @@ void draw_background (Area *a, cairo_t *c, int active)
void remove_area (Area *a)
{
Area *parent;
Area *parent = (Area*)a->parent;
parent = (Area*)a->parent;
parent->list = g_slist_remove(parent->list, a);
set_redraw (parent);
@@ -164,9 +162,8 @@ void remove_area (Area *a)
void add_area (Area *a)
{
Area *parent;
Area *parent = (Area*)a->parent;
parent = (Area*)a->parent;
parent->list = g_slist_remove(parent->list, a);
set_redraw (parent);

View File

@@ -80,6 +80,8 @@ typedef struct {
int paddingxlr, paddingx, paddingy;
// parent Area
void *parent;
// panel
void *panel;
// each object can overwrite following function
void (*draw_foreground)(void *obj, cairo_t *c, int active);

View File

@@ -1,6 +1,6 @@
/**************************************************************************
* Common declarations
*
*
**************************************************************************/
#ifndef COMMON_H
@@ -11,9 +11,6 @@
#include "area.h"
// taskbar table : convert 2 dimension in 1 dimension
#define index(i, j) ((i * panel.nb_monitor) + j)
/*
void fxfree(void** ptr){
if(*ptr){
@@ -33,6 +30,7 @@ FXint fxmalloc(void** ptr,unsigned long size){
// mouse actions
enum { NONE=0, CLOSE, TOGGLE, ICONIFY, SHADE, TOGGLE_ICONIFY };
#define ALLDESKTOP 0xFFFFFFFF
typedef struct config_border

View File

@@ -32,6 +32,7 @@
#include "common.h"
#include "window.h"
#include "server.h"
#include "panel.h"
@@ -70,7 +71,7 @@ int window_is_hidden (Window win)
Window window;
Atom *at;
int count, i;
if (XGetTransientForHint(server.dsp, win, &window) != 0) {
if (window) {
return 1;
@@ -78,7 +79,7 @@ int window_is_hidden (Window win)
}
at = server_get_property (win, server.atom._NET_WM_STATE, XA_ATOM, &count);
for (i = 0; i < count; i++) {
for (i = 0; i < count; i++) {
if (at[i] == server.atom._NET_WM_STATE_SKIP_PAGER || at[i] == server.atom._NET_WM_STATE_SKIP_TASKBAR) {
XFree(at);
return 1;
@@ -93,11 +94,16 @@ int window_is_hidden (Window win)
return 1;
}
}
XFree(at);
for (i=0 ; i < nb_panel ; i++) {
if (panel1[i].main_win == win)
return 1;
}
// specification
// Windows with neither _NET_WM_WINDOW_TYPE nor WM_TRANSIENT_FOR set
// MUST be taken as top-level window.
XFree(at);
return 0;
}
@@ -105,7 +111,7 @@ int window_is_hidden (Window win)
int window_get_desktop (Window win)
{
return get_property32(win, server.atom._NET_WM_DESKTOP, XA_CARDINAL);
}
}
int window_get_monitor (Window win)
@@ -113,13 +119,15 @@ int window_get_monitor (Window win)
int i, x, y;
Window src;
XTranslateCoordinates(server.dsp, win, server.root_win, 0, 0, &x, &y, &src);
XTranslateCoordinates(server.dsp, win, server.root_win, 0, 0, &x, &y, &src);
x += 2;
y += 2;
for (i = 0; i < server.nb_monitor; i++) {
if (x >= server.monitor[i].x && x <= (server.monitor[i].x + server.monitor[i].width))
if (y >= server.monitor[i].y && y <= (server.monitor[i].y + server.monitor[i].height))
break;
}
//printf("window %lx : ecran %d, (%d, %d)\n", win, i, x, y);
if (i == server.nb_monitor) return 0;
else return i;
@@ -213,7 +221,7 @@ long *get_best_icon (long *data, int icon_count, int num, int *iw, int *ih, int
}
}
}
*iw = width[icon_num];
*ih = height[icon_num];
return icon_data[icon_num];
@@ -228,17 +236,17 @@ void get_text_size(PangoFontDescription *font, int *height_ink, int *height, int
cairo_surface_t *cs = cairo_xlib_surface_create (server.dsp, pmap, server.visual, panel_height, panel_height);
cairo_t *c = cairo_create (cs);
PangoLayout *layout = pango_cairo_create_layout (c);
pango_layout_set_font_description (layout, font);
pango_layout_set_text (layout, text, len);
pango_layout_get_pixel_extents(layout, &rect_ink, &rect);
*height_ink = rect_ink.height;
*height = rect.height;
//printf("dimension : %d - %d\n", rect_ink.height, rect.height);
g_object_unref (layout);
g_object_unref (layout);
cairo_destroy (c);
cairo_surface_destroy (cs);
XFreePixmap (server.dsp, pmap);

View File

@@ -1,6 +1,6 @@
/**************************************************************************
* window :
* -
* window :
* -
*
* Check COPYING file for Copyright
*
@@ -12,13 +12,6 @@
#include <pango/pangocairo.h>
typedef struct window_global
{
Window main_win;
} window_global;
window_global window;
void set_active (Window win);
void set_desktop (int desktop);
void set_close (Window win);