moved monitor and follow_mode to config.h

This commit is contained in:
Sascha Kruse 2012-07-25 10:30:11 +02:00
parent 0750c5da0f
commit 7fe7938460
2 changed files with 20 additions and 7 deletions

View File

@ -20,6 +20,20 @@ enum alignment align = left; /* text alignment [left/center/right] */
int sticky_history = True; int sticky_history = True;
int verbosity = 0; int verbosity = 0;
/* monitor to display notifications on */
int monitor = 0;
/* follow focus to different monitor and display notifications there?
* possible values:
* FOLLOW_NONE
* FOLLOW_MOUSE
* FOLLOW_KEYBOARD
*
* everything else than FOLLOW_NONE overrides 'monitor'
*/
enum follow_mode f_mode = FOLLOW_NONE;
/* keyboard shortcuts */ /* keyboard shortcuts */
keyboard_shortcut close_ks = {.str = "ctrl+space", keyboard_shortcut close_ks = {.str = "ctrl+space",
.code = 0, .sym = NoSymbol,.is_valid = False}; /* ignore this */ .code = 0, .sym = NoSymbol,.is_valid = False}; /* ignore this */

13
dunst.c
View File

@ -77,7 +77,6 @@ static dimension_t geometry;
static XScreenSaverInfo *screensaver_info; static XScreenSaverInfo *screensaver_info;
static int font_h; static int font_h;
static enum follow_mode f_mode = FOLLOW_NONE;
int next_notification_id = 1; int next_notification_id = 1;
@ -958,7 +957,7 @@ Window get_focused_window(void)
int select_screen(XineramaScreenInfo * info, int info_len) int select_screen(XineramaScreenInfo * info, int info_len)
{ {
if (f_mode == FOLLOW_NONE) { if (f_mode == FOLLOW_NONE) {
return scr.scr; return monitor;
} else { } else {
int x, y; int x, y;
@ -980,7 +979,7 @@ int select_screen(XineramaScreenInfo * info, int info_len)
if (focused == 0) { if (focused == 0) {
/* something went wrong. Fallback to default */ /* something went wrong. Fallback to default */
return scr.scr; return monitor;
} }
Window child_return; Window child_return;
@ -997,7 +996,7 @@ int select_screen(XineramaScreenInfo * info, int info_len)
} }
/* something seems to be wrong. Fallback to default */ /* something seems to be wrong. Fallback to default */
return scr.scr; return monitor;
} }
} }
@ -1005,15 +1004,15 @@ void update_screen_info()
{ {
#ifdef XINERAMA #ifdef XINERAMA
int n; int n;
int screen = 0; int screen = monitor;
XineramaScreenInfo *info; XineramaScreenInfo *info;
#endif #endif
#ifdef XINERAMA #ifdef XINERAMA
if ((info = XineramaQueryScreens(dc->dpy, &n))) { if ((info = XineramaQueryScreens(dc->dpy, &n))) {
screen = select_screen(info, n); screen = select_screen(info, n);
if (screen >= n) { if (screen >= n) {
fprintf(stderr, "Monitor %d not found\n", screen); /* invalid monitor, fallback to default */
exit(EXIT_FAILURE); screen = 0;
} }
scr.dim.x = info[screen].x_org; scr.dim.x = info[screen].x_org;
scr.dim.y = info[screen].y_org; scr.dim.y = info[screen].y_org;