]>
Dogcows Code - chaz/tint2/blob - src/freespace/freespace.c
1 /**************************************************************************
5 * Copyright (C) 2011 Mishael A Sibiryakov (death@junki.org)
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License version 2
9 * as published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 **************************************************************************/
24 #include <cairo-xlib.h>
25 #include <pango/pangocairo.h>
31 #include "freespace.h"
39 void init_freespace_panel(void *p
)
41 Panel
*panel
=(Panel
*)p
;
42 FreeSpace
*fsp
= &panel
->freespace
;
44 if (fsp
->area
.bg
== 0)
45 fsp
->area
.bg
= &g_array_index(backgrounds
, Background
, 0);
48 fsp
->area
.size_mode
= SIZE_BY_CONTENT
;
50 fsp
->area
.on_screen
= 1;
51 fsp
->area
._resize
= resize_freespace
;
54 int freespace_get_max_size(Panel
*p
, SpaceType t
) {
60 // Get space used by every element except the freespace
61 for (walk
= p
->area
.list
; walk
; walk
= g_slist_next(walk
)) {
62 a
= (Area
*)walk
->data
;
65 if (a
->_resize
== resize_freespace
)
69 sz
+= a
->width
+ (a
->bg
->border
.width
* 2) + p
->area
.paddingx
;
71 if (t
== COUNT_HEIGHT
)
72 sz
+= a
->height
+ (a
->bg
->border
.width
* 2) + p
->area
.paddingy
;
76 sz
= p
->area
.width
- sz
- (p
->area
.bg
->border
.width
* 2) - p
->area
.paddingxlr
;
78 if (t
== COUNT_HEIGHT
)
79 sz
= p
->area
.height
- sz
- (p
->area
.bg
->border
.width
* 2) - p
->area
.paddingxlr
; // Not sure about paddingxlr
84 int resize_freespace(void *obj
) {
86 FreeSpace
*fsp
= (FreeSpace
*)obj
;
87 Panel
*panel
= (Panel
*)fsp
->area
.panel
;
92 fsp
->area
.width
= freespace_get_max_size(panel
, COUNT_WIDTH
);
94 fsp
->area
.height
= freespace_get_max_size(panel
, COUNT_HEIGHT
);
This page took 0.031926 seconds and 4 git commands to generate.