update screen info before mapping window

This commit is contained in:
Sascha Kruse 2012-07-07 04:10:21 +02:00
parent 880c8fcbe4
commit 4feac25664

44
dunst.c
View File

@ -114,6 +114,7 @@ char *string_replace(const char *needle, const char *replacement,
char *strtrim(char *str);
void run(void);
void setup(void);
void update_screen_info();
void usage(int exit_status);
void hide_window();
l_node *most_important(list * l);
@ -859,28 +860,12 @@ void hide_win()
visible = False;
}
void setup(void)
void update_screen_info()
{
Window root;
XSetWindowAttributes wa;
KeyCode code;
#ifdef XINERAMA
int n;
XineramaScreenInfo *info;
#endif
notification_queue = l_init();
notification_history = l_init();
displayed_notifications = l_init();
if (scr.scr < 0) {
scr.scr = DefaultScreen(dc->dpy);
}
root = RootWindow(dc->dpy, DefaultScreen(dc->dpy));
utf8 = XInternAtom(dc->dpy, "UTF8_STRING", False);
/* menu geometry */
font_h = dc->font.height + FONT_HEIGHT_BORDER;
#ifdef XINERAMA
if ((info = XineramaQueryScreens(dc->dpy, &n))) {
if (scr.scr >= n) {
@ -900,6 +885,29 @@ void setup(void)
scr.dim.w = DisplayWidth(dc->dpy, scr.scr);
scr.dim.h = DisplayHeight(dc->dpy, scr.scr);
}
}
void setup(void)
{
Window root;
XSetWindowAttributes wa;
KeyCode code;
notification_queue = l_init();
notification_history = l_init();
displayed_notifications = l_init();
if (scr.scr < 0) {
scr.scr = DefaultScreen(dc->dpy);
}
root = RootWindow(dc->dpy, DefaultScreen(dc->dpy));
utf8 = XInternAtom(dc->dpy, "UTF8_STRING", False);
/* menu geometry */
font_h = dc->font.height + FONT_HEIGHT_BORDER;
update_screen_info();
/* menu window */
wa.override_redirect = True;
wa.background_pixmap = ParentRelative;
@ -935,6 +943,8 @@ void map_win(void)
return;
}
update_screen_info();
XMapRaised(dc->dpy, win);
XGrabButton(dc->dpy, AnyButton, AnyModifier, win, False,
BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);