From 62f2e40ff471455509590b54076f4334cc5f8ae0 Mon Sep 17 00:00:00 2001 From: Martin Duquesnoy Date: Thu, 6 Nov 2008 00:26:12 +0100 Subject: [PATCH] Fix typo --- src/event.c | 4 ++-- src/infobar.c | 34 +++++++++++++++++++++++++++++----- src/wmfs.c | 17 ++--------------- src/wmfs.h | 1 + 4 files changed, 34 insertions(+), 22 deletions(-) diff --git a/src/event.c b/src/event.c index 4402ade..8f87e7e 100644 --- a/src/event.c +++ b/src/event.c @@ -326,12 +326,12 @@ mouseaction(Client *c, int x, int y, int type) mx = sgeo.width - (tags[seltag].mwfact * sgeo.width); else if(tags[seltag].layout.func == tile_top) { - mx = event.xmotion.x; + mx = event.xmotion.x_root; my = sgeo.height - (tags[seltag].mwfact * sgeo.height); } else if(tags[seltag].layout.func == tile_bottom) { - mx = event.xmotion.x; + mx = event.xmotion.x_root; my = tags[seltag].mwfact * sgeo.height; } XWarpPointer(dpy, None, root, 0, 0, 0, 0, mx, my); diff --git a/src/infobar.c b/src/infobar.c index 9e04a37..74070b5 100644 --- a/src/infobar.c +++ b/src/infobar.c @@ -32,6 +32,33 @@ #include "wmfs.h" +void +infobar_init(InfoBar *ib) +{ + ib->geo.height = fonth + (float)4.5; + ib->geo.y = (conf.bartop) ? 0 : mh - ib->geo.height; + + /* Create infobar barwindow */ + ib->bar = bar_create(0, ib->geo.y, mw, ib->geo.height, 0, conf.colors.bar, False); + + /* Create layout switch & layout type switch barwindow */ + ib->layout_switch = bar_create(0, (conf.bartop) ? ib->geo.y : ib->geo.y + 1, + 1, ib->geo.height - 1, 0, + conf.colors.layout_bg, False); + ib->layout_type_switch = bar_create(0, ib->geo.y, + 1, ib->geo.height, + 0, conf.colors.layout_bg, False); + + /* Map all */ + bar_map(ib->bar); + bar_map(ib->layout_switch); + + strcpy(ib->statustext, "WMFS-" WMFS_VERSION); + infobar_draw(); + + return; +} + void infobar_draw(void) { @@ -99,11 +126,8 @@ infobar_draw_layout(void) width += textw(symbol) + PAD; bar_refresh(infobar.layout_switch); - if(tags[seltag].layout.func == tile - || tags[seltag].layout.func == tile_left - || tags[seltag].layout.func == tile_top - || tags[seltag].layout.func == tile_bottom - || tags[seltag].layout.func == grid) + if(tags[seltag].layout.func != freelayout + && tags[seltag].layout.func != maxlayout) { bar_map(infobar.layout_type_switch); bar_refresh_color(infobar.layout_type_switch); diff --git a/src/wmfs.c b/src/wmfs.c index 55917e7..456a60b 100644 --- a/src/wmfs.c +++ b/src/wmfs.c @@ -132,7 +132,6 @@ init(void) xftfont = XftFontOpenName(dpy, screen, "sans-10"); } fonth = (xftfont->ascent + xftfont->descent); - infobar.geo.height = fonth + (float)4.5; /* INIT CURSOR */ cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr); @@ -166,20 +165,8 @@ init(void) if(conf.root.background_command) uicb_spawn(conf.root.background_command); - /* INIT BAR / BUTTON */ - /* bar */ - infobar.geo.y = (conf.bartop) ? 0 : mh - infobar.geo.height; - infobar.bar = bar_create(0, infobar.geo.y, mw, infobar.geo.height, 0, conf.colors.bar, False); - - /* layout button */ - infobar.layout_switch = bar_create(0, (conf.bartop) ? infobar.geo.y : infobar.geo.y + 1, - 1, infobar.geo.height - 1, 0, - conf.colors.layout_bg, False); - infobar.layout_type_switch = bar_create(0, infobar.geo.y, 1, infobar.geo.height, 0, conf.colors.layout_bg, False); - bar_map(infobar.bar); - bar_map(infobar.layout_switch); - strcpy(infobar.statustext, "WMFS-" WMFS_VERSION); - infobar_draw(); + /* INIT INFOBAR */ + infobar_init(&infobar); /* INIT WORKABLE SPACE GEOMETRY */ sgeo.x = 0; diff --git a/src/wmfs.h b/src/wmfs.h index 733a0a5..54e40a8 100644 --- a/src/wmfs.h +++ b/src/wmfs.h @@ -77,6 +77,7 @@ void draw_rectangle(Drawable dr, int x, int y, uint w, uint h, uint color); ushort textw(const char *text); /* infobar.c */ +void infobar_init(InfoBar *ib); void infobar_draw(void); void infobar_draw_layout(void); void infobar_draw_taglist(Drawable dr);