negative width within geometry

See github issue #72
This commit is contained in:
Sascha Kruse 2012-10-20 14:44:50 +02:00
parent f682519ea9
commit 78d7daed12
3 changed files with 16 additions and 1 deletions

14
dunst.c
View File

@ -559,7 +559,11 @@ void draw_win(void)
width = 0;
} else if (geometry.mask & WidthValue) {
/* fixed width */
width = geometry.w;
if (geometry.negative_width) {
width = scr.dim.w - geometry.w;
} else {
width = geometry.w;
}
} else {
/* across the screen */
width = scr.dim.w;
@ -1559,10 +1563,18 @@ int main(int argc, char *argv[])
init_shortcut(&history_ks);
if (geom[0] == '-') {
geometry.negative_width = True;
geom++;
} else {
geometry.negative_width = False;
}
geometry.mask = XParseGeometry(geom,
&geometry.x, &geometry.y,
&geometry.w, &geometry.h);
screensaver_info = XScreenSaverAllocInfo();
initdbus();

View File

@ -23,6 +23,7 @@ typedef struct _dimension_t {
unsigned int h;
unsigned int w;
int mask;
int negative_width;
} dimension_t;
typedef struct _screen_info {

View File

@ -43,6 +43,8 @@
# the window expands to the longest message displayed.
# A positive x is measured from the left, a negative from the
# right side of the screen. Y is measured from the top and down respectevly.
# The width can be negative. In this case the actual width is the
# screen width minus the width defined in within the geometry option.
geometry = "0x3-30+20"
# The transparency of the window. range: [0; 100]