Continue to simplify interfaces that require arguments in globalconf.
Today I focus on screen.c.
This commit is contained in:
parent
205f2c55ca
commit
965cbb7e0b
16
awesome.c
16
awesome.c
|
@ -170,7 +170,7 @@ scan()
|
||||||
if(wa.map_state == IsViewable || window_getstate(globalconf.display, wins[i]) == IconicState)
|
if(wa.map_state == IsViewable || window_getstate(globalconf.display, wins[i]) == IconicState)
|
||||||
{
|
{
|
||||||
if(screen == 0)
|
if(screen == 0)
|
||||||
real_screen = get_screen_bycoord(globalconf.display, wa.x, wa.y);
|
real_screen = get_screen_bycoord(wa.x, wa.y);
|
||||||
client_manage(wins[i], &wa, real_screen);
|
client_manage(wins[i], &wa, real_screen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -183,7 +183,7 @@ scan()
|
||||||
&& (wa.map_state == IsViewable || window_getstate(globalconf.display, wins[i]) == IconicState))
|
&& (wa.map_state == IsViewable || window_getstate(globalconf.display, wins[i]) == IconicState))
|
||||||
{
|
{
|
||||||
if(screen == 0)
|
if(screen == 0)
|
||||||
real_screen = get_screen_bycoord(globalconf.display, wa.x, wa.y);
|
real_screen = get_screen_bycoord(wa.x, wa.y);
|
||||||
client_manage(wins[i], &wa, real_screen);
|
client_manage(wins[i], &wa, real_screen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -213,10 +213,12 @@ setup(int screen)
|
||||||
wa.cursor = globalconf.cursor[CurNormal];
|
wa.cursor = globalconf.cursor[CurNormal];
|
||||||
|
|
||||||
XChangeWindowAttributes(globalconf.display,
|
XChangeWindowAttributes(globalconf.display,
|
||||||
RootWindow(globalconf.display, get_phys_screen(globalconf.display, screen)),
|
RootWindow(globalconf.display, get_phys_screen(screen)),
|
||||||
CWEventMask | CWCursor, &wa);
|
CWEventMask | CWCursor, &wa);
|
||||||
|
|
||||||
XSelectInput(globalconf.display, RootWindow(globalconf.display, get_phys_screen(globalconf.display, screen)), wa.event_mask);
|
XSelectInput(globalconf.display,
|
||||||
|
RootWindow(globalconf.display, get_phys_screen(screen)),
|
||||||
|
wa.event_mask);
|
||||||
|
|
||||||
grabkeys(screen);
|
grabkeys(screen);
|
||||||
}
|
}
|
||||||
|
@ -331,14 +333,14 @@ main(int argc, char *argv[])
|
||||||
XSetErrorHandler(NULL);
|
XSetErrorHandler(NULL);
|
||||||
xerrorxlib = XSetErrorHandler(xerror);
|
xerrorxlib = XSetErrorHandler(xerror);
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
|
globalconf.display = dpy;
|
||||||
|
|
||||||
globalconf.screens = p_new(VirtScreen, get_screen_count(dpy));
|
globalconf.screens = p_new(VirtScreen, get_screen_count());
|
||||||
focus_add_client(NULL);
|
focus_add_client(NULL);
|
||||||
/* store display */
|
/* store display */
|
||||||
globalconf.display = dpy;
|
|
||||||
config_parse(confpath);
|
config_parse(confpath);
|
||||||
|
|
||||||
for(screen = 0; screen < get_screen_count(dpy); screen++)
|
for(screen = 0; screen < get_screen_count(); screen++)
|
||||||
{
|
{
|
||||||
/* set screen */
|
/* set screen */
|
||||||
setup_screen(screen);
|
setup_screen(screen);
|
||||||
|
|
20
client.c
20
client.c
|
@ -240,7 +240,7 @@ focus(Client *c, Bool selscreen, int screen)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
XSetInputFocus(globalconf.display,
|
XSetInputFocus(globalconf.display,
|
||||||
RootWindow(globalconf.display, get_phys_screen(globalconf.display, screen)),
|
RootWindow(globalconf.display, get_phys_screen(screen)),
|
||||||
RevertToPointerRoot, CurrentTime);
|
RevertToPointerRoot, CurrentTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,8 +268,8 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
|
||||||
c->oldborder = wa->border_width;
|
c->oldborder = wa->border_width;
|
||||||
|
|
||||||
c->display = globalconf.display;
|
c->display = globalconf.display;
|
||||||
c->screen = get_screen_bycoord(c->display, c->x, c->y);
|
c->screen = get_screen_bycoord(c->x, c->y);
|
||||||
c->phys_screen = get_phys_screen(globalconf.display, c->screen);
|
c->phys_screen = get_phys_screen(c->screen);
|
||||||
|
|
||||||
move_client_to_screen(c, screen, True);
|
move_client_to_screen(c, screen, True);
|
||||||
|
|
||||||
|
@ -280,7 +280,7 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
|
||||||
if(!client_loadprops(c, screen))
|
if(!client_loadprops(c, screen))
|
||||||
tag_client_with_rules(c);
|
tag_client_with_rules(c);
|
||||||
|
|
||||||
screen_info = get_screen_info(globalconf.display, screen, NULL, NULL);
|
screen_info = get_screen_info(screen, NULL, NULL);
|
||||||
|
|
||||||
/* if window request fullscreen mode */
|
/* if window request fullscreen mode */
|
||||||
if(c->w == screen_info[screen].width && c->h == screen_info[screen].height)
|
if(c->w == screen_info[screen].width && c->h == screen_info[screen].height)
|
||||||
|
@ -292,7 +292,9 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ScreenInfo *display_info = get_display_info(c->display, c->phys_screen, globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
ScreenInfo *display_info = get_display_info(c->phys_screen,
|
||||||
|
globalconf.screens[screen].statusbar,
|
||||||
|
&globalconf.screens[screen].padding);
|
||||||
|
|
||||||
if(c->x + c->w + 2 * c->border > display_info->x_org + display_info->width)
|
if(c->x + c->w + 2 * c->border > display_info->x_org + display_info->width)
|
||||||
c->x = c->rx = display_info->x_org + display_info->width - c->w - 2 * c->border;
|
c->x = c->rx = display_info->x_org + display_info->width - c->w - 2 * c->border;
|
||||||
|
@ -409,7 +411,9 @@ client_resize(Client *c, int x, int y, int w, int h,
|
||||||
if(w <= 0 || h <= 0)
|
if(w <= 0 || h <= 0)
|
||||||
return;
|
return;
|
||||||
/* offscreen appearance fixes */
|
/* offscreen appearance fixes */
|
||||||
si = get_display_info(c->display, c->phys_screen, NULL, &globalconf.screens[c->screen].padding);
|
si = get_display_info(c->phys_screen,
|
||||||
|
NULL,
|
||||||
|
&globalconf.screens[c->screen].padding);
|
||||||
if(x > si->width)
|
if(x > si->width)
|
||||||
x = si->width - w - 2 * c->border;
|
x = si->width - w - 2 * c->border;
|
||||||
if(y > si->height)
|
if(y > si->height)
|
||||||
|
@ -440,7 +444,7 @@ client_resize(Client *c, int x, int y, int w, int h,
|
||||||
XSync(c->display, False);
|
XSync(c->display, False);
|
||||||
if((c->x >= 0 || c->y >= 0) && XineramaIsActive(c->display))
|
if((c->x >= 0 || c->y >= 0) && XineramaIsActive(c->display))
|
||||||
{
|
{
|
||||||
int new_screen = get_screen_bycoord(c->display, c->x, c->y);
|
int new_screen = get_screen_bycoord(c->x, c->y);
|
||||||
if(c->screen != new_screen)
|
if(c->screen != new_screen)
|
||||||
move_client_to_screen(c, new_screen, False);
|
move_client_to_screen(c, new_screen, False);
|
||||||
}
|
}
|
||||||
|
@ -712,7 +716,7 @@ uicb_client_moveresize(int screen, char *arg)
|
||||||
ow = sel->w;
|
ow = sel->w;
|
||||||
oh = sel->h;
|
oh = sel->h;
|
||||||
|
|
||||||
Bool xqp = XQueryPointer(globalconf.display, RootWindow(globalconf.display, get_phys_screen(globalconf.display, screen)), &dummy, &dummy, &mx, &my, &dx, &dy, &dui);
|
Bool xqp = XQueryPointer(globalconf.display, RootWindow(globalconf.display, get_phys_screen(screen)), &dummy, &dummy, &mx, &my, &dx, &dy, &dui);
|
||||||
client_resize(sel, nx, ny, nw, nh, True, False);
|
client_resize(sel, nx, ny, nw, nh, True, False);
|
||||||
if (xqp && ox <= mx && (ox + ow) >= mx && oy <= my && (oy + oh) >= my)
|
if (xqp && ox <= mx && (ox + ow) >= mx && oy <= my && (oy + oh) >= my)
|
||||||
{
|
{
|
||||||
|
|
18
config.c
18
config.c
|
@ -505,7 +505,7 @@ config_parse(const char *confpatharg)
|
||||||
cfg_error(cfg, "awesome: parsing configuration file %s failed.\n", confpath);
|
cfg_error(cfg, "awesome: parsing configuration file %s failed.\n", confpath);
|
||||||
|
|
||||||
/* get the right screen section */
|
/* get the right screen section */
|
||||||
for(screen = 0; screen < get_screen_count(globalconf.display); screen++)
|
for(screen = 0; screen < get_screen_count(); screen++)
|
||||||
{
|
{
|
||||||
virtscreen = &globalconf.screens[screen];
|
virtscreen = &globalconf.screens[screen];
|
||||||
snprintf(buf, sizeof(buf), "%d", screen);
|
snprintf(buf, sizeof(buf), "%d", screen);
|
||||||
|
@ -537,28 +537,28 @@ config_parse(const char *confpatharg)
|
||||||
virtscreen->focus_move_pointer = cfg_getbool(cfg_general, "focus_move_pointer");
|
virtscreen->focus_move_pointer = cfg_getbool(cfg_general, "focus_move_pointer");
|
||||||
virtscreen->allow_lower_floats = cfg_getbool(cfg_general, "allow_lower_floats");
|
virtscreen->allow_lower_floats = cfg_getbool(cfg_general, "allow_lower_floats");
|
||||||
virtscreen->font = XftFontOpenName(globalconf.display,
|
virtscreen->font = XftFontOpenName(globalconf.display,
|
||||||
get_phys_screen(globalconf.display, screen),
|
get_phys_screen(screen),
|
||||||
cfg_getstr(cfg_general, "font"));
|
cfg_getstr(cfg_general, "font"));
|
||||||
if(!virtscreen->font)
|
if(!virtscreen->font)
|
||||||
eprint("awesome: cannot init font\n");
|
eprint("awesome: cannot init font\n");
|
||||||
/* Colors */
|
/* Colors */
|
||||||
virtscreen->colors_normal[ColBorder] = initxcolor(globalconf.display,
|
virtscreen->colors_normal[ColBorder] = initxcolor(globalconf.display,
|
||||||
get_phys_screen(globalconf.display, screen),
|
get_phys_screen(screen),
|
||||||
cfg_getstr(cfg_colors, "normal_border"));
|
cfg_getstr(cfg_colors, "normal_border"));
|
||||||
virtscreen->colors_normal[ColBG] = initxcolor(globalconf.display,
|
virtscreen->colors_normal[ColBG] = initxcolor(globalconf.display,
|
||||||
get_phys_screen(globalconf.display, screen),
|
get_phys_screen(screen),
|
||||||
cfg_getstr(cfg_colors, "normal_bg"));
|
cfg_getstr(cfg_colors, "normal_bg"));
|
||||||
virtscreen->colors_normal[ColFG] = initxcolor(globalconf.display,
|
virtscreen->colors_normal[ColFG] = initxcolor(globalconf.display,
|
||||||
get_phys_screen(globalconf.display, screen),
|
get_phys_screen(screen),
|
||||||
cfg_getstr(cfg_colors, "normal_fg"));
|
cfg_getstr(cfg_colors, "normal_fg"));
|
||||||
virtscreen->colors_selected[ColBorder] = initxcolor(globalconf.display,
|
virtscreen->colors_selected[ColBorder] = initxcolor(globalconf.display,
|
||||||
get_phys_screen(globalconf.display, screen),
|
get_phys_screen(screen),
|
||||||
cfg_getstr(cfg_colors, "focus_border"));
|
cfg_getstr(cfg_colors, "focus_border"));
|
||||||
virtscreen->colors_selected[ColBG] = initxcolor(globalconf.display,
|
virtscreen->colors_selected[ColBG] = initxcolor(globalconf.display,
|
||||||
get_phys_screen(globalconf.display, screen),
|
get_phys_screen(screen),
|
||||||
cfg_getstr(cfg_colors, "focus_bg"));
|
cfg_getstr(cfg_colors, "focus_bg"));
|
||||||
virtscreen->colors_selected[ColFG] = initxcolor(globalconf.display,
|
virtscreen->colors_selected[ColFG] = initxcolor(globalconf.display,
|
||||||
get_phys_screen(globalconf.display, screen),
|
get_phys_screen(screen),
|
||||||
cfg_getstr(cfg_colors, "focus_fg"));
|
cfg_getstr(cfg_colors, "focus_fg"));
|
||||||
|
|
||||||
/* Statusbar */
|
/* Statusbar */
|
||||||
|
@ -652,7 +652,7 @@ config_parse(const char *confpatharg)
|
||||||
rule->tags = NULL;
|
rule->tags = NULL;
|
||||||
rule->isfloating = cfg_getbool(cfgsectmp, "float");
|
rule->isfloating = cfg_getbool(cfgsectmp, "float");
|
||||||
rule->screen = cfg_getint(cfgsectmp, "screen");
|
rule->screen = cfg_getint(cfgsectmp, "screen");
|
||||||
if(rule->screen >= get_screen_count(globalconf.display))
|
if(rule->screen >= get_screen_count())
|
||||||
rule->screen = 0;
|
rule->screen = 0;
|
||||||
|
|
||||||
if(i < cfg_size(cfg_rules, "rule") - 1)
|
if(i < cfg_size(cfg_rules, "rule") - 1)
|
||||||
|
|
21
event.c
21
event.c
|
@ -70,7 +70,7 @@ handle_event_buttonpress(XEvent * e)
|
||||||
Tag *tag;
|
Tag *tag;
|
||||||
XButtonPressedEvent *ev = &e->xbutton;
|
XButtonPressedEvent *ev = &e->xbutton;
|
||||||
|
|
||||||
for(screen = 0; screen < get_screen_count(e->xany.display); screen++)
|
for(screen = 0; screen < get_screen_count(); screen++)
|
||||||
if(globalconf.screens[screen].statusbar->window == ev->window)
|
if(globalconf.screens[screen].statusbar->window == ev->window)
|
||||||
{
|
{
|
||||||
for(i = 1, tag = globalconf.screens[screen].tags; tag; tag = tag->next, i++)
|
for(i = 1, tag = globalconf.screens[screen].tags; tag; tag = tag->next, i++)
|
||||||
|
@ -115,9 +115,12 @@ handle_event_buttonpress(XEvent * e)
|
||||||
else
|
else
|
||||||
for(screen = 0; screen < ScreenCount(e->xany.display); screen++)
|
for(screen = 0; screen < ScreenCount(e->xany.display); screen++)
|
||||||
if(RootWindow(e->xany.display, screen) == ev->window
|
if(RootWindow(e->xany.display, screen) == ev->window
|
||||||
&& XQueryPointer(e->xany.display, ev->window, &wdummy, &wdummy, &x, &y, &i, &i, &udummy))
|
&& XQueryPointer(e->xany.display,
|
||||||
|
ev->window, &wdummy,
|
||||||
|
&wdummy, &x, &y, &i,
|
||||||
|
&i, &udummy))
|
||||||
{
|
{
|
||||||
screen = get_screen_bycoord(e->xany.display, x, y);
|
screen = get_screen_bycoord(x, y);
|
||||||
handle_mouse_button_press(screen, ev->button, ev->state,
|
handle_mouse_button_press(screen, ev->button, ev->state,
|
||||||
globalconf.buttons.root, NULL);
|
globalconf.buttons.root, NULL);
|
||||||
return;
|
return;
|
||||||
|
@ -152,7 +155,7 @@ handle_event_configurerequest(XEvent * e)
|
||||||
window_configure(c->display, c->win, c->x, c->y, c->w, c->h, c->border);
|
window_configure(c->display, c->win, c->x, c->y, c->w, c->h, c->border);
|
||||||
/* recompute screen */
|
/* recompute screen */
|
||||||
old_screen = c->screen;
|
old_screen = c->screen;
|
||||||
c->screen = get_screen_bycoord(c->display, c->x, c->y);
|
c->screen = get_screen_bycoord(c->x, c->y);
|
||||||
if(old_screen != c->screen)
|
if(old_screen != c->screen)
|
||||||
{
|
{
|
||||||
move_client_to_screen(c, c->screen, False);
|
move_client_to_screen(c, c->screen, False);
|
||||||
|
@ -196,7 +199,7 @@ handle_event_configurenotify(XEvent * e)
|
||||||
DisplayHeight(e->xany.display, screen) = ev->height;
|
DisplayHeight(e->xany.display, screen) = ev->height;
|
||||||
|
|
||||||
/* update statusbar */
|
/* update statusbar */
|
||||||
si = get_screen_info(e->xany.display, screen, NULL, &globalconf.screens[screen].padding);
|
si = get_screen_info(screen, NULL, &globalconf.screens[screen].padding);
|
||||||
globalconf.screens[screen].statusbar->width = si[screen].width;
|
globalconf.screens[screen].statusbar->width = si[screen].width;
|
||||||
p_delete(&si);
|
p_delete(&si);
|
||||||
|
|
||||||
|
@ -249,7 +252,7 @@ handle_event_expose(XEvent * e)
|
||||||
int screen;
|
int screen;
|
||||||
|
|
||||||
if(!ev->count)
|
if(!ev->count)
|
||||||
for(screen = 0; screen < get_screen_count(e->xany.display); screen++)
|
for(screen = 0; screen < get_screen_count(); screen++)
|
||||||
if(globalconf.screens[screen].statusbar->window == ev->window)
|
if(globalconf.screens[screen].statusbar->window == ev->window)
|
||||||
statusbar_draw(screen);
|
statusbar_draw(screen);
|
||||||
}
|
}
|
||||||
|
@ -275,7 +278,7 @@ handle_event_keypress(XEvent * e)
|
||||||
* number with get_screen_bycoord: we'll get 0 in Zaphod mode
|
* number with get_screen_bycoord: we'll get 0 in Zaphod mode
|
||||||
* so it's the same, or maybe the real Xinerama screen */
|
* so it's the same, or maybe the real Xinerama screen */
|
||||||
if(screen == 0)
|
if(screen == 0)
|
||||||
screen = get_screen_bycoord(e->xany.display, x, y);
|
screen = get_screen_bycoord(x, y);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,7 +311,7 @@ handle_event_mappingnotify(XEvent * e)
|
||||||
XRefreshKeyboardMapping(ev);
|
XRefreshKeyboardMapping(ev);
|
||||||
if(ev->request == MappingKeyboard)
|
if(ev->request == MappingKeyboard)
|
||||||
for(screen = 0; screen < ScreenCount(e->xany.display); screen++)
|
for(screen = 0; screen < ScreenCount(e->xany.display); screen++)
|
||||||
grabkeys(get_phys_screen(globalconf.display, screen));
|
grabkeys(get_phys_screen(screen));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -329,7 +332,7 @@ handle_event_maprequest(XEvent * e)
|
||||||
for(screen = 0; wa.screen != ScreenOfDisplay(e->xany.display, screen); screen++);
|
for(screen = 0; wa.screen != ScreenOfDisplay(e->xany.display, screen); screen++);
|
||||||
if(screen == 0 && XQueryPointer(e->xany.display, RootWindow(e->xany.display, screen),
|
if(screen == 0 && XQueryPointer(e->xany.display, RootWindow(e->xany.display, screen),
|
||||||
&dummy, &dummy, &x, &y, &d, &d, &m))
|
&dummy, &dummy, &x, &y, &d, &d, &m))
|
||||||
screen = get_screen_bycoord(e->xany.display, x, y);
|
screen = get_screen_bycoord(x, y);
|
||||||
client_manage(ev->window, &wa, screen);
|
client_manage(ev->window, &wa, screen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
16
layout.c
16
layout.c
|
@ -149,7 +149,7 @@ loadawesomeprops(int screen)
|
||||||
prop = p_new(char, ntags + 1);
|
prop = p_new(char, ntags + 1);
|
||||||
|
|
||||||
if(xgettextprop(globalconf.display,
|
if(xgettextprop(globalconf.display,
|
||||||
RootWindow(globalconf.display, get_phys_screen(globalconf.display, screen)),
|
RootWindow(globalconf.display, get_phys_screen(screen)),
|
||||||
AWESOMEPROPS_ATOM(globalconf.display), prop, ntags + 1))
|
AWESOMEPROPS_ATOM(globalconf.display), prop, ntags + 1))
|
||||||
for(i = 0, tag = globalconf.screens[screen].tags; tag && prop[i]; i++, tag = tag->next)
|
for(i = 0, tag = globalconf.screens[screen].tags; tag && prop[i]; i++, tag = tag->next)
|
||||||
if(prop[i] == '1')
|
if(prop[i] == '1')
|
||||||
|
@ -218,7 +218,7 @@ saveawesomeprops(int screen)
|
||||||
|
|
||||||
prop[i] = '\0';
|
prop[i] = '\0';
|
||||||
XChangeProperty(globalconf.display,
|
XChangeProperty(globalconf.display,
|
||||||
RootWindow(globalconf.display, get_phys_screen(globalconf.display, screen)),
|
RootWindow(globalconf.display, get_phys_screen(screen)),
|
||||||
AWESOMEPROPS_ATOM(globalconf.display), XA_STRING, 8,
|
AWESOMEPROPS_ATOM(globalconf.display), XA_STRING, 8,
|
||||||
PropModeReplace, (unsigned char *) prop, i);
|
PropModeReplace, (unsigned char *) prop, i);
|
||||||
p_delete(&prop);
|
p_delete(&prop);
|
||||||
|
@ -280,7 +280,9 @@ maximize(int x, int y, int w, int h, int screen)
|
||||||
void
|
void
|
||||||
uicb_client_togglemax(int screen, char *arg __attribute__ ((unused)))
|
uicb_client_togglemax(int screen, char *arg __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
ScreenInfo *si = get_screen_info(globalconf.display, screen, globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
ScreenInfo *si = get_screen_info(screen,
|
||||||
|
globalconf.screens[screen].statusbar,
|
||||||
|
&globalconf.screens[screen].padding);
|
||||||
|
|
||||||
maximize(si[screen].x_org, si[screen].y_org,
|
maximize(si[screen].x_org, si[screen].y_org,
|
||||||
si[screen].width - 2 * globalconf.screens[screen].borderpx,
|
si[screen].width - 2 * globalconf.screens[screen].borderpx,
|
||||||
|
@ -293,7 +295,9 @@ void
|
||||||
uicb_client_toggleverticalmax(int screen, char *arg __attribute__ ((unused)))
|
uicb_client_toggleverticalmax(int screen, char *arg __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
Client *sel = globalconf.focus->client;
|
Client *sel = globalconf.focus->client;
|
||||||
ScreenInfo *si = get_screen_info(globalconf.display, screen, globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
ScreenInfo *si = get_screen_info(screen,
|
||||||
|
globalconf.screens[screen].statusbar,
|
||||||
|
&globalconf.screens[screen].padding);
|
||||||
|
|
||||||
if(sel)
|
if(sel)
|
||||||
maximize(sel->x,
|
maximize(sel->x,
|
||||||
|
@ -309,7 +313,9 @@ void
|
||||||
uicb_client_togglehorizontalmax(int screen, char *arg __attribute__ ((unused)))
|
uicb_client_togglehorizontalmax(int screen, char *arg __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
Client *sel = globalconf.focus->client;
|
Client *sel = globalconf.focus->client;
|
||||||
ScreenInfo *si = get_screen_info(globalconf.display, screen, globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
ScreenInfo *si = get_screen_info(screen,
|
||||||
|
globalconf.screens[screen].statusbar,
|
||||||
|
&globalconf.screens[screen].padding);
|
||||||
|
|
||||||
if(sel)
|
if(sel)
|
||||||
maximize(si[screen].x_org,
|
maximize(si[screen].x_org,
|
||||||
|
|
|
@ -31,7 +31,7 @@ layout_fibonacci(int screen, int shape)
|
||||||
{
|
{
|
||||||
int n = 0, i = 0, nx, ny, nw, nh;
|
int n = 0, i = 0, nx, ny, nw, nh;
|
||||||
Client *c;
|
Client *c;
|
||||||
ScreenInfo *si = get_screen_info(globalconf.display, screen,
|
ScreenInfo *si = get_screen_info(screen,
|
||||||
globalconf.screens[screen].statusbar,
|
globalconf.screens[screen].statusbar,
|
||||||
&globalconf.screens[screen].padding);
|
&globalconf.screens[screen].padding);
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ void
|
||||||
layout_max(int screen)
|
layout_max(int screen)
|
||||||
{
|
{
|
||||||
Client *c;
|
Client *c;
|
||||||
ScreenInfo *si = get_screen_info(globalconf.display, screen, globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
ScreenInfo *si = get_screen_info(screen, globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
||||||
|
|
||||||
for(c = globalconf.clients; c; c = c->next)
|
for(c = globalconf.clients; c; c = c->next)
|
||||||
if(IS_TILED(c, screen))
|
if(IS_TILED(c, screen))
|
||||||
|
|
|
@ -103,7 +103,7 @@ _tile(int screen, const Bool right)
|
||||||
Client *c;
|
Client *c;
|
||||||
Tag *curtag = get_current_tag(screen);
|
Tag *curtag = get_current_tag(screen);
|
||||||
|
|
||||||
screens_info = get_screen_info(globalconf.display, screen, globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
screens_info = get_screen_info(screen, globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
||||||
|
|
||||||
for(n = 0, c = globalconf.clients; c; c = c->next)
|
for(n = 0, c = globalconf.clients; c; c = c->next)
|
||||||
if(IS_TILED(c, screen))
|
if(IS_TILED(c, screen))
|
||||||
|
|
2
mouse.c
2
mouse.c
|
@ -49,7 +49,7 @@ uicb_client_movemouse(int screen, char *arg __attribute__ ((unused)))
|
||||||
else
|
else
|
||||||
restack(screen);
|
restack(screen);
|
||||||
|
|
||||||
si = get_screen_info(c->display, c->screen, globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
si = get_screen_info(c->screen, globalconf.screens[screen].statusbar, &globalconf.screens[screen].padding);
|
||||||
|
|
||||||
ocx = nx = c->x;
|
ocx = nx = c->x;
|
||||||
ocy = ny = c->y;
|
ocy = ny = c->y;
|
||||||
|
|
72
screen.c
72
screen.c
|
@ -29,25 +29,24 @@
|
||||||
extern awesome_config globalconf;
|
extern awesome_config globalconf;
|
||||||
|
|
||||||
/** Get screens info
|
/** Get screens info
|
||||||
* \param disp Display ref
|
|
||||||
* \param screen Screen number
|
* \param screen Screen number
|
||||||
* \param statusbar statusbar
|
* \param statusbar statusbar
|
||||||
* \return ScreenInfo struct array with all screens info
|
* \return ScreenInfo struct array with all screens info
|
||||||
*/
|
*/
|
||||||
ScreenInfo *
|
ScreenInfo *
|
||||||
get_screen_info(Display *disp, int screen, Statusbar *statusbar, Padding *padding)
|
get_screen_info(int screen, Statusbar *statusbar, Padding *padding)
|
||||||
{
|
{
|
||||||
int i, screen_number = 0;
|
int i, screen_number = 0;
|
||||||
ScreenInfo *si;
|
ScreenInfo *si;
|
||||||
|
|
||||||
if(XineramaIsActive(disp))
|
if(XineramaIsActive(globalconf.display))
|
||||||
si = XineramaQueryScreens(disp, &screen_number);
|
si = XineramaQueryScreens(globalconf.display, &screen_number);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* emulate Xinerama info but only fill the screen we want */
|
/* emulate Xinerama info but only fill the screen we want */
|
||||||
si = p_new(ScreenInfo, screen + 1);
|
si = p_new(ScreenInfo, screen + 1);
|
||||||
si[screen].width = DisplayWidth(disp, screen);
|
si[screen].width = DisplayWidth(globalconf.display, screen);
|
||||||
si[screen].height = DisplayHeight(disp, screen);
|
si[screen].height = DisplayHeight(globalconf.display, screen);
|
||||||
si[screen].x_org = 0;
|
si[screen].x_org = 0;
|
||||||
si[screen].y_org = 0;
|
si[screen].y_org = 0;
|
||||||
screen_number = screen + 1;
|
screen_number = screen + 1;
|
||||||
|
@ -82,13 +81,12 @@ get_screen_info(Display *disp, int screen, Statusbar *statusbar, Padding *paddin
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get display info
|
/** Get display info
|
||||||
* \param disp Display ref
|
|
||||||
* \param screen Screen number
|
* \param screen Screen number
|
||||||
* \param statusbar the statusbar
|
* \param statusbar the statusbar
|
||||||
* \return ScreenInfo struct pointer with all display info
|
* \return ScreenInfo struct pointer with all display info
|
||||||
*/
|
*/
|
||||||
ScreenInfo *
|
ScreenInfo *
|
||||||
get_display_info(Display *disp, int screen, Statusbar *statusbar, Padding *padding)
|
get_display_info(int screen, Statusbar *statusbar, Padding *padding)
|
||||||
{
|
{
|
||||||
ScreenInfo *si;
|
ScreenInfo *si;
|
||||||
|
|
||||||
|
@ -96,8 +94,8 @@ get_display_info(Display *disp, int screen, Statusbar *statusbar, Padding *paddi
|
||||||
|
|
||||||
si->x_org = 0;
|
si->x_org = 0;
|
||||||
si->y_org = statusbar && statusbar->position == BarTop ? statusbar->height : 0;
|
si->y_org = statusbar && statusbar->position == BarTop ? statusbar->height : 0;
|
||||||
si->width = DisplayWidth(disp, screen);
|
si->width = DisplayWidth(globalconf.display, screen);
|
||||||
si->height = DisplayHeight(disp, screen) -
|
si->height = DisplayHeight(globalconf.display, screen) -
|
||||||
(statusbar && (statusbar->position == BarTop || statusbar->position == BarBot) ? statusbar->height : 0);
|
(statusbar && (statusbar->position == BarTop || statusbar->position == BarBot) ? statusbar->height : 0);
|
||||||
|
|
||||||
/* make padding corrections */
|
/* make padding corrections */
|
||||||
|
@ -113,24 +111,23 @@ get_display_info(Display *disp, int screen, Statusbar *statusbar, Padding *paddi
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return the Xinerama screen number where the coordinates belongs to
|
/** Return the Xinerama screen number where the coordinates belongs to
|
||||||
* \param disp Display ref
|
|
||||||
* \param x x coordinate of the window
|
* \param x x coordinate of the window
|
||||||
* \param y y coordinate of the window
|
* \param y y coordinate of the window
|
||||||
* \return screen number or DefaultScreen of disp on no match
|
* \return screen number or DefaultScreen of disp on no match
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
get_screen_bycoord(Display *disp, int x, int y)
|
get_screen_bycoord(int x, int y)
|
||||||
{
|
{
|
||||||
ScreenInfo *si;
|
ScreenInfo *si;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* don't waste our time */
|
/* don't waste our time */
|
||||||
if(!XineramaIsActive(disp))
|
if(!XineramaIsActive(globalconf.display))
|
||||||
return DefaultScreen(disp);
|
return DefaultScreen(globalconf.display);
|
||||||
|
|
||||||
si = get_screen_info(disp, 0, NULL, NULL);
|
si = get_screen_info(0, NULL, NULL);
|
||||||
|
|
||||||
for(i = 0; i < get_screen_count(disp); i++)
|
for(i = 0; i < get_screen_count(); i++)
|
||||||
if((x < 0 || (x >= si[i].x_org && x < si[i].x_org + si[i].width))
|
if((x < 0 || (x >= si[i].x_org && x < si[i].x_org + si[i].width))
|
||||||
&& (y < 0 || (y >= si[i].y_org && y < si[i].y_org + si[i].height)))
|
&& (y < 0 || (y >= si[i].y_org && y < si[i].y_org + si[i].height)))
|
||||||
{
|
{
|
||||||
|
@ -139,37 +136,35 @@ get_screen_bycoord(Display *disp, int x, int y)
|
||||||
}
|
}
|
||||||
|
|
||||||
p_delete(&si);
|
p_delete(&si);
|
||||||
return DefaultScreen(disp);
|
return DefaultScreen(globalconf.display);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return the actual screen count
|
/** Return the actual screen count
|
||||||
* \param disp Display ref
|
|
||||||
* \return the number of screen available
|
* \return the number of screen available
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
get_screen_count(Display *disp)
|
get_screen_count(void)
|
||||||
{
|
{
|
||||||
int screen_number;
|
int screen_number;
|
||||||
|
|
||||||
if(XineramaIsActive(disp))
|
if(XineramaIsActive(globalconf.display))
|
||||||
XineramaQueryScreens(disp, &screen_number);
|
XineramaQueryScreens(globalconf.display, &screen_number);
|
||||||
else
|
else
|
||||||
return ScreenCount(disp);
|
return ScreenCount(globalconf.display);
|
||||||
|
|
||||||
return screen_number;
|
return screen_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This returns the real X screen number for a logical
|
/** This returns the real X screen number for a logical
|
||||||
* screen if Xinerama is active.
|
* screen if Xinerama is active.
|
||||||
* \param disp Display ref
|
|
||||||
* \param screen the logical screen
|
* \param screen the logical screen
|
||||||
* \return the X screen
|
* \return the X screen
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
get_phys_screen(Display *disp, int screen)
|
get_phys_screen(int screen)
|
||||||
{
|
{
|
||||||
if(XineramaIsActive(disp))
|
if(XineramaIsActive(globalconf.display))
|
||||||
return DefaultScreen(disp);
|
return DefaultScreen(globalconf.display);
|
||||||
return screen;
|
return screen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,8 +191,8 @@ move_client_to_screen(Client *c, int new_screen, Bool doresize)
|
||||||
{
|
{
|
||||||
ScreenInfo *si, *si_old;
|
ScreenInfo *si, *si_old;
|
||||||
|
|
||||||
si = get_screen_info(c->display, c->screen, NULL, NULL);
|
si = get_screen_info(c->screen, NULL, NULL);
|
||||||
si_old = get_screen_info(c->display, old_screen, NULL, NULL);
|
si_old = get_screen_info(old_screen, NULL, NULL);
|
||||||
|
|
||||||
/* compute new coords in new screen */
|
/* compute new coords in new screen */
|
||||||
c->rx = (c->rx - si_old[old_screen].x_org) + si[c->screen].x_org;
|
c->rx = (c->rx - si_old[old_screen].x_org) + si[c->screen].x_org;
|
||||||
|
@ -226,20 +221,19 @@ move_client_to_screen(Client *c, int new_screen, Bool doresize)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Move mouse pointer to x_org and y_xorg of specified screen
|
/** Move mouse pointer to x_org and y_xorg of specified screen
|
||||||
* \param disp display ref
|
|
||||||
* \param screen screen number
|
* \param screen screen number
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
move_mouse_pointer_to_screen(Display *disp, int screen)
|
move_mouse_pointer_to_screen(int screen)
|
||||||
{
|
{
|
||||||
if(XineramaIsActive(disp))
|
if(XineramaIsActive(globalconf.display))
|
||||||
{
|
{
|
||||||
ScreenInfo *si = get_screen_info(disp, screen, NULL, NULL);
|
ScreenInfo *si = get_screen_info(screen, NULL, NULL);
|
||||||
XWarpPointer(disp, None, DefaultRootWindow(disp), 0, 0, 0, 0, si[screen].x_org, si[screen].y_org);
|
XWarpPointer(globalconf.display, None, DefaultRootWindow(globalconf.display), 0, 0, 0, 0, si[screen].x_org, si[screen].y_org);
|
||||||
p_delete(&si);
|
p_delete(&si);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
XWarpPointer(disp, None, RootWindow(disp, screen), 0, 0, 0, 0, 0, 0);
|
XWarpPointer(globalconf.display, None, RootWindow(globalconf.display, screen), 0, 0, 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -250,7 +244,7 @@ move_mouse_pointer_to_screen(Display *disp, int screen)
|
||||||
void
|
void
|
||||||
uicb_screen_focus(int screen, char *arg)
|
uicb_screen_focus(int screen, char *arg)
|
||||||
{
|
{
|
||||||
int new_screen, numscreens = get_screen_count(globalconf.display);
|
int new_screen, numscreens = get_screen_count();
|
||||||
|
|
||||||
if(arg)
|
if(arg)
|
||||||
new_screen = compute_new_value_from_arg(arg, screen);
|
new_screen = compute_new_value_from_arg(arg, screen);
|
||||||
|
@ -265,7 +259,7 @@ uicb_screen_focus(int screen, char *arg)
|
||||||
focus(focus_get_latest_client_for_tag(new_screen, get_current_tag(new_screen)),
|
focus(focus_get_latest_client_for_tag(new_screen, get_current_tag(new_screen)),
|
||||||
True, new_screen);
|
True, new_screen);
|
||||||
|
|
||||||
move_mouse_pointer_to_screen(globalconf.display, new_screen);
|
move_mouse_pointer_to_screen(new_screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Move client to a virtual screen (if Xinerama is active)
|
/** Move client to a virtual screen (if Xinerama is active)
|
||||||
|
@ -286,14 +280,14 @@ uicb_client_movetoscreen(int screen __attribute__ ((unused)), char *arg)
|
||||||
else
|
else
|
||||||
new_screen = sel->screen + 1;
|
new_screen = sel->screen + 1;
|
||||||
|
|
||||||
if(new_screen >= get_screen_count(globalconf.display))
|
if(new_screen >= get_screen_count())
|
||||||
new_screen = 0;
|
new_screen = 0;
|
||||||
else if(new_screen < 0)
|
else if(new_screen < 0)
|
||||||
new_screen = get_screen_count(globalconf.display) - 1;
|
new_screen = get_screen_count() - 1;
|
||||||
|
|
||||||
prev_screen = sel->screen;
|
prev_screen = sel->screen;
|
||||||
move_client_to_screen(sel, new_screen, True);
|
move_client_to_screen(sel, new_screen, True);
|
||||||
move_mouse_pointer_to_screen(globalconf.display, new_screen);
|
move_mouse_pointer_to_screen(new_screen);
|
||||||
arrange(prev_screen);
|
arrange(prev_screen);
|
||||||
arrange(new_screen);
|
arrange(new_screen);
|
||||||
}
|
}
|
||||||
|
|
10
screen.h
10
screen.h
|
@ -28,11 +28,11 @@
|
||||||
|
|
||||||
typedef XineramaScreenInfo ScreenInfo;
|
typedef XineramaScreenInfo ScreenInfo;
|
||||||
|
|
||||||
ScreenInfo * get_screen_info(Display *, int, Statusbar *, Padding *);
|
ScreenInfo * get_screen_info(int, Statusbar *, Padding *);
|
||||||
ScreenInfo * get_display_info(Display *, int, Statusbar *, Padding *);
|
ScreenInfo * get_display_info(int, Statusbar *, Padding *);
|
||||||
int get_screen_bycoord(Display *, int, int);
|
int get_screen_bycoord(int, int);
|
||||||
int get_screen_count(Display *);
|
int get_screen_count(void);
|
||||||
int get_phys_screen(Display *, int);
|
int get_phys_screen(int);
|
||||||
void move_client_to_screen(Client *, int, Bool);
|
void move_client_to_screen(Client *, int, Bool);
|
||||||
|
|
||||||
UICB_PROTO(uicb_screen_focus);
|
UICB_PROTO(uicb_screen_focus);
|
||||||
|
|
|
@ -35,7 +35,7 @@ extern awesome_config globalconf;
|
||||||
void
|
void
|
||||||
statusbar_draw(int screen)
|
statusbar_draw(int screen)
|
||||||
{
|
{
|
||||||
int phys_screen = get_phys_screen(globalconf.display, screen);
|
int phys_screen = get_phys_screen(screen);
|
||||||
VirtScreen vscreen;
|
VirtScreen vscreen;
|
||||||
Widget *widget;
|
Widget *widget;
|
||||||
int left = 0, right = 0;
|
int left = 0, right = 0;
|
||||||
|
@ -102,8 +102,8 @@ void
|
||||||
statusbar_init(Display *disp, int screen, Statusbar *statusbar, Cursor cursor, XftFont *font, Padding *padding)
|
statusbar_init(Display *disp, int screen, Statusbar *statusbar, Cursor cursor, XftFont *font, Padding *padding)
|
||||||
{
|
{
|
||||||
XSetWindowAttributes wa;
|
XSetWindowAttributes wa;
|
||||||
int phys_screen = get_phys_screen(disp, screen);
|
int phys_screen = get_phys_screen(screen);
|
||||||
ScreenInfo *si = get_screen_info(disp, screen, NULL, padding);
|
ScreenInfo *si = get_screen_info(screen, NULL, padding);
|
||||||
|
|
||||||
statusbar->height = font->height * 1.5;
|
statusbar->height = font->height * 1.5;
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ void
|
||||||
statusbar_update_position(Display *disp, Statusbar *statusbar, Padding *padding)
|
statusbar_update_position(Display *disp, Statusbar *statusbar, Padding *padding)
|
||||||
{
|
{
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
ScreenInfo *si = get_screen_info(disp, statusbar->screen, NULL, padding);
|
ScreenInfo *si = get_screen_info(statusbar->screen, NULL, padding);
|
||||||
|
|
||||||
XMapRaised(disp, statusbar->window);
|
XMapRaised(disp, statusbar->window);
|
||||||
switch (statusbar->position)
|
switch (statusbar->position)
|
||||||
|
|
4
uicb.c
4
uicb.c
|
@ -86,7 +86,7 @@ const NameFuncLink UicbList[] =
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
run_uicb(char *cmd, awesome_config *awesomeconf)
|
run_uicb(char *cmd, awesome_config *awesomeconf __attribute ((unused)))
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
const char *arg;
|
const char *arg;
|
||||||
|
@ -101,7 +101,7 @@ run_uicb(char *cmd, awesome_config *awesomeconf)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
screen = atoi(cmd);
|
screen = atoi(cmd);
|
||||||
if(screen >= get_screen_count(awesomeconf->display) || screen < 0){
|
if(screen >= get_screen_count() || screen < 0){
|
||||||
warn("Invalid screen specified: %i\n", screen);
|
warn("Invalid screen specified: %i\n", screen);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue