store simple window geometry
This commit is contained in:
parent
f17bf8b334
commit
c1569eedf4
2
config.c
2
config.c
|
@ -355,8 +355,8 @@ config_parse_screen(cfg_t *cfg, int screen)
|
|||
statusbar->width = cfg_getint(cfgsectmp, "width");
|
||||
statusbar->name = a_strdup(cfg_title(cfgsectmp));
|
||||
statusbar->screen = screen;
|
||||
create_widgets(cfgsectmp, statusbar);
|
||||
statusbar_preinit(statusbar);
|
||||
create_widgets(cfgsectmp, statusbar);
|
||||
statusbar_list_push(&virtscreen->statusbar, statusbar);
|
||||
}
|
||||
|
||||
|
|
18
event.c
18
event.c
|
@ -88,8 +88,9 @@ handle_event_buttonpress(XEvent *e)
|
|||
case Right:
|
||||
for(widget = statusbar->widgets; widget; widget = widget->next)
|
||||
if(ev->y >= widget->area.x && ev->y < widget->area.x + widget->area.width
|
||||
&& statusbar->height - ev->x >= widget->area.y
|
||||
&& statusbar->height - ev->x < widget->area.y + widget->area.height)
|
||||
&& statusbar->sw->geometry.height - ev->x >= widget->area.y
|
||||
&& statusbar->sw->geometry.height - ev->x
|
||||
< widget->area.y + widget->area.height)
|
||||
{
|
||||
widget->button_press(widget, ev);
|
||||
return;
|
||||
|
@ -97,8 +98,9 @@ handle_event_buttonpress(XEvent *e)
|
|||
break;
|
||||
default:
|
||||
for(widget = statusbar->widgets; widget; widget = widget->next)
|
||||
if(statusbar->width - ev->y >= widget->area.x
|
||||
&& statusbar->width - ev->y < widget->area.x + widget->area.width
|
||||
if(statusbar->sw->geometry.width - ev->y >= widget->area.x
|
||||
&& statusbar->sw->geometry.width - ev->y
|
||||
< widget->area.x + widget->area.width
|
||||
&& ev->x >= widget->area.y && ev->x < widget->area.y + widget->area.height)
|
||||
{
|
||||
widget->button_press(widget, ev);
|
||||
|
@ -191,6 +193,7 @@ handle_event_configurenotify(XEvent * e)
|
|||
int screen;
|
||||
Area area;
|
||||
|
||||
/* XXX this is all crap -- need to rewrite everything */
|
||||
for(screen = 0; screen < ScreenCount(e->xany.display); screen++)
|
||||
if(ev->window == RootWindow(e->xany.display, screen)
|
||||
&& (ev->width != DisplayWidth(e->xany.display, screen)
|
||||
|
@ -201,12 +204,7 @@ handle_event_configurenotify(XEvent * e)
|
|||
|
||||
/* update statusbar */
|
||||
area = get_screen_area(screen, NULL, &globalconf.screens[screen].padding);
|
||||
globalconf.screens[screen].statusbar->width = area.width;
|
||||
|
||||
XResizeWindow(e->xany.display,
|
||||
globalconf.screens[screen].statusbar->sw->window,
|
||||
globalconf.screens[screen].statusbar->width,
|
||||
globalconf.screens[screen].statusbar->height);
|
||||
globalconf.screens[screen].statusbar->sw->geometry.width = area.width;
|
||||
|
||||
widget_invalidate_cache(screen, WIDGET_CACHE_ALL);
|
||||
globalconf.screens[screen].need_arrange = True;
|
||||
|
|
|
@ -132,6 +132,7 @@ typedef struct SimpleWindow
|
|||
{
|
||||
Window window;
|
||||
Drawable drawable;
|
||||
Area geometry;
|
||||
} SimpleWindow;
|
||||
|
||||
/** Status bar */
|
||||
|
|
6
window.c
6
window.c
|
@ -185,6 +185,12 @@ simplewindow_new(int phys_screen, int x, int y, unsigned int w, unsigned int h,
|
|||
SimpleWindow *sw;
|
||||
|
||||
sw = p_new(SimpleWindow, 1);
|
||||
|
||||
sw->geometry.x = x;
|
||||
sw->geometry.y = y;
|
||||
sw->geometry.width = w;
|
||||
sw->geometry.height = h;
|
||||
|
||||
wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask
|
||||
| EnterWindowMask | LeaveWindowMask | StructureNotifyMask;
|
||||
wa.cursor = globalconf.cursor[CurNormal];
|
||||
|
|
Loading…
Reference in New Issue