Store physical screen id in statusbar and client, change get_phys_s() to screen_virttophys()
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
8d0e5b29a6
commit
0a6c6e017b
22
client.c
22
client.c
|
@ -182,8 +182,6 @@ client_ban(Client *c)
|
||||||
void
|
void
|
||||||
client_focus(Client *c, int screen, Bool raise)
|
client_focus(Client *c, int screen, Bool raise)
|
||||||
{
|
{
|
||||||
int phys_screen = get_phys_screen(screen);
|
|
||||||
|
|
||||||
/* if c is NULL or invisible, take next client in the focus history */
|
/* if c is NULL or invisible, take next client in the focus history */
|
||||||
if(!c || (c && !client_isvisible(c, screen)))
|
if(!c || (c && !client_isvisible(c, screen)))
|
||||||
{
|
{
|
||||||
|
@ -263,15 +261,15 @@ client_focus(Client *c, int screen, Bool raise)
|
||||||
}
|
}
|
||||||
/* since we're dropping EnterWindow events and sometimes the window
|
/* since we're dropping EnterWindow events and sometimes the window
|
||||||
* will appear under the mouse, grabbuttons */
|
* will appear under the mouse, grabbuttons */
|
||||||
window_grabbuttons(phys_screen, c->win);
|
window_grabbuttons(c->phys_screen, c->win);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
XSetInputFocus(globalconf.display,
|
XSetInputFocus(globalconf.display,
|
||||||
RootWindow(globalconf.display, phys_screen),
|
RootWindow(globalconf.display, c->phys_screen),
|
||||||
RevertToPointerRoot, CurrentTime);
|
RevertToPointerRoot, CurrentTime);
|
||||||
|
|
||||||
widget_invalidate_cache(screen, WIDGET_CACHE_CLIENTS);
|
widget_invalidate_cache(screen, WIDGET_CACHE_CLIENTS);
|
||||||
ewmh_update_net_active_window(phys_screen);
|
ewmh_update_net_active_window(c->phys_screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Manage a new client
|
/** Manage a new client
|
||||||
|
@ -289,13 +287,17 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
|
||||||
Tag *tag;
|
Tag *tag;
|
||||||
Rule *rule;
|
Rule *rule;
|
||||||
area_t screen_geom;
|
area_t screen_geom;
|
||||||
int phys_screen = get_phys_screen(screen);
|
|
||||||
long flags;
|
long flags;
|
||||||
|
|
||||||
c = p_new(Client, 1);
|
c = p_new(Client, 1);
|
||||||
|
|
||||||
c->screen = screen_get_bycoord(globalconf.screens_info, screen, wa->x, wa->y);
|
c->screen = screen_get_bycoord(globalconf.screens_info, screen, wa->x, wa->y);
|
||||||
|
|
||||||
|
if(globalconf.screens_info->xinerama_is_active)
|
||||||
|
c->phys_screen = DefaultScreen(globalconf.display);
|
||||||
|
else
|
||||||
|
c->phys_screen = c->screen;
|
||||||
|
|
||||||
screen_geom = screen_get_area(c->screen,
|
screen_geom = screen_get_area(c->screen,
|
||||||
globalconf.screens[screen].statusbar,
|
globalconf.screens[screen].statusbar,
|
||||||
&globalconf.screens[screen].padding);
|
&globalconf.screens[screen].padding);
|
||||||
|
@ -400,7 +402,7 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
|
||||||
if(globalconf.have_shape)
|
if(globalconf.have_shape)
|
||||||
{
|
{
|
||||||
XShapeSelectInput(globalconf.display, w, ShapeNotifyMask);
|
XShapeSelectInput(globalconf.display, w, ShapeNotifyMask);
|
||||||
window_setshape(phys_screen, c->win);
|
window_setshape(c->phys_screen, c->win);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* attach to the stack */
|
/* attach to the stack */
|
||||||
|
@ -431,7 +433,7 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
|
||||||
c->geometry.width, c->geometry.height);
|
c->geometry.width, c->geometry.height);
|
||||||
|
|
||||||
widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS);
|
widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS);
|
||||||
ewmh_update_net_client_list(phys_screen);
|
ewmh_update_net_client_list(c->phys_screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
static area_t
|
static area_t
|
||||||
|
@ -505,7 +507,7 @@ client_resize(Client *c, area_t geometry, Bool hints)
|
||||||
return False;
|
return False;
|
||||||
|
|
||||||
/* offscreen appearance fixes */
|
/* offscreen appearance fixes */
|
||||||
area = get_display_area(get_phys_screen(c->screen), NULL,
|
area = get_display_area(c->phys_screen, NULL,
|
||||||
&globalconf.screens[c->screen].padding);
|
&globalconf.screens[c->screen].padding);
|
||||||
|
|
||||||
if(geometry.x > area.width)
|
if(geometry.x > area.width)
|
||||||
|
@ -899,7 +901,7 @@ uicb_client_moveresize(int screen, char *arg)
|
||||||
|
|
||||||
Bool xqp = XQueryPointer(globalconf.display,
|
Bool xqp = XQueryPointer(globalconf.display,
|
||||||
RootWindow(globalconf.display,
|
RootWindow(globalconf.display,
|
||||||
get_phys_screen(screen)),
|
sel->phys_screen),
|
||||||
&dummy, &dummy, &mx, &my, &dx, &dy, &dui);
|
&dummy, &dummy, &mx, &my, &dx, &dy, &dui);
|
||||||
if(globalconf.screens[sel->screen].resize_hints)
|
if(globalconf.screens[sel->screen].resize_hints)
|
||||||
geometry = client_geometry_hints(sel, geometry);
|
geometry = client_geometry_hints(sel, geometry);
|
||||||
|
|
4
config.c
4
config.c
|
@ -277,7 +277,7 @@ statusbar_widgets_create(cfg_t *cfg_statusbar, Statusbar *statusbar)
|
||||||
static void
|
static void
|
||||||
config_section_titlebar_init(cfg_t *cfg_titlebar, Titlebar *tb, int screen)
|
config_section_titlebar_init(cfg_t *cfg_titlebar, Titlebar *tb, int screen)
|
||||||
{
|
{
|
||||||
int phys_screen = get_phys_screen(screen);
|
int phys_screen = screen_virttophys(screen);
|
||||||
cfg_t *cfg_styles = cfg_getsec(cfg_titlebar, "styles");
|
cfg_t *cfg_styles = cfg_getsec(cfg_titlebar, "styles");
|
||||||
|
|
||||||
tb->position = tb->dposition = cfg_getposition(cfg_titlebar, "position");
|
tb->position = tb->dposition = cfg_getposition(cfg_titlebar, "position");
|
||||||
|
@ -309,7 +309,7 @@ config_parse_screen(cfg_t *cfg, int screen)
|
||||||
*cfg_layouts, *cfg_padding, *cfgsectmp, *cfg_titlebar,
|
*cfg_layouts, *cfg_padding, *cfgsectmp, *cfg_titlebar,
|
||||||
*cfg_styles_normal, *cfg_styles_focus, *cfg_styles_urgent;
|
*cfg_styles_normal, *cfg_styles_focus, *cfg_styles_urgent;
|
||||||
VirtScreen *virtscreen = &globalconf.screens[screen];
|
VirtScreen *virtscreen = &globalconf.screens[screen];
|
||||||
int i, phys_screen = get_phys_screen(screen);
|
int i, phys_screen = screen_virttophys(screen);
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%d", screen);
|
snprintf(buf, sizeof(buf), "%d", screen);
|
||||||
cfg_screen = cfg_gettsec(cfg, "screen", buf);
|
cfg_screen = cfg_gettsec(cfg, "screen", buf);
|
||||||
|
|
10
event.c
10
event.c
|
@ -132,7 +132,7 @@ event_handle_buttonpress(XEvent *e)
|
||||||
&& ev->button == Button1)
|
&& ev->button == Button1)
|
||||||
{
|
{
|
||||||
XAllowEvents(globalconf.display, ReplayPointer, CurrentTime);
|
XAllowEvents(globalconf.display, ReplayPointer, CurrentTime);
|
||||||
window_grabbuttons(get_phys_screen(c->screen), c->win);
|
window_grabbuttons(c->phys_screen, c->win);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
event_handle_mouse_button_press(c->screen, ev->button, ev->state, globalconf.buttons.client, NULL);
|
event_handle_mouse_button_press(c->screen, ev->button, ev->state, globalconf.buttons.client, NULL);
|
||||||
|
@ -268,7 +268,7 @@ event_handle_enternotify(XEvent *e)
|
||||||
|
|
||||||
if(c || (c = client_get_bywin(globalconf.clients, ev->window)))
|
if(c || (c = client_get_bywin(globalconf.clients, ev->window)))
|
||||||
{
|
{
|
||||||
window_grabbuttons(get_phys_screen(c->screen), c->win);
|
window_grabbuttons(c->phys_screen, c->win);
|
||||||
if(globalconf.screens[c->screen].sloppy_focus)
|
if(globalconf.screens[c->screen].sloppy_focus)
|
||||||
client_focus(c, c->screen,
|
client_focus(c, c->screen,
|
||||||
(globalconf.screens[c->screen].sloppy_focus
|
(globalconf.screens[c->screen].sloppy_focus
|
||||||
|
@ -319,7 +319,7 @@ event_handle_expose(XEvent *e)
|
||||||
for(c = globalconf.clients; c; c = c->next)
|
for(c = globalconf.clients; c; c = c->next)
|
||||||
if(c->titlebar.sw && c->titlebar.sw->window == ev->window)
|
if(c->titlebar.sw && c->titlebar.sw->window == ev->window)
|
||||||
{
|
{
|
||||||
simplewindow_refresh_drawable(c->titlebar.sw, get_phys_screen(c->screen));
|
simplewindow_refresh_drawable(c->titlebar.sw, c->phys_screen);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -457,7 +457,7 @@ event_handle_unmapnotify(XEvent * e)
|
||||||
XUnmapEvent *ev = &e->xunmap;
|
XUnmapEvent *ev = &e->xunmap;
|
||||||
|
|
||||||
if((c = client_get_bywin(globalconf.clients, ev->window))
|
if((c = client_get_bywin(globalconf.clients, ev->window))
|
||||||
&& ev->event == RootWindow(e->xany.display, get_phys_screen(c->screen))
|
&& ev->event == RootWindow(e->xany.display, c->phys_screen)
|
||||||
&& ev->send_event && window_getstate(c->win) == NormalState)
|
&& ev->send_event && window_getstate(c->win) == NormalState)
|
||||||
client_unmanage(c);
|
client_unmanage(c);
|
||||||
}
|
}
|
||||||
|
@ -472,7 +472,7 @@ event_handle_shape(XEvent * e)
|
||||||
Client *c = client_get_bywin(globalconf.clients, ev->window);
|
Client *c = client_get_bywin(globalconf.clients, ev->window);
|
||||||
|
|
||||||
if(c)
|
if(c)
|
||||||
window_setshape(get_phys_screen(c->screen), c->win);
|
window_setshape(c->phys_screen, c->win);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Handle XRandR events
|
/** Handle XRandR events
|
||||||
|
|
2
ewmh.c
2
ewmh.c
|
@ -154,7 +154,7 @@ ewmh_update_net_client_list(int phys_screen)
|
||||||
wins = p_new(Window, n);
|
wins = p_new(Window, n);
|
||||||
|
|
||||||
for(n = 0, c = globalconf.clients; c; c = c->next, n++)
|
for(n = 0, c = globalconf.clients; c; c = c->next, n++)
|
||||||
if(get_phys_screen(c->screen) == phys_screen)
|
if(c->phys_screen == phys_screen)
|
||||||
wins[n] = c->win;
|
wins[n] = c->win;
|
||||||
|
|
||||||
XChangeProperty(globalconf.display, RootWindow(globalconf.display, phys_screen),
|
XChangeProperty(globalconf.display, RootWindow(globalconf.display, phys_screen),
|
||||||
|
|
8
layout.c
8
layout.c
|
@ -46,7 +46,7 @@ arrange(int screen)
|
||||||
Client *c;
|
Client *c;
|
||||||
Layout *curlay = layout_get_current(screen);
|
Layout *curlay = layout_get_current(screen);
|
||||||
unsigned int dui;
|
unsigned int dui;
|
||||||
int di, x, y;
|
int di, x, y, phys_screen = screen_virttophys(screen);
|
||||||
Window rootwin, childwin;
|
Window rootwin, childwin;
|
||||||
|
|
||||||
for(c = globalconf.clients; c; c = c->next)
|
for(c = globalconf.clients; c; c = c->next)
|
||||||
|
@ -75,11 +75,11 @@ arrange(int screen)
|
||||||
client_focus(c, screen, True);
|
client_focus(c, screen, True);
|
||||||
|
|
||||||
/* check that the mouse is on a window or not */
|
/* check that the mouse is on a window or not */
|
||||||
if(XQueryPointer(globalconf.display, RootWindow(globalconf.display,
|
if(XQueryPointer(globalconf.display,
|
||||||
get_phys_screen(screen)),
|
RootWindow(globalconf.display, phys_screen),
|
||||||
&rootwin, &childwin, &x, &y, &di, &di, &dui)
|
&rootwin, &childwin, &x, &y, &di, &di, &dui)
|
||||||
&& (rootwin == None || childwin == None || childwin == rootwin))
|
&& (rootwin == None || childwin == None || childwin == rootwin))
|
||||||
window_root_grabbuttons(get_phys_screen(screen));
|
window_root_grabbuttons(phys_screen);
|
||||||
|
|
||||||
/* reset status */
|
/* reset status */
|
||||||
globalconf.screens[screen].need_arrange = False;
|
globalconf.screens[screen].need_arrange = False;
|
||||||
|
|
17
mouse.c
17
mouse.c
|
@ -44,7 +44,7 @@ extern AwesomeConf globalconf;
|
||||||
void
|
void
|
||||||
uicb_client_movemouse(int screen, char *arg __attribute__ ((unused)))
|
uicb_client_movemouse(int screen, char *arg __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
int x, y, ocx, ocy, di, phys_screen, newscreen;
|
int x, y, ocx, ocy, di, newscreen;
|
||||||
unsigned int dui;
|
unsigned int dui;
|
||||||
Window dummy, child;
|
Window dummy, child;
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
|
@ -61,15 +61,14 @@ uicb_client_movemouse(int screen, char *arg __attribute__ ((unused)))
|
||||||
|
|
||||||
ocx = geometry.x = c->geometry.x;
|
ocx = geometry.x = c->geometry.x;
|
||||||
ocy = geometry.y = c->geometry.y;
|
ocy = geometry.y = c->geometry.y;
|
||||||
phys_screen = get_phys_screen(c->screen);
|
|
||||||
if(XGrabPointer(globalconf.display,
|
if(XGrabPointer(globalconf.display,
|
||||||
RootWindow(globalconf.display, phys_screen),
|
RootWindow(globalconf.display, c->phys_screen),
|
||||||
False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
|
False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
|
||||||
RootWindow(globalconf.display, phys_screen),
|
RootWindow(globalconf.display, c->phys_screen),
|
||||||
globalconf.cursor[CurMove], CurrentTime) != GrabSuccess)
|
globalconf.cursor[CurMove], CurrentTime) != GrabSuccess)
|
||||||
return;
|
return;
|
||||||
XQueryPointer(globalconf.display,
|
XQueryPointer(globalconf.display,
|
||||||
RootWindow(globalconf.display, phys_screen),
|
RootWindow(globalconf.display, c->phys_screen),
|
||||||
&dummy, &dummy, &x, &y, &di, &di, &dui);
|
&dummy, &dummy, &x, &y, &di, &di, &dui);
|
||||||
c->ismax = False;
|
c->ismax = False;
|
||||||
for(;;)
|
for(;;)
|
||||||
|
@ -119,7 +118,7 @@ uicb_client_movemouse(int screen, char *arg __attribute__ ((unused)))
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
XQueryPointer(globalconf.display,
|
XQueryPointer(globalconf.display,
|
||||||
RootWindow(globalconf.display, phys_screen),
|
RootWindow(globalconf.display, c->phys_screen),
|
||||||
&dummy, &child, &x, &y, &di, &di, &dui);
|
&dummy, &child, &x, &y, &di, &di, &dui);
|
||||||
if((newscreen = screen_get_bycoord(globalconf.screens_info, c->screen, x, y)) != c->screen)
|
if((newscreen = screen_get_bycoord(globalconf.screens_info, c->screen, x, y)) != c->screen)
|
||||||
{
|
{
|
||||||
|
@ -188,10 +187,10 @@ uicb_client_resizemouse(int screen, char *arg __attribute__ ((unused)))
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(XGrabPointer(globalconf.display, RootWindow(globalconf.display,
|
if(XGrabPointer(globalconf.display,
|
||||||
get_phys_screen(c->screen)),
|
RootWindow(globalconf.display, c->phys_screen),
|
||||||
False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
|
False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
|
||||||
RootWindow(globalconf.display,get_phys_screen(c->screen)),
|
RootWindow(globalconf.display, c->phys_screen),
|
||||||
globalconf.cursor[CurResize], CurrentTime) != GrabSuccess)
|
globalconf.cursor[CurResize], CurrentTime) != GrabSuccess)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -159,7 +159,7 @@ placement_under_mouse(Client *c)
|
||||||
int x, y, d;
|
int x, y, d;
|
||||||
area_t finalgeometry = c->f_geometry;
|
area_t finalgeometry = c->f_geometry;
|
||||||
|
|
||||||
if(XQueryPointer(globalconf.display, RootWindow(globalconf.display, get_phys_screen(c->screen)),
|
if(XQueryPointer(globalconf.display, RootWindow(globalconf.display, c->phys_screen),
|
||||||
&dummy, &dummy, &x, &y, &d, &d, &m))
|
&dummy, &dummy, &x, &y, &d, &d, &m))
|
||||||
{
|
{
|
||||||
finalgeometry.x = x - c->f_geometry.width / 2;
|
finalgeometry.x = x - c->f_geometry.width / 2;
|
||||||
|
|
2
screen.c
2
screen.c
|
@ -106,7 +106,7 @@ get_display_area(int screen, Statusbar *statusbar, Padding *padding)
|
||||||
* \return the X screen
|
* \return the X screen
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
get_phys_screen(int screen)
|
screen_virttophys(int screen)
|
||||||
{
|
{
|
||||||
if(globalconf.screens_info->xinerama_is_active)
|
if(globalconf.screens_info->xinerama_is_active)
|
||||||
return DefaultScreen(globalconf.display);
|
return DefaultScreen(globalconf.display);
|
||||||
|
|
2
screen.h
2
screen.h
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
area_t screen_get_area(int, Statusbar *, Padding *);
|
area_t screen_get_area(int, Statusbar *, Padding *);
|
||||||
area_t get_display_area(int, Statusbar *, Padding *);
|
area_t get_display_area(int, Statusbar *, Padding *);
|
||||||
int get_phys_screen(int);
|
int screen_virttophys(int);
|
||||||
void move_client_to_screen(Client *, int, Bool);
|
void move_client_to_screen(Client *, int, Bool);
|
||||||
|
|
||||||
Uicb uicb_screen_focus;
|
Uicb uicb_screen_focus;
|
||||||
|
|
|
@ -164,7 +164,7 @@ statusbar_display(Statusbar *statusbar)
|
||||||
{
|
{
|
||||||
/* don't waste our time */
|
/* don't waste our time */
|
||||||
if(statusbar->position != Off)
|
if(statusbar->position != Off)
|
||||||
simplewindow_refresh_drawable(statusbar->sw, get_phys_screen(statusbar->screen));
|
simplewindow_refresh_drawable(statusbar->sw, statusbar->phys_screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -182,11 +182,12 @@ statusbar_init(Statusbar *statusbar)
|
||||||
{
|
{
|
||||||
Statusbar *sb;
|
Statusbar *sb;
|
||||||
Drawable dw;
|
Drawable dw;
|
||||||
int phys_screen = get_phys_screen(statusbar->screen);
|
int phys_screen = screen_virttophys(statusbar->screen);
|
||||||
area_t area = screen_get_area(statusbar->screen,
|
area_t area = screen_get_area(statusbar->screen,
|
||||||
globalconf.screens[statusbar->screen].statusbar,
|
globalconf.screens[statusbar->screen].statusbar,
|
||||||
&globalconf.screens[statusbar->screen].padding);
|
&globalconf.screens[statusbar->screen].padding);
|
||||||
|
|
||||||
|
statusbar->phys_screen = phys_screen;
|
||||||
|
|
||||||
/* Top and Bottom Statusbar have prio */
|
/* Top and Bottom Statusbar have prio */
|
||||||
for(sb = globalconf.screens[statusbar->screen].statusbar; sb; sb = sb->next)
|
for(sb = globalconf.screens[statusbar->screen].statusbar; sb; sb = sb->next)
|
||||||
|
|
|
@ -163,6 +163,8 @@ struct Statusbar
|
||||||
Position position;
|
Position position;
|
||||||
/** Screen */
|
/** Screen */
|
||||||
int screen;
|
int screen;
|
||||||
|
/** Physical screen id */
|
||||||
|
int phys_screen;
|
||||||
/** Widget list */
|
/** Widget list */
|
||||||
Widget *widgets;
|
Widget *widgets;
|
||||||
/** Draw context */
|
/** Draw context */
|
||||||
|
@ -208,6 +210,8 @@ struct Client
|
||||||
Window win;
|
Window win;
|
||||||
/** Client logical screen */
|
/** Client logical screen */
|
||||||
int screen;
|
int screen;
|
||||||
|
/** Client physical screen */
|
||||||
|
int phys_screen;
|
||||||
/** True if the client is a new one */
|
/** True if the client is a new one */
|
||||||
Bool newcomer;
|
Bool newcomer;
|
||||||
/** Titlebar */
|
/** Titlebar */
|
||||||
|
|
2
tag.c
2
tag.c
|
@ -328,7 +328,7 @@ tag_view(Tag *tag, Bool view)
|
||||||
{
|
{
|
||||||
tag->was_selected = tag->selected;
|
tag->was_selected = tag->selected;
|
||||||
tag->selected = view;
|
tag->selected = view;
|
||||||
ewmh_update_net_current_desktop(get_phys_screen(tag->screen));
|
ewmh_update_net_current_desktop(screen_virttophys(tag->screen));
|
||||||
widget_invalidate_cache(tag->screen, WIDGET_CACHE_TAGS);
|
widget_invalidate_cache(tag->screen, WIDGET_CACHE_TAGS);
|
||||||
globalconf.screens[tag->screen].need_arrange = True;
|
globalconf.screens[tag->screen].need_arrange = True;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,6 @@ void
|
||||||
titlebar_init(Client *c)
|
titlebar_init(Client *c)
|
||||||
{
|
{
|
||||||
int titlebar_height;
|
int titlebar_height;
|
||||||
int phys_screen = get_phys_screen(c->screen);
|
|
||||||
|
|
||||||
if(c->titlebar.position == Off
|
if(c->titlebar.position == Off
|
||||||
|| c->titlebar.position == Auto)
|
|| c->titlebar.position == Auto)
|
||||||
|
@ -47,7 +46,7 @@ titlebar_init(Client *c)
|
||||||
{
|
{
|
||||||
case Top:
|
case Top:
|
||||||
c->titlebar.sw = simplewindow_new(globalconf.display,
|
c->titlebar.sw = simplewindow_new(globalconf.display,
|
||||||
phys_screen,
|
c->phys_screen,
|
||||||
c->geometry.x,
|
c->geometry.x,
|
||||||
c->geometry.y - titlebar_height,
|
c->geometry.y - titlebar_height,
|
||||||
c->geometry.width + 2 * c->border,
|
c->geometry.width + 2 * c->border,
|
||||||
|
@ -56,7 +55,7 @@ titlebar_init(Client *c)
|
||||||
break;
|
break;
|
||||||
case Bottom:
|
case Bottom:
|
||||||
c->titlebar.sw = simplewindow_new(globalconf.display,
|
c->titlebar.sw = simplewindow_new(globalconf.display,
|
||||||
phys_screen,
|
c->phys_screen,
|
||||||
c->geometry.x,
|
c->geometry.x,
|
||||||
c->geometry.y + c->geometry.height + 2 * c->border,
|
c->geometry.y + c->geometry.height + 2 * c->border,
|
||||||
c->geometry.width + 2 * c->border,
|
c->geometry.width + 2 * c->border,
|
||||||
|
@ -65,7 +64,7 @@ titlebar_init(Client *c)
|
||||||
break;
|
break;
|
||||||
case Left:
|
case Left:
|
||||||
c->titlebar.sw = simplewindow_new(globalconf.display,
|
c->titlebar.sw = simplewindow_new(globalconf.display,
|
||||||
phys_screen,
|
c->phys_screen,
|
||||||
c->geometry.x - titlebar_height,
|
c->geometry.x - titlebar_height,
|
||||||
c->geometry.y,
|
c->geometry.y,
|
||||||
titlebar_height,
|
titlebar_height,
|
||||||
|
@ -74,7 +73,7 @@ titlebar_init(Client *c)
|
||||||
break;
|
break;
|
||||||
case Right:
|
case Right:
|
||||||
c->titlebar.sw = simplewindow_new(globalconf.display,
|
c->titlebar.sw = simplewindow_new(globalconf.display,
|
||||||
phys_screen,
|
c->phys_screen,
|
||||||
c->geometry.x + c->geometry.width + 2 * c->border,
|
c->geometry.x + c->geometry.width + 2 * c->border,
|
||||||
c->geometry.y,
|
c->geometry.y,
|
||||||
titlebar_height,
|
titlebar_height,
|
||||||
|
|
|
@ -338,13 +338,15 @@ graph_tell(Widget *widget, char *property, char *command)
|
||||||
d->height = atof(command);
|
d->height = atof(command);
|
||||||
else if(!a_strcmp(property, "bg"))
|
else if(!a_strcmp(property, "bg"))
|
||||||
{
|
{
|
||||||
if(!draw_color_new(globalconf.display, get_phys_screen(widget->statusbar->screen),
|
if(!draw_color_new(globalconf.display,
|
||||||
|
widget->statusbar->phys_screen,
|
||||||
command, &d->bg))
|
command, &d->bg))
|
||||||
return WIDGET_ERROR_FORMAT_COLOR;
|
return WIDGET_ERROR_FORMAT_COLOR;
|
||||||
}
|
}
|
||||||
else if(!a_strcmp(property, "bordercolor"))
|
else if(!a_strcmp(property, "bordercolor"))
|
||||||
{
|
{
|
||||||
if(!draw_color_new(globalconf.display, get_phys_screen(widget->statusbar->screen),
|
if(!draw_color_new(globalconf.display,
|
||||||
|
widget->statusbar->phys_screen,
|
||||||
command, &d->bordercolor))
|
command, &d->bordercolor))
|
||||||
return WIDGET_ERROR_FORMAT_COLOR;
|
return WIDGET_ERROR_FORMAT_COLOR;
|
||||||
}
|
}
|
||||||
|
@ -372,7 +374,6 @@ graph_new(Statusbar *statusbar, cfg_t *config)
|
||||||
Data *d;
|
Data *d;
|
||||||
cfg_t *cfg;
|
cfg_t *cfg;
|
||||||
char *color;
|
char *color;
|
||||||
int phys_screen = get_phys_screen(statusbar->screen);
|
|
||||||
int i;
|
int i;
|
||||||
char *type;
|
char *type;
|
||||||
XColor tmp_color = { 0, 0, 0, 0, 0, 0 };
|
XColor tmp_color = { 0, 0, 0, 0, 0, 0 };
|
||||||
|
@ -454,20 +455,20 @@ graph_new(Statusbar *statusbar, cfg_t *config)
|
||||||
d->data_title[i] = a_strdup(cfg_title(cfg));
|
d->data_title[i] = a_strdup(cfg_title(cfg));
|
||||||
|
|
||||||
if((color = cfg_getstr(cfg, "fg")))
|
if((color = cfg_getstr(cfg, "fg")))
|
||||||
draw_color_new(globalconf.display, phys_screen, color, &tmp_color);
|
draw_color_new(globalconf.display, statusbar->phys_screen, color, &tmp_color);
|
||||||
else
|
else
|
||||||
tmp_color = globalconf.screens[statusbar->screen].styles.normal.fg;
|
tmp_color = globalconf.screens[statusbar->screen].styles.normal.fg;
|
||||||
|
|
||||||
if((color = cfg_getstr(cfg, "fg_center")))
|
if((color = cfg_getstr(cfg, "fg_center")))
|
||||||
{
|
{
|
||||||
ptmp_color_center = p_new(XColor, 1);
|
ptmp_color_center = p_new(XColor, 1);
|
||||||
draw_color_new(globalconf.display, phys_screen, color, ptmp_color_center);
|
draw_color_new(globalconf.display, statusbar->phys_screen, color, ptmp_color_center);
|
||||||
}
|
}
|
||||||
|
|
||||||
if((color = cfg_getstr(cfg, "fg_end")))
|
if((color = cfg_getstr(cfg, "fg_end")))
|
||||||
{
|
{
|
||||||
ptmp_color_end = p_new(XColor, 1);
|
ptmp_color_end = p_new(XColor, 1);
|
||||||
draw_color_new(globalconf.display, phys_screen, color, ptmp_color_end);
|
draw_color_new(globalconf.display, statusbar->phys_screen, color, ptmp_color_end);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cfg_getbool(cfg, "scale"))
|
if (cfg_getbool(cfg, "scale"))
|
||||||
|
@ -522,12 +523,12 @@ graph_new(Statusbar *statusbar, cfg_t *config)
|
||||||
}
|
}
|
||||||
|
|
||||||
if((color = cfg_getstr(config, "bg")))
|
if((color = cfg_getstr(config, "bg")))
|
||||||
draw_color_new(globalconf.display, phys_screen, color, &d->bg);
|
draw_color_new(globalconf.display, statusbar->phys_screen, color, &d->bg);
|
||||||
else
|
else
|
||||||
d->bg = globalconf.screens[statusbar->screen].styles.normal.bg;
|
d->bg = globalconf.screens[statusbar->screen].styles.normal.bg;
|
||||||
|
|
||||||
if((color = cfg_getstr(config, "bordercolor")))
|
if((color = cfg_getstr(config, "bordercolor")))
|
||||||
draw_color_new(globalconf.display, phys_screen, color, &d->bordercolor);
|
draw_color_new(globalconf.display, statusbar->phys_screen, color, &d->bordercolor);
|
||||||
else
|
else
|
||||||
d->bordercolor = tmp_color;
|
d->bordercolor = tmp_color;
|
||||||
|
|
||||||
|
|
|
@ -276,7 +276,8 @@ progressbar_tell(Widget *widget, char *property, char *command)
|
||||||
for(i = 0; i < d->data_items; i++)
|
for(i = 0; i < d->data_items; i++)
|
||||||
if(!a_strcmp(title, d->data_title[i]))
|
if(!a_strcmp(title, d->data_title[i]))
|
||||||
{
|
{
|
||||||
if(draw_color_new(globalconf.display, get_phys_screen(widget->statusbar->screen),
|
if(draw_color_new(globalconf.display,
|
||||||
|
widget->statusbar->phys_screen,
|
||||||
setting, &d->fg[i]))
|
setting, &d->fg[i]))
|
||||||
return WIDGET_NOERROR;
|
return WIDGET_NOERROR;
|
||||||
else
|
else
|
||||||
|
@ -292,7 +293,8 @@ progressbar_tell(Widget *widget, char *property, char *command)
|
||||||
for(i = 0; i < d->data_items; i++)
|
for(i = 0; i < d->data_items; i++)
|
||||||
if(!a_strcmp(title, d->data_title[i]))
|
if(!a_strcmp(title, d->data_title[i]))
|
||||||
{
|
{
|
||||||
if(draw_color_new(globalconf.display, get_phys_screen(widget->statusbar->screen),
|
if(draw_color_new(globalconf.display,
|
||||||
|
widget->statusbar->phys_screen,
|
||||||
setting, &d->bg[i]))
|
setting, &d->bg[i]))
|
||||||
return WIDGET_NOERROR;
|
return WIDGET_NOERROR;
|
||||||
else
|
else
|
||||||
|
@ -314,7 +316,8 @@ progressbar_tell(Widget *widget, char *property, char *command)
|
||||||
flag = True; /* p_delete && restore to NULL, if draw_color_new unsuccessful */
|
flag = True; /* p_delete && restore to NULL, if draw_color_new unsuccessful */
|
||||||
d->pfg_center[i] = p_new(XColor, 1);
|
d->pfg_center[i] = p_new(XColor, 1);
|
||||||
}
|
}
|
||||||
if(!(draw_color_new(globalconf.display, get_phys_screen(widget->statusbar->screen),
|
if(!(draw_color_new(globalconf.display,
|
||||||
|
widget->statusbar->phys_screen,
|
||||||
setting, d->pfg_center[i])))
|
setting, d->pfg_center[i])))
|
||||||
{
|
{
|
||||||
if(flag) /* restore */
|
if(flag) /* restore */
|
||||||
|
@ -342,7 +345,8 @@ progressbar_tell(Widget *widget, char *property, char *command)
|
||||||
flag = True;
|
flag = True;
|
||||||
d->pfg_end[i] = p_new(XColor, 1);
|
d->pfg_end[i] = p_new(XColor, 1);
|
||||||
}
|
}
|
||||||
if(!(draw_color_new(globalconf.display, get_phys_screen(widget->statusbar->screen),
|
if(!(draw_color_new(globalconf.display,
|
||||||
|
widget->statusbar->phys_screen,
|
||||||
setting, d->pfg_end[i])))
|
setting, d->pfg_end[i])))
|
||||||
{
|
{
|
||||||
if(flag) /* restore */
|
if(flag) /* restore */
|
||||||
|
@ -363,7 +367,8 @@ progressbar_tell(Widget *widget, char *property, char *command)
|
||||||
for(i = 0; i < d->data_items; i++)
|
for(i = 0; i < d->data_items; i++)
|
||||||
if(!a_strcmp(title, d->data_title[i]))
|
if(!a_strcmp(title, d->data_title[i]))
|
||||||
{
|
{
|
||||||
if(draw_color_new(globalconf.display, get_phys_screen(widget->statusbar->screen),
|
if(draw_color_new(globalconf.display,
|
||||||
|
widget->statusbar->phys_screen,
|
||||||
setting, &d->bordercolor[i]))
|
setting, &d->bordercolor[i]))
|
||||||
return WIDGET_NOERROR;
|
return WIDGET_NOERROR;
|
||||||
else
|
else
|
||||||
|
@ -409,7 +414,7 @@ progressbar_new(Statusbar *statusbar, cfg_t *config)
|
||||||
Widget *w;
|
Widget *w;
|
||||||
Data *d;
|
Data *d;
|
||||||
char *color;
|
char *color;
|
||||||
int i, phys_screen = get_phys_screen(statusbar->screen);
|
int i;
|
||||||
cfg_t *cfg;
|
cfg_t *cfg;
|
||||||
|
|
||||||
w = p_new(Widget, 1);
|
w = p_new(Widget, 1);
|
||||||
|
@ -459,29 +464,29 @@ progressbar_new(Statusbar *statusbar, cfg_t *config)
|
||||||
d->reverse[i] = False;
|
d->reverse[i] = False;
|
||||||
|
|
||||||
if((color = cfg_getstr(cfg, "fg")))
|
if((color = cfg_getstr(cfg, "fg")))
|
||||||
draw_color_new(globalconf.display, phys_screen, color, &d->fg[i]);
|
draw_color_new(globalconf.display, statusbar->phys_screen, color, &d->fg[i]);
|
||||||
else
|
else
|
||||||
d->fg[i] = globalconf.screens[statusbar->screen].styles.normal.fg;
|
d->fg[i] = globalconf.screens[statusbar->screen].styles.normal.fg;
|
||||||
|
|
||||||
if((color = cfg_getstr(cfg, "fg_center")))
|
if((color = cfg_getstr(cfg, "fg_center")))
|
||||||
{
|
{
|
||||||
d->pfg_center[i] = p_new(XColor, 1);
|
d->pfg_center[i] = p_new(XColor, 1);
|
||||||
draw_color_new(globalconf.display, phys_screen, color, d->pfg_center[i]);
|
draw_color_new(globalconf.display, statusbar->phys_screen, color, d->pfg_center[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if((color = cfg_getstr(cfg, "fg_end")))
|
if((color = cfg_getstr(cfg, "fg_end")))
|
||||||
{
|
{
|
||||||
d->pfg_end[i] = p_new(XColor, 1);
|
d->pfg_end[i] = p_new(XColor, 1);
|
||||||
draw_color_new(globalconf.display, phys_screen, color, d->pfg_end[i]);
|
draw_color_new(globalconf.display, statusbar->phys_screen, color, d->pfg_end[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if((color = cfg_getstr(cfg, "bg")))
|
if((color = cfg_getstr(cfg, "bg")))
|
||||||
draw_color_new(globalconf.display, phys_screen, color, &d->bg[i]);
|
draw_color_new(globalconf.display, statusbar->phys_screen, color, &d->bg[i]);
|
||||||
else
|
else
|
||||||
d->bg[i] = globalconf.screens[statusbar->screen].styles.normal.bg;
|
d->bg[i] = globalconf.screens[statusbar->screen].styles.normal.bg;
|
||||||
|
|
||||||
if((color = cfg_getstr(cfg, "bordercolor")))
|
if((color = cfg_getstr(cfg, "bordercolor")))
|
||||||
draw_color_new(globalconf.display, phys_screen, color, &d->bordercolor[i]);
|
draw_color_new(globalconf.display, statusbar->phys_screen, color, &d->bordercolor[i]);
|
||||||
else
|
else
|
||||||
d->bordercolor[i] = d->fg[i];
|
d->bordercolor[i] = d->fg[i];
|
||||||
}
|
}
|
||||||
|
|
|
@ -272,7 +272,6 @@ tasklist_new(Statusbar *statusbar, cfg_t *config)
|
||||||
Data *d;
|
Data *d;
|
||||||
char *buf;
|
char *buf;
|
||||||
cfg_t *cfg_styles;
|
cfg_t *cfg_styles;
|
||||||
int phys_screen = get_phys_screen(statusbar->screen);
|
|
||||||
|
|
||||||
w = p_new(Widget, 1);
|
w = p_new(Widget, 1);
|
||||||
widget_common_new(w, statusbar, config);
|
widget_common_new(w, statusbar, config);
|
||||||
|
@ -283,17 +282,17 @@ tasklist_new(Statusbar *statusbar, cfg_t *config)
|
||||||
|
|
||||||
cfg_styles = cfg_getsec(config, "styles");
|
cfg_styles = cfg_getsec(config, "styles");
|
||||||
|
|
||||||
draw_style_init(globalconf.display, phys_screen,
|
draw_style_init(globalconf.display, statusbar->phys_screen,
|
||||||
cfg_getsec(cfg_styles, "normal"),
|
cfg_getsec(cfg_styles, "normal"),
|
||||||
&d->styles.normal,
|
&d->styles.normal,
|
||||||
&globalconf.screens[statusbar->screen].styles.normal);
|
&globalconf.screens[statusbar->screen].styles.normal);
|
||||||
|
|
||||||
draw_style_init(globalconf.display, phys_screen,
|
draw_style_init(globalconf.display, statusbar->phys_screen,
|
||||||
cfg_getsec(cfg_styles, "focus"),
|
cfg_getsec(cfg_styles, "focus"),
|
||||||
&d->styles.focus,
|
&d->styles.focus,
|
||||||
&globalconf.screens[statusbar->screen].styles.focus);
|
&globalconf.screens[statusbar->screen].styles.focus);
|
||||||
|
|
||||||
draw_style_init(globalconf.display, phys_screen,
|
draw_style_init(globalconf.display, statusbar->phys_screen,
|
||||||
cfg_getsec(cfg_styles, "urgent"),
|
cfg_getsec(cfg_styles, "urgent"),
|
||||||
&d->styles.urgent,
|
&d->styles.urgent,
|
||||||
&globalconf.screens[statusbar->screen].styles.urgent);
|
&globalconf.screens[statusbar->screen].styles.urgent);
|
||||||
|
|
|
@ -113,7 +113,6 @@ textbox_new(Statusbar *statusbar, cfg_t *config)
|
||||||
{
|
{
|
||||||
Widget *w;
|
Widget *w;
|
||||||
Data *d;
|
Data *d;
|
||||||
int phys_screen = get_phys_screen(statusbar->screen);
|
|
||||||
|
|
||||||
w = p_new(Widget, 1);
|
w = p_new(Widget, 1);
|
||||||
widget_common_new(w, statusbar, config);
|
widget_common_new(w, statusbar, config);
|
||||||
|
@ -123,7 +122,7 @@ textbox_new(Statusbar *statusbar, cfg_t *config)
|
||||||
|
|
||||||
w->data = d = p_new(Data, 1);
|
w->data = d = p_new(Data, 1);
|
||||||
|
|
||||||
draw_style_init(globalconf.display, phys_screen,
|
draw_style_init(globalconf.display, statusbar->phys_screen,
|
||||||
cfg_getsec(config, "style"),
|
cfg_getsec(config, "style"),
|
||||||
&d->style,
|
&d->style,
|
||||||
&globalconf.screens[statusbar->screen].styles.normal);
|
&globalconf.screens[statusbar->screen].styles.normal);
|
||||||
|
|
Loading…
Reference in New Issue